|
@@ -41,6 +41,11 @@ unit optutils;
|
|
|
procedure SetNodeSucessors(p : tnode);
|
|
|
procedure PrintDFAInfo(var f : text;p : tnode);
|
|
|
procedure PrintIndexedNodeSet(var f : text;s : TIndexedNodeSet);
|
|
|
+ { determines the optinfo.defsum field for the given node
|
|
|
+ this field contains a sum of all expressions defined by
|
|
|
+ all child expressions reachable through p
|
|
|
+ }
|
|
|
+ procedure CalcDefSum(p : tnode);
|
|
|
|
|
|
implementation
|
|
|
|
|
@@ -189,6 +194,7 @@ unit optutils;
|
|
|
DoSet(tfornode(p).t2,p);
|
|
|
Breakstack.Delete(Breakstack.Count-1);
|
|
|
Continuestack.Delete(Continuestack.Count-1);
|
|
|
+ p.successor:=succ;
|
|
|
end;
|
|
|
breakn:
|
|
|
begin
|
|
@@ -295,5 +301,27 @@ unit optutils;
|
|
|
Breakstack.Free;
|
|
|
end;
|
|
|
|
|
|
+ var
|
|
|
+ sum : TDFASet;
|
|
|
+
|
|
|
+ function adddef(var n: tnode; arg: pointer): foreachnoderesult;
|
|
|
+ begin
|
|
|
+ if assigned(n.optinfo) then
|
|
|
+ DFASetIncludeSet(sum,n.optinfo^.def);
|
|
|
+ Result:=fen_false;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ procedure CalcDefSum(p : tnode);
|
|
|
+ begin
|
|
|
+ p.allocoptinfo;
|
|
|
+ if not assigned(p.optinfo^.defsum) then
|
|
|
+ begin
|
|
|
+ sum:=nil;
|
|
|
+ foreachnodestatic(pm_postprocess,p,@adddef,nil);
|
|
|
+ p.optinfo^.defsum:=sum;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
end.
|
|
|
|