mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 04:19:07 +02:00
+ do life dfa for exit
git-svn-id: trunk@7299 -
This commit is contained in:
parent
c0d27b5482
commit
d469e3a7ef
@ -45,6 +45,8 @@ unit optdfa;
|
|||||||
verbose,
|
verbose,
|
||||||
cpuinfo,
|
cpuinfo,
|
||||||
symdef,
|
symdef,
|
||||||
|
defutil,
|
||||||
|
procinfo,
|
||||||
nutils,
|
nutils,
|
||||||
nbas,nflw,ncon,ninl,ncal,
|
nbas,nflw,ncon,ninl,ncal,
|
||||||
optbase,optutils;
|
optbase,optutils;
|
||||||
@ -125,6 +127,7 @@ unit optdfa;
|
|||||||
|
|
||||||
var
|
var
|
||||||
changed : boolean;
|
changed : boolean;
|
||||||
|
Resultnode : TNode;
|
||||||
|
|
||||||
procedure CreateInfo(node : tnode);
|
procedure CreateInfo(node : tnode);
|
||||||
|
|
||||||
@ -286,6 +289,16 @@ unit optdfa;
|
|||||||
{ finally, update the life info of the node }
|
{ finally, update the life info of the node }
|
||||||
UpdateLifeInfo(node,l);
|
UpdateLifeInfo(node,l);
|
||||||
end;
|
end;
|
||||||
|
exitn:
|
||||||
|
begin
|
||||||
|
if not(is_void(current_procinfo.procdef.returndef)) then
|
||||||
|
begin
|
||||||
|
{ get info from faked resultnode }
|
||||||
|
node.optinfo^.use:=resultnode.optinfo^.use;
|
||||||
|
node.optinfo^.life:=node.optinfo^.use;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
nothingn,
|
||||||
continuen,
|
continuen,
|
||||||
goton,
|
goton,
|
||||||
breakn,
|
breakn,
|
||||||
@ -302,9 +315,22 @@ unit optdfa;
|
|||||||
|
|
||||||
var
|
var
|
||||||
runs : integer;
|
runs : integer;
|
||||||
|
dfarec : tdfainfo;
|
||||||
begin
|
begin
|
||||||
runs:=0;
|
runs:=0;
|
||||||
|
if not(is_void(current_procinfo.procdef.returndef)) then
|
||||||
|
begin
|
||||||
|
{ create a fake node using the result }
|
||||||
|
resultnode:=load_result_node;
|
||||||
|
resultnode.allocoptinfo;
|
||||||
|
dfarec.use:=@resultnode.optinfo^.use;
|
||||||
|
dfarec.def:=@resultnode.optinfo^.def;
|
||||||
|
dfarec.map:=map;
|
||||||
|
AddDefUse(resultnode,@dfarec);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
resultnode:=nil;
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
inc(runs);
|
inc(runs);
|
||||||
changed:=false;
|
changed:=false;
|
||||||
@ -317,6 +343,7 @@ unit optdfa;
|
|||||||
{$ifdef DEBUG_DFA}
|
{$ifdef DEBUG_DFA}
|
||||||
writeln('DFA solver iterations: ',runs);
|
writeln('DFA solver iterations: ',runs);
|
||||||
{$endif DEBUG_DFA}
|
{$endif DEBUG_DFA}
|
||||||
|
resultnode.free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -240,16 +240,13 @@ unit optutils;
|
|||||||
internalerror(2007050701);
|
internalerror(2007050701);
|
||||||
p.successor:=tgotonode(p).labelnode;
|
p.successor:=tgotonode(p).labelnode;
|
||||||
end;
|
end;
|
||||||
{ exit is actually a jump to some final. code
|
|
||||||
exitn:
|
exitn:
|
||||||
begin
|
begin
|
||||||
result:=p;
|
result:=p;
|
||||||
p.successor:=nil;
|
p.successor:=nil;
|
||||||
end;
|
end;
|
||||||
}
|
|
||||||
inlinen,
|
inlinen,
|
||||||
calln,
|
calln,
|
||||||
exitn,
|
|
||||||
withn,
|
withn,
|
||||||
casen,
|
casen,
|
||||||
tryexceptn,
|
tryexceptn,
|
||||||
|
Loading…
Reference in New Issue
Block a user