SCM Repository
[diderot] Diff of /trunk/src/compiler/IL/forward-dfa-fn.sml
Diff of /trunk/src/compiler/IL/forward-dfa-fn.sml
Parent Directory
|
Revision Log
|
Patch
8 |
|
|
9 |
functor ForwardDFAFn (D : DOMAIN) :> sig |
functor ForwardDFAFn (D : DOMAIN) :> sig |
10 |
|
|
11 |
structure D : DOMAIN |
structure D : DOMAIN = D |
12 |
|
|
13 |
(* given the entry value and root statement, do the forward DFA on the CFG and |
(* given the entry value and root statement, do the forward DFA on the CFG and |
14 |
* return the list of nodes analysed. |
* return the list of nodes analysed. |
44 |
val anyChange = ref false |
val anyChange = ref false |
45 |
fun doNode nd = let |
fun doNode nd = let |
46 |
val inValue = D.join (List.map getOut (IL.Node.preds nd)) |
val inValue = D.join (List.map getOut (IL.Node.preds nd)) |
|
val outValue = D.transfer (inValue, nd) |
|
47 |
in |
in |
48 |
if D.same(getIn nd, inValue) |
if D.same(getIn nd, inValue) |
49 |
then () (* input unchanged, so output will be unchanged *) |
then () (* input unchanged, so output will be unchanged *) |
53 |
anyChange := true; |
anyChange := true; |
54 |
setIn (nd, inValue); |
setIn (nd, inValue); |
55 |
if D.same(getOut nd, outValue) |
if D.same(getOut nd, outValue) |
56 |
then setOut(nd, outValue) |
then () |
57 |
else () |
else setOut(nd, outValue) |
58 |
end |
end |
59 |
end |
end |
60 |
in |
in |
|
Legend:
Removed from v.416 |
|
changed lines |
|
Added in v.417 |
|
|