mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 04:09:20 +02:00
* fixed several issues with nested procedures
This commit is contained in:
parent
88f3ab569c
commit
7ec9711f9a
@ -963,6 +963,13 @@ const
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_R0;
|
||||
a_reg_alloc(list,r);
|
||||
|
||||
if aktprocdef.parast.symtablelevel>1 then
|
||||
begin
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_R11;
|
||||
a_reg_alloc(list,r);
|
||||
end;
|
||||
{ allocate registers containing reg parameters }
|
||||
r.enum := R_INTREGISTER;
|
||||
for regcounter2 := RS_R3 to RS_R10 do
|
||||
@ -1011,7 +1018,7 @@ const
|
||||
if usesfpr or usesgpr then
|
||||
begin
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_R11;
|
||||
r.number:=NR_R12;
|
||||
a_reg_alloc(list,r);
|
||||
{ save end of fpr save area }
|
||||
list.concat(taicpu.op_reg_reg(A_MR,r,rsp));
|
||||
@ -1063,7 +1070,7 @@ const
|
||||
|
||||
{ compute end of gpr save area }
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_R11;
|
||||
r.number:=NR_R12;
|
||||
list.concat(taicpu.op_reg_reg_const(A_ADDI,r,r,-(ord(R_F31)-ord(firstregfpu.enum)+1)*8));
|
||||
end;
|
||||
|
||||
@ -1080,13 +1087,13 @@ const
|
||||
a_call_name(objectlibrary.newasmsymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14))
|
||||
}
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_R11;
|
||||
r.number:=NR_R12;
|
||||
reference_reset_base(href,r,-((NR_R31-firstreggpr.number) shr 8+1)*4);
|
||||
list.concat(taicpu.op_reg_ref(A_STMW,firstreggpr,href));
|
||||
end;
|
||||
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_R11;
|
||||
r.number:=NR_R12;
|
||||
if usesfpr or usesgpr then
|
||||
a_reg_dealloc(list,r);
|
||||
|
||||
@ -1113,6 +1120,15 @@ const
|
||||
new_reference(STACK_POINTER_REG,LA_CR)));
|
||||
a_reg_dealloc(list,R_0); }
|
||||
{ now comes the AltiVec context save, not yet implemented !!! }
|
||||
|
||||
{ if we're in a nested procedure, we've to save R11 }
|
||||
if aktprocdef.parast.symtablelevel>2 then
|
||||
begin
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_R11;
|
||||
reference_reset_base(href,rsp,procinfo.framepointer_offset);
|
||||
list.concat(taicpu.op_reg_ref(A_STW,r,href));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure tcgppc.g_return_from_proc_sysv(list : taasmoutput;parasize : aword);
|
||||
@ -1165,7 +1181,7 @@ const
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_STACK_POINTER_REG;
|
||||
r2.enum:=R_INTREGISTER;
|
||||
r2.number:=NR_R11;
|
||||
r2.number:=NR_R12;
|
||||
if usesfpr then
|
||||
list.concat(taicpu.op_reg_reg_const(A_ADDI,r2,r,tppcprocinfo(procinfo).localsize-(ord(R_F31)-ord(firstregfpu.enum)+1)*8))
|
||||
else
|
||||
@ -1185,7 +1201,7 @@ const
|
||||
begin
|
||||
{ address of fpr save area to r11 }
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_R11;
|
||||
r.number:=NR_R12;
|
||||
list.concat(taicpu.op_reg_reg_const(A_ADDI,r,r,(ord(R_F31)-ord(firstregfpu.enum)+1)*8));
|
||||
{
|
||||
if (procinfo.flags and pi_do_call)<>0 then
|
||||
@ -2337,7 +2353,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.80 2003-04-23 22:18:01 peter
|
||||
Revision 1.81 2003-04-24 11:24:00 florian
|
||||
* fixed several issues with nested procedures
|
||||
|
||||
Revision 1.80 2003/04/23 22:18:01 peter
|
||||
* fixes to get rtl compiled
|
||||
|
||||
Revision 1.79 2003/04/23 12:35:35 florian
|
||||
|
@ -30,7 +30,7 @@ unit cpunode;
|
||||
|
||||
uses
|
||||
{ generic nodes }
|
||||
ncgbas,ncgld,ncgflw,ncgcnv,ncgmem,ncgcon,ncgcal,ncgset,ncginl,
|
||||
ncgbas,ncgld,ncgflw,ncgcnv,ncgmem,ncgcon,ncgcal,ncgset,ncginl,ncgopt,
|
||||
{ to be able to only parts of the generic code,
|
||||
the processor specific nodes must be included
|
||||
after the generic one (FK)
|
||||
@ -52,7 +52,10 @@ unit cpunode;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.15 2002-08-13 21:40:58 florian
|
||||
Revision 1.16 2003-04-24 11:24:00 florian
|
||||
* fixed several issues with nested procedures
|
||||
|
||||
Revision 1.15 2002/08/13 21:40:58 florian
|
||||
* more fixes for ppc calling conventions
|
||||
|
||||
Revision 1.14 2002/08/11 11:39:12 jonas
|
||||
|
@ -66,7 +66,7 @@ unit cpupi;
|
||||
procedure tppcprocinfo.after_header;
|
||||
begin
|
||||
procdef.parast.address_fixup:=0;
|
||||
if assigned(procdef.localst) and (procdef.localst.symtablelevel>1) then
|
||||
if assigned(procdef.parast) and (procdef.parast.symtablelevel>1) then
|
||||
begin
|
||||
procinfo.framepointer_offset:=procdef.parast.address_fixup;
|
||||
inc(procdef.parast.address_fixup,4);
|
||||
@ -111,7 +111,7 @@ unit cpupi;
|
||||
// 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;
|
||||
|
||||
{
|
||||
{
|
||||
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
|
||||
@ -136,7 +136,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.8 2003-04-06 16:39:11 jonas
|
||||
Revision 1.9 2003-04-24 11:24:00 florian
|
||||
* fixed several issues with nested procedures
|
||||
|
||||
Revision 1.8 2003/04/06 16:39:11 jonas
|
||||
* don't generate entry/exit code for assembler procedures
|
||||
|
||||
Revision 1.7 2003/04/05 21:09:32 jonas
|
||||
|
@ -89,7 +89,12 @@ implementation
|
||||
but it cannot be more !! }
|
||||
else if (lexlevel=(tprocdef(procdefinition).parast.symtablelevel)-1) then
|
||||
begin
|
||||
// cg.a_param_reg(exprasmlist,OS_ADDR,procinfo.framepointer,paramanager.getframepointerloc(procinfo.procdef));
|
||||
{ pass the same framepointer as the current procedure got }
|
||||
hregister1.enum:=R_INTREGISTER;
|
||||
hregister1.number:=NR_R1;
|
||||
hregister2.enum:=R_INTREGISTER;
|
||||
hregister2.number:=NR_R11;
|
||||
exprasmlist.concat(taicpu.op_reg_reg_const(A_ADDI,hregister2,hregister1,procinfo.framepointer_offset));
|
||||
end
|
||||
else if (lexlevel>(tprocdef(procdefinition).parast.symtablelevel)) then
|
||||
begin
|
||||
@ -116,7 +121,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2003-04-23 12:35:35 florian
|
||||
Revision 1.7 2003-04-24 11:24:00 florian
|
||||
* fixed several issues with nested procedures
|
||||
|
||||
Revision 1.6 2003/04/23 12:35:35 florian
|
||||
* fixed several issues with powerpc
|
||||
+ applied a patch from Jonas for nested function calls (PowerPC only)
|
||||
* ...
|
||||
|
Loading…
Reference in New Issue
Block a user