SCM Repository
Diff of /trunk/src/compiler/IL/ssa-fn.sml
Parent Directory
|
Revision Log
|
Patch
revision 340, Mon Sep 13 15:34:36 2010 UTC | revision 341, Mon Sep 13 17:14:24 2010 UTC | |
---|---|---|
# | Line 201 | Line 201 |
201 | *) | *) |
202 | val sortNodes : stmt -> node list | val sortNodes : stmt -> node list |
203 | ||
204 | (* apply a function to all of the nodes in the graph rooted at the entry to the statement *) | |
205 | val applyToNodes : (node -> unit) -> stmt -> unit | |
206 | ||
207 | end | end |
208 | ||
209 | functor SSAFn (Op : OPERATORS) : SSA = | functor SSAFn (Op : OPERATORS) : SSA = |
# | Line 544 | Line 547 |
547 | nodes | nodes |
548 | end | end |
549 | ||
550 | (* apply a function to all of the nodes in the graph rooted at the entry to the statement *) | |
551 | fun applyToNodes (f : node -> unit) stmt = let | |
552 | val {getFn, setFn} = PropList.newFlag (fn (ND{props, ...}) => props) | |
553 | fun dfs (nd, l) = | |
554 | if getFn nd | |
555 | then l | |
556 | else ( | |
557 | f nd; (* visit *) | |
558 | setFn (nd, true); | |
559 | nd :: List.foldl dfs l (Node.succs nd)) | |
560 | val nodes = dfs (Stmt.entry stmt, []) | |
561 | in | |
562 | List.app (fn nd => setFn(nd, false)) nodes | |
563 | end | |
564 | ||
565 | end | end |
|
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |