mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-06 11:58:26 +02:00
* several ppc/generic result offset related fixes. The "normal" result
offset seems now to be calculated correctly and a lot of duplicate calculations have been removed. Nested functions accessing the parent's function result don't work at all though :(
This commit is contained in:
parent
092db52aca
commit
ec71805aa8
@ -166,8 +166,10 @@ unit cgbase;
|
|||||||
}
|
}
|
||||||
procedure after_pass1;virtual;
|
procedure after_pass1;virtual;
|
||||||
|
|
||||||
|
(* done by symtablestack.insertvardata() (JM)
|
||||||
{ sets the offset for a temp used by the result }
|
{ sets the offset for a temp used by the result }
|
||||||
procedure set_result_offset;virtual;
|
procedure set_result_offset;virtual;
|
||||||
|
*)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
pregvarinfo = ^tregvarinfo;
|
pregvarinfo = ^tregvarinfo;
|
||||||
@ -422,28 +424,32 @@ implementation
|
|||||||
{ !!!!! this means that we can not set the return value
|
{ !!!!! this means that we can not set the return value
|
||||||
in a subfunction !!!!! }
|
in a subfunction !!!!! }
|
||||||
{ because we don't know yet where the address is }
|
{ because we don't know yet where the address is }
|
||||||
if not is_void(aktprocdef.rettype.def) then
|
if not is_void(procdef.rettype.def) then
|
||||||
begin
|
begin
|
||||||
if paramanager.ret_in_reg(aktprocdef.rettype.def,aktprocdef.proccalloption) then
|
if paramanager.ret_in_reg(procdef.rettype.def,procdef.proccalloption) then
|
||||||
begin
|
begin
|
||||||
|
(* already done in symtable.pas:tlocalsymtable.insertvardata() (JM)
|
||||||
{ the space has been set in the local symtable }
|
{ the space has been set in the local symtable }
|
||||||
procinfo.return_offset:=tg.direction*tfuncretsym(aktprocdef.funcretsym).address;
|
procinfo.return_offset:=tg.direction*tfuncretsym(procdef.funcretsym).address;
|
||||||
|
*)
|
||||||
if ((procinfo.flags and pi_operator)<>0) and
|
if ((procinfo.flags and pi_operator)<>0) and
|
||||||
assigned(otsym) then
|
assigned(otsym) then
|
||||||
otsym.address:=tfuncretsym(aktprocdef.funcretsym).address;
|
otsym.address:=tfuncretsym(procdef.funcretsym).address;
|
||||||
|
|
||||||
rg.usedinproc := rg.usedinproc +
|
rg.usedinproc := rg.usedinproc +
|
||||||
getfuncretusedregisters(aktprocdef.rettype.def,aktprocdef.proccalloption);
|
getfuncretusedregisters(procdef.rettype.def,procdef.proccalloption);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
(* already done in symtable.pas:tlocalsymtable.insertvardata() (JM)
|
||||||
procedure tprocinfo.set_result_offset;
|
procedure tprocinfo.set_result_offset;
|
||||||
begin
|
begin
|
||||||
if paramanager.ret_in_reg(aktprocdef,procdef.proccalloption) then
|
if paramanager.ret_in_reg(procdef.rettype.def,procdef.proccalloption) then
|
||||||
procinfo.return_offset:=-tfuncretsym(procdef.funcretsym).address;
|
procinfo.return_offset:=tg.direction*tfuncretsym(procdef.funcretsym).address;
|
||||||
end;
|
end;
|
||||||
|
*)
|
||||||
|
|
||||||
|
|
||||||
procedure tprocinfo.after_header;
|
procedure tprocinfo.after_header;
|
||||||
@ -657,7 +663,13 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.38 2003-03-28 19:16:56 peter
|
Revision 1.39 2003-04-05 21:09:31 jonas
|
||||||
|
* several ppc/generic result offset related fixes. The "normal" result
|
||||||
|
offset seems now to be calculated correctly and a lot of duplicate
|
||||||
|
calculations have been removed. Nested functions accessing the parent's
|
||||||
|
function result don't work at all though :(
|
||||||
|
|
||||||
|
Revision 1.38 2003/03/28 19:16:56 peter
|
||||||
* generic constructor working for i386
|
* generic constructor working for i386
|
||||||
* remove fixed self register
|
* remove fixed self register
|
||||||
* esi added as address register for i386
|
* esi added as address register for i386
|
||||||
|
@ -84,28 +84,38 @@ unit cpupi;
|
|||||||
{ this value is necessary for nested procedures }
|
{ this value is necessary for nested procedures }
|
||||||
if assigned(procdef.localst) then
|
if assigned(procdef.localst) then
|
||||||
procdef.localst.address_fixup:=align(procdef.parast.address_fixup+procdef.parast.datasize,16);
|
procdef.localst.address_fixup:=align(procdef.parast.address_fixup+procdef.parast.datasize,16);
|
||||||
if assigned(aktprocdef.funcretsym) and
|
|
||||||
|
{
|
||||||
|
procdef.funcretsym isn't set here yet and besides,
|
||||||
|
symtable.insertvardata() already sets procinfo.return_offset! (JM)
|
||||||
|
if assigned(procdef.funcretsym) and
|
||||||
not(paramanager.ret_in_param(procdef.rettype.def,procdef.proccalloption)) then
|
not(paramanager.ret_in_param(procdef.rettype.def,procdef.proccalloption)) then
|
||||||
procinfo.return_offset:=tg.direction*tfuncretsym(aktprocdef.funcretsym).address+procdef.localst.address_fixup;
|
procinfo.return_offset:=tg.direction*tfuncretsym(procdef.funcretsym).address+procdef.localst.address_fixup;
|
||||||
|
}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure tppcprocinfo.after_pass1;
|
procedure tppcprocinfo.after_pass1;
|
||||||
var
|
var
|
||||||
ofs : aword;
|
ofs : aword;
|
||||||
begin
|
begin
|
||||||
ofs:=align(maxpushedparasize,16)+LinkageAreaSize;
|
ofs:=align(maxpushedparasize+LinkageAreaSize,16);
|
||||||
inc(procdef.parast.address_fixup,ofs);
|
inc(procdef.parast.address_fixup,ofs);
|
||||||
inc(procinfo.return_offset,ofs);
|
inc(procinfo.return_offset,ofs);
|
||||||
inc(procinfo.framepointer_offset,ofs);
|
inc(procinfo.framepointer_offset,ofs);
|
||||||
inc(procinfo.selfpointer_offset,ofs);
|
inc(procinfo.selfpointer_offset,ofs);
|
||||||
|
inc(procdef.localst.address_fixup,ofs);
|
||||||
if cs_asm_source in aktglobalswitches then
|
if cs_asm_source in aktglobalswitches then
|
||||||
aktproccode.insert(Tai_comment.Create(strpnew('Parameter copies start at: r1+'+tostr(procdef.parast.address_fixup))));
|
aktproccode.insert(Tai_comment.Create(strpnew('Parameter copies start at: r1+'+tostr(procdef.parast.address_fixup))));
|
||||||
|
|
||||||
procdef.localst.address_fixup:=align(procdef.parast.address_fixup+procdef.parast.datasize,16);
|
{
|
||||||
|
Already done with an "inc" above now, not sure if it's correct (JM)
|
||||||
|
procdef.localst.address_fixup:=procdef.parast.address_fixup+procdef.parast.datasize;
|
||||||
|
|
||||||
if assigned(aktprocdef.funcretsym) and
|
Already done with an "inc" above, should be correct (JM)
|
||||||
|
if assigned(procdef.funcretsym) and
|
||||||
not(paramanager.ret_in_param(procdef.rettype.def,procdef.proccalloption)) then
|
not(paramanager.ret_in_param(procdef.rettype.def,procdef.proccalloption)) then
|
||||||
procinfo.return_offset:=tg.direction*tfuncretsym(aktprocdef.funcretsym).address+procdef.localst.address_fixup;
|
procinfo.return_offset:=tg.direction*tfuncretsym(procdef.funcretsym).address+procdef.localst.address_fixup;
|
||||||
|
}
|
||||||
|
|
||||||
if cs_asm_source in aktglobalswitches then
|
if cs_asm_source in aktglobalswitches then
|
||||||
aktproccode.insert(Tai_comment.Create(strpnew('Locals start at: r1+'+tostr(procdef.localst.address_fixup))));
|
aktproccode.insert(Tai_comment.Create(strpnew('Locals start at: r1+'+tostr(procdef.localst.address_fixup))));
|
||||||
@ -124,7 +134,13 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.6 2002-12-15 19:22:01 florian
|
Revision 1.7 2003-04-05 21:09:32 jonas
|
||||||
|
* several ppc/generic result offset related fixes. The "normal" result
|
||||||
|
offset seems now to be calculated correctly and a lot of duplicate
|
||||||
|
calculations have been removed. Nested functions accessing the parent's
|
||||||
|
function result don't work at all though :(
|
||||||
|
|
||||||
|
Revision 1.6 2002/12/15 19:22:01 florian
|
||||||
* fixed some crashes and a rte 201
|
* fixed some crashes and a rte 201
|
||||||
|
|
||||||
Revision 1.5 2002/11/18 17:32:01 peter
|
Revision 1.5 2002/11/18 17:32:01 peter
|
||||||
|
@ -117,7 +117,10 @@ implementation
|
|||||||
symtablestack.insertvardata(aktprocdef.funcretsym);
|
symtablestack.insertvardata(aktprocdef.funcretsym);
|
||||||
akttokenpos:=storepos;
|
akttokenpos:=storepos;
|
||||||
|
|
||||||
|
(* already done by
|
||||||
|
symtablestack.insertvardata(aktprocdef.funcretsym); above (JM)
|
||||||
procinfo.set_result_offset;
|
procinfo.set_result_offset;
|
||||||
|
*)
|
||||||
{ insert result also if support is on }
|
{ insert result also if support is on }
|
||||||
if (m_result in aktmodeswitches) then
|
if (m_result in aktmodeswitches) then
|
||||||
begin
|
begin
|
||||||
@ -854,7 +857,13 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.95 2003-04-02 16:11:34 peter
|
Revision 1.96 2003-04-05 21:09:31 jonas
|
||||||
|
* several ppc/generic result offset related fixes. The "normal" result
|
||||||
|
offset seems now to be calculated correctly and a lot of duplicate
|
||||||
|
calculations have been removed. Nested functions accessing the parent's
|
||||||
|
function result don't work at all though :(
|
||||||
|
|
||||||
|
Revision 1.95 2003/04/02 16:11:34 peter
|
||||||
* give error when exports is not supported
|
* give error when exports is not supported
|
||||||
|
|
||||||
Revision 1.94 2003/03/12 22:43:38 jonas
|
Revision 1.94 2003/03/12 22:43:38 jonas
|
||||||
|
@ -288,7 +288,7 @@ implementation
|
|||||||
gdb,
|
gdb,
|
||||||
{$endif GDB}
|
{$endif GDB}
|
||||||
{ codegen }
|
{ codegen }
|
||||||
cgbase
|
cgbase,tgobj
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
@ -1332,9 +1332,15 @@ implementation
|
|||||||
l:=tfuncretsym(sym).returntype.def.size;
|
l:=tfuncretsym(sym).returntype.def.size;
|
||||||
varalign:=size_2_align(l);
|
varalign:=size_2_align(l);
|
||||||
varalign:=used_align(varalign,aktalignment.localalignmin,dataalignment);
|
varalign:=used_align(varalign,aktalignment.localalignmin,dataalignment);
|
||||||
|
{$ifdef powerpc}
|
||||||
|
{ on the powerpc, the local variables are accessed with a positiv offset }
|
||||||
|
tfuncretsym(sym).address:=align(datasize,varalign);
|
||||||
|
datasize:=tfuncretsym(sym).address+l;
|
||||||
|
{$else powerpc}
|
||||||
tfuncretsym(sym).address:=align(datasize+l,varalign);
|
tfuncretsym(sym).address:=align(datasize+l,varalign);
|
||||||
datasize:=tfuncretsym(sym).address;
|
datasize:=tfuncretsym(sym).address;
|
||||||
procinfo.return_offset:=-tfuncretsym(sym).address;
|
{$endif powerpc}
|
||||||
|
procinfo.return_offset:=tg.direction*tfuncretsym(sym).address;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2451,7 +2457,13 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.91 2003-03-17 18:56:49 peter
|
Revision 1.92 2003-04-05 21:09:32 jonas
|
||||||
|
* several ppc/generic result offset related fixes. The "normal" result
|
||||||
|
offset seems now to be calculated correctly and a lot of duplicate
|
||||||
|
calculations have been removed. Nested functions accessing the parent's
|
||||||
|
function result don't work at all though :(
|
||||||
|
|
||||||
|
Revision 1.91 2003/03/17 18:56:49 peter
|
||||||
* ignore hints for default parameter values
|
* ignore hints for default parameter values
|
||||||
|
|
||||||
Revision 1.90 2003/03/17 16:54:41 peter
|
Revision 1.90 2003/03/17 16:54:41 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user