|
@@ -163,11 +163,12 @@ unit optutils;
|
|
var
|
|
var
|
|
Continuestack : TFPList;
|
|
Continuestack : TFPList;
|
|
Breakstack : TFPList;
|
|
Breakstack : TFPList;
|
|
|
|
+ Exitsuccessor: TNode;
|
|
{ sets the successor nodes of a node tree block
|
|
{ sets the successor nodes of a node tree block
|
|
returns the first node of the tree if it's a controll flow node }
|
|
returns the first node of the tree if it's a controll flow node }
|
|
function DoSet(p : tnode;succ : tnode) : tnode;
|
|
function DoSet(p : tnode;succ : tnode) : tnode;
|
|
var
|
|
var
|
|
- hp1,hp2 : tnode;
|
|
|
|
|
|
+ hp1,hp2, oldexitsuccessor: tnode;
|
|
i : longint;
|
|
i : longint;
|
|
begin
|
|
begin
|
|
result:=nil;
|
|
result:=nil;
|
|
@@ -203,11 +204,15 @@ unit optutils;
|
|
blockn:
|
|
blockn:
|
|
begin
|
|
begin
|
|
result:=p;
|
|
result:=p;
|
|
|
|
+ oldexitsuccessor:=Exitsuccessor;
|
|
|
|
+ if nf_block_with_exit in p.flags then
|
|
|
|
+ Exitsuccessor:=succ;
|
|
DoSet(tblocknode(p).statements,succ);
|
|
DoSet(tblocknode(p).statements,succ);
|
|
if assigned(tblocknode(p).statements) then
|
|
if assigned(tblocknode(p).statements) then
|
|
p.successor:=tblocknode(p).statements
|
|
p.successor:=tblocknode(p).statements
|
|
else
|
|
else
|
|
p.successor:=succ;
|
|
p.successor:=succ;
|
|
|
|
+ Exitsuccessor:=oldexitsuccessor;
|
|
end;
|
|
end;
|
|
forn:
|
|
forn:
|
|
begin
|
|
begin
|
|
@@ -288,7 +293,7 @@ unit optutils;
|
|
exitn:
|
|
exitn:
|
|
begin
|
|
begin
|
|
result:=p;
|
|
result:=p;
|
|
- p.successor:=nil;
|
|
|
|
|
|
+ p.successor:=Exitsuccessor;
|
|
end;
|
|
end;
|
|
casen:
|
|
casen:
|
|
begin
|
|
begin
|
|
@@ -337,6 +342,7 @@ unit optutils;
|
|
begin
|
|
begin
|
|
Breakstack:=TFPList.Create;
|
|
Breakstack:=TFPList.Create;
|
|
Continuestack:=TFPList.Create;
|
|
Continuestack:=TFPList.Create;
|
|
|
|
+ Exitsuccessor:=nil;
|
|
DoSet(p,last);
|
|
DoSet(p,last);
|
|
Continuestack.Free;
|
|
Continuestack.Free;
|
|
Breakstack.Free;
|
|
Breakstack.Free;
|