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:
           LOC_CONSTANT:
             a_load_const_reg(list,loc.size,loc.value,reg);
             a_load_const_reg(list,loc.size,loc.value,reg);
           else
           else
-            internalerror(200109092);
+            begin
+               writeln(ord(loc.loc));
+               runerror(216);
+               internalerror(200109092);
+            end;
         end;
         end;
       end;
       end;
 
 
@@ -1396,7 +1400,10 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $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
     * some more ppc fixes
 
 
   Revision 1.39  2002/07/28 15:56:00  jonas
   Revision 1.39  2002/07/28 15:56:00  jonas

+ 7 - 4
compiler/ncginl.pas

@@ -106,8 +106,8 @@ implementation
                   second_TypeInfo;
                   second_TypeInfo;
                end;
                end;
             in_assigned_x :
             in_assigned_x :
-              begin                 
-                 second_Assigned;
+              begin
+//                 second_Assigned;
               end;
               end;
             in_include_x_y,
             in_include_x_y,
             in_exclude_x_y:
             in_exclude_x_y:
@@ -583,7 +583,10 @@ end.
 
 
 {
 {
   $Log$
   $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
     * more fixes for the ppc
     + wrappers for the tcnvnode.first_* stuff introduced
     + wrappers for the tcnvnode.first_* stuff introduced
 
 
@@ -601,4 +604,4 @@ end.
 
 
   Revision 1.1  2002/07/24 04:07:49  carl
   Revision 1.1  2002/07/24 04:07:49  carl
    + first revision (incomplete)
    + first revision (incomplete)
-}
+}

+ 24 - 2
compiler/paramgr.pas

@@ -56,6 +56,8 @@ unit paramgr;
           }
           }
        end;
        end;
 
 
+    procedure setparalocs(p : tprocdef);
+
     var
     var
        paralocdummy : tparalocation;
        paralocdummy : tparalocation;
        paramanager : tparamanager;
        paramanager : tparamanager;
@@ -64,7 +66,7 @@ unit paramgr;
 
 
     uses
     uses
        cpuinfo,
        cpuinfo,
-       symconst,symbase,
+       symconst,symbase,symsym,
        defbase;
        defbase;
 
 
     { true if the return value is in accumulator (EAX for i386), D0 for 68k }
     { true if the return value is in accumulator (EAX for i386), D0 for 68k }
@@ -129,13 +131,33 @@ unit paramgr;
          end;
          end;
       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
 finalization
   paramanager.free;
   paramanager.free;
 end.
 end.
 
 
 {
 {
    $Log$
    $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
      * rewrote the system handling
 
 
    Revision 1.4  2002/07/20 11:57:55  florian
    Revision 1.4  2002/07/20 11:57:55  florian

+ 10 - 2
compiler/pass_2.pas

@@ -52,7 +52,7 @@ implementation
 {$endif}
 {$endif}
      globtype,systems,verbose,
      globtype,systems,verbose,
      cclasses,globals,
      cclasses,globals,
-     symconst,symbase,symtype,symsym,
+     symconst,symbase,symtype,symsym,paramgr,
      aasmbase,aasmtai,
      aasmbase,aasmtai,
      pass_1,cpubase,cgbase,regvars,nflw,rgobj;
      pass_1,cpubase,cgbase,regvars,nflw,rgobj;
 
 
@@ -301,6 +301,11 @@ implementation
                 end;
                 end;
 {$endif OMITSTACKFRAME}
 {$endif OMITSTACKFRAME}
 
 
+              { assign parameter locations }
+{$ifndef i386}
+              setparalocs(procinfo^.procdef);
+{$endif i386}
+
               { process register variable stuff (JM) }
               { process register variable stuff (JM) }
               assign_regvars(p);
               assign_regvars(p);
               load_regvars(procinfo^.aktentrycode,p);
               load_regvars(procinfo^.aktentrycode,p);
@@ -323,7 +328,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
   * State tracker work
   * The whilen and repeatn are now completely unified into whilerepeatn. This
   * The whilen and repeatn are now completely unified into whilerepeatn. This
     allows the state tracker to change while nodes automatically into
     allows the state tracker to change while nodes automatically into

+ 5 - 6
compiler/powerpc/cgcpu.pas

@@ -209,11 +209,7 @@ const
                  internalerror(2002072801);
                  internalerror(2002072801);
             end;
             end;
           else
           else
-            begin
-               runerror(216);
-               writeln(ord(locpara.loc));
-               internalerror(2002081103);
-            end;
+            internalerror(2002081103);
         end;
         end;
         if locpara.sp_fixup<>0 then
         if locpara.sp_fixup<>0 then
           internalerror(2002081104);
           internalerror(2002081104);
@@ -1457,7 +1453,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * more fixes for the ppc
     + wrappers for the tcnvnode.first_* stuff introduced
     + wrappers for the tcnvnode.first_* stuff introduced
 
 

+ 20 - 3
compiler/powerpc/cpupara.pas

@@ -155,7 +155,21 @@ unit cpupara;
                    end;
                    end;
                  LOC_FPUREGISTER:
                  LOC_FPUREGISTER:
                    begin
                    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
                         begin
                            hp.paraloc.loc:=LOC_FPUREGISTER;
                            hp.paraloc.loc:=LOC_FPUREGISTER;
                            hp.paraloc.register:=nextfloatreg;
                            hp.paraloc.register:=nextfloatreg;
@@ -169,7 +183,7 @@ unit cpupara;
                    end;
                    end;
                  LOC_REFERENCE:
                  LOC_REFERENCE:
                    begin
                    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
                         begin
                            if nextintreg<=R_8 then
                            if nextintreg<=R_8 then
                              begin
                              begin
@@ -210,7 +224,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     + added direct assembler reader for PowerPC
 
 
   Revision 1.3  2002/07/26 22:22:10  florian
   Revision 1.3  2002/07/26 22:22:10  florian