Ver Fonte

* fixed ppc build

peter há 22 anos atrás
pai
commit
ec2e200e42

+ 31 - 33
compiler/powerpc/cgcpu.pas

@@ -145,6 +145,8 @@ unit cgcpu;
         procedure a_jmp(list: taasmoutput; op: tasmop;
                         c: tasmcondflag; crval: longint; l: tasmlabel);
 
+        function save_regs(list : taasmoutput):longint;
+        procedure restore_regs(list : taasmoutput);
      end;
 
      tcg64fppc = class(tcg64f32)
@@ -176,14 +178,17 @@ const
 
     procedure tcgppc.init_register_allocators;
       begin
-        rgfpu:=trgcpu.create(29,R_INTREGISTER,R_SUBWHOLE,chr(ord(RS_R3))+chr(ord(RS_R4))+chr(ord(RS_R5))+chr(ord(RS_R6))+chr(ord(RS_R7))+chr(ord(RS_R8))+
-           chr(ord(RS_R9))+chr(ord(RS_R10))+chr(ord(RS_R11))+chr(ord(RS_R12))+chr(ord(RS_R31))+chr(ord(RS_R30))+chr(ord(RS_R29))+
-           chr(ord(RS_R28))+chr(ord(RS_R27))+chr(ord(RS_R26))+chr(ord(RS_R25))+chr(ord(RS_R24))+chr(ord(RS_R23))+chr(ord(RS_R22))+
-           chr(ord(RS_R21))+chr(ord(RS_R20))+chr(ord(RS_R19))+chr(ord(RS_R18))+chr(ord(RS_R17))+chr(ord(RS_R16))+chr(ord(RS_R15))+
-           chr(ord(RS_R14))+chr(ord(RS_R13)),first_int_imreg,[]);
+        rgfpu:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,
+            [RS_R3,RS_R4,RS_R5,RS_R6,RS_R7,RS_R8,
+             RS_R9,RS_R10,RS_R11,RS_R12,RS_R31,RS_R30,RS_R29,
+             RS_R28,RS_R27,RS_R26,RS_R25,RS_R24,RS_R23,RS_R22,
+             RS_R21,RS_R20,RS_R19,RS_R18,RS_R17,RS_R16,RS_R15,
+             RS_R14,RS_R13],first_int_imreg,[]);
         {$warning FIX ME}
-        rgfpu:=trgcpu.create(6,R_INTREGISTER,R_SUBWHOLE,#0#1#2#3#4#5,first_fpu_imreg,[]);
-        rgmm:=trgcpu.create(0,R_MMXREGISTER,R_SUBNONE,'',first_mm_imreg,[]);
+        rgfpu:=trgcpu.create(R_FPUREGISTER,R_SUBNONE,
+            [RS_F0,RS_F1,RS_F2,RS_F3,RS_F4,RS_F5],first_fpu_imreg,[]);
+        rgmm:=trgcpu.create(R_MMXREGISTER,R_SUBNONE,
+            [],first_mm_imreg,[]);
       end;
 
 
@@ -982,7 +987,6 @@ const
          offset : aword;
 //         r,r2,rsp:Tregister;
          regcounter2: Tsuperregister;
-         regidx : tregisterindex;
          hp: tparaitem;
 
       begin
@@ -1002,8 +1006,7 @@ const
           { FIXME: has to be R_F8 instad of R_F14 for SYSV abi }
           for regcounter:=RS_F14 to RS_F31 do
            begin
-             regidx:=findreg_by_number(newreg(R_FPUREGISTER,regcounter,R_SUBWHOLE));
-            if regidx in rgfpu.used_in_proc then
+             if supregset_in(rgfpu.used_in_proc,regcounter) then
               begin
                 usesfpr:= true;
                 firstregfpu:=regcounter;
@@ -1015,7 +1018,7 @@ const
         if not (po_assembler in current_procinfo.procdef.procoptions) then
           for regcounter2:=firstsaveintreg to RS_R31 do
             begin
-              if regcounter2 in rgint.used_in_proc then
+              if supregset_in(rgint.used_in_proc,regcounter2) then
                 begin
                    usesgpr:=true;
                    firstreggpr:=regcounter2;
@@ -1098,8 +1101,7 @@ const
              reference_reset_base(href,NR_R12,-8);
              for regcounter:=firstregfpu to RS_F31 do
               begin
-                regidx:=findreg_by_number(newreg(R_FPUREGISTER,regcounter,R_SUBWHOLE));
-                if regidx in rgfpu.used_in_proc then
+                if supregset_in(rgfpu.used_in_proc,regcounter) then
                  begin
                     a_loadfpu_reg_ref(list,OS_F64,newreg(R_FPUREGISTER,regcounter,R_SUBNONE),href);
                     dec(href.offset,8);
@@ -1125,7 +1127,7 @@ const
             reference_reset_base(href,NR_R12,-4);
             for regcounter2:=firstsaveintreg to RS_R31 do
               begin
-                if regcounter2 in rgint.used_in_proc then
+                if supregset_in(rgint.used_in_proc,regcounter2) then
                   begin
                      usesgpr:=true;
                      a_load_reg_ref(list,OS_INT,OS_INT,newreg(R_INTREGISTER,regcounter2,R_SUBNONE),href);
@@ -1211,7 +1213,6 @@ const
          usesfpr,usesgpr,genret : boolean;
          regcounter2:Tsuperregister;
          localsize: aword;
-         regidx : tregisterindex;
       begin
         { AltiVec context restore, not yet implemented !!! }
 
@@ -1219,8 +1220,7 @@ const
         if not (po_assembler in current_procinfo.procdef.procoptions) then
           for regcounter:=RS_F14 to RS_F31 do
            begin
-             regidx:=findreg_by_number(newreg(R_FPUREGISTER,regcounter,R_SUBWHOLE));
-             if regidx in rgfpu.used_in_proc then
+             if supregset_in(rgfpu.used_in_proc,regcounter) then
               begin
                  usesfpr:=true;
                  firstregfpu:=regcounter;
@@ -1232,7 +1232,7 @@ const
         if not (po_assembler in current_procinfo.procdef.procoptions) then
           for regcounter2:=firstsaveintreg to RS_R31 do
             begin
-              if regcounter2 in rgint.used_in_proc then
+              if supregset_in(rgint.used_in_proc,regcounter2) then
                 begin
                   usesgpr:=true;
                   firstreggpr:=regcounter2;
@@ -1253,8 +1253,7 @@ const
                  reference_reset_base(href,NR_R12,-8);
                  for regcounter := firstregfpu to RS_F31 do
                   begin
-                    regidx:=findreg_by_number(newreg(R_FPUREGISTER,regcounter,R_SUBWHOLE));
-                    if regidx in rgfpu.used_in_proc then
+                    if supregset_in(rgfpu.used_in_proc,regcounter) then
                      begin
                        a_loadfpu_ref_reg(list,OS_F64,href,newreg(R_FPUREGISTER,regcounter,R_SUBNONE));
                        dec(href.offset,8);
@@ -1267,7 +1266,7 @@ const
 
             for regcounter2:=firstsaveintreg to RS_R31 do
               begin
-                if regcounter2 in rgint.used_in_proc then
+                if supregset_in(rgint.used_in_proc,regcounter2) then
                   begin
                      usesgpr:=true;
                      a_load_ref_reg(list,OS_INT,OS_INT,href,newreg(R_INTREGISTER,regcounter2,R_SUBNONE));
@@ -1337,7 +1336,7 @@ const
           end;
       end;
 
-    function save_regs(list : taasmoutput):longint;
+    function tcgppc.save_regs(list : taasmoutput):longint;
     {Generates code which saves used non-volatile registers in
      the save area right below the address the stackpointer point to.
      Returns the actual used save area size.}
@@ -1347,14 +1346,12 @@ const
          href : treference;
          offset: integer;
          regcounter2: Tsuperregister;
-         regidx : tregisterindex;
     begin
       usesfpr:=false;
       if not (po_assembler in current_procinfo.procdef.procoptions) then
         for regcounter:=RS_F14 to RS_F31 do
          begin
-            regidx:=findreg_by_number(newreg(R_FPUREGISTER,regcounter,R_SUBWHOLE));
-            if regidx in tcgppc(cg).rgfpu.used_in_proc then
+           if supregset_in(rgfpu.used_in_proc,regcounter) then
             begin
                usesfpr:=true;
                firstregfpu:=regcounter;
@@ -1365,7 +1362,7 @@ const
       if not (po_assembler in current_procinfo.procdef.procoptions) then
         for regcounter2:=firstsaveintreg to RS_R31 do
           begin
-            if regcounter2 in tcgppc(cg).rgint.used_in_proc then
+            if supregset_in(rgint.used_in_proc,regcounter2) then
               begin
                  usesgpr:=true;
                  firstreggpr:=regcounter2;
@@ -1408,7 +1405,7 @@ const
       save_regs:= -offset;
     end;
 
-    procedure restore_regs(list : taasmoutput);
+    procedure tcgppc.restore_regs(list : taasmoutput);
     {Generates code which restores used non-volatile registers from
     the save area right below the address the stackpointer point to.}
 
@@ -1417,15 +1414,13 @@ const
          href : treference;
          offset: integer;
          regcounter2: Tsuperregister;
-         regidx : tregisterindex;
 
     begin
       usesfpr:=false;
       if not (po_assembler in current_procinfo.procdef.procoptions) then
         for regcounter:=RS_F14 to RS_F31 do
          begin
-           regidx:=findreg_by_number(newreg(R_FPUREGISTER,regcounter,R_SUBWHOLE));
-            if regidx in tcgppc(cg).rgfpu.used_in_proc then
+           if supregset_in(rgfpu.used_in_proc,regcounter) then
             begin
                usesfpr:=true;
                firstregfpu:=regcounter;
@@ -1437,7 +1432,7 @@ const
       if not (po_assembler in current_procinfo.procdef.procoptions) then
         for regcounter2:=RS_R13 to RS_R31 do
           begin
-            if regcounter2 in tcgppc(cg).rgint.used_in_proc then
+            if supregset_in(rgint.used_in_proc,regcounter2) then
               begin
                  usesgpr:=true;
                  firstreggpr:=regcounter2;
@@ -2123,7 +2118,7 @@ const
                  { otherwise it may be overwritten (and it's still used afterwards)    }
                  freeindex := false;
                  if (getsupreg(ref.index) >= first_int_supreg) and
-                    (getsupreg(ref.index) in rgint.unusedregs) then
+                    (supregset_in(rgint.unusedregs,getsupreg(ref.index))) then
                    begin
                      rgint.getexplicitregister(list,ref.index);
                      orgindex := ref.index;
@@ -2441,7 +2436,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.130  2003-10-17 01:22:08  florian
+  Revision 1.131  2003-10-17 14:52:07  peter
+    * fixed ppc build
+
+  Revision 1.130  2003/10/17 01:22:08  florian
     * compilation of the powerpc compiler fixed
 
   Revision 1.129  2003/10/13 01:58:04  florian

+ 8 - 5
compiler/powerpc/cpupara.pas

@@ -35,8 +35,8 @@ unit cpupara;
 
     type
        tppcparamanager = class(tparamanager)
-          function get_volatile_registers_int(calloption : tproccalloption):tsuperregisterset;override;
-          function get_volatile_registers_fpu(calloption : tproccalloption):tsuperregisterset;override;
+          function get_volatile_registers_int(calloption : tproccalloption):tcpuregisterset;override;
+          function get_volatile_registers_fpu(calloption : tproccalloption):tcpuregisterset;override;
           function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
           function getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;override;
           function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
@@ -51,12 +51,12 @@ unit cpupara;
        defutil,symsym;
 
 
-    function tppcparamanager.get_volatile_registers_int(calloption : tproccalloption):tsuperregisterset;
+    function tppcparamanager.get_volatile_registers_int(calloption : tproccalloption):tcpuregisterset;
       begin
         result := [RS_R3..RS_R12];
       end;
 
-    function tppcparamanager.get_volatile_registers_fpu(calloption : tproccalloption):tsuperregisterset;
+    function tppcparamanager.get_volatile_registers_fpu(calloption : tproccalloption):tcpuregisterset;
       begin
         case target_info.abi of
           abi_powerpc_aix:
@@ -359,7 +359,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.49  2003-10-08 21:15:27  olle
+  Revision 1.50  2003-10-17 14:52:07  peter
+    * fixed ppc build
+
+  Revision 1.49  2003/10/08 21:15:27  olle
     * changed to symbolic const for alignment
 
   Revision 1.47  2003/10/01 20:34:49  peter

+ 6 - 1
compiler/powerpc/nppcadd.pas

@@ -711,7 +711,9 @@ interface
         var
           oldnodetype: tnodetype;
         begin
+{$ifdef OLDREGVARS}
            load_all_regvars(exprasmlist);
+{$endif OLDREGVARS}
            { the jump the sequence is a little bit hairy }
            case nodetype of
               ltn,gtn:
@@ -1428,7 +1430,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.37  2003-10-17 01:22:08  florian
+  Revision 1.38  2003-10-17 14:52:07  peter
+    * fixed ppc build
+
+  Revision 1.37  2003/10/17 01:22:08  florian
     * compilation of the powerpc compiler fixed
 
   Revision 1.36  2003/10/01 20:34:49  peter

+ 5 - 2
compiler/symdef.pas

@@ -3117,8 +3117,8 @@ implementation
              para.free;
 {$ifdef MEMDEBUG}
              memprocpara.stop;
-          end;
 {$endif MEMDEBUG}
+          end;
          if assigned(parast) then
           begin
 {$ifdef MEMDEBUG}
@@ -5868,7 +5868,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.179  2003-10-17 14:38:32  peter
+  Revision 1.180  2003-10-17 14:52:07  peter
+    * fixed ppc build
+
+  Revision 1.179  2003/10/17 14:38:32  peter
     * 64k registers supported
     * fixed some memory leaks