Run the post-regalloc verification inside the regalloc context.
This means that we can verify the basics with verify_context before moving on to verifying the liveness information. Live ranges are now verified immediately after computing them and after register allocation is complete.
This commit is contained in:
@@ -54,7 +54,7 @@ impl Context {
|
||||
/// The `TargetIsa` argument is currently unused, but the verifier will soon be able to also
|
||||
/// check ISA-dependent constraints.
|
||||
pub fn verify<'a, ISA: Into<Option<&'a TargetIsa>>>(&self, _isa: ISA) -> verifier::Result {
|
||||
verifier::verify_context(self)
|
||||
verifier::verify_context(&self.func, &self.cfg, &self.domtree)
|
||||
}
|
||||
|
||||
/// Run the verifier only if the `enable_verifier` setting is true.
|
||||
@@ -81,7 +81,6 @@ impl Context {
|
||||
/// Run the register allocator.
|
||||
pub fn regalloc(&mut self, isa: &TargetIsa) -> CtonResult {
|
||||
self.regalloc
|
||||
.run(isa, &mut self.func, &self.cfg, &self.domtree)?;
|
||||
self.verify_if(isa)
|
||||
.run(isa, &mut self.func, &self.cfg, &self.domtree)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use regalloc::coloring::Coloring;
|
||||
use regalloc::live_value_tracker::LiveValueTracker;
|
||||
use regalloc::liveness::Liveness;
|
||||
use result::CtonResult;
|
||||
use verifier::verify_liveness;
|
||||
use verifier::{verify_context, verify_liveness};
|
||||
|
||||
/// Persistent memory allocations for register allocation.
|
||||
pub struct Context {
|
||||
@@ -62,6 +62,10 @@ impl Context {
|
||||
self.coloring
|
||||
.run(isa, func, domtree, &mut self.liveness, &mut self.tracker);
|
||||
|
||||
if isa.flags().enable_verifier() {
|
||||
verify_context(func, cfg, domtree)?;
|
||||
verify_liveness(isa, func, cfg, &self.liveness)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ use ir::entities::AnyEntity;
|
||||
use ir::instructions::{InstructionFormat, BranchInfo, ResolvedConstraint, CallInfo};
|
||||
use ir::{types, Function, ValueDef, Ebb, Inst, SigRef, FuncRef, ValueList, JumpTable, StackSlot,
|
||||
Value, Type};
|
||||
use Context;
|
||||
use std::error as std_error;
|
||||
use std::fmt::{self, Display, Formatter};
|
||||
use std::result;
|
||||
@@ -114,11 +113,12 @@ pub fn verify_function(func: &Function) -> Result {
|
||||
Verifier::new(func).run()
|
||||
}
|
||||
|
||||
/// Verify `ctx`.
|
||||
pub fn verify_context(ctx: &Context) -> Result {
|
||||
let verifier = Verifier::new(&ctx.func);
|
||||
verifier.domtree_integrity(&ctx.domtree)?;
|
||||
verifier.cfg_integrity(&ctx.cfg)?;
|
||||
/// Verify `func` after checking the integrity of associated context data structures `cfg` and
|
||||
/// `domtree`.
|
||||
pub fn verify_context(func: &Function, cfg: &ControlFlowGraph, domtree: &DominatorTree) -> Result {
|
||||
let verifier = Verifier::new(func);
|
||||
verifier.cfg_integrity(cfg)?;
|
||||
verifier.domtree_integrity(domtree)?;
|
||||
verifier.run()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user