--- trunk/src/compiler/IL/ssa-fn.sml 2010/08/18 04:11:57 318 +++ trunk/src/compiler/IL/ssa-fn.sml 2010/08/18 04:13:08 319 @@ -196,7 +196,9 @@ structure Tbl : MONO_HASH_TABLE where type Key.hash_key = var end - (* DFS sorting of the graph rooted at the entry to a statement *) + (* DFS sorting of the graph rooted at the entry to a statement; the resulting list will + * be in preorder with parents before children. + *) val sortNodes : stmt -> node list end @@ -525,7 +527,9 @@ end) end - (* DFS sorting of the graph rooted at the entry to a statement *) + (* DFS sorting of the graph rooted at the entry to a statement; the resulting list will + * be in preorder with parents before children. + *) fun sortNodes stmt = let val {getFn, setFn} = PropList.newFlag (fn (ND{props, ...}) => props) fun dfs (nd, l) = @@ -534,8 +538,10 @@ else ( setFn (nd, true); nd :: List.foldl dfs l (Node.succs nd)) + val nodes = dfs (Stmt.entry stmt, []) in - dfs (Stmt.entry stmt, []) + List.app (fn nd => setFn(nd, false)) nodes; + nodes end end
Click to toggle
does not end with </html> tag
does not end with </body> tag
The output has ended thus: (Stmt.entry stmt, []) + List.app (fn nd => setFn(nd, false)) nodes; + nodes end end