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}
 {$I version.inc}
     type
     type
-{$ifdef klaempfl}
-{$ifdef ver0_9_2}
-       extended = double;
-{$endif ver0_9_2}
-{$endif klaempfl}
        tait = (
        tait = (
           ait_string,
           ait_string,
           ait_label,
           ait_label,
@@ -69,6 +64,10 @@ unit aasm;
           ait_cut,
           ait_cut,
 {$endif MAKELIB}
 {$endif MAKELIB}
           { never used, makes insertation of new ait_ easier to type }
           { never used, makes insertation of new ait_ easier to type }
+{$ifdef REGALLOC}
+          ait_regalloc,
+          ait_regdealloc,
+{$endif REGALLOC}
           ait_dummy);
           ait_dummy);
 
 
      type
      type
@@ -678,8 +677,11 @@ type
 end.
 end.
 {
 {
   $Log$
   $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
   Revision 1.18  1998/03/10 16:27:36  pierre
     * better line info in stabs debug
     * better line info in stabs debug

+ 45 - 1
compiler/i386.pas

@@ -196,6 +196,24 @@ unit i386;
           destructor done;virtual;
           destructor done;virtual;
        end;
        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;
        pai386 = ^tai386;
 
 
        tai386 = object(tai)
        tai386 = object(tai)
@@ -1209,6 +1227,29 @@ unit i386;
       strdispose(p^.symbol);
       strdispose(p^.symbol);
       dispose(p);
       dispose(p);
       end;
       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
                              TAI386
@@ -1713,7 +1754,10 @@ unit i386;
 end.
 end.
 {
 {
   $Log$
   $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
     * several bugfixes
       ADD ADC and AND are also sign extended
       ADD ADC and AND are also sign extended
       nasm output OK (program still crashes at end
       nasm output OK (program still crashes at end

+ 19 - 7
compiler/tgeni386.pas

@@ -204,7 +204,9 @@ unit tgeni386;
            begin
            begin
               if not(r in [R_EAX,R_EBX,R_ECX,R_EDX]) then
               if not(r in [R_EAX,R_EBX,R_ECX,R_EDX]) then
                 exit;
                 exit;
-              unused:=unused+[r];
+{$ifdef REGALLOC}
+              exprasmlist^.concat(new(pairegdealloc,init(r)));
+{$endif REGALLOC}
               inc(usablereg32);
               inc(usablereg32);
            end;
            end;
       end;
       end;
@@ -271,33 +273,40 @@ unit tgeni386;
 
 
     function getregister32 : tregister;
     function getregister32 : tregister;
 
 
+      var
+         r : tregister;
+
       begin
       begin
          dec(usablereg32);
          dec(usablereg32);
          if R_EAX in unused then
          if R_EAX in unused then
            begin
            begin
               unused:=unused-[R_EAX];
               unused:=unused-[R_EAX];
               usedinproc:=usedinproc or ($80 shr byte(R_EAX));
               usedinproc:=usedinproc or ($80 shr byte(R_EAX));
-              getregister32:=R_EAX;
+              r:=R_EAX;
            end
            end
          else if R_EDX in unused then
          else if R_EDX in unused then
            begin
            begin
               unused:=unused-[R_EDX];
               unused:=unused-[R_EDX];
               usedinproc:=usedinproc or ($80 shr byte(R_EDX));
               usedinproc:=usedinproc or ($80 shr byte(R_EDX));
-              getregister32:=R_EDX;
+              r:=R_EDX;
            end
            end
          else if R_EBX in unused then
          else if R_EBX in unused then
            begin
            begin
               unused:=unused-[R_EBX];
               unused:=unused-[R_EBX];
               usedinproc:=usedinproc or ($80 shr byte(R_EBX));
               usedinproc:=usedinproc or ($80 shr byte(R_EBX));
-              getregister32:=R_EBX;
+              r:=R_EBX;
            end
            end
          else if R_ECX in unused then
          else if R_ECX in unused then
            begin
            begin
               unused:=unused-[R_ECX];
               unused:=unused-[R_ECX];
               usedinproc:=usedinproc or ($80 shr byte(R_ECX));
               usedinproc:=usedinproc or ($80 shr byte(R_ECX));
-              getregister32:=R_ECX;
+              r:=R_ECX;
            end
            end
          else internalerror(10);
          else internalerror(10);
+{$ifdef REGALLOC}
+         exprasmlist^.concat(new(pairegalloc,init(r)));
+{$endif REGALLOC}
+         getregister32:=r;
       end;
       end;
 
 
     procedure cleartempgen;
     procedure cleartempgen;
@@ -591,8 +600,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
   Revision 1.9  2036/02/07 09:26:57  florian
     * more fixes to get -Ox work
     * more fixes to get -Ox work