Use a bforest::Set to represent CFG successor sets.

This has two advantages over the previous Vec<Ebb>:

- Duplicates are removed.
- Clearing the control flow graph is constant time.

The set of EBB successors is simply ordered by EBB number.
This commit is contained in:
Jakob Stoklund Olesen
2017-11-20 14:02:16 -08:00
parent cf45afa1e7
commit b5d4fb66d9
3 changed files with 40 additions and 42 deletions

View File

@@ -184,9 +184,9 @@ fn postorder_ebbs_loop(loop_analysis: &LoopAnalysis, cfg: &ControlFlowGraph, lp:
grey.insert(node);
stack.push(node);
// Get any children we've never seen before.
for child in cfg.get_successors(node) {
if loop_analysis.is_in_loop(*child, lp) && !grey.contains(child) {
stack.push(*child);
for child in cfg.succ_iter(node) {
if loop_analysis.is_in_loop(child, lp) && !grey.contains(&child) {
stack.push(child);
}
}
} else if !black.contains(&node) {