Sfoglia il codice sorgente

* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent

Jonas Maebe 22 anni fa
parent
commit
404d344d92

+ 6 - 10
compiler/i386/rgcpu.pas

@@ -287,15 +287,6 @@ unit rgcpu;
       end;
 
 
-    procedure trgcpu.ungetreference(list: taasmoutput; const ref : treference);
-
-      begin
-         if (ref.base.number<>NR_NO) and (ref.base.number<>NR_FRAME_POINTER_REG) then
-           ungetregisterint(list,ref.base);
-         if (ref.index.number<>NR_NO) and (ref.index.number<>NR_FRAME_POINTER_REG) then
-           ungetregisterint(list,ref.index);
-      end;
-
 {$ifndef newra}
     procedure trgcpu.pushusedintregisters(list:Taasmoutput;
                                          var pushed:Tpushedsavedint;
@@ -517,7 +508,12 @@ end.
 
 {
   $Log$
-  Revision 1.27  2003-06-13 21:19:31  peter
+  Revision 1.28  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.27  2003/06/13 21:19:31  peter
     * current_procdef removed, use current_procinfo.procdef instead
 
   Revision 1.26  2003/06/12 21:12:20  peter

+ 10 - 1
compiler/m68k/cpubase.pas

@@ -174,6 +174,10 @@ uses
       first_supreg    = $01;
       last_supreg     = $10;
 
+{$warning FIXME!!!}
+      { registers which may be destroyed by calls }
+      VOLATILE_INTREGISTERS = [first_supreg..last_supreg];
+
       first_imreg     = $11;
       last_imreg      = $ff;
 
@@ -705,7 +709,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.21  2003-06-03 13:01:59  daniel
+  Revision 1.22  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.21  2003/06/03 13:01:59  daniel
     * Register allocator finished
 
   Revision 1.20  2003/04/23 13:40:33  peter

+ 7 - 2
compiler/ncal.pas

@@ -2351,7 +2351,7 @@ type
               if not (block_type in [bt_const,bt_type]) then
                 include(current_procinfo.flags,pi_do_call);
             {$ifndef newra}
-              rg.incrementintregisterpushed(all_intregisters);
+              rg.incrementintregisterpushed(VOLATILE_INTREGISTERS);
             {$endif}
               rg.incrementotherregisterpushed(all_registers);
            end
@@ -2635,7 +2635,12 @@ begin
 end.
 {
   $Log$
-  Revision 1.171  2003-06-15 16:47:33  jonas
+  Revision 1.172  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.171  2003/06/15 16:47:33  jonas
     * fixed revious commit
 
   Revision 1.170  2003/06/15 15:10:57  jonas

+ 85 - 43
compiler/ncgcal.pas

@@ -441,10 +441,13 @@ implementation
               end
             else
               begin
+{$ifndef newra}
                 tg.gettemp(exprasmlist,pointer_size,tt_normal,href);
                 cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,r,href);
-{$ifdef newra}
                 cg.a_reg_dealloc(exprasmlist,r);
+{$else newra}
+                hregister := rg.getaddressregister(exprasmlist);
+                cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,r,hregister);
 {$endif newra}
                 { in case of a regular funcretnode with ret_in_param, the }
                 { original funcretnode isn't touched -> make sure it's    }
@@ -454,11 +457,16 @@ implementation
                 location := tempnode.location;
                 tempnode.free;
                 cg.g_decrrefcount(exprasmlist,resulttype.def,location.reference, false);
+{$ifndef newra}
                 cg.a_load_ref_ref(exprasmlist,OS_ADDR,OS_ADDR,href,location.reference);
                 { since we used a normal temp, it won't be finalized or }
                 { decref'd later -> no need to zero it                  }
                 tg.ungettemp(exprasmlist,href);
-              end;
+{$else newra}
+               cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,location.reference);
+               rg.ungetregisterint(exprasmlist,hregister);
+{$endif newra}
+             end;
           end
         else
         { we have only to handle the result if it is used }
@@ -647,6 +655,7 @@ implementation
       {$ifdef newra}
          i:Tsuperregister;
          regs_to_alloc,regs_to_free:Tsupregset;
+         funcretloc: tparalocation;
       {$else}
          regs_to_push_int : Tsupregset;
          pushedint : tpushedsavedint;
@@ -712,17 +721,25 @@ implementation
 
 {$ifdef newra}
               regs_to_alloc:=Tprocdef(procdefinition).usedintregisters;
-{$ifndef cpu64bit}
-              if resulttype.def.size>sizeof(aword) then
+              if (not is_void(resulttype.def)) and
+                 not(paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
                 begin
-                  include(regs_to_alloc,RS_FUNCTION_RESULT64_LOW_REG);
-                  include(regs_to_alloc,RS_FUNCTION_RESULT64_HIGH_REG);
-                end
-              else
+                  funcretloc := paramanager.getfuncretparaloc(procdefinition);
+                  case funcretloc.loc of
+                    LOC_REGISTER,LOC_CREGISTER:
+                      begin
+{$ifndef cpu64bit}
+                        if funcretloc.size in [OS_S64,OS_64] then
+                          begin
+                            include(regs_to_alloc,funcretloc.registerlow.number shr 8);
+                            include(regs_to_alloc,funcretloc.registerhigh.number shr 8);
+                          end
+                       else
 {$endif cpu64bit}
-              if (not is_void(resulttype.def)) and
-                 (not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
-                include(regs_to_alloc,RS_FUNCTION_RESULT_REG);
+                         include(regs_to_alloc,funcretloc.register.number shr 8);
+                     end;
+                  end;
+                end;
 {$else}
               { save all used registers and possible registers
                 used for the return value }
@@ -762,20 +779,28 @@ implementation
            begin
               {No procedure is allowed to destroy ebp.}
 {$ifdef newra}
-              regs_to_alloc:=ALL_INTREGISTERS-[RS_FRAME_POINTER_REG];
-{$ifndef cpu64bit}
-              if resulttype.def.size>sizeof(aword) then
+              regs_to_alloc:=VOLATILE_INTREGISTERS-[RS_FRAME_POINTER_REG];
+              if (not is_void(resulttype.def)) and
+                 not(paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
                 begin
-                  include(regs_to_alloc,RS_FUNCTION_RESULT64_LOW_REG);
-                  include(regs_to_alloc,RS_FUNCTION_RESULT64_HIGH_REG);
-                end
-              else
+                  funcretloc := paramanager.getfuncretparaloc(procdefinition);
+                  case funcretloc.loc of
+                    LOC_REGISTER,LOC_CREGISTER:
+                      begin
+{$ifndef cpu64bit}
+                        if funcretloc.size in [OS_S64,OS_64] then
+                          begin
+                            include(regs_to_alloc,funcretloc.registerlow.number shr 8);
+                            include(regs_to_alloc,funcretloc.registerhigh.number shr 8);
+                          end
+                       else
 {$endif cpu64bit}
-              if (not is_void(resulttype.def)) and
-                 (not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
-                include(regs_to_alloc,RS_FUNCTION_RESULT_REG);
+                         include(regs_to_alloc,funcretloc.register.number shr 8);
+                     end;
+                  end;
+                end;
 {$else}
-              regs_to_push_int := all_intregisters-[RS_FRAME_POINTER_REG];
+              regs_to_push_int := VOLATILE_INTREGISTERS-[RS_FRAME_POINTER_REG];
               rg.saveusedintregisters(exprasmlist,pushedint,regs_to_push_int);
 {$endif}
 {$ifdef i386}
@@ -987,7 +1012,7 @@ implementation
 
             {$ifndef newra}
                helpref:=right.location.reference;
-               rg.saveintregvars(exprasmlist,ALL_INTREGISTERS);
+               rg.saveintregvars(exprasmlist,VOLATILE_INTREGISTERS);
             {$endif}
                rg.saveotherregvars(exprasmlist,ALL_REGISTERS);
                if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
@@ -1032,17 +1057,22 @@ implementation
 {$ifdef newra}
          regs_to_free:=regs_to_alloc;
          if (not is_void(resulttype.def)) and
-            (not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
+            not(paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
            begin
+             case funcretloc.loc of
+               LOC_REGISTER,LOC_CREGISTER:
+                 begin
 {$ifndef cpu64bit}
-             if resulttype.def.size>sizeof(aword) then
-               begin
-                 exclude(regs_to_free,RS_FUNCTION_RESULT64_HIGH_REG);
-                 exclude(regs_to_free,RS_FUNCTION_RESULT64_LOW_REG);
-               end
-             else
+                   if funcretloc.size in [OS_S64,OS_64] then
+                     begin
+                       exclude(regs_to_free,funcretloc.registerlow.number shr 8);
+                       exclude(regs_to_free,funcretloc.registerhigh.number shr 8);
+                     end
+                   else
 {$endif cpu64bit}
-               exclude(regs_to_free,RS_FUNCTION_RESULT_REG);
+                     exclude(regs_to_free,funcretloc.register.number shr 8);
+                 end;
+             end;
            end;
          r.enum:=R_INTREGISTER;
          for i:=first_supreg to last_supreg do
@@ -1114,6 +1144,7 @@ implementation
          pushedint : tpushedsavedint;
          pushedregs : tmaybesave;
       {$endif}
+         funcretloc: tparalocation;
          oldpushedparasize : longint;
          { adress returned from an I/O-error }
          iolabel : tasmlabel;
@@ -1277,19 +1308,25 @@ implementation
          regs_to_push_int := tprocdef(procdefinition).usedintregisters;
          regs_to_push_other := tprocdef(procdefinition).usedotherregisters;
          if (not is_void(resulttype.def)) and
-            (not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
-          begin
-            include(regs_to_push_int,RS_FUNCTION_RESULT_REG);
+            not(paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
+           begin
+             funcretloc := paramanager.getfuncretparaloc(procdefinition);
+             case funcretloc.loc of
+               LOC_REGISTER,LOC_CREGISTER:
+                 begin
 {$ifndef cpu64bit}
-                 if resulttype.def.size>sizeof(aword) then
-                   begin
-                     include(regs_to_push_int,RS_FUNCTION_RESULT64_LOW_REG);
-                     include(regs_to_push_int,RS_FUNCTION_RESULT64_HIGH_REG);
-                   end
-                 else
+                   if funcretloc.size in [OS_S64,OS_64] then
+                     begin
+                       include(regs_to_push_int,funcretloc.registerlow.number shr 8);
+                       include(regs_to_push_int,funcretloc.registerhigh.number shr 8);
+                     end
+                   else
 {$endif cpu64bit}
-                   include(regs_to_push_int,RS_FUNCTION_RESULT_REG);
-          end;
+                    include(regs_to_push_int,funcretloc.register.number shr 8);
+                 end;
+             end;
+           end;
+
       {$ifndef newra}
          rg.saveusedintregisters(exprasmlist,pushedint,regs_to_push_int);
       {$endif}
@@ -1494,7 +1531,12 @@ begin
 end.
 {
   $Log$
-  Revision 1.94  2003-06-15 16:52:02  jonas
+  Revision 1.95  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.94  2003/06/15 16:52:02  jonas
     * release function result registers if the functino result isn't used
     * don't allocate function result register with -dnewra if there is none
     * some optimizations for non-x86 processor (don't save any registers

+ 16 - 12
compiler/ncgmem.pas

@@ -516,7 +516,7 @@ implementation
           if is_dynamic_array(left.resulttype.def) then
             begin
             {$ifndef newra}
-               rg.saveusedintregisters(exprasmlist,pushed,all_intregisters);
+               rg.saveusedintregisters(exprasmlist,pushed,VOLATILE_INTREGISTERS);
             {$endif}
                cg.a_param_loc(exprasmlist,right.location,paramanager.getintparaloc(exprasmlist,2));
                cg.a_param_loc(exprasmlist,left.location,paramanager.getintparaloc(exprasmlist,1));
@@ -529,7 +529,7 @@ implementation
                      rg.getexplicitregisterint(exprasmlist,hreg.number);
                    end;
             {$else}
-               rg.saveintregvars(exprasmlist,all_intregisters);
+               rg.saveintregvars(exprasmlist,VOLATILE_INTREGISTERS);
             {$endif}
                cg.a_call_name(exprasmlist,'FPC_DYNARRAY_RANGECHECK');
                paramanager.freeintparaloc(exprasmlist,2);
@@ -577,7 +577,6 @@ implementation
          else
            location_reset(location,LOC_REFERENCE,newsize);
 
-
          { an ansistring needs to be dereferenced }
          if is_ansistring(left.resulttype.def) or
             is_widestring(left.resulttype.def) then
@@ -587,7 +586,7 @@ implementation
                    if left.location.loc<>LOC_REFERENCE then
                      internalerror(200304236);
                 {$ifndef newra}
-                   rg.saveusedintregisters(exprasmlist,pushed,all_intregisters);
+                   rg.saveusedintregisters(exprasmlist,pushed,VOLATILE_INTREGISTERS);
                 {$endif}
                    cg.a_paramaddr_ref(exprasmlist,left.location.reference,paramanager.getintparaloc(exprasmlist,1));
                 {$ifdef newra}
@@ -599,7 +598,7 @@ implementation
                          rg.getexplicitregisterint(exprasmlist,hreg.number);
                        end;
                 {$else}
-                   rg.saveintregvars(exprasmlist,all_intregisters);
+                   rg.saveintregvars(exprasmlist,VOLATILE_INTREGISTERS);
                 {$endif}
                    cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_UNIQUE');
                    paramanager.freeintparaloc(exprasmlist,1);
@@ -635,7 +634,7 @@ implementation
               if (cs_check_range in aktlocalswitches) then
                 begin
                 {$ifndef newra}
-                   rg.saveusedintregisters(exprasmlist,pushed,all_intregisters);
+                   rg.saveusedintregisters(exprasmlist,pushed,VOLATILE_INTREGISTERS);
                 {$endif}
                    cg.a_param_reg(exprasmlist,OS_ADDR,location.reference.base,paramanager.getintparaloc(exprasmlist,1));
                 {$ifdef newra}
@@ -647,7 +646,7 @@ implementation
                          rg.getexplicitregisterint(exprasmlist,hreg.number);
                        end;
                 {$else}
-                   rg.saveintregvars(exprasmlist,all_intregisters);
+                   rg.saveintregvars(exprasmlist,VOLATILE_INTREGISTERS);
                 {$endif}
                    cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_CHECKZERO');
                    paramanager.freeintparaloc(exprasmlist,1);
@@ -734,7 +733,7 @@ implementation
                          st_ansistring:
                            begin
                             {$ifndef newra}
-                              rg.saveusedintregisters(exprasmlist,pushed,all_intregisters);
+                              rg.saveusedintregisters(exprasmlist,pushed,VOLATILE_INTREGISTERS);
                             {$endif}
                               cg.a_param_const(exprasmlist,OS_INT,tordconstnode(right).value,paramanager.getintparaloc(exprasmlist,2));
                               href:=location.reference;
@@ -749,7 +748,7 @@ implementation
                                     rg.getexplicitregisterint(exprasmlist,hreg.number);
                                   end;
                             {$else}
-                              rg.saveintregvars(exprasmlist,all_intregisters);
+                              rg.saveintregvars(exprasmlist,VOLATILE_INTREGISTERS);
                             {$endif}
                               cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK');
                               paramanager.freeintparaloc(exprasmlist,2);
@@ -892,7 +891,7 @@ implementation
                          st_ansistring:
                            begin
                             {$ifndef newra}
-                              rg.saveusedintregisters(exprasmlist,pushed,all_intregisters);
+                              rg.saveusedintregisters(exprasmlist,pushed,VOLATILE_INTREGISTERS);
                             {$endif}
                               cg.a_param_reg(exprasmlist,OS_INT,right.location.register,paramanager.getintparaloc(exprasmlist,2));
                               href:=location.reference;
@@ -907,7 +906,7 @@ implementation
                                     rg.getexplicitregisterint(exprasmlist,hreg.number);
                                   end;
                             {$else}
-                              rg.saveintregvars(exprasmlist,all_intregisters);
+                              rg.saveintregvars(exprasmlist,VOLATILE_INTREGISTERS);
                             {$endif}
                               cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK');
                               paramanager.freeintparaloc(exprasmlist,2);
@@ -955,7 +954,12 @@ begin
 end.
 {
   $Log$
-  Revision 1.62  2003-06-13 21:19:30  peter
+  Revision 1.63  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.62  2003/06/13 21:19:30  peter
     * current_procdef removed, use current_procinfo.procdef instead
 
   Revision 1.61  2003/06/09 16:45:41  jonas

+ 15 - 2
compiler/nmem.pas

@@ -698,7 +698,15 @@ implementation
          if (nf_callunique in flags) and
             (is_ansistring(left.resulttype.def) or
              is_widestring(left.resulttype.def)) then
-           include(current_procinfo.flags,pi_do_call);
+           begin
+             left := ccallnode.createintern('fpc_'+tstringdef(left.resulttype.def).stringtypname+'_unique',
+               ccallparanode.create(
+                 ctypeconvnode.create_explicit(left,voidpointertype),nil));
+             firstpass(left);
+             { double resulttype passes somwhere else may cause this to be }
+             { reset though :/                                             }
+             exclude(flags,nf_callunique);
+           end;
 
          { the register calculation is easy if a const index is used }
          if right.nodetype=ordconstn then
@@ -904,7 +912,12 @@ begin
 end.
 {
   $Log$
-  Revision 1.57  2003-06-07 20:26:32  peter
+  Revision 1.58  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.57  2003/06/07 20:26:32  peter
     * re-resolving added instead of reloading from ppu
     * tderef object added to store deref info for resolving
 

+ 11 - 3
compiler/powerpc/cpubase.pas

@@ -234,8 +234,11 @@ uses
       RS_R27 = $1C; RS_R28 = $1D; RS_R29 = $1E;
       RS_R30 = $1F; RS_R31 = $20;
 
-      first_supreg = $00;
-      last_supreg = $20;
+      first_supreg = RS_R3;
+      last_supreg = RS_R31;
+
+      { registers which may be destroyed by calls }
+      VOLATILE_INTREGISTERS = [RS_R13..RS_R31];
       {Number of first and last imaginary register.}
       first_imreg     = $21;
       last_imreg      = $ff;
@@ -877,7 +880,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.58  2003-06-14 22:32:43  jonas
+  Revision 1.59  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.58  2003/06/14 22:32:43  jonas
     * ppc compiles with -dnewra, haven't tried to compile anything with it
       yet though
 

+ 18 - 7
compiler/powerpc/cpupara.pas

@@ -363,16 +363,22 @@ unit cpupara;
             classrefdef,
             recorddef,
             objectdef,
-            stringdef,
             procvardef,
             filedef,
             arraydef,
-            errordef:
+            stringdef:
               begin
-                getfuncretparaloc.loc:=LOC_REGISTER;
-                getfuncretparaloc.register.enum:=R_INTREGISTER;
-                getfuncretparaloc.register.number:=NR_R3;
-                getfuncretparaloc.size:=OS_ADDR;
+                if (p.rettype.def.deftype <> stringdef) or
+                   (is_ansistring(p.rettype.def) or
+                    is_widestring(p.rettype.def)) then
+                  begin
+                    getfuncretparaloc.loc:=LOC_REGISTER;
+                    getfuncretparaloc.register.enum:=R_INTREGISTER;
+                    getfuncretparaloc.register.number:=NR_R3;
+                    getfuncretparaloc.size:=OS_ADDR;
+                  end
+                else
+                  internalerror(2003061601);
               end;
             else
               internalerror(2002090903);
@@ -385,7 +391,12 @@ begin
 end.
 {
   $Log$
-  Revision 1.37  2003-06-09 14:54:26  jonas
+  Revision 1.38  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.37  2003/06/09 14:54:26  jonas
     * (de)allocation of registers for parameters is now performed properly
       (and checked on the ppc)
     - removed obsolete allocation of all parameter registers at the start

+ 12 - 5
compiler/powerpc/rgcpu.pas

@@ -57,7 +57,7 @@ unit rgcpu;
   implementation
 
     uses
-      cgobj, verbose;
+      cgobj, verbose, cutils;
 
     function trgcpu.getexplicitregisterint(list: taasmoutput; reg: Tnewregister): tregister;
 
@@ -66,7 +66,8 @@ unit rgcpu;
            not((reg shr 8) in is_reg_var_int) then
           begin
             if (reg shr 8) in usedpararegs then
-              internalerror(2003060701);
+              internalerror(2003060701); 
+{              comment(v_warning,'Double allocation of register '+tostr((reg shr 8)-1));}
             include(usedpararegs,reg shr 8);
             result.enum:=R_INTREGISTER;
             result.number:=reg;
@@ -83,7 +84,8 @@ unit rgcpu;
             not((reg.number shr 8) in is_reg_var_int) then
           begin
             if not((reg.number shr 8) in usedpararegs) then
-              internalerror(2003060702);
+              internalerror(2003060702); 
+{               comment(v_warning,'Double free of register '+tostr((reg.number shr 8)-1));}
             exclude(usedpararegs,reg.number shr 8);
             cg.a_reg_dealloc(list,reg);
           end
@@ -156,12 +158,17 @@ unit rgcpu;
       end;
 
 initialization
-  rg := trgcpu.create(32);  {PPC has 32 registers.}
+  rg := trgcpu.create(last_supreg-first_supreg+1);
 end.
 
 {
   $Log$
-  Revision 1.11  2003-06-14 22:32:43  jonas
+  Revision 1.12  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.11  2003/06/14 22:32:43  jonas
     * ppc compiles with -dnewra, haven't tried to compile anything with it
       yet though
 

+ 8 - 1
compiler/ppu.pas

@@ -164,12 +164,14 @@ type
     fname    : string;
     fsize    : integer;
 {$ifdef Test_Double_checksum}
+  public
     crcindex,
     crc_index,
     crcindex2,
     crc_index2 : cardinal;
     crc_test,
     crc_test2  : pcrc_array;
+  private
 {$endif def Test_Double_checksum}
     change_endian : boolean;
     buf      : pchar;
@@ -983,7 +985,12 @@ end;
 end.
 {
   $Log$
-  Revision 1.39  2003-06-07 20:26:32  peter
+  Revision 1.40  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.39  2003/06/07 20:26:32  peter
     * re-resolving added instead of reloading from ppu
     * tderef object added to store deref info for resolving
 

+ 7 - 2
compiler/pstatmnt.pas

@@ -844,7 +844,7 @@ implementation
            end
          else
            begin
-              rg.used_in_proc_int:=ALL_INTREGISTERS;
+              rg.used_in_proc_int:=VOLATILE_INTREGISTERS;
               rg.used_in_proc_other:=ALL_OTHERREGISTERS;
            end;
 
@@ -1189,7 +1189,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.104  2003-06-13 21:19:31  peter
+  Revision 1.105  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.104  2003/06/13 21:19:31  peter
     * current_procdef removed, use current_procinfo.procdef instead
 
   Revision 1.103  2003/06/09 18:27:14  peter

+ 7 - 2
compiler/psub.pas

@@ -659,7 +659,7 @@ implementation
         { now all the registers used are known }
         { Remove all imaginary registers from the used list.}
 {$ifdef newra}
-        procdef.usedintregisters:=rg.used_in_proc_int*ALL_INTREGISTERS-rg.savedintbyproc;
+        procdef.usedintregisters:=rg.used_in_proc_int*VOLATILE_INTREGISTERS-rg.savedintbyproc;
 {$else}
         procdef.usedintregisters:=rg.used_in_proc_int;
 {$endif}
@@ -1251,7 +1251,12 @@ begin
 end.
 {
   $Log$
-  Revision 1.128  2003-06-14 14:53:50  jonas
+  Revision 1.129  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.128  2003/06/14 14:53:50  jonas
     * fixed newra cycle for x86
     * added constants for indicating source and destination operands of the
       "move reg,reg" instruction to aasmcpu (and use those in rgobj)

+ 14 - 6
compiler/rgobj.pas

@@ -88,7 +88,6 @@ unit rgobj;
 
 
     const
-      ALL_INTREGISTERS=[first_supreg..last_supreg]-[RS_STACK_POINTER_REG];
       ALL_OTHERREGISTERS=[firstreg..lastreg];
 
     type
@@ -523,7 +522,7 @@ unit rgobj;
        resetusableregisters;
        lastintreg:=0;
        maxintreg:=first_imreg;
-       cpu_registers:=Acpu_registers;
+       cpu_registers:={Acpu_registers}last_supreg-first_supreg+1;
 {$ifdef TEMPREGDEBUG}
        fillchar(reg_user,sizeof(reg_user),0);
        fillchar(reg_releaser,sizeof(reg_releaser),0);
@@ -889,7 +888,11 @@ unit rgobj;
       unusedregsfpu:=usableregsfpu;
       unusedregsmm:=usableregsmm;
    {$ifdef newra}
+{$ifdef powerpc}
+      savedintbyproc:=[RS_R13..RS_R31];
+{$else powerpc}
       savedintbyproc:=[];
+{$endif powerpc}
       for i:=low(Tsuperregister) to high(Tsuperregister) do
         begin
           if igraph.adjlist[i]<>nil then
@@ -909,9 +912,9 @@ unit rgobj;
     procedure trgobj.ungetreference(list : taasmoutput; const ref : treference);
 
       begin
-         if ref.base.number<>NR_NO then
+         if (ref.base.number<>NR_NO) and (ref.base.number<>NR_FRAME_POINTER_REG) then
            ungetregisterint(list,ref.base);
-       if ref.index.number<>NR_NO then
+         if (ref.index.number<>NR_NO) and (ref.index.number<>NR_FRAME_POINTER_REG) then
            ungetregisterint(list,ref.index);
       end;
 
@@ -1941,7 +1944,7 @@ unit rgobj;
           {Assume a spill by default...}
           spillednodes:=spillednodes+char(n);
           {Search for a colour not in this list.}
-          for k:=1 to cpu_registers do
+          for k:=first_supreg to last_supreg do
             if not(k in adj_colours) then
               begin
                 colour[n]:=k;
@@ -2453,7 +2456,12 @@ end.
 
 {
   $Log$
-  Revision 1.55  2003-06-14 14:53:50  jonas
+  Revision 1.56  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.55  2003/06/14 14:53:50  jonas
     * fixed newra cycle for x86
     * added constants for indicating source and destination operands of the
       "move reg,reg" instruction to aasmcpu (and use those in rgobj)

+ 11 - 1
compiler/sparc/cpubase.pas

@@ -360,6 +360,11 @@ uses
       first_supreg = $01;
       last_supreg = $20;
 
+{$warning FIXME!!}
+      { registers which may be destroyed by calls }
+      VOLATILE_INTREGISTERS = [first_supreg..last_supreg];
+
+
       first_imreg = $21;
       last_imreg = $ff;
 
@@ -1046,7 +1051,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.42  2003-06-13 21:08:30  peter
+  Revision 1.43  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.42  2003/06/13 21:08:30  peter
     * supreg_name added
 
   Revision 1.41  2003/06/12 19:11:34  jonas

+ 8 - 3
compiler/symdef.pas

@@ -3423,7 +3423,7 @@ implementation
           end;
          lastref:=defref;
        { first, we assume that all registers are used }
-         usedintregisters:=ALL_INTREGISTERS-[RS_FRAME_POINTER_REG];
+         usedintregisters:=VOLATILE_INTREGISTERS-[RS_FRAME_POINTER_REG];
          usedotherregisters:=ALL_REGISTERS;
          forwarddef:=true;
          interfacedef:=false;
@@ -3558,7 +3558,7 @@ implementation
          { set all registers to used for simplified compilation PM }
          if simplify_ppu then
            begin
-             usedintregisters:=ALL_INTREGISTERS-[RS_FRAME_POINTER_REG];
+             usedintregisters:=VOLATILE_INTREGISTERS-[RS_FRAME_POINTER_REG];
              usedotherregisters:=ALL_REGISTERS;
            end;
 
@@ -5767,7 +5767,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.151  2003-06-08 11:41:21  peter
+  Revision 1.152  2003-06-17 16:34:44  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.151  2003/06/08 11:41:21  peter
     * set parast.next to the owner of the procdef
 
   Revision 1.150  2003/06/07 20:26:32  peter

+ 10 - 1
compiler/x86/cpubase.pas

@@ -175,6 +175,10 @@ uses
 {$else}
       last_supreg     = $08;
 {$endif}
+
+      { registers which may be destroyed by calls }
+      VOLATILE_INTREGISTERS = [first_supreg..last_supreg];
+
       {Number of first and last imaginary register.}
       first_imreg     = $12;
       last_imreg      = $ff;
@@ -728,7 +732,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.9  2003-06-13 21:19:33  peter
+  Revision 1.10  2003-06-17 16:34:45  jonas
+    * lots of newra fixes (need getfuncretparaloc implementation for i386)!
+    * renamed all_intregisters to volatile_intregisters and made it
+      processor dependent
+
+  Revision 1.9  2003/06/13 21:19:33  peter
     * current_procdef removed, use current_procinfo.procdef instead
 
   Revision 1.8  2003/06/12 19:11:34  jonas