瀏覽代碼

+ has_life_info
* successor info for for nodes fixed

git-svn-id: trunk@24899 -

florian 12 年之前
父節點
當前提交
0af7a6f92c
共有 1 個文件被更改,包括 12 次插入1 次删除
  1. 12 1
      compiler/optutils.pas

+ 12 - 1
compiler/optutils.pas

@@ -47,6 +47,9 @@ unit optutils;
     }
     }
     procedure CalcDefSum(p : tnode);
     procedure CalcDefSum(p : tnode);
 
 
+    { returns true, if n is a valid node and has life info }
+    function has_life_info(n : tnode) : boolean;
+
   implementation
   implementation
 
 
     uses
     uses
@@ -192,6 +195,7 @@ unit optutils;
                 result:=p;
                 result:=p;
                 { the successor of the last node of the for body is the for node itself }
                 { the successor of the last node of the for body is the for node itself }
                 DoSet(tfornode(p).t2,p);
                 DoSet(tfornode(p).t2,p);
+                p.successor:=succ;
                 Breakstack.Delete(Breakstack.Count-1);
                 Breakstack.Delete(Breakstack.Count-1);
                 Continuestack.Delete(Continuestack.Count-1);
                 Continuestack.Delete(Continuestack.Count-1);
                 p.successor:=succ;
                 p.successor:=succ;
@@ -211,7 +215,7 @@ unit optutils;
                 Breakstack.Add(succ);
                 Breakstack.Add(succ);
                 Continuestack.Add(p);
                 Continuestack.Add(p);
                 result:=p;
                 result:=p;
-                { the successor of the last node of the while body is the while node itself }
+                { the successor of the last node of the while/repeat body is the while node itself }
                 DoSet(twhilerepeatnode(p).right,p);
                 DoSet(twhilerepeatnode(p).right,p);
                 p.successor:=succ;
                 p.successor:=succ;
                 Breakstack.Delete(Breakstack.Count-1);
                 Breakstack.Delete(Breakstack.Count-1);
@@ -324,5 +328,12 @@ unit optutils;
           end;
           end;
       end;
       end;
 
 
+
+    function has_life_info(n : tnode) : boolean;
+      begin
+        result:=assigned(n) and assigned(n.optinfo) and
+          assigned(n.optinfo^.life);
+      end;
+
 end.
 end.