From d469e3a7ef9968beefd872befbf94cd11fa53c36 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 7 May 2007 20:30:19 +0000 Subject: [PATCH] + do life dfa for exit git-svn-id: trunk@7299 - --- compiler/optdfa.pas | 29 ++++++++++++++++++++++++++++- compiler/optutils.pas | 3 --- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/compiler/optdfa.pas b/compiler/optdfa.pas index 30187341dc..29ffed1f11 100644 --- a/compiler/optdfa.pas +++ b/compiler/optdfa.pas @@ -45,6 +45,8 @@ unit optdfa; verbose, cpuinfo, symdef, + defutil, + procinfo, nutils, nbas,nflw,ncon,ninl,ncal, optbase,optutils; @@ -125,6 +127,7 @@ unit optdfa; var changed : boolean; + Resultnode : TNode; procedure CreateInfo(node : tnode); @@ -286,6 +289,16 @@ unit optdfa; { finally, update the life info of the node } UpdateLifeInfo(node,l); 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, goton, breakn, @@ -302,9 +315,22 @@ unit optdfa; var runs : integer; - + dfarec : tdfainfo; begin 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 inc(runs); changed:=false; @@ -317,6 +343,7 @@ unit optdfa; {$ifdef DEBUG_DFA} writeln('DFA solver iterations: ',runs); {$endif DEBUG_DFA} + resultnode.free; end; diff --git a/compiler/optutils.pas b/compiler/optutils.pas index 0838cbb1f5..4b2171426a 100644 --- a/compiler/optutils.pas +++ b/compiler/optutils.pas @@ -240,16 +240,13 @@ unit optutils; internalerror(2007050701); p.successor:=tgotonode(p).labelnode; end; - { exit is actually a jump to some final. code exitn: begin result:=p; p.successor:=nil; end; - } inlinen, calln, - exitn, withn, casen, tryexceptn,