Browse Source

+ temps can now also hold fpu values in registers (take care with use,
bacause of the x86 fpu stack)
* fpu parameters to node-inlined procedures can now also be put in
a register

Jonas Maebe 21 years ago
parent
commit
ddf175f171
3 changed files with 46 additions and 14 deletions
  1. 9 2
      compiler/nbas.pas
  2. 8 2
      compiler/ncal.pas
  3. 29 10
      compiler/ncgbas.pas

+ 9 - 2
compiler/nbas.pas

@@ -668,7 +668,8 @@ implementation
         create(_restype,_size,_temptype);
         create(_restype,_size,_temptype);
         tempinfo^.may_be_in_reg:=
         tempinfo^.may_be_in_reg:=
           { temp must fit a single register }
           { temp must fit a single register }
-          (_size<=sizeof(aint)) and
+          ((_restype.def.deftype = floatdef) or
+           (_size<=TCGSize2Size[OS_INT])) and
           { size of register operations must be known }
           { size of register operations must be known }
           (def_cgsize(_restype.def)<>OS_NO) and
           (def_cgsize(_restype.def)<>OS_NO) and
           { no init/final needed }
           { no init/final needed }
@@ -1017,7 +1018,13 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.85  2004-06-20 08:55:29  florian
+  Revision 1.86  2004-07-16 19:45:15  jonas
+    + temps can now also hold fpu values in registers (take care with use,
+      bacause of the x86 fpu stack)
+    * fpu parameters to node-inlined procedures can now also be put in
+      a register
+
+  Revision 1.85  2004/06/20 08:55:29  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.84  2004/06/16 20:07:07  florian
   Revision 1.84  2004/06/16 20:07:07  florian

+ 8 - 2
compiler/ncal.pas

@@ -1883,7 +1883,7 @@ type
                 not paramanager.push_addr_param(vs_const,para.left.resulttype.def,procdefinition.proccalloption)) then
                 not paramanager.push_addr_param(vs_const,para.left.resulttype.def,procdefinition.proccalloption)) then
               begin
               begin
                 if (cs_regvars in aktglobalswitches) and
                 if (cs_regvars in aktglobalswitches) and
-                   (vo_regable in tvarsym(para.paraitem.parasym).varoptions) and
+                   (([vo_regable,vo_fpuregable] * tvarsym(para.paraitem.parasym).varoptions) <> []) and
                    (not tvarsym(para.paraitem.parasym).vartype.def.needs_inittable) then
                    (not tvarsym(para.paraitem.parasym).vartype.def.needs_inittable) then
                   tempnode := ctempcreatenode.create_reg(para.left.resulttype,para.left.resulttype.def.size,tt_persistent)
                   tempnode := ctempcreatenode.create_reg(para.left.resulttype,para.left.resulttype.def.size,tt_persistent)
                 else
                 else
@@ -2258,7 +2258,13 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.242  2004-07-15 21:02:05  jonas
+  Revision 1.243  2004-07-16 19:45:15  jonas
+    + temps can now also hold fpu values in registers (take care with use,
+      bacause of the x86 fpu stack)
+    * fpu parameters to node-inlined procedures can now also be put in
+      a register
+
+  Revision 1.242  2004/07/15 21:02:05  jonas
     * the condition for when to use a temp in case of reference var/const
     * the condition for when to use a temp in case of reference var/const
       parameters was inverse
       parameters was inverse
 
 

+ 29 - 10
compiler/ncgbas.pas

@@ -69,7 +69,7 @@ interface
     uses
     uses
       globtype,systems,
       globtype,systems,
       cutils,verbose,cpuinfo,
       cutils,verbose,cpuinfo,
-      aasmbase,aasmtai,aasmcpu,symsym,
+      aasmbase,aasmtai,aasmcpu,symsym,symconst,
       defutil,
       defutil,
       nflw,pass_2,
       nflw,pass_2,
       cgbase,
       cgbase,
@@ -369,16 +369,27 @@ interface
         else if tempinfo^.may_be_in_reg then
         else if tempinfo^.may_be_in_reg then
           begin
           begin
             cgsize := def_cgsize(tempinfo^.restype.def);
             cgsize := def_cgsize(tempinfo^.restype.def);
-            if (TCGSize2Size[cgsize]>TCGSize2Size[OS_INT]) then
-              internalerror(2004020202);
-            tempinfo^.loc.reg := cg.getintregister(exprasmlist,cgsize);
-            if (tempinfo^.temptype = tt_persistent) then
+            if tempinfo^.restype.def.deftype <> floatdef then
               begin
               begin
-                { !!tell rgobj this register is now a regvar, so it can't be freed!! }
-                tempinfo^.loc.loc := LOC_CREGISTER
+                if (TCGSize2Size[cgsize]>TCGSize2Size[OS_INT]) then
+                  internalerror(2004020202);
+                tempinfo^.loc.reg := cg.getintregister(exprasmlist,cgsize);
+                if (tempinfo^.temptype = tt_persistent) then
+                  begin
+                    { !!tell rgobj this register is now a regvar, so it can't be freed!! }
+                    tempinfo^.loc.loc := LOC_CREGISTER
+                  end
+                else
+                  tempinfo^.loc.loc := LOC_REGISTER;
               end
               end
             else
             else
-              tempinfo^.loc.loc := LOC_REGISTER;
+              begin
+                tempinfo^.loc.reg := cg.getfpuregister(exprasmlist,cgsize);
+                if (tempinfo^.temptype = tt_persistent) then
+                  tempinfo^.loc.loc := LOC_CFPUREGISTER
+                else
+                  tempinfo^.loc.loc := LOC_FPUREGISTER;
+              end;
           end
           end
         else
         else
           begin
           begin
@@ -407,7 +418,9 @@ interface
               inc(location.reference.offset,offset);
               inc(location.reference.offset,offset);
             end;
             end;
           LOC_REGISTER,
           LOC_REGISTER,
-          LOC_CREGISTER:
+          LOC_CREGISTER,
+          LOC_FPUREGISTER,
+          LOC_CFPUREGISTER:
             begin
             begin
               if offset <> 0 then
               if offset <> 0 then
                 internalerror(2004020205);
                 internalerror(2004020205);
@@ -483,7 +496,13 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.64  2004-06-20 08:55:29  florian
+  Revision 1.65  2004-07-16 19:45:15  jonas
+    + temps can now also hold fpu values in registers (take care with use,
+      bacause of the x86 fpu stack)
+    * fpu parameters to node-inlined procedures can now also be put in
+      a register
+
+  Revision 1.64  2004/06/20 08:55:29  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.63  2004/06/16 20:07:08  florian
   Revision 1.63  2004/06/16 20:07:08  florian