Move verify calls out of Context.
Also, move flowgraph() calls out of filetest and into the passes that need them so that filetest doesn't have embedded knowledge of these dependencies. This resolves a TODO about the way Context was running the verifier, and it makes the Context functions and the filetest runners more transparent. This also fixes simple_gvn to use the existing dominator tree rather than computing its own.
This commit is contained in:
@@ -131,6 +131,23 @@ impl ControlFlowGraph {
|
||||
pub fn get_successors(&self, ebb: Ebb) -> &[Ebb] {
|
||||
&self.data[ebb].successors
|
||||
}
|
||||
|
||||
/// Check if the CFG is in a valid state.
|
||||
///
|
||||
/// Note that this doesn't perform any kind of validity checks. It simply checks if the
|
||||
/// `compute()` method has been called since the last `clear()`. It does not check that the
|
||||
/// CFG is consistent with the function.
|
||||
pub fn is_valid(&self) -> bool {
|
||||
self.entry_block.is_some()
|
||||
}
|
||||
|
||||
/// Conveneince function to call `compute` if `compute` hasn't been called
|
||||
/// since the last `clear()`.
|
||||
pub fn ensure(&mut self, func: &Function) {
|
||||
if !self.is_valid() {
|
||||
self.compute(func)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user