Browse Source

+ register allocation tracing stuff added

florian 27 years ago
parent
commit
4b25db4d28
3 changed files with 73 additions and 15 deletions
  1. 9 7
      compiler/aasm.pas
  2. 45 1
      compiler/i386.pas
  3. 19 7
      compiler/tgeni386.pas

+ 9 - 7
compiler/aasm.pas

@@ -29,11 +29,6 @@ unit aasm;
 
 {$I version.inc}
     type
-{$ifdef klaempfl}
-{$ifdef ver0_9_2}
-       extended = double;
-{$endif ver0_9_2}
-{$endif klaempfl}
        tait = (
           ait_string,
           ait_label,
@@ -69,6 +64,10 @@ unit aasm;
           ait_cut,
 {$endif MAKELIB}
           { never used, makes insertation of new ait_ easier to type }
+{$ifdef REGALLOC}
+          ait_regalloc,
+          ait_regdealloc,
+{$endif REGALLOC}
           ait_dummy);
 
      type
@@ -678,8 +677,11 @@ type
 end.
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:16  root
-  Initial revision
+  Revision 1.2  1998-04-09 15:46:37  florian
+    + register allocation tracing stuff added
+
+  Revision 1.1.1.1  1998/03/25 11:18:16  root
+  * Restored version
 
   Revision 1.18  1998/03/10 16:27:36  pierre
     * better line info in stabs debug

+ 45 - 1
compiler/i386.pas

@@ -196,6 +196,24 @@ unit i386;
           destructor done;virtual;
        end;
 
+{$ifdef REGALLOC}
+
+       pairegalloc = ^tairegalloc;
+
+       tairegalloc = object(tai)
+          reg : tregister;
+          constructor init(r : tregister);
+       end;
+
+       pairegdealloc = ^tairegdealloc;
+
+       tairegdealloc = object(tai)
+          reg : tregister;
+          constructor init(r : tregister);
+       end;
+
+{$endif REGALLOC}
+
        pai386 = ^tai386;
 
        tai386 = object(tai)
@@ -1209,6 +1227,29 @@ unit i386;
       strdispose(p^.symbol);
       dispose(p);
       end;
+{****************************************************************************
+                       objects for register de/allocation
+ ****************************************************************************}
+
+{$ifdef REGALLOC}
+
+    constructor tairegalloc.init(r : tregister);
+
+      begin
+         inherited init;
+         typ:=ait_regalloc;
+         reg:=r;
+      end;
+
+    constructor tairegdealloc.init(r : tregister);
+
+      begin
+         inherited init;
+         typ:=ait_regdealloc;
+         reg:=r;
+      end;
+
+{$endif REGALLOC}
 
 {****************************************************************************
                              TAI386
@@ -1713,7 +1754,10 @@ unit i386;
 end.
 {
   $Log$
-  Revision 1.3  1998-04-08 16:58:02  pierre
+  Revision 1.4  1998-04-09 15:46:38  florian
+    + register allocation tracing stuff added
+
+  Revision 1.3  1998/04/08 16:58:02  pierre
     * several bugfixes
       ADD ADC and AND are also sign extended
       nasm output OK (program still crashes at end

+ 19 - 7
compiler/tgeni386.pas

@@ -204,7 +204,9 @@ unit tgeni386;
            begin
               if not(r in [R_EAX,R_EBX,R_ECX,R_EDX]) then
                 exit;
-              unused:=unused+[r];
+{$ifdef REGALLOC}
+              exprasmlist^.concat(new(pairegdealloc,init(r)));
+{$endif REGALLOC}
               inc(usablereg32);
            end;
       end;
@@ -271,33 +273,40 @@ unit tgeni386;
 
     function getregister32 : tregister;
 
+      var
+         r : tregister;
+
       begin
          dec(usablereg32);
          if R_EAX in unused then
            begin
               unused:=unused-[R_EAX];
               usedinproc:=usedinproc or ($80 shr byte(R_EAX));
-              getregister32:=R_EAX;
+              r:=R_EAX;
            end
          else if R_EDX in unused then
            begin
               unused:=unused-[R_EDX];
               usedinproc:=usedinproc or ($80 shr byte(R_EDX));
-              getregister32:=R_EDX;
+              r:=R_EDX;
            end
          else if R_EBX in unused then
            begin
               unused:=unused-[R_EBX];
               usedinproc:=usedinproc or ($80 shr byte(R_EBX));
-              getregister32:=R_EBX;
+              r:=R_EBX;
            end
          else if R_ECX in unused then
            begin
               unused:=unused-[R_ECX];
               usedinproc:=usedinproc or ($80 shr byte(R_ECX));
-              getregister32:=R_ECX;
+              r:=R_ECX;
            end
          else internalerror(10);
+{$ifdef REGALLOC}
+         exprasmlist^.concat(new(pairegalloc,init(r)));
+{$endif REGALLOC}
+         getregister32:=r;
       end;
 
     procedure cleartempgen;
@@ -591,8 +600,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:15  root
-  Initial revision
+  Revision 1.2  1998-04-09 15:46:39  florian
+    + register allocation tracing stuff added
+
+  Revision 1.1.1.1  1998/03/25 11:18:15  root
+  * Restored version
 
   Revision 1.9  2036/02/07 09:26:57  florian
     * more fixes to get -Ox work