Add a 'clear()' function to Context.

This includes adding `clear()` functions to its (transitive) members.
This commit is contained in:
Dan Gohman
2017-11-15 10:49:32 -08:00
parent 4c829f7c7f
commit 4d9aedbaca
10 changed files with 85 additions and 2 deletions

View File

@@ -35,6 +35,14 @@ impl TopoOrder {
}
}
/// Clear all data structures in this topological order.
pub fn clear(&mut self) {
self.preferred.clear();
self.next = 0;
self.visited.clear();
self.stack.clear();
}
/// Reset and initialize with a preferred sequence of EBBs. The resulting topological order is
/// guaranteed to contain all of the EBBs in `preferred` as well as any dominators.
pub fn reset<Ebbs>(&mut self, preferred: Ebbs)