Make the DominatorTree reusable.

Add a compute() method which can recompute a dominator tree for
different functions.

Add a dominator tree data to the cretonne::Context.
This commit is contained in:
Jakob Stoklund Olesen
2017-02-17 13:09:41 -08:00
parent 77a7ad88f4
commit 85fa68023c
3 changed files with 37 additions and 14 deletions

View File

@@ -41,7 +41,7 @@ impl SubTest for TestDomtree {
fn run(&self, func: Cow<Function>, context: &Context) -> Result<()> {
let func = func.borrow();
let cfg = ControlFlowGraph::with_function(func);
let domtree = DominatorTree::new(func, &cfg);
let domtree = DominatorTree::with_function(func, &cfg);
// Build an expected domtree from the source annotations.
let mut expected = HashMap::new();