2
0
peter 22 жил өмнө
parent
commit
ec2e200e42

+ 31 - 33
compiler/powerpc/cgcpu.pas

@@ -145,6 +145,8 @@ unit cgcpu;
         procedure a_jmp(list: taasmoutput; op: tasmop;
         procedure a_jmp(list: taasmoutput; op: tasmop;
                         c: tasmcondflag; crval: longint; l: tasmlabel);
                         c: tasmcondflag; crval: longint; l: tasmlabel);
 
 
+        function save_regs(list : taasmoutput):longint;
+        procedure restore_regs(list : taasmoutput);
      end;
      end;
 
 
      tcg64fppc = class(tcg64f32)
      tcg64fppc = class(tcg64f32)
@@ -176,14 +178,17 @@ const
 
 
     procedure tcgppc.init_register_allocators;
     procedure tcgppc.init_register_allocators;
       begin
       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}
         {$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;
       end;
 
 
 
 
@@ -982,7 +987,6 @@ const
          offset : aword;
          offset : aword;
 //         r,r2,rsp:Tregister;
 //         r,r2,rsp:Tregister;
          regcounter2: Tsuperregister;
          regcounter2: Tsuperregister;
-         regidx : tregisterindex;
          hp: tparaitem;
          hp: tparaitem;
 
 
       begin
       begin
@@ -1002,8 +1006,7 @@ const
           { FIXME: has to be R_F8 instad of R_F14 for SYSV abi }
           { FIXME: has to be R_F8 instad of R_F14 for SYSV abi }
           for regcounter:=RS_F14 to RS_F31 do
           for regcounter:=RS_F14 to RS_F31 do
            begin
            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
               begin
                 usesfpr:= true;
                 usesfpr:= true;
                 firstregfpu:=regcounter;
                 firstregfpu:=regcounter;
@@ -1015,7 +1018,7 @@ const
         if not (po_assembler in current_procinfo.procdef.procoptions) then
         if not (po_assembler in current_procinfo.procdef.procoptions) then
           for regcounter2:=firstsaveintreg to RS_R31 do
           for regcounter2:=firstsaveintreg to RS_R31 do
             begin
             begin
-              if regcounter2 in rgint.used_in_proc then
+              if supregset_in(rgint.used_in_proc,regcounter2) then
                 begin
                 begin
                    usesgpr:=true;
                    usesgpr:=true;
                    firstreggpr:=regcounter2;
                    firstreggpr:=regcounter2;
@@ -1098,8 +1101,7 @@ const
              reference_reset_base(href,NR_R12,-8);
              reference_reset_base(href,NR_R12,-8);
              for regcounter:=firstregfpu to RS_F31 do
              for regcounter:=firstregfpu to RS_F31 do
               begin
               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
                  begin
                     a_loadfpu_reg_ref(list,OS_F64,newreg(R_FPUREGISTER,regcounter,R_SUBNONE),href);
                     a_loadfpu_reg_ref(list,OS_F64,newreg(R_FPUREGISTER,regcounter,R_SUBNONE),href);
                     dec(href.offset,8);
                     dec(href.offset,8);
@@ -1125,7 +1127,7 @@ const
             reference_reset_base(href,NR_R12,-4);
             reference_reset_base(href,NR_R12,-4);
             for regcounter2:=firstsaveintreg to RS_R31 do
             for regcounter2:=firstsaveintreg to RS_R31 do
               begin
               begin
-                if regcounter2 in rgint.used_in_proc then
+                if supregset_in(rgint.used_in_proc,regcounter2) then
                   begin
                   begin
                      usesgpr:=true;
                      usesgpr:=true;
                      a_load_reg_ref(list,OS_INT,OS_INT,newreg(R_INTREGISTER,regcounter2,R_SUBNONE),href);
                      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;
          usesfpr,usesgpr,genret : boolean;
          regcounter2:Tsuperregister;
          regcounter2:Tsuperregister;
          localsize: aword;
          localsize: aword;
-         regidx : tregisterindex;
       begin
       begin
         { AltiVec context restore, not yet implemented !!! }
         { AltiVec context restore, not yet implemented !!! }
 
 
@@ -1219,8 +1220,7 @@ const
         if not (po_assembler in current_procinfo.procdef.procoptions) then
         if not (po_assembler in current_procinfo.procdef.procoptions) then
           for regcounter:=RS_F14 to RS_F31 do
           for regcounter:=RS_F14 to RS_F31 do
            begin
            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
               begin
                  usesfpr:=true;
                  usesfpr:=true;
                  firstregfpu:=regcounter;
                  firstregfpu:=regcounter;
@@ -1232,7 +1232,7 @@ const
         if not (po_assembler in current_procinfo.procdef.procoptions) then
         if not (po_assembler in current_procinfo.procdef.procoptions) then
           for regcounter2:=firstsaveintreg to RS_R31 do
           for regcounter2:=firstsaveintreg to RS_R31 do
             begin
             begin
-              if regcounter2 in rgint.used_in_proc then
+              if supregset_in(rgint.used_in_proc,regcounter2) then
                 begin
                 begin
                   usesgpr:=true;
                   usesgpr:=true;
                   firstreggpr:=regcounter2;
                   firstreggpr:=regcounter2;
@@ -1253,8 +1253,7 @@ const
                  reference_reset_base(href,NR_R12,-8);
                  reference_reset_base(href,NR_R12,-8);
                  for regcounter := firstregfpu to RS_F31 do
                  for regcounter := firstregfpu to RS_F31 do
                   begin
                   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
                      begin
                        a_loadfpu_ref_reg(list,OS_F64,href,newreg(R_FPUREGISTER,regcounter,R_SUBNONE));
                        a_loadfpu_ref_reg(list,OS_F64,href,newreg(R_FPUREGISTER,regcounter,R_SUBNONE));
                        dec(href.offset,8);
                        dec(href.offset,8);
@@ -1267,7 +1266,7 @@ const
 
 
             for regcounter2:=firstsaveintreg to RS_R31 do
             for regcounter2:=firstsaveintreg to RS_R31 do
               begin
               begin
-                if regcounter2 in rgint.used_in_proc then
+                if supregset_in(rgint.used_in_proc,regcounter2) then
                   begin
                   begin
                      usesgpr:=true;
                      usesgpr:=true;
                      a_load_ref_reg(list,OS_INT,OS_INT,href,newreg(R_INTREGISTER,regcounter2,R_SUBNONE));
                      a_load_ref_reg(list,OS_INT,OS_INT,href,newreg(R_INTREGISTER,regcounter2,R_SUBNONE));
@@ -1337,7 +1336,7 @@ const
           end;
           end;
       end;
       end;
 
 
-    function save_regs(list : taasmoutput):longint;
+    function tcgppc.save_regs(list : taasmoutput):longint;
     {Generates code which saves used non-volatile registers in
     {Generates code which saves used non-volatile registers in
      the save area right below the address the stackpointer point to.
      the save area right below the address the stackpointer point to.
      Returns the actual used save area size.}
      Returns the actual used save area size.}
@@ -1347,14 +1346,12 @@ const
          href : treference;
          href : treference;
          offset: integer;
          offset: integer;
          regcounter2: Tsuperregister;
          regcounter2: Tsuperregister;
-         regidx : tregisterindex;
     begin
     begin
       usesfpr:=false;
       usesfpr:=false;
       if not (po_assembler in current_procinfo.procdef.procoptions) then
       if not (po_assembler in current_procinfo.procdef.procoptions) then
         for regcounter:=RS_F14 to RS_F31 do
         for regcounter:=RS_F14 to RS_F31 do
          begin
          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
             begin
                usesfpr:=true;
                usesfpr:=true;
                firstregfpu:=regcounter;
                firstregfpu:=regcounter;
@@ -1365,7 +1362,7 @@ const
       if not (po_assembler in current_procinfo.procdef.procoptions) then
       if not (po_assembler in current_procinfo.procdef.procoptions) then
         for regcounter2:=firstsaveintreg to RS_R31 do
         for regcounter2:=firstsaveintreg to RS_R31 do
           begin
           begin
-            if regcounter2 in tcgppc(cg).rgint.used_in_proc then
+            if supregset_in(rgint.used_in_proc,regcounter2) then
               begin
               begin
                  usesgpr:=true;
                  usesgpr:=true;
                  firstreggpr:=regcounter2;
                  firstreggpr:=regcounter2;
@@ -1408,7 +1405,7 @@ const
       save_regs:= -offset;
       save_regs:= -offset;
     end;
     end;
 
 
-    procedure restore_regs(list : taasmoutput);
+    procedure tcgppc.restore_regs(list : taasmoutput);
     {Generates code which restores used non-volatile registers from
     {Generates code which restores used non-volatile registers from
     the save area right below the address the stackpointer point to.}
     the save area right below the address the stackpointer point to.}
 
 
@@ -1417,15 +1414,13 @@ const
          href : treference;
          href : treference;
          offset: integer;
          offset: integer;
          regcounter2: Tsuperregister;
          regcounter2: Tsuperregister;
-         regidx : tregisterindex;
 
 
     begin
     begin
       usesfpr:=false;
       usesfpr:=false;
       if not (po_assembler in current_procinfo.procdef.procoptions) then
       if not (po_assembler in current_procinfo.procdef.procoptions) then
         for regcounter:=RS_F14 to RS_F31 do
         for regcounter:=RS_F14 to RS_F31 do
          begin
          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
             begin
                usesfpr:=true;
                usesfpr:=true;
                firstregfpu:=regcounter;
                firstregfpu:=regcounter;
@@ -1437,7 +1432,7 @@ const
       if not (po_assembler in current_procinfo.procdef.procoptions) then
       if not (po_assembler in current_procinfo.procdef.procoptions) then
         for regcounter2:=RS_R13 to RS_R31 do
         for regcounter2:=RS_R13 to RS_R31 do
           begin
           begin
-            if regcounter2 in tcgppc(cg).rgint.used_in_proc then
+            if supregset_in(rgint.used_in_proc,regcounter2) then
               begin
               begin
                  usesgpr:=true;
                  usesgpr:=true;
                  firstreggpr:=regcounter2;
                  firstreggpr:=regcounter2;
@@ -2123,7 +2118,7 @@ const
                  { otherwise it may be overwritten (and it's still used afterwards)    }
                  { otherwise it may be overwritten (and it's still used afterwards)    }
                  freeindex := false;
                  freeindex := false;
                  if (getsupreg(ref.index) >= first_int_supreg) and
                  if (getsupreg(ref.index) >= first_int_supreg) and
-                    (getsupreg(ref.index) in rgint.unusedregs) then
+                    (supregset_in(rgint.unusedregs,getsupreg(ref.index))) then
                    begin
                    begin
                      rgint.getexplicitregister(list,ref.index);
                      rgint.getexplicitregister(list,ref.index);
                      orgindex := ref.index;
                      orgindex := ref.index;
@@ -2441,7 +2436,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * compilation of the powerpc compiler fixed
 
 
   Revision 1.129  2003/10/13 01:58:04  florian
   Revision 1.129  2003/10/13 01:58:04  florian

+ 8 - 5
compiler/powerpc/cpupara.pas

@@ -35,8 +35,8 @@ unit cpupara;
 
 
     type
     type
        tppcparamanager = class(tparamanager)
        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 push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
           function getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;override;
           function getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;override;
           function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
           function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
@@ -51,12 +51,12 @@ unit cpupara;
        defutil,symsym;
        defutil,symsym;
 
 
 
 
-    function tppcparamanager.get_volatile_registers_int(calloption : tproccalloption):tsuperregisterset;
+    function tppcparamanager.get_volatile_registers_int(calloption : tproccalloption):tcpuregisterset;
       begin
       begin
         result := [RS_R3..RS_R12];
         result := [RS_R3..RS_R12];
       end;
       end;
 
 
-    function tppcparamanager.get_volatile_registers_fpu(calloption : tproccalloption):tsuperregisterset;
+    function tppcparamanager.get_volatile_registers_fpu(calloption : tproccalloption):tcpuregisterset;
       begin
       begin
         case target_info.abi of
         case target_info.abi of
           abi_powerpc_aix:
           abi_powerpc_aix:
@@ -359,7 +359,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * changed to symbolic const for alignment
 
 
   Revision 1.47  2003/10/01 20:34:49  peter
   Revision 1.47  2003/10/01 20:34:49  peter

+ 6 - 1
compiler/powerpc/nppcadd.pas

@@ -711,7 +711,9 @@ interface
         var
         var
           oldnodetype: tnodetype;
           oldnodetype: tnodetype;
         begin
         begin
+{$ifdef OLDREGVARS}
            load_all_regvars(exprasmlist);
            load_all_regvars(exprasmlist);
+{$endif OLDREGVARS}
            { the jump the sequence is a little bit hairy }
            { the jump the sequence is a little bit hairy }
            case nodetype of
            case nodetype of
               ltn,gtn:
               ltn,gtn:
@@ -1428,7 +1430,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * compilation of the powerpc compiler fixed
 
 
   Revision 1.36  2003/10/01 20:34:49  peter
   Revision 1.36  2003/10/01 20:34:49  peter

+ 5 - 2
compiler/symdef.pas

@@ -3117,8 +3117,8 @@ implementation
              para.free;
              para.free;
 {$ifdef MEMDEBUG}
 {$ifdef MEMDEBUG}
              memprocpara.stop;
              memprocpara.stop;
-          end;
 {$endif MEMDEBUG}
 {$endif MEMDEBUG}
+          end;
          if assigned(parast) then
          if assigned(parast) then
           begin
           begin
 {$ifdef MEMDEBUG}
 {$ifdef MEMDEBUG}
@@ -5868,7 +5868,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * 64k registers supported
     * fixed some memory leaks
     * fixed some memory leaks