Browse Source

* fix statedebug compile

peter 21 years ago
parent
commit
2057dbd01a
2 changed files with 55 additions and 52 deletions
  1. 46 37
      compiler/i386/daopt386.pas
  2. 9 15
      compiler/rgobj.pas

+ 46 - 37
compiler/i386/daopt386.pas

@@ -249,6 +249,10 @@ Implementation
 Uses
 Uses
 {$ifdef csdebug}
 {$ifdef csdebug}
   cutils,
   cutils,
+{$else}
+  {$ifdef statedebug}
+    cutils,
+  {$endif}
 {$endif}
 {$endif}
   globals, systems, verbose, symconst, symsym, cgobj,
   globals, systems, verbose, symconst, symsym, cgobj,
    rgobj, procinfo;
    rgobj, procinfo;
@@ -1863,12 +1867,12 @@ begin
     top_reg:
     top_reg:
       begin
       begin
 {$ifdef statedebug}
 {$ifdef statedebug}
-        hp := tai_comment.Create(strpnew('destroying '+std_reg2str[o.reg]));
-        hp.next := taiobj^.next;
+        hp := tai_comment.Create(strpnew('destroying '+std_regname(o.reg)));
+        hp.next := taiobj.next;
         hp.previous := taiobj;
         hp.previous := taiobj;
-        taiobj^.next := hp;
+        taiobj.next := hp;
         if assigned(hp.next) then
         if assigned(hp.next) then
-          hp.next^.previous := hp;
+          hp.next.previous := hp;
 {$endif statedebug}
 {$endif statedebug}
         DestroyReg(ptaiprop(taiObj.OptInfo), getsupreg(o.reg), true);
         DestroyReg(ptaiprop(taiObj.OptInfo), getsupreg(o.reg), true);
       end;
       end;
@@ -1902,20 +1906,20 @@ begin
         invalidateDependingRegs(p.optinfo,supreg);
         invalidateDependingRegs(p.optinfo,supreg);
         ptaiprop(p.optinfo)^.regs[supreg].memwrite := nil;
         ptaiprop(p.optinfo)^.regs[supreg].memwrite := nil;
 {$ifdef StateDebug}
 {$ifdef StateDebug}
-        hp := tai_comment.Create(strpnew(std_reg2str[reg]+': '+tostr(ptaiprop(p.optinfo)^.Regs[reg].WState)
-              + ' -- ' + tostr(ptaiprop(p.optinfo)^.Regs[reg].nrofmods))));
+        hp := tai_comment.Create(strpnew(std_regname(newreg(R_INTREGISTER,supreg,R_SUBWHOLE))+': '+tostr(ptaiprop(p.optinfo)^.Regs[supreg].WState)
+              + ' -- ' + tostr(ptaiprop(p.optinfo)^.Regs[supreg].nrofmods)));
         InsertLLItem(AsmL, p, p.next, hp);
         InsertLLItem(AsmL, p, p.next, hp);
 {$endif StateDebug}
 {$endif StateDebug}
       end
       end
     else
     else
       begin
       begin
 {$ifdef statedebug}
 {$ifdef statedebug}
-        hp := tai_comment.Create(strpnew('destroying '+std_reg2str[reg]));
+        hp := tai_comment.Create(strpnew('destroying '+std_regname(newreg(R_INTREGISTER,supreg,R_SUBWHOLE))));
         insertllitem(asml,p,p.next,hp);
         insertllitem(asml,p,p.next,hp);
 {$endif statedebug}
 {$endif statedebug}
         DestroyReg(ptaiprop(p.optinfo), supreg, true);
         DestroyReg(ptaiprop(p.optinfo), supreg, true);
 {$ifdef StateDebug}
 {$ifdef StateDebug}
-        hp := tai_comment.Create(strpnew(std_reg2str[reg]+': '+tostr(ptaiprop(p.optinfo)^.Regs[supreg].WState)));
+        hp := tai_comment.Create(strpnew(std_regname(newreg(R_INTREGISTER,supreg,R_SUBWHOLE))+': '+tostr(ptaiprop(p.optinfo)^.Regs[supreg].WState)));
         InsertLLItem(AsmL, p, p.next, hp);
         InsertLLItem(AsmL, p, p.next, hp);
 {$endif StateDebug}
 {$endif StateDebug}
       end
       end
@@ -2135,6 +2139,9 @@ var
     prev,p  : tai;
     prev,p  : tai;
     tmpref: TReference;
     tmpref: TReference;
     tmpsupreg: tsuperregister;
     tmpsupreg: tsuperregister;
+{$ifdef statedebug}
+    hp : tai;
+{$endif}
 {$ifdef AnalyzeLoops}
 {$ifdef AnalyzeLoops}
     hp : tai;
     hp : tai;
     TmpState: Byte;
     TmpState: Byte;
@@ -2389,9 +2396,8 @@ begin
                         top_reg:
                         top_reg:
                           begin
                           begin
 {$ifdef statedebug}
 {$ifdef statedebug}
-                            hp := tai_comment.Create(strpnew('destroying '+
-                              std_reg2str[taicpu(p).oper[1]^.reg])));
-                            insertllitem(asml,p,p.next,hp);
+                            hp := tai_comment.Create(strpnew('destroying '+std_regname(taicpu(p).oper[1]^.reg)));
+                            insertllitem(list,p,p.next,hp);
 {$endif statedebug}
 {$endif statedebug}
 
 
                             readOp(curprop, taicpu(p).oper[0]^);
                             readOp(curprop, taicpu(p).oper[0]^);
@@ -2418,8 +2424,8 @@ begin
                           else
                           else
                             begin
                             begin
 {$ifdef statedebug}
 {$ifdef statedebug}
-                              hp := tai_comment.Create(strpnew('destroying & initing '+std_reg2str[tmpsupreg]));
-                              insertllitem(asml,p,p.next,hp);
+                              hp := tai_comment.Create(strpnew('destroying & initing '+std_regname(newreg(R_INTREGISTER,tmpsupreg,R_SUBWHOLE))));
+                              insertllitem(list,p,p.next,hp);
 {$endif statedebug}
 {$endif statedebug}
                               destroyReg(curprop, tmpsupreg, true);
                               destroyReg(curprop, tmpsupreg, true);
                               if not(reginop(tmpsupreg, taicpu(p).oper[0]^)) then
                               if not(reginop(tmpsupreg, taicpu(p).oper[0]^)) then
@@ -2431,8 +2437,8 @@ begin
                                   end
                                   end
                             end;
                             end;
 {$ifdef StateDebug}
 {$ifdef StateDebug}
-                            hp := tai_comment.Create(strpnew(std_reg2str[tmpsupreg]+': '+tostr(curprop^.regs[tmpsupreg].WState)));
-                            InsertLLItem(AsmL, p, p.next, hp);
+                            hp := tai_comment.Create(strpnew(std_regname(newreg(R_INTREGISTER,tmpsupreg,R_SUBWHOLE))+': '+tostr(curprop^.regs[tmpsupreg].WState)));
+                            insertllitem(list,p,p.next,hp);
 {$endif StateDebug}
 {$endif StateDebug}
                           end;
                           end;
                         top_ref:
                         top_ref:
@@ -2456,8 +2462,8 @@ begin
                             begin
                             begin
                               tmpsupreg := getsupreg(taicpu(p).oper[1]^.reg);
                               tmpsupreg := getsupreg(taicpu(p).oper[1]^.reg);
 {$ifdef statedebug}
 {$ifdef statedebug}
-                              hp := tai_comment.Create(strpnew('destroying '+std_reg2str[tmpsupreg]));
-                              insertllitem(asml,p,p.next,hp);
+                              hp := tai_comment.Create(strpnew('destroying '+std_regname(newreg(R_INTREGISTER,tmpsupreg,R_SUBWHOLE))));
+                              insertllitem(list,p,p.next,hp);
 {$endif statedebug}
 {$endif statedebug}
                               With curprop^.regs[tmpsupreg] Do
                               With curprop^.regs[tmpsupreg] Do
                                 begin
                                 begin
@@ -2486,10 +2492,10 @@ begin
                     end;
                     end;
 {$ifdef statedebug}
 {$ifdef statedebug}
                   hp := tai_comment.Create(strpnew('destroying eax and edx'));
                   hp := tai_comment.Create(strpnew('destroying eax and edx'));
-                  insertllitem(asml,p,p.next,hp);
+                  insertllitem(list,p,p.next,hp);
 {$endif statedebug}
 {$endif statedebug}
 {                  DestroyReg(curprop, RS_EAX, true);}
 {                  DestroyReg(curprop, RS_EAX, true);}
-                  AddInstr2RegContents({$ifdef statedebug}asml,{$endif}
+                  AddInstr2RegContents({$ifdef statedebug}list,{$endif}
                     taicpu(p), RS_EAX);
                     taicpu(p), RS_EAX);
                   DestroyReg(curprop, RS_EDX, true)
                   DestroyReg(curprop, RS_EDX, true)
                 end;
                 end;
@@ -2504,33 +2510,33 @@ begin
                         readreg(curprop,RS_EAX);
                         readreg(curprop,RS_EAX);
 {$ifdef statedebug}
 {$ifdef statedebug}
                         hp := tai_comment.Create(strpnew('destroying eax and edx'));
                         hp := tai_comment.Create(strpnew('destroying eax and edx'));
-                        insertllitem(asml,p,p.next,hp);
+                        insertllitem(list,p,p.next,hp);
 {$endif statedebug}
 {$endif statedebug}
 {                        DestroyReg(curprop, RS_EAX, true); }
 {                        DestroyReg(curprop, RS_EAX, true); }
-                        AddInstr2RegContents({$ifdef statedebug}asml,{$endif}
+                        AddInstr2RegContents({$ifdef statedebug}list,{$endif}
                           taicpu(p), RS_EAX);
                           taicpu(p), RS_EAX);
                         DestroyReg(curprop,RS_EDX, true)
                         DestroyReg(curprop,RS_EDX, true)
                       end
                       end
                     else
                     else
                       AddInstr2OpContents(
                       AddInstr2OpContents(
-                        {$ifdef statedebug}asml,{$endif}
+                        {$ifdef statedebug}list,{$endif}
                           taicpu(p), taicpu(p).oper[1]^)
                           taicpu(p), taicpu(p).oper[1]^)
                   else
                   else
-                    AddInstr2OpContents({$ifdef statedebug}asml,{$endif}
+                    AddInstr2OpContents({$ifdef statedebug}list,{$endif}
                       taicpu(p), taicpu(p).oper[2]^);
                       taicpu(p), taicpu(p).oper[2]^);
                 end;
                 end;
               A_LEA:
               A_LEA:
                 begin
                 begin
                   readop(curprop,taicpu(p).oper[0]^);
                   readop(curprop,taicpu(p).oper[0]^);
                   if reginref(getsupreg(taicpu(p).oper[1]^.reg),taicpu(p).oper[0]^.ref^) then
                   if reginref(getsupreg(taicpu(p).oper[1]^.reg),taicpu(p).oper[0]^.ref^) then
-                    AddInstr2RegContents({$ifdef statedebug}asml,{$endif}
+                    AddInstr2RegContents({$ifdef statedebug}list,{$endif}
                       taicpu(p), getsupreg(taicpu(p).oper[1]^.reg))
                       taicpu(p), getsupreg(taicpu(p).oper[1]^.reg))
                   else
                   else
                     begin
                     begin
 {$ifdef statedebug}
 {$ifdef statedebug}
                       hp := tai_comment.Create(strpnew('destroying & initing'+
                       hp := tai_comment.Create(strpnew('destroying & initing'+
-                        std_reg2str[taicpu(p).oper[1]^.reg])));
-                      insertllitem(asml,p,p.next,hp);
+                        std_regname(taicpu(p).oper[1]^.reg)));
+                      insertllitem(list,p,p.next,hp);
 {$endif statedebug}
 {$endif statedebug}
                       destroyreg(curprop,getsupreg(taicpu(p).oper[1]^.reg),true);
                       destroyreg(curprop,getsupreg(taicpu(p).oper[1]^.reg),true);
                       with curprop^.regs[getsupreg(taicpu(p).oper[1]^.reg)] Do
                       with curprop^.regs[getsupreg(taicpu(p).oper[1]^.reg)] Do
@@ -2562,8 +2568,8 @@ begin
                               end;
                               end;
 {$ifdef statedebug}
 {$ifdef statedebug}
                             hp := tai_comment.Create(strpnew('destroying '+
                             hp := tai_comment.Create(strpnew('destroying '+
-                              std_reg2str[tch2reg(InstrProp.Ch[Cnt])])));
-                            insertllitem(asml,p,p.next,hp);
+                              std_regname(tch2reg(InstrProp.Ch[Cnt]))));
+                            insertllitem(list,p,p.next,hp);
 {$endif statedebug}
 {$endif statedebug}
                             tmpsupreg:=tch2reg(InstrProp.Ch[Cnt]);
                             tmpsupreg:=tch2reg(InstrProp.Ch[Cnt]);
                             DestroyReg(curprop,tmpsupreg, true);
                             DestroyReg(curprop,tmpsupreg, true);
@@ -2571,7 +2577,7 @@ begin
                         Ch_MEAX..Ch_MEDI:
                         Ch_MEAX..Ch_MEDI:
                           begin
                           begin
                             tmpsupreg:=tch2reg(InstrProp.Ch[Cnt]);
                             tmpsupreg:=tch2reg(InstrProp.Ch[Cnt]);
-                            AddInstr2RegContents({$ifdef statedebug} asml,{$endif}
+                            AddInstr2RegContents({$ifdef statedebug} list,{$endif}
                                                  taicpu(p),tmpsupreg);
                                                  taicpu(p),tmpsupreg);
                           end;
                           end;
                         Ch_CDirFlag: curprop^.DirFlag := F_notSet;
                         Ch_CDirFlag: curprop^.DirFlag := F_notSet;
@@ -2586,7 +2592,7 @@ begin
                             DestroyOp(p, taicpu(p).oper[0]^);
                             DestroyOp(p, taicpu(p).oper[0]^);
                           end;
                           end;
                         Ch_Mop1:
                         Ch_Mop1:
-                          AddInstr2OpContents({$ifdef statedebug} asml, {$endif}
+                          AddInstr2OpContents({$ifdef statedebug} list, {$endif}
                             taicpu(p), taicpu(p).oper[0]^);
                             taicpu(p), taicpu(p).oper[0]^);
                         Ch_Wop2..Ch_RWop2:
                         Ch_Wop2..Ch_RWop2:
                           begin
                           begin
@@ -2595,7 +2601,7 @@ begin
                             DestroyOp(p, taicpu(p).oper[1]^);
                             DestroyOp(p, taicpu(p).oper[1]^);
                           end;
                           end;
                         Ch_Mop2:
                         Ch_Mop2:
-                          AddInstr2OpContents({$ifdef statedebug} asml, {$endif}
+                          AddInstr2OpContents({$ifdef statedebug} list, {$endif}
                             taicpu(p), taicpu(p).oper[1]^);
                             taicpu(p), taicpu(p).oper[1]^);
                         Ch_WOp3..Ch_RWOp3:
                         Ch_WOp3..Ch_RWOp3:
                           begin
                           begin
@@ -2604,7 +2610,7 @@ begin
                             DestroyOp(p, taicpu(p).oper[2]^);
                             DestroyOp(p, taicpu(p).oper[2]^);
                           end;
                           end;
                         Ch_Mop3:
                         Ch_Mop3:
-                          AddInstr2OpContents({$ifdef statedebug} asml, {$endif}
+                          AddInstr2OpContents({$ifdef statedebug} list, {$endif}
                             taicpu(p), taicpu(p).oper[2]^);
                             taicpu(p), taicpu(p).oper[2]^);
                         Ch_WMemEDI:
                         Ch_WMemEDI:
                           begin
                           begin
@@ -2630,8 +2636,8 @@ begin
                           begin
                           begin
 {$ifdef statedebug}
 {$ifdef statedebug}
                             hp := tai_comment.Create(strpnew(
                             hp := tai_comment.Create(strpnew(
-                              'destroying all regs for prev instruction')));
-                            insertllitem(asml,p, p.next,hp);
+                              'destroying all regs for prev instruction'));
+                            insertllitem(list,p, p.next,hp);
 {$endif statedebug}
 {$endif statedebug}
                             DestroyAllRegs(curprop,true,true);
                             DestroyAllRegs(curprop,true,true);
                             LastFlagsChangeProp := curprop;
                             LastFlagsChangeProp := curprop;
@@ -2647,8 +2653,8 @@ begin
           begin
           begin
 {$ifdef statedebug}
 {$ifdef statedebug}
             hp := tai_comment.Create(strpnew(
             hp := tai_comment.Create(strpnew(
-              'destroying all regs: unknown tai: '+tostr(ord(p.typ)))));
-            insertllitem(asml,p, p.next,hp);
+              'destroying all regs: unknown tai: '+tostr(ord(p.typ))));
+            insertllitem(list,p, p.next,hp);
 {$endif statedebug}
 {$endif statedebug}
             DestroyAllRegs(curprop,true,true);
             DestroyAllRegs(curprop,true,true);
           end;
           end;
@@ -2708,7 +2714,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.59  2003-12-14 22:42:14  peter
+  Revision 1.60  2003-12-15 15:58:58  peter
+    * fix statedebug compile
+
+  Revision 1.59  2003/12/14 22:42:14  peter
     * fixed csdebug
     * fixed csdebug
 
 
   Revision 1.58  2003/12/14 14:18:59  peter
   Revision 1.58  2003/12/14 14:18:59  peter

+ 9 - 15
compiler/rgobj.pas

@@ -691,9 +691,9 @@ implementation
               end;
               end;
         end;
         end;
     end;
     end;
-    
+
     procedure Trgobj.sort_simplify_worklist;
     procedure Trgobj.sort_simplify_worklist;
-    
+
     {Sorts the simplifyworklist by the number of interferences the
     {Sorts the simplifyworklist by the number of interferences the
      registers in it cause. This allows simplify to execute in
      registers in it cause. This allows simplify to execute in
      constant time.}
      constant time.}
@@ -757,7 +757,7 @@ implementation
     end;
     end;
 
 
     procedure trgobj.prepare_colouring;
     procedure trgobj.prepare_colouring;
-    
+
     var i:word;
     var i:word;
 
 
     begin
     begin
@@ -838,7 +838,7 @@ implementation
         min,i:word;
         min,i:word;
     begin
     begin
       {We take the element with the least interferences out of the
       {We take the element with the least interferences out of the
-       simplifyworklist. Since the simplifyworklist is now sorted, we 
+       simplifyworklist. Since the simplifyworklist is now sorted, we
        no longer need to search, but we can simply take the first element.}
        no longer need to search, but we can simply take the first element.}
       n:=simplifyworklist.get;
       n:=simplifyworklist.get;
 
 
@@ -1156,7 +1156,7 @@ implementation
         adj_colours,
         adj_colours,
         colourednodes : Tsuperregisterset;
         colourednodes : Tsuperregisterset;
         found : boolean;
         found : boolean;
-        
+
     begin
     begin
       spillednodes.clear;
       spillednodes.clear;
       {Reset colours}
       {Reset colours}
@@ -1599,23 +1599,17 @@ implementation
 
 
 
 
     procedure Trgobj.check_unreleasedregs;
     procedure Trgobj.check_unreleasedregs;
-{$ifdef EXTDEBUG}
-      var
-        sr : tsuperregister;
-{$endif EXTDEBUG}
       begin
       begin
-{$ifdef EXTDEBUG}
-        for sr:=first_imaginary to maxreg-1 do
-          if not(supregset_in(unusedregs,sr)) then
-            Comment(V_Warning,'Register '+std_regname(newreg(R_INTREGISTER,sr,R_SUBNONE))+' not released');
-{$endif EXTDEBUG}
       end;
       end;
 
 
 
 
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.100  2003-12-14 20:24:28  daniel
+  Revision 1.101  2003-12-15 15:58:58  peter
+    * fix statedebug compile
+
+  Revision 1.100  2003/12/14 20:24:28  daniel
     * Register allocator speed optimizations
     * Register allocator speed optimizations
       - Worklist no longer a ringbuffer
       - Worklist no longer a ringbuffer
       - No find operations are left
       - No find operations are left