SCM Repository
[diderot] Diff of /trunk/src/compiler/IL/ssa-fn.sml
Diff of /trunk/src/compiler/IL/ssa-fn.sml
Parent Directory
|
Revision Log
|
Patch
196 |
structure Tbl : MONO_HASH_TABLE where type Key.hash_key = var |
structure Tbl : MONO_HASH_TABLE where type Key.hash_key = var |
197 |
end |
end |
198 |
|
|
199 |
(* 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 |
200 |
|
* be in preorder with parents before children. |
201 |
|
*) |
202 |
val sortNodes : stmt -> node list |
val sortNodes : stmt -> node list |
203 |
|
|
204 |
end |
end |
527 |
end) |
end) |
528 |
end |
end |
529 |
|
|
530 |
(* 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 |
531 |
|
* be in preorder with parents before children. |
532 |
|
*) |
533 |
fun sortNodes stmt = let |
fun sortNodes stmt = let |
534 |
val {getFn, setFn} = PropList.newFlag (fn (ND{props, ...}) => props) |
val {getFn, setFn} = PropList.newFlag (fn (ND{props, ...}) => props) |
535 |
fun dfs (nd, l) = |
fun dfs (nd, l) = |
538 |
else ( |
else ( |
539 |
setFn (nd, true); |
setFn (nd, true); |
540 |
nd :: List.foldl dfs l (Node.succs nd)) |
nd :: List.foldl dfs l (Node.succs nd)) |
541 |
|
val nodes = dfs (Stmt.entry stmt, []) |
542 |
in |
in |
543 |
dfs (Stmt.entry stmt, []) |
List.app (fn nd => setFn(nd, false)) nodes; |
544 |
|
nodes |
545 |
end |
end |
546 |
|
|
547 |
end |
end |
|
Legend:
Removed from v.318 |
|
changed lines |
|
Added in v.319 |
|
|