mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 16:39:36 +01:00
* set successor properly for for-nodes
+ CalcDefSum git-svn-id: trunk@11804 -
This commit is contained in:
parent
ecd05a1043
commit
61dbf89bdb
@ -37,9 +37,11 @@ unit optbase;
|
||||
toptinfo = record
|
||||
{ index of the current node inside the dfa sets, aword(-1) if no entry }
|
||||
index : aword;
|
||||
{ dfa }
|
||||
def : tdfaset;
|
||||
use : tdfaset;
|
||||
life : tdfaset;
|
||||
defsum : tdfaset;
|
||||
end;
|
||||
|
||||
poptinfo = ^toptinfo;
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user