Răsfoiți Sursa

* fixed relabeling (nextaltnr was never increased)
* fixed inlining of case statements at the node level

Jonas Maebe 21 ani în urmă
părinte
comite
038a5dde80
2 a modificat fișierele cu 25 adăugiri și 5 ștergeri
  1. 13 1
      compiler/aasmbase.pas
  2. 12 4
      compiler/ncgset.pas

+ 13 - 1
compiler/aasmbase.pas

@@ -92,6 +92,7 @@ interface
          function  is_used:boolean;
          function  is_used:boolean;
          procedure increfs;
          procedure increfs;
          procedure decrefs;
          procedure decrefs;
+         function getrefs: longint;
          procedure setaddress(_pass:byte;sec:TAsmSection;offset,len:aint);
          procedure setaddress(_pass:byte;sec:TAsmSection;offset,len:aint);
        end;
        end;
 
 
@@ -315,6 +316,12 @@ implementation
       end;
       end;
 
 
 
 
+    function tasmsymbol.getrefs: longint;
+      begin
+        getrefs := refs;
+      end;
+
+
     procedure tasmsymbol.setaddress(_pass:byte;sec:TAsmSection;offset,len:aint);
     procedure tasmsymbol.setaddress(_pass:byte;sec:TAsmSection;offset,len:aint);
       begin
       begin
         if (_pass=pass) then
         if (_pass=pass) then
@@ -829,6 +836,7 @@ implementation
         if not assigned(p.altsymbol) then
         if not assigned(p.altsymbol) then
          begin
          begin
            p.altsymbol:=tasmsymbol.create(name+'_'+tostr(nextaltnr),p.defbind,p.typ);
            p.altsymbol:=tasmsymbol.create(name+'_'+tostr(nextaltnr),p.defbind,p.typ);
+           inc(nextaltnr);
            symbolsearch.insert(p.altsymbol);
            symbolsearch.insert(p.altsymbol);
            { add also the original sym to the usedasmsymbollist,
            { add also the original sym to the usedasmsymbollist,
              that list is used to reset the altsymbol }
              that list is used to reset the altsymbol }
@@ -942,7 +950,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.19  2004-06-20 08:55:28  florian
+  Revision 1.20  2004-07-22 10:07:09  jonas
+    * fixed relabeling (nextaltnr was never increased)
+    * fixed inlining of case statements at the node level
+
+  Revision 1.19  2004/06/20 08:55:28  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.18  2004/06/16 20:07:06  florian
   Revision 1.18  2004/06/16 20:07:06  florian

+ 12 - 4
compiler/ncgset.pas

@@ -768,14 +768,18 @@ implementation
          max_dist,
          max_dist,
          dist : aword;
          dist : aword;
          hp : tstatementnode;
          hp : tstatementnode;
+         relabeling: boolean;
       begin
       begin
          location_reset(location,LOC_VOID,OS_NO);
          location_reset(location,LOC_VOID,OS_NO);
 
 
          { Relabel for inlining? }
          { Relabel for inlining? }
-         if inlining_procedure and assigned(nodes) then
+         relabeling := false;
+         if assigned(nodes) and
+            (nodes^.statement.getrefs <> 0) then
           begin
           begin
             objectlibrary.CreateUsedAsmSymbolList;
             objectlibrary.CreateUsedAsmSymbolList;
             relabelcaserecord(nodes);
             relabelcaserecord(nodes);
+            relabeling := true;
           end;
           end;
 
 
          objectlibrary.getlabel(endlabel);
          objectlibrary.getlabel(endlabel);
@@ -926,7 +930,7 @@ implementation
          while assigned(hp) do
          while assigned(hp) do
            begin
            begin
               { relabel when inlining }
               { relabel when inlining }
-              if inlining_procedure then
+              if relabeling then
                 begin
                 begin
                   if hp.left.nodetype<>labeln then
                   if hp.left.nodetype<>labeln then
                     internalerror(200211261);
                     internalerror(200211261);
@@ -953,7 +957,7 @@ implementation
          cg.a_label(exprasmlist,endlabel);
          cg.a_label(exprasmlist,endlabel);
 
 
          { Remove relabels for inlining }
          { Remove relabels for inlining }
-         if inlining_procedure and
+         if relabeling and
             assigned(nodes) then
             assigned(nodes) then
           begin
           begin
              { restore used symbols }
              { restore used symbols }
@@ -970,7 +974,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.64  2004-07-04 12:38:55  jonas
+  Revision 1.65  2004-07-22 10:07:09  jonas
+    * fixed relabeling (nextaltnr was never increased)
+    * fixed inlining of case statements at the node level
+
+  Revision 1.64  2004/07/04 12:38:55  jonas
     * fixed regvar bug in tcginnode.pass_2
     * fixed regvar bug in tcginnode.pass_2
 
 
   Revision 1.63  2004/06/20 08:55:29  florian
   Revision 1.63  2004/06/20 08:55:29  florian