mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-04 20:30:40 +02:00
+ cleaning up in proc entry and exit, now calc_stack_frame always is used.
This commit is contained in:
parent
787fcc5797
commit
c6f4df63e6
@ -1000,7 +1000,11 @@ const
|
||||
{ generated the entry code of a procedure/function. Note: localsize is the }
|
||||
{ sum of the size necessary for local variables and the maximum possible }
|
||||
{ combined size of ALL the parameters of a procedure called by the current }
|
||||
{ one }
|
||||
{ one. }
|
||||
{ This procedure may be called before, as well as after
|
||||
g_return_from_proc is called.}
|
||||
|
||||
|
||||
var regcounter,firstregfpu,firstreggpr: TRegister;
|
||||
href,href2 : treference;
|
||||
usesfpr,usesgpr,gotgot : boolean;
|
||||
@ -1011,8 +1015,6 @@ const
|
||||
hp: tparaitem;
|
||||
|
||||
begin
|
||||
{ we do our own localsize calculation }
|
||||
localsize:=0;
|
||||
{ CR and LR only have to be saved in case they are modified by the current }
|
||||
{ procedure, but currently this isn't checked, so save them always }
|
||||
{ following is the entry code as described in "Altivec Programming }
|
||||
@ -1102,25 +1104,6 @@ const
|
||||
list.concat(taicpu.op_reg_reg(A_MR,r,rsp));
|
||||
end;
|
||||
|
||||
{ calculate the size of the locals }
|
||||
{
|
||||
if usesgpr then
|
||||
inc(localsize,((NR_R31-firstreggpr.number) shr 8+1)*4);
|
||||
if usesfpr then
|
||||
inc(localsize,(ord(R_F31)-ord(firstregfpu.enum)+1)*8);
|
||||
}
|
||||
{ !!! always allocate space for all registers for now !!! }
|
||||
if not (po_assembler in current_procinfo.procdef.procoptions) then
|
||||
inc(localsize,(31-13+1)*4+(31-14+1)*8);
|
||||
|
||||
{ align to 16 bytes }
|
||||
localsize:=align(localsize,16);
|
||||
|
||||
inc(localsize,tg.lasttemp);
|
||||
|
||||
localsize:=align(localsize,16);
|
||||
|
||||
tppcprocinfo(current_procinfo).localsize:=localsize;
|
||||
|
||||
if (localsize <> 0) then
|
||||
begin
|
||||
@ -1269,9 +1252,12 @@ const
|
||||
reference_reset_base(href,rsp,PARENT_FRAMEPOINTER_OFFSET);
|
||||
list.concat(taicpu.op_reg_ref(A_STW,r,href));
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure tcgppc.g_return_from_proc(list : taasmoutput;parasize : aword);
|
||||
{ This procedure may be called before, as well as after
|
||||
g_stackframe_entry is called.}
|
||||
|
||||
var
|
||||
regcounter,firstregfpu,firstreggpr: TRegister;
|
||||
@ -1282,7 +1268,6 @@ const
|
||||
localsize: aword;
|
||||
|
||||
begin
|
||||
localsize := 0;
|
||||
{ AltiVec context restore, not yet implemented !!! }
|
||||
|
||||
usesfpr:=false;
|
||||
@ -1308,18 +1293,7 @@ const
|
||||
end;
|
||||
end;
|
||||
|
||||
if not (po_assembler in current_procinfo.procdef.procoptions) then
|
||||
inc(localsize,(31-13+1)*4+(31-14+1)*8);
|
||||
|
||||
{ align to 16 bytes }
|
||||
localsize:=align(localsize,16);
|
||||
|
||||
inc(localsize,tg.lasttemp);
|
||||
|
||||
localsize:=align(localsize,16);
|
||||
|
||||
tppcprocinfo(current_procinfo).localsize:=localsize;
|
||||
|
||||
localsize:= tppcprocinfo(current_procinfo).calc_stackframe_size;
|
||||
|
||||
{ no return (blr) generated yet }
|
||||
genret:=true;
|
||||
@ -1330,7 +1304,7 @@ const
|
||||
r.number:=NR_STACK_POINTER_REG;
|
||||
r2.enum:=R_INTREGISTER;
|
||||
r2.number:=NR_R12;
|
||||
a_op_const_reg_reg(list,OP_ADD,OS_ADDR,tppcprocinfo(current_procinfo).localsize,r,r2);
|
||||
a_op_const_reg_reg(list,OP_ADD,OS_ADDR,localsize,r,r2);
|
||||
if usesfpr then
|
||||
begin
|
||||
reference_reset_base(href,r2,-8);
|
||||
@ -1391,7 +1365,7 @@ const
|
||||
{ adjust r1 }
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_R1;
|
||||
a_op_const_reg(list,OP_ADD,OS_ADDR,tppcprocinfo(current_procinfo).localsize,r);
|
||||
a_op_const_reg(list,OP_ADD,OS_ADDR,localsize,r);
|
||||
{ load link register? }
|
||||
if not (po_assembler in current_procinfo.procdef.procoptions) then
|
||||
begin
|
||||
@ -1663,7 +1637,7 @@ const
|
||||
localsize:= align(localsize + macosLinkageAreaSize + registerSaveAreaSize, 16);
|
||||
inc(localsize,tg.lasttemp);
|
||||
localsize:=align(localsize,16);
|
||||
tppcprocinfo(current_procinfo).localsize:=localsize;
|
||||
//tppcprocinfo(current_procinfo).localsize:=localsize;
|
||||
|
||||
if (localsize <> 0) then
|
||||
begin
|
||||
@ -2681,7 +2655,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.120 2003-08-17 16:59:20 jonas
|
||||
Revision 1.121 2003-08-18 11:50:55 olle
|
||||
+ cleaning up in proc entry and exit, now calc_stack_frame always is used.
|
||||
|
||||
Revision 1.120 2003/08/17 16:59:20 jonas
|
||||
* fixed regvars so they work with newra (at least for ppc)
|
||||
* fixed some volatile register bugs
|
||||
+ -dnotranslation option for -dnewra, which causes the registers not to
|
||||
|
@ -34,11 +34,8 @@ unit cpupi;
|
||||
|
||||
type
|
||||
tppcprocinfo = class(tcgprocinfo)
|
||||
{ overall size of allocated stack space, currently this is used for the PowerPC only }
|
||||
localsize : aword;
|
||||
{ max. of space need for parameters, currently used by the PowerPC port only }
|
||||
maxpushedparasize : aword;
|
||||
|
||||
constructor create(aparent:tprocinfo);override;
|
||||
procedure handle_body_start;override;
|
||||
procedure after_pass1;override;
|
||||
@ -54,14 +51,13 @@ unit cpupi;
|
||||
cpubase,
|
||||
aasmtai,
|
||||
tgobj,
|
||||
symconst, symsym,paramgr;
|
||||
symconst,symsym,paramgr;
|
||||
|
||||
constructor tppcprocinfo.create(aparent:tprocinfo);
|
||||
|
||||
begin
|
||||
inherited create(aparent);
|
||||
maxpushedparasize:=0;
|
||||
localsize:=0;
|
||||
end;
|
||||
|
||||
|
||||
@ -114,11 +110,12 @@ unit cpupi;
|
||||
|
||||
|
||||
function tppcprocinfo.calc_stackframe_size:longint;
|
||||
var
|
||||
savearea : longint;
|
||||
begin
|
||||
{ more or less copied from cgcpu.pas/g_stackframe_entry }
|
||||
result := align(align((31-13+1)*4+(31-14+1)*8,16)+tg.lasttemp,16);
|
||||
if not (po_assembler in procdef.procoptions) then
|
||||
result := align(align((31-13+1)*4+(31-14+1)*8,16)+tg.lasttemp,16)
|
||||
else
|
||||
result := align(tg.lasttemp,16);
|
||||
end;
|
||||
|
||||
|
||||
@ -127,7 +124,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.26 2003-08-16 14:26:44 jonas
|
||||
Revision 1.27 2003-08-18 11:51:19 olle
|
||||
+ cleaning up in proc entry and exit, now calc_stack_frame always is used.
|
||||
|
||||
Revision 1.26 2003/08/16 14:26:44 jonas
|
||||
* set correct localsymtable fixup already in handle_body_start instead
|
||||
of in after_pass1, as it's necessary to get the correct offsets for
|
||||
the calleeside paralocs (and those are now setup in the generic
|
||||
|
Loading…
Reference in New Issue
Block a user