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