Browse Source

* fixed and re-enabled temps in registers

Jonas Maebe 21 years ago
parent
commit
0d004c1e35
2 changed files with 14 additions and 3 deletions
  1. 5 2
      compiler/nbas.pas
  2. 9 1
      compiler/ncgbas.pas

+ 5 - 2
compiler/nbas.pas

@@ -671,7 +671,7 @@ implementation
     constructor ttempcreatenode.create_reg(const _restype: ttype; _size: longint; _temptype: ttemptype);
       begin
         create(_restype,_size,_temptype);
-//        may_be_in_reg:=true;
+        may_be_in_reg:=true;
       end;
 
     constructor ttempcreatenode.create(const _restype: ttype; _size: longint; _temptype: ttemptype);
@@ -1002,7 +1002,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.77  2004-02-03 17:56:14  jonas
+  Revision 1.78  2004-02-03 19:48:06  jonas
+    * fixed and re-enabled temps in registers
+
+  Revision 1.77  2004/02/03 17:56:14  jonas
     * disabled temps in registers for now, because the register allocator
       can't handle it yet in some cases
 

+ 9 - 1
compiler/ncgbas.pas

@@ -441,12 +441,17 @@ interface
               else
                 tg.UnGetTemp(exprasmlist,tempinfo^.loc.ref);
             end;
+          LOC_CREGISTER,
           LOC_REGISTER:
             begin
               if release_to_normal then
                 tempinfo^.loc.loc := LOC_REGISTER
               else
                 begin
+                  { make sure the register allocator doesn't reuse the }
+                  { register e.g. in the middle of a loop              }
+                  cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,tempinfo^.loc.reg,
+                    tempinfo^.loc.reg);
                   { !!tell rgobj this register is no longer a regvar!! }
                   cg.ungetregister(exprasmlist,tempinfo^.loc.reg);
                 end;
@@ -466,7 +471,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.53  2004-02-03 17:55:50  jonas
+  Revision 1.54  2004-02-03 19:48:06  jonas
+    * fixed and re-enabled temps in registers
+
+  Revision 1.53  2004/02/03 17:55:50  jonas
     * cleanup
 
   Revision 1.52  2004/02/03 16:46:51  jonas