Browse Source

* calculate localsize also in g_return_from_proc since it's now called
before g_stackframe_entry (still have to fix macos)
* compilation fixes (cycle doesn't work yet though)

Jonas Maebe 22 years ago
parent
commit
eb066d3b32

+ 61 - 36
compiler/powerpc/cgcpu.pas

@@ -27,6 +27,7 @@ unit cgcpu;
   interface
   interface
 
 
     uses
     uses
+       symtype,
        cgbase,cgobj,
        cgbase,cgobj,
        aasmbase,aasmcpu,aasmtai,
        aasmbase,aasmcpu,aasmtai,
        cpubase,cpuinfo,node,cg64f32,cginfo;
        cpubase,cpuinfo,node,cg64f32,cginfo;
@@ -57,9 +58,9 @@ unit cgcpu;
 
 
         { move instructions }
         { move instructions }
         procedure a_load_const_reg(list : taasmoutput; size: tcgsize; a : aword;reg : tregister);override;
         procedure a_load_const_reg(list : taasmoutput; size: tcgsize; a : aword;reg : tregister);override;
-        procedure a_load_reg_ref(list : taasmoutput; size: tcgsize; reg : tregister;const ref : treference);override;
-        procedure a_load_ref_reg(list : taasmoutput;size : tcgsize;const Ref : treference;reg : tregister);override;
-        procedure a_load_reg_reg(list : taasmoutput;fromsize, tosize : tcgsize;reg1,reg2 : tregister);override;
+        procedure a_load_reg_ref(list : taasmoutput; fromsize, tosize: tcgsize; reg : tregister;const ref : treference);override;
+        procedure a_load_ref_reg(list : taasmoutput; fromsize, tosize : tcgsize;const Ref : treference;reg : tregister);override;
+        procedure a_load_reg_reg(list : taasmoutput; fromsize, tosize : tcgsize;reg1,reg2 : tregister);override;
 
 
         { fpu move instructions }
         { fpu move instructions }
         procedure a_loadfpu_reg_reg(list: taasmoutput; reg1, reg2: tregister); override;
         procedure a_loadfpu_reg_reg(list: taasmoutput; reg1, reg2: tregister); override;
@@ -85,7 +86,7 @@ unit cgcpu;
 
 
         procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aword; delsource,loadref : boolean);override;
         procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aword; delsource,loadref : boolean);override;
 
 
-        procedure g_overflowcheck(list: taasmoutput; const p: tnode); override;
+        procedure g_overflowcheck(list: taasmoutput; const l: tlocation; def: tdef); override;
         { find out whether a is of the form 11..00..11b or 00..11...00. If }
         { find out whether a is of the form 11..00..11b or 00..11...00. If }
         { that's the case, we can use rlwinm to do an AND operation        }
         { that's the case, we can use rlwinm to do an AND operation        }
         function get_rlwi_const(a: aword; var l1, l2: longint): boolean;
         function get_rlwi_const(a: aword; var l1, l2: longint): boolean;
@@ -188,15 +189,15 @@ const
       begin
       begin
         case locpara.loc of
         case locpara.loc of
           LOC_REGISTER,LOC_CREGISTER:
           LOC_REGISTER,LOC_CREGISTER:
-            a_load_ref_reg(list,size,r,locpara.register);
+            a_load_ref_reg(list,size,size,r,locpara.register);
           LOC_REFERENCE:
           LOC_REFERENCE:
             begin
             begin
                reference_reset(ref);
                reference_reset(ref);
                ref.base:=locpara.reference.index;
                ref.base:=locpara.reference.index;
                ref.offset:=locpara.reference.offset;
                ref.offset:=locpara.reference.offset;
                tmpreg := get_scratch_reg_int(list,size);
                tmpreg := get_scratch_reg_int(list,size);
-               a_load_ref_reg(list,size,r,tmpreg);
-               a_load_reg_ref(list,size,tmpreg,ref);
+               a_load_ref_reg(list,size,size,r,tmpreg);
+               a_load_reg_ref(list,size,size,tmpreg,ref);
                free_scratch_reg(list,tmpreg);
                free_scratch_reg(list,tmpreg);
             end;
             end;
           LOC_FPUREGISTER,LOC_CFPUREGISTER:
           LOC_FPUREGISTER,LOC_CFPUREGISTER:
@@ -231,7 +232,7 @@ const
                 ref.offset := locpara.reference.offset;
                 ref.offset := locpara.reference.offset;
                 tmpreg := get_scratch_reg_address(list);
                 tmpreg := get_scratch_reg_address(list);
                 a_loadaddr_ref_reg(list,r,tmpreg);
                 a_loadaddr_ref_reg(list,r,tmpreg);
-                a_load_reg_ref(list,OS_ADDR,tmpreg,ref);
+                a_load_reg_ref(list,OS_ADDR,OS_ADDR,tmpreg,ref);
                 free_scratch_reg(list,tmpreg);
                 free_scratch_reg(list,tmpreg);
               end;
               end;
             else
             else
@@ -296,7 +297,7 @@ const
 
 
       begin
       begin
         tmpreg := get_scratch_reg_int(list,OS_ADDR);
         tmpreg := get_scratch_reg_int(list,OS_ADDR);
-        a_load_ref_reg(list,OS_ADDR,ref,tmpreg);
+        a_load_ref_reg(list,OS_ADDR,OS_ADDR,ref,tmpreg);
         if target_info.system=system_powerpc_macos then
         if target_info.system=system_powerpc_macos then
           begin
           begin
             {Generate instruction to load the procedure address from
             {Generate instruction to load the procedure address from
@@ -341,7 +342,7 @@ const
        end;
        end;
 
 
 
 
-     procedure tcgppc.a_load_reg_ref(list : taasmoutput; size: TCGSize; reg : tregister;const ref : treference);
+     procedure tcgppc.a_load_reg_ref(list : taasmoutput; fromsize, tosize: TCGSize; reg : tregister;const ref : treference);
 
 
        const
        const
          StoreInstr: Array[OS_8..OS_32,boolean, boolean] of TAsmOp =
          StoreInstr: Array[OS_8..OS_32,boolean, boolean] of TAsmOp =
@@ -356,20 +357,20 @@ const
        begin
        begin
          ref2 := ref;
          ref2 := ref;
          freereg := fixref(list,ref2);
          freereg := fixref(list,ref2);
-         if size in [OS_S8..OS_S16] then
+         if tosize in [OS_S8..OS_S16] then
            { storing is the same for signed and unsigned values }
            { storing is the same for signed and unsigned values }
-           size := tcgsize(ord(size)-(ord(OS_S8)-ord(OS_8)));
+           tosize := tcgsize(ord(tosize)-(ord(OS_S8)-ord(OS_8)));
          { 64 bit stuff should be handled separately }
          { 64 bit stuff should be handled separately }
-         if size in [OS_64,OS_S64] then
+         if tosize in [OS_64,OS_S64] then
            internalerror(200109236);
            internalerror(200109236);
-         op := storeinstr[tcgsize2unsigned[size],ref2.index.number<>NR_NO,false];
+         op := storeinstr[tcgsize2unsigned[tosize],ref2.index.number<>NR_NO,false];
          a_load_store(list,op,reg,ref2);
          a_load_store(list,op,reg,ref2);
          if freereg then
          if freereg then
            cg.free_scratch_reg(list,ref2.base);
            cg.free_scratch_reg(list,ref2.base);
        End;
        End;
 
 
 
 
-     procedure tcgppc.a_load_ref_reg(list : taasmoutput;size : tcgsize;const ref: treference;reg : tregister);
+     procedure tcgppc.a_load_ref_reg(list : taasmoutput; fromsize,tosize : tcgsize;const ref: treference;reg : tregister);
 
 
        const
        const
          LoadInstr: Array[OS_8..OS_S32,boolean, boolean] of TAsmOp =
          LoadInstr: Array[OS_8..OS_S32,boolean, boolean] of TAsmOp =
@@ -390,17 +391,19 @@ const
          freereg: boolean;
          freereg: boolean;
 
 
        begin
        begin
-          if not(size in [OS_8,OS_S8,OS_16,OS_S16,OS_32,OS_S32]) then
+          { TODO: optimize/take into consideration fromsize/tosize. Will }
+          { probably only matter for OS_S8 loads though                  }
+          if not(fromsize in [OS_8,OS_S8,OS_16,OS_S16,OS_32,OS_S32]) then
             internalerror(2002090902);
             internalerror(2002090902);
           ref2 := ref;
           ref2 := ref;
           freereg := fixref(list,ref2);
           freereg := fixref(list,ref2);
-          op := loadinstr[size,ref2.index.number<>NR_NO,false];
+          op := loadinstr[fromsize,ref2.index.number<>NR_NO,false];
           a_load_store(list,op,reg,ref2);
           a_load_store(list,op,reg,ref2);
           if freereg then
           if freereg then
             free_scratch_reg(list,ref2.base);
             free_scratch_reg(list,ref2.base);
           { sign extend shortint if necessary, since there is no }
           { sign extend shortint if necessary, since there is no }
           { load instruction that does that automatically (JM)   }
           { load instruction that does that automatically (JM)   }
-          if size = OS_S8 then
+          if fromsize = OS_S8 then
             list.concat(taicpu.op_reg_reg(A_EXTSB,reg,reg));
             list.concat(taicpu.op_reg_reg(A_EXTSB,reg,reg));
        end;
        end;
 
 
@@ -1130,7 +1133,7 @@ const
                      usesgpr:=true;
                      usesgpr:=true;
                      r.enum := R_INTREGISTER;
                      r.enum := R_INTREGISTER;
                      r.number := regcounter2 shl 8;
                      r.number := regcounter2 shl 8;
-                     a_load_reg_ref(list,OS_INT,r,href);
+                     a_load_reg_ref(list,OS_INT,OS_INT,r,href);
                      dec(href.offset,4);
                      dec(href.offset,4);
                   end;
                   end;
               end;
               end;
@@ -1156,7 +1159,7 @@ const
                       begin
                       begin
                         reference_reset_base(href,current_procinfo.framepointer,tvarsym(hp.parasym).adjusted_address);
                         reference_reset_base(href,current_procinfo.framepointer,tvarsym(hp.parasym).adjusted_address);
                         reference_reset_base(href2,r,hp.paraloc.reference.offset);
                         reference_reset_base(href2,r,hp.paraloc.reference.offset);
-                        cg.a_load_ref_ref(list,hp.paraloc.size,href2,href);
+                        cg.a_load_ref_ref(list,hp.paraloc.size,hp.paraloc.size,href2,href);
                       end;
                       end;
                     hp := tparaitem(hp.next);
                     hp := tparaitem(hp.next);
                   end;
                   end;
@@ -1217,8 +1220,10 @@ const
          usesfpr,usesgpr,genret : boolean;
          usesfpr,usesgpr,genret : boolean;
          r,r2:Tregister;
          r,r2:Tregister;
          regcounter2:Tsuperregister;
          regcounter2:Tsuperregister;
+         localsize: aword;
 
 
       begin
       begin
+        localsize := 0;
         { release parameter registers }
         { release parameter registers }
         r.enum := R_INTREGISTER;
         r.enum := R_INTREGISTER;
         for regcounter2 := RS_R3 to RS_R10 do
         for regcounter2 := RS_R3 to RS_R10 do
@@ -1251,6 +1256,19 @@ const
                 end;
                 end;
             end;
             end;
 
 
+        if not (po_assembler in current_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;
+
+
         { no return (blr) generated yet }
         { no return (blr) generated yet }
         genret:=true;
         genret:=true;
         if usesgpr or usesfpr then
         if usesgpr or usesfpr then
@@ -1282,7 +1300,7 @@ const
                      usesgpr:=true;
                      usesgpr:=true;
                      r.enum := R_INTREGISTER;
                      r.enum := R_INTREGISTER;
                      r.number := regcounter2 shl 8;
                      r.number := regcounter2 shl 8;
-                     a_load_ref_reg(list,OS_INT,href,r);
+                     a_load_ref_reg(list,OS_INT,OS_INT,href,r);
                      dec(href.offset,4);
                      dec(href.offset,4);
                   end;
                   end;
               end;
               end;
@@ -1797,6 +1815,7 @@ const
         count, count2: aword;
         count, count2: aword;
         orgsrc, orgdst: boolean;
         orgsrc, orgdst: boolean;
         r:Tregister;
         r:Tregister;
+        size: tcgsize;
 
 
       begin
       begin
 {$ifdef extdebug}
 {$ifdef extdebug}
@@ -1811,7 +1830,8 @@ const
             begin
             begin
               if len < 8 then
               if len < 8 then
                 begin
                 begin
-                  a_load_ref_ref(list,int_cgsize(len),source,dest);
+                  size := int_cgsize(len);
+                  a_load_ref_ref(list,size,size,source,dest);
                   if delsource then
                   if delsource then
                     begin
                     begin
                       reference_release(list,source);
                       reference_release(list,source);
@@ -1842,7 +1862,7 @@ const
         if loadref then
         if loadref then
           begin
           begin
             src.base := get_scratch_reg_address(list);
             src.base := get_scratch_reg_address(list);
-            a_load_ref_reg(list,OS_32,source,src.base);
+            a_load_ref_reg(list,OS_32,OS_32,source,src.base);
             orgsrc := false;
             orgsrc := false;
           end
           end
         else if (count > 4) or
         else if (count > 4) or
@@ -1929,8 +1949,8 @@ const
             r.enum:=R_INTREGISTER;
             r.enum:=R_INTREGISTER;
             r.number:=NR_R0;
             r.number:=NR_R0;
             a_reg_alloc(list,r);
             a_reg_alloc(list,r);
-            a_load_ref_reg(list,OS_32,src,r);
-            a_load_reg_ref(list,OS_32,r,dst);
+            a_load_ref_reg(list,OS_32,OS_32,src,r);
+            a_load_reg_ref(list,OS_32,OS_32,r,dst);
             inc(src.offset,4);
             inc(src.offset,4);
             inc(dst.offset,4);
             inc(dst.offset,4);
             a_reg_dealloc(list,r);
             a_reg_dealloc(list,r);
@@ -1974,8 +1994,8 @@ const
             a_reg_alloc(list,r);
             a_reg_alloc(list,r);
             for count2 := 1 to count do
             for count2 := 1 to count do
               begin
               begin
-                a_load_ref_reg(list,OS_32,src,r);
-                a_load_reg_ref(list,OS_32,r,dst);
+                a_load_ref_reg(list,OS_32,OS_32,src,r);
+                a_load_reg_ref(list,OS_32,OS_32,r,dst);
                 inc(src.offset,4);
                 inc(src.offset,4);
                 inc(dst.offset,4);
                 inc(dst.offset,4);
               end;
               end;
@@ -1989,8 +2009,8 @@ const
            r.enum:=R_INTREGISTER;
            r.enum:=R_INTREGISTER;
            r.number:=NR_R0;
            r.number:=NR_R0;
            a_reg_alloc(list,r);
            a_reg_alloc(list,r);
-           a_load_ref_reg(list,OS_16,src,r);
-           a_load_reg_ref(list,OS_16,r,dst);
+           a_load_ref_reg(list,OS_16,OS_16,src,r);
+           a_load_reg_ref(list,OS_16,OS_16,r,dst);
            inc(src.offset,2);
            inc(src.offset,2);
            inc(dst.offset,2);
            inc(dst.offset,2);
            a_reg_dealloc(list,r);
            a_reg_dealloc(list,r);
@@ -2000,8 +2020,8 @@ const
            r.enum:=R_INTREGISTER;
            r.enum:=R_INTREGISTER;
            r.number:=NR_R0;
            r.number:=NR_R0;
            a_reg_alloc(list,r);
            a_reg_alloc(list,r);
-           a_load_ref_reg(list,OS_8,src,r);
-           a_load_reg_ref(list,OS_8,r,dst);
+           a_load_ref_reg(list,OS_8,OS_8,src,r);
+           a_load_reg_ref(list,OS_8,OS_8,r,dst);
            a_reg_dealloc(list,r);
            a_reg_dealloc(list,r);
          end;
          end;
        if orgsrc then
        if orgsrc then
@@ -2141,7 +2161,7 @@ const
 !!!!}
 !!!!}
       end;
       end;
 
 
-    procedure tcgppc.g_overflowcheck(list: taasmoutput; const p: tnode);
+    procedure tcgppc.g_overflowcheck(list: taasmoutput; const l: tlocation; def: tdef);
 
 
       var
       var
          hl : tasmlabel;
          hl : tasmlabel;
@@ -2150,9 +2170,9 @@ const
          if not(cs_check_overflow in aktlocalswitches) then
          if not(cs_check_overflow in aktlocalswitches) then
           exit;
           exit;
          objectlibrary.getlabel(hl);
          objectlibrary.getlabel(hl);
-         if not ((p.resulttype.def.deftype=pointerdef) or
-                ((p.resulttype.def.deftype=orddef) and
-                 (torddef(p.resulttype.def).typ in [u64bit,u16bit,u32bit,u8bit,uchar,
+         if not ((def.deftype=pointerdef) or
+                ((def.deftype=orddef) and
+                 (torddef(def).typ in [u64bit,u16bit,u32bit,u8bit,uchar,
                                                   bool8bit,bool16bit,bool32bit]))) then
                                                   bool8bit,bool16bit,bool32bit]))) then
            begin
            begin
              r.enum:=R_CR7;
              r.enum:=R_CR7;
@@ -2543,7 +2563,12 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.103  2003-06-01 21:38:06  peter
+  Revision 1.104  2003-06-04 11:58:58  jonas
+    * calculate localsize also in g_return_from_proc since it's now called
+      before g_stackframe_entry (still have to fix macos)
+    * compilation fixes (cycle doesn't work yet though)
+
+  Revision 1.103  2003/06/01 21:38:06  peter
     * getregisterfpu size parameter added
     * getregisterfpu size parameter added
     * op_const_reg size parameter added
     * op_const_reg size parameter added
     * sparc updates
     * sparc updates

+ 8 - 3
compiler/powerpc/nppcadd.pas

@@ -1080,7 +1080,7 @@ interface
               left.location.registerlow,right.location.registerlow));
               left.location.registerlow,right.location.registerlow));
             exprasmlist.concat(taicpu.op_reg_reg_reg(op2,location.registerhigh,
             exprasmlist.concat(taicpu.op_reg_reg_reg(op2,location.registerhigh,
               right.location.registerhigh,left.location.registerhigh));
               right.location.registerhigh,left.location.registerhigh));
-            cg.g_overflowcheck(exprasmlist,self);
+            cg.g_overflowcheck(exprasmlist,location,resulttype.def);
           end;
           end;
 
 
         { set result location }
         { set result location }
@@ -1461,7 +1461,7 @@ interface
              end;
              end;
              exprasmlist.concat(taicpu.op_reg_reg_reg(op,location.register,
              exprasmlist.concat(taicpu.op_reg_reg_reg(op,location.register,
                left.location.register,right.location.register));
                left.location.register,right.location.register));
-             cg.g_overflowcheck(exprasmlist,self);
+             cg.g_overflowcheck(exprasmlist,location,resulttype.def);
            end;
            end;
 
 
          clear_left_right(cmpop);
          clear_left_right(cmpop);
@@ -1472,7 +1472,12 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.31  2003-06-01 21:38:06  peter
+  Revision 1.32  2003-06-04 11:58:58  jonas
+    * calculate localsize also in g_return_from_proc since it's now called
+      before g_stackframe_entry (still have to fix macos)
+    * compilation fixes (cycle doesn't work yet though)
+
+  Revision 1.31  2003/06/01 21:38:06  peter
     * getregisterfpu size parameter added
     * getregisterfpu size parameter added
     * op_const_reg size parameter added
     * op_const_reg size parameter added
     * sparc updates
     * sparc updates

+ 9 - 4
compiler/powerpc/nppccal.pas

@@ -83,7 +83,7 @@ implementation
             hregister2.enum:=R_INTREGISTER;
             hregister2.enum:=R_INTREGISTER;
             hregister2.number:=NR_R11;
             hregister2.number:=NR_R11;
             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,hregister2);
+            cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,hregister2);
             { it must be adjusted! }
             { it must be adjusted! }
          end
          end
          { this is only true if the difference is one !!
          { this is only true if the difference is one !!
@@ -101,14 +101,14 @@ implementation
          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,OS_ADDR,href,hregister1);
             { the previous frame pointer is always saved at }
             { the previous frame pointer is always saved at }
             { previous_framepointer+12 (in the link area)   }
             { previous_framepointer+12 (in the link area)   }
             reference_reset_base(href,hregister1,12);
             reference_reset_base(href,hregister1,12);
             i:=current_procdef.parast.symtablelevel-1;
             i:=current_procdef.parast.symtablelevel-1;
             while (i>tprocdef(procdefinition).parast.symtablelevel) do
             while (i>tprocdef(procdefinition).parast.symtablelevel) do
               begin
               begin
-                 cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,hregister1);
+                 cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,hregister1);
                  dec(i);
                  dec(i);
               end;
               end;
             hregister2.enum:=R_INTREGISTER;
             hregister2.enum:=R_INTREGISTER;
@@ -125,7 +125,12 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2003-05-25 14:32:42  jonas
+  Revision 1.17  2003-06-04 11:58:58  jonas
+    * calculate localsize also in g_return_from_proc since it's now called
+      before g_stackframe_entry (still have to fix macos)
+    * compilation fixes (cycle doesn't work yet though)
+
+  Revision 1.16  2003/05/25 14:32:42  jonas
     * fixed register numbering bug
     * fixed register numbering bug
 
 
   Revision 1.15  2003/05/24 11:47:27  jonas
   Revision 1.15  2003/05/24 11:47:27  jonas

+ 17 - 7
compiler/powerpc/nppccnv.pas

@@ -128,6 +128,7 @@ implementation
         tempconst: trealconstnode;
         tempconst: trealconstnode;
         ref: treference;
         ref: treference;
         valuereg, tempreg, leftreg, tmpfpureg: tregister;
         valuereg, tempreg, leftreg, tmpfpureg: tregister;
+        size: tcgsize;
         signed, valuereg_is_scratch: boolean;
         signed, valuereg_is_scratch: boolean;
       begin
       begin
 {$ifdef VER1_0}
 {$ifdef VER1_0}
@@ -200,22 +201,26 @@ implementation
               leftreg := cg.get_scratch_reg_int(exprasmlist,OS_INT);
               leftreg := cg.get_scratch_reg_int(exprasmlist,OS_INT);
               valuereg := leftreg;
               valuereg := leftreg;
               valuereg_is_scratch := true;
               valuereg_is_scratch := true;
+              if signed then
+                size := OS_S32
+              else
+                size := OS_32;
               cg.a_load_ref_reg(exprasmlist,def_cgsize(left.resulttype.def),
               cg.a_load_ref_reg(exprasmlist,def_cgsize(left.resulttype.def),
-                left.location.reference,leftreg);
+                size,left.location.reference,leftreg);
             end
             end
           else
           else
             internalerror(200110012);
             internalerror(200110012);
          end;
          end;
          tempreg := cg.get_scratch_reg_int(exprasmlist,OS_INT);
          tempreg := cg.get_scratch_reg_int(exprasmlist,OS_INT);
          exprasmlist.concat(taicpu.op_reg_const(A_LIS,tempreg,$4330));
          exprasmlist.concat(taicpu.op_reg_const(A_LIS,tempreg,$4330));
-         cg.a_load_reg_ref(exprasmlist,OS_32,tempreg,ref);
+         cg.a_load_reg_ref(exprasmlist,OS_32,OS_32,tempreg,ref);
          cg.free_scratch_reg(exprasmlist,tempreg);
          cg.free_scratch_reg(exprasmlist,tempreg);
          if signed then
          if signed then
            exprasmlist.concat(taicpu.op_reg_reg_const(A_XORIS,valuereg,
            exprasmlist.concat(taicpu.op_reg_reg_const(A_XORIS,valuereg,
              { xoris expects a unsigned 16 bit int (FK) }
              { xoris expects a unsigned 16 bit int (FK) }
              leftreg,$8000));
              leftreg,$8000));
          inc(ref.offset,4);
          inc(ref.offset,4);
-         cg.a_load_reg_ref(exprasmlist,OS_32,valuereg,ref);
+         cg.a_load_reg_ref(exprasmlist,OS_32,OS_32,valuereg,ref);
          dec(ref.offset,4);
          dec(ref.offset,4);
          if (valuereg_is_scratch) then
          if (valuereg_is_scratch) then
            cg.free_scratch_reg(exprasmlist,valuereg);
            cg.free_scratch_reg(exprasmlist,valuereg);
@@ -302,18 +307,18 @@ implementation
                     hreg2:=rg.getregisterint(exprasmlist,OS_INT);
                     hreg2:=rg.getregisterint(exprasmlist,OS_INT);
                     if left.location.size in [OS_64,OS_S64] then
                     if left.location.size in [OS_64,OS_S64] then
                       begin
                       begin
-                        cg.a_load_ref_reg(exprasmlist,OS_INT,
+                        cg.a_load_ref_reg(exprasmlist,OS_INT,OS_INT,
                          left.location.reference,hreg2);
                          left.location.reference,hreg2);
                         hreg1:=rg.getregisterint(exprasmlist,OS_INT);
                         hreg1:=rg.getregisterint(exprasmlist,OS_INT);
                         href:=left.location.reference;
                         href:=left.location.reference;
                         inc(href.offset,4);
                         inc(href.offset,4);
-                        cg.a_load_ref_reg(exprasmlist,OS_INT,
+                        cg.a_load_ref_reg(exprasmlist,OS_INT,OS_INT,
                           href,hreg1);
                           href,hreg1);
                         cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,hreg2,hreg1,hreg2);
                         cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,hreg2,hreg1,hreg2);
                         rg.ungetregisterint(exprasmlist,hreg1);
                         rg.ungetregisterint(exprasmlist,hreg1);
                       end
                       end
                     else
                     else
-                      cg.a_load_ref_reg(exprasmlist,opsize,
+                      cg.a_load_ref_reg(exprasmlist,opsize,opsize,
                         left.location.reference,hreg2);
                         left.location.reference,hreg2);
                   end
                   end
                 else
                 else
@@ -429,7 +434,12 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.37  2003-06-01 21:38:06  peter
+  Revision 1.38  2003-06-04 11:58:58  jonas
+    * calculate localsize also in g_return_from_proc since it's now called
+      before g_stackframe_entry (still have to fix macos)
+    * compilation fixes (cycle doesn't work yet though)
+
+  Revision 1.37  2003/06/01 21:38:06  peter
     * getregisterfpu size parameter added
     * getregisterfpu size parameter added
     * op_const_reg size parameter added
     * op_const_reg size parameter added
     * sparc updates
     * sparc updates

+ 9 - 4
compiler/powerpc/nppcmat.pas

@@ -157,7 +157,7 @@ implementation
         { set result location }
         { set result location }
         location.loc:=LOC_REGISTER;
         location.loc:=LOC_REGISTER;
         location.register:=resultreg;
         location.register:=resultreg;
-        cg.g_overflowcheck(exprasmlist,self);
+        cg.g_overflowcheck(exprasmlist,location,resulttype.def);
       end;
       end;
 
 
 
 
@@ -404,7 +404,7 @@ implementation
                        begin
                        begin
                           src1 := rg.getregisterint(exprasmlist,OS_32);
                           src1 := rg.getregisterint(exprasmlist,OS_32);
                           location.register:= src1;
                           location.register:= src1;
-                          cg.a_load_ref_reg(exprasmlist,OS_32,
+                          cg.a_load_ref_reg(exprasmlist,OS_32,OS_32,
                             left.location.reference,src1);
                             left.location.reference,src1);
                        end;
                        end;
                      reference_release(exprasmlist,left.location.reference);
                      reference_release(exprasmlist,left.location.reference);
@@ -433,7 +433,7 @@ implementation
 { 32-bit before doing neg!!     }
 { 32-bit before doing neg!!     }
 { So this is useless...     }
 { So this is useless...     }
 { that's not true: -2^31 gives an overflow error if it is negated (FK) }
 { that's not true: -2^31 gives an overflow error if it is negated (FK) }
-        cg.g_overflowcheck(exprasmlist,self);
+        cg.g_overflowcheck(exprasmlist,location,resulttype.def);
       end;
       end;
 
 
 
 
@@ -520,7 +520,12 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.28  2003-06-01 21:38:06  peter
+  Revision 1.29  2003-06-04 11:58:58  jonas
+    * calculate localsize also in g_return_from_proc since it's now called
+      before g_stackframe_entry (still have to fix macos)
+    * compilation fixes (cycle doesn't work yet though)
+
+  Revision 1.28  2003/06/01 21:38:06  peter
     * getregisterfpu size parameter added
     * getregisterfpu size parameter added
     * op_const_reg size parameter added
     * op_const_reg size parameter added
     * sparc updates
     * sparc updates