Browse Source

* use as little different registers on the ppc until newra is released,
since every used register must be saved

Jonas Maebe 22 years ago
parent
commit
f433c21ead
2 changed files with 24 additions and 11 deletions
  1. 8 10
      compiler/cgobj.pas
  2. 16 1
      compiler/rgobj.pas

+ 8 - 10
compiler/cgobj.pas

@@ -60,7 +60,6 @@ unit cgobj;
        }
        }
        tcg = class
        tcg = class
 {$ifndef newra}
 {$ifndef newra}
-          scratch_register_array_pointer : aword;
           {# List of currently unused scratch registers }
           {# List of currently unused scratch registers }
           unusedscratchregisters:Tsupregset;
           unusedscratchregisters:Tsupregset;
 {$endif}
 {$endif}
@@ -523,7 +522,6 @@ unit cgobj;
 
 
       begin
       begin
 {$ifndef newra}
 {$ifndef newra}
-         scratch_register_array_pointer:=1;
          for i:=low(scratch_regs) to high(scratch_regs) do
          for i:=low(scratch_regs) to high(scratch_regs) do
            include(unusedscratchregisters,scratch_regs[i]);
            include(unusedscratchregisters,scratch_regs[i]);
 {$endif}
 {$endif}
@@ -558,21 +556,17 @@ unit cgobj;
          if unusedscratchregisters=[] then
          if unusedscratchregisters=[] then
            internalerror(68996);
            internalerror(68996);
 
 
-         for i:=scratch_register_array_pointer to
-                (scratch_register_array_pointer+max_scratch_regs-1) do
-           if scratch_regs[(i mod max_scratch_regs)+1] in unusedscratchregisters then
+         for i:=low(scratch_regs) to high(scratch_regs) do
+           if scratch_regs[i] in unusedscratchregisters then
              begin
              begin
                 r.enum:=R_INTREGISTER;
                 r.enum:=R_INTREGISTER;
-                r.number:=scratch_regs[(i mod max_scratch_regs)+1] shl 8 or cgsize2subreg(size);
+                r.number:=scratch_regs[i] shl 8 or cgsize2subreg(size);
                 break;
                 break;
              end;
              end;
          exclude(unusedscratchregisters,r.number shr 8);
          exclude(unusedscratchregisters,r.number shr 8);
 {$ifndef i386}
 {$ifndef i386}
          include(rg.usedintbyproc,r.number shr 8);
          include(rg.usedintbyproc,r.number shr 8);
 {$endif i386}
 {$endif i386}
-         inc(scratch_register_array_pointer);
-         if scratch_register_array_pointer>max_scratch_regs then
-           scratch_register_array_pointer:=1;
          a_reg_alloc(list,r);
          a_reg_alloc(list,r);
          get_scratch_reg_int:=r;
          get_scratch_reg_int:=r;
       end;
       end;
@@ -1697,7 +1691,11 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.99  2003-05-23 14:27:35  peter
+  Revision 1.100  2003-05-30 12:36:13  jonas
+    * use as little different registers on the ppc until newra is released,
+      since every used register must be saved
+
+  Revision 1.99  2003/05/23 14:27:35  peter
     * remove some unit dependencies
     * remove some unit dependencies
     * current_procinfo changes to store more info
     * current_procinfo changes to store more info
 
 

+ 16 - 1
compiler/rgobj.pas

@@ -528,13 +528,24 @@ unit rgobj;
                                       var fusedinproc,fusedbyproc,unusedregs:Tsupregset
                                       var fusedinproc,fusedbyproc,unusedregs:Tsupregset
                                       {$ifndef newra};var countunusedregs:byte{$endif}):Tregister;
                                       {$ifndef newra};var countunusedregs:byte{$endif}):Tregister;
 
 
+{$ifdef powerpc}
+{$ifndef newra}
+{$define reuseregs}
+{$endif newra}
+{$endif powerpc}
+
     var i:Tsuperregister;
     var i:Tsuperregister;
         r:Tregister;
         r:Tregister;
 
 
     begin
     begin
+{$ifdef reuseregs}
+      i := lowreg;
+      lastintreg := highreg;
+{$else reuseregs}
       if not (lastintreg in [lowreg..highreg]) then
       if not (lastintreg in [lowreg..highreg]) then
         lastintreg:=lowreg;
         lastintreg:=lowreg;
       i:=lastintreg;
       i:=lastintreg;
+{$endif reuseregs}
       repeat
       repeat
         if i=highreg then
         if i=highreg then
           i:=lowreg
           i:=lowreg
@@ -2027,7 +2038,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.44  2003-05-17 13:30:08  jonas
+  Revision 1.45  2003-05-30 12:36:13  jonas
+    * use as little different registers on the ppc until newra is released,
+      since every used register must be saved
+
+  Revision 1.44  2003/05/17 13:30:08  jonas
     * changed tt_persistant to tt_persistent :)
     * changed tt_persistant to tt_persistent :)
     * tempcreatenode now doesn't accept a boolean anymore for persistent
     * tempcreatenode now doesn't accept a boolean anymore for persistent
       temps, but a ttemptype, so you can also create ansistring temps etc
       temps, but a ttemptype, so you can also create ansistring temps etc