Browse Source

* the code generator knows now if parameters are in registers

florian 23 years ago
parent
commit
ed950491a8
6 changed files with 75 additions and 19 deletions
  1. 9 2
      compiler/cgobj.pas
  2. 7 4
      compiler/ncginl.pas
  3. 24 2
      compiler/paramgr.pas
  4. 10 2
      compiler/pass_2.pas
  5. 5 6
      compiler/powerpc/cgcpu.pas
  6. 20 3
      compiler/powerpc/cpupara.pas

+ 9 - 2
compiler/cgobj.pas

@@ -652,7 +652,11 @@ unit cgobj;
           LOC_CONSTANT:
             a_load_const_reg(list,loc.size,loc.value,reg);
           else
-            internalerror(200109092);
+            begin
+               writeln(ord(loc.loc));
+               runerror(216);
+               internalerror(200109092);
+            end;
         end;
       end;
 
@@ -1396,7 +1400,10 @@ finalization
 end.
 {
   $Log$
-  Revision 1.40  2002-07-29 21:16:02  florian
+  Revision 1.41  2002-07-30 20:50:43  florian
+    * the code generator knows now if parameters are in registers
+
+  Revision 1.40  2002/07/29 21:16:02  florian
     * some more ppc fixes
 
   Revision 1.39  2002/07/28 15:56:00  jonas

+ 7 - 4
compiler/ncginl.pas

@@ -106,8 +106,8 @@ implementation
                   second_TypeInfo;
                end;
             in_assigned_x :
-              begin                 
-                 second_Assigned;
+              begin
+//                 second_Assigned;
               end;
             in_include_x_y,
             in_exclude_x_y:
@@ -583,7 +583,10 @@ end.
 
 {
   $Log$
-  Revision 1.6  2002-07-29 21:23:42  florian
+  Revision 1.7  2002-07-30 20:50:43  florian
+    * the code generator knows now if parameters are in registers
+
+  Revision 1.6  2002/07/29 21:23:42  florian
     * more fixes for the ppc
     + wrappers for the tcnvnode.first_* stuff introduced
 
@@ -601,4 +604,4 @@ end.
 
   Revision 1.1  2002/07/24 04:07:49  carl
    + first revision (incomplete)
-}
+}

+ 24 - 2
compiler/paramgr.pas

@@ -56,6 +56,8 @@ unit paramgr;
           }
        end;
 
+    procedure setparalocs(p : tprocdef);
+
     var
        paralocdummy : tparalocation;
        paramanager : tparamanager;
@@ -64,7 +66,7 @@ unit paramgr;
 
     uses
        cpuinfo,
-       symconst,symbase,
+       symconst,symbase,symsym,
        defbase;
 
     { true if the return value is in accumulator (EAX for i386), D0 for 68k }
@@ -129,13 +131,33 @@ unit paramgr;
          end;
       end;
 
+    procedure setparalocs(p : tprocdef);
+
+      var
+         hp : tparaitem;
+
+      begin
+         hp:=tparaitem(p.para.first);
+         while assigned(hp) do
+           begin
+              if (hp.paraloc.loc in [LOC_REGISTER,LOC_FPUREGISTER]) and
+              { if the parameter isn't regable, we've to work with the local copy }
+                (vo_regable in tvarsym(hp.parasym).varoptions) then
+                tvarsym(hp.parasym).reg:=hp.paraloc.register;
+              hp:=tparaitem(hp.next);
+           end;
+      end;
+
 finalization
   paramanager.free;
 end.
 
 {
    $Log$
-   Revision 1.5  2002-07-26 21:15:39  florian
+   Revision 1.6  2002-07-30 20:50:43  florian
+     * the code generator knows now if parameters are in registers
+
+   Revision 1.5  2002/07/26 21:15:39  florian
      * rewrote the system handling
 
    Revision 1.4  2002/07/20 11:57:55  florian

+ 10 - 2
compiler/pass_2.pas

@@ -52,7 +52,7 @@ implementation
 {$endif}
      globtype,systems,verbose,
      cclasses,globals,
-     symconst,symbase,symtype,symsym,
+     symconst,symbase,symtype,symsym,paramgr,
      aasmbase,aasmtai,
      pass_1,cpubase,cgbase,regvars,nflw,rgobj;
 
@@ -301,6 +301,11 @@ implementation
                 end;
 {$endif OMITSTACKFRAME}
 
+              { assign parameter locations }
+{$ifndef i386}
+              setparalocs(procinfo^.procdef);
+{$endif i386}
+
               { process register variable stuff (JM) }
               assign_regvars(p);
               load_regvars(procinfo^.aktentrycode,p);
@@ -323,7 +328,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.32  2002-07-19 11:41:36  daniel
+  Revision 1.33  2002-07-30 20:50:44  florian
+    * the code generator knows now if parameters are in registers
+
+  Revision 1.32  2002/07/19 11:41:36  daniel
   * State tracker work
   * The whilen and repeatn are now completely unified into whilerepeatn. This
     allows the state tracker to change while nodes automatically into

+ 5 - 6
compiler/powerpc/cgcpu.pas

@@ -209,11 +209,7 @@ const
                  internalerror(2002072801);
             end;
           else
-            begin
-               runerror(216);
-               writeln(ord(locpara.loc));
-               internalerror(2002081103);
-            end;
+            internalerror(2002081103);
         end;
         if locpara.sp_fixup<>0 then
           internalerror(2002081104);
@@ -1457,7 +1453,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.30  2002-07-29 21:23:44  florian
+  Revision 1.31  2002-07-30 20:50:44  florian
+    * the code generator knows now if parameters are in registers
+
+  Revision 1.30  2002/07/29 21:23:44  florian
     * more fixes for the ppc
     + wrappers for the tcnvnode.first_* stuff introduced
 

+ 20 - 3
compiler/powerpc/cpupara.pas

@@ -155,7 +155,21 @@ unit cpupara;
                    end;
                  LOC_FPUREGISTER:
                    begin
-                      if nextfloatreg<=R_F8 then
+                      if hp.paratyp in [vs_var,vs_out] then
+                        begin
+                           if nextintreg<=R_8 then
+                             begin
+                                hp.paraloc.loc:=LOC_REGISTER;
+                                hp.paraloc.register:=nextintreg;
+                                inc(nextintreg);
+                             end
+                           else
+                              begin
+                                 {!!!!!!!}
+                                 internalerror(2002071006);
+                             end;
+                        end
+                      else if nextfloatreg<=R_F8 then
                         begin
                            hp.paraloc.loc:=LOC_FPUREGISTER;
                            hp.paraloc.register:=nextfloatreg;
@@ -169,7 +183,7 @@ unit cpupara;
                    end;
                  LOC_REFERENCE:
                    begin
-                      if push_addr_param(hp.paratype.def) then
+                      if push_addr_param(hp.paratype.def) or (hp.paratyp in [vs_var,vs_out]) then
                         begin
                            if nextintreg<=R_8 then
                              begin
@@ -210,7 +224,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.4  2002-07-28 20:45:22  florian
+  Revision 1.5  2002-07-30 20:50:44  florian
+    * the code generator knows now if parameters are in registers
+
+  Revision 1.4  2002/07/28 20:45:22  florian
     + added direct assembler reader for PowerPC
 
   Revision 1.3  2002/07/26 22:22:10  florian