mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-03 04:09:32 +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
|
toptinfo = record
|
||||||
{ index of the current node inside the dfa sets, aword(-1) if no entry }
|
{ index of the current node inside the dfa sets, aword(-1) if no entry }
|
||||||
index : aword;
|
index : aword;
|
||||||
|
{ dfa }
|
||||||
def : tdfaset;
|
def : tdfaset;
|
||||||
use : tdfaset;
|
use : tdfaset;
|
||||||
life : tdfaset;
|
life : tdfaset;
|
||||||
|
defsum : tdfaset;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
poptinfo = ^toptinfo;
|
poptinfo = ^toptinfo;
|
||||||
|
|||||||
@ -41,6 +41,11 @@ unit optutils;
|
|||||||
procedure SetNodeSucessors(p : tnode);
|
procedure SetNodeSucessors(p : tnode);
|
||||||
procedure PrintDFAInfo(var f : text;p : tnode);
|
procedure PrintDFAInfo(var f : text;p : tnode);
|
||||||
procedure PrintIndexedNodeSet(var f : text;s : TIndexedNodeSet);
|
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
|
implementation
|
||||||
|
|
||||||
@ -189,6 +194,7 @@ unit optutils;
|
|||||||
DoSet(tfornode(p).t2,p);
|
DoSet(tfornode(p).t2,p);
|
||||||
Breakstack.Delete(Breakstack.Count-1);
|
Breakstack.Delete(Breakstack.Count-1);
|
||||||
Continuestack.Delete(Continuestack.Count-1);
|
Continuestack.Delete(Continuestack.Count-1);
|
||||||
|
p.successor:=succ;
|
||||||
end;
|
end;
|
||||||
breakn:
|
breakn:
|
||||||
begin
|
begin
|
||||||
@ -295,5 +301,27 @@ unit optutils;
|
|||||||
Breakstack.Free;
|
Breakstack.Free;
|
||||||
end;
|
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.
|
end.
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user