Browse Source

* workaround for nested procedures until Peter fixes it properly :)

Jonas Maebe 22 years ago
parent
commit
9055529171
2 changed files with 16 additions and 5 deletions
  1. 9 3
      compiler/powerpc/cpupi.pas
  2. 7 2
      compiler/powerpc/nppccal.pas

+ 9 - 3
compiler/powerpc/cpupi.pas

@@ -67,9 +67,11 @@ unit cpupi;
       begin
       begin
          { this value is necessary for nested procedures }
          { this value is necessary for nested procedures }
          procdef.parast.address_fixup:=0;
          procdef.parast.address_fixup:=0;
-         if assigned(procdef.localst) then
-           procdef.localst.address_fixup:=procdef.parast.address_fixup+procdef.parast.datasize;
          inherited after_header;
          inherited after_header;
+
+         if assigned(procdef.localst) then
+           procdef.localst.address_fixup:=0;
+         procdef.parast.address_fixup:= -procdef.parast.datasize;
      end;
      end;
 
 
     procedure tppcprocinfo.after_pass1;
     procedure tppcprocinfo.after_pass1;
@@ -108,6 +110,7 @@ unit cpupi;
              //!!!! tg.setfirsttemp(firsttemp_offset);
              //!!!! tg.setfirsttemp(firsttemp_offset);
              tg.firsttemp:=firsttemp_offset;
              tg.firsttemp:=firsttemp_offset;
              tg.lasttemp:=firsttemp_offset;
              tg.lasttemp:=firsttemp_offset;
+             inherited after_pass1;
            end;
            end;
       end;
       end;
 
 
@@ -116,7 +119,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2003-05-16 20:00:39  jonas
+  Revision 1.17  2003-05-16 23:15:51  jonas
+    * workaround for nested procedures until Peter fixes it properly :)
+
+  Revision 1.16  2003/05/16 20:00:39  jonas
     * powerpc nested procedure fixes, should work completely now if all
     * powerpc nested procedure fixes, should work completely now if all
       local variables of the parent procedure are declared before the
       local variables of the parent procedure are declared before the
       nested procedures are declared
       nested procedures are declared

+ 7 - 2
compiler/powerpc/nppccal.pas

@@ -95,13 +95,15 @@ implementation
             hregister1.number:=NR_R1;
             hregister1.number:=NR_R1;
             hregister2.enum:=R_INTREGISTER;
             hregister2.enum:=R_INTREGISTER;
             hregister2.number:=NR_R11;
             hregister2.number:=NR_R11;
-            exprasmlist.concat(taicpu.op_reg_reg_const(A_ADDI,hregister2,hregister1,current_procinfo.procdef.parast.address_fixup));
+            if assigned(current_procinfo.procdef.localst) then
+              exprasmlist.concat(taicpu.op_reg_reg_const(A_ADDI,hregister2,hregister1,current_procinfo.procdef.localst.address_fixup));
          end
          end
        else if (current_procdef.parast.symtablelevel>(tprocdef(procdefinition).parast.symtablelevel)) then
        else if (current_procdef.parast.symtablelevel>(tprocdef(procdefinition).parast.symtablelevel)) then
          begin
          begin
             hregister1:=rg.getregisterint(exprasmlist,OS_ADDR);
             hregister1:=rg.getregisterint(exprasmlist,OS_ADDR);
             reference_reset_base(href,current_procinfo.framepointer,current_procinfo.framepointer_offset);
             reference_reset_base(href,current_procinfo.framepointer,current_procinfo.framepointer_offset);
             cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,hregister1);
             cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,hregister1);
+            { !!!!!!!!!! not true anymore!!!!!!! (JM)       }
             { the previous frame pointer is always saved at }
             { the previous frame pointer is always saved at }
             { previous_framepointer-sizeof(pointer)         }
             { previous_framepointer-sizeof(pointer)         }
             reference_reset_base(href,hregister1,-POINTER_SIZE);
             reference_reset_base(href,hregister1,-POINTER_SIZE);
@@ -126,7 +128,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.11  2003-05-16 20:00:39  jonas
+  Revision 1.12  2003-05-16 23:15:51  jonas
+    * workaround for nested procedures until Peter fixes it properly :)
+
+  Revision 1.11  2003/05/16 20:00:39  jonas
     * powerpc nested procedure fixes, should work completely now if all
     * powerpc nested procedure fixes, should work completely now if all
       local variables of the parent procedure are declared before the
       local variables of the parent procedure are declared before the
       nested procedures are declared
       nested procedures are declared