Regalloc: remove the transient LiveRangeContext data structure;

This commit is contained in:
Benjamin Bouvier
2019-09-12 19:32:43 +02:00
parent b9b1c842e9
commit 5beb10e77a
10 changed files with 108 additions and 143 deletions

View File

@@ -64,7 +64,6 @@ impl<'a> LivenessVerifier<'a> {
/// Check all instructions.
fn check_insts(&self, errors: &mut VerifierErrors) -> VerifierStepResult<()> {
let lr_ctx = self.liveness.context(&self.func.layout);
for ebb in self.func.layout.ebbs() {
for inst in self.func.layout.ebb_insts(ebb) {
let encoding = self.func.encodings[inst];
@@ -107,8 +106,8 @@ impl<'a> LivenessVerifier<'a> {
None => return fatal!(errors, inst, "{} has no live range", val),
};
debug_assert!(lr_ctx.order.inst_ebb(inst).unwrap() == ebb);
if !lr.reaches_use(inst, ebb, lr_ctx) {
debug_assert!(self.func.layout.inst_ebb(inst).unwrap() == ebb);
if !lr.reaches_use(inst, ebb, self.liveness.forest(), &self.func.layout) {
return fatal!(errors, inst, "{} is not live at this use", val);
}
@@ -180,7 +179,7 @@ impl<'a> LivenessVerifier<'a> {
}
// Now check the live-in intervals against the CFG.
for (mut ebb, end) in lr.liveins(self.liveness.context(l)) {
for (mut ebb, end) in lr.liveins(self.liveness.forest()) {
if !l.is_ebb_inserted(ebb) {
return fatal!(
errors,
@@ -204,13 +203,11 @@ impl<'a> LivenessVerifier<'a> {
}
};
let lr_ctx = self.liveness.context(&self.func.layout);
// Check all the EBBs in the interval independently.
loop {
// If `val` is live-in at `ebb`, it must be live at all the predecessors.
for BasicBlock { inst: pred, ebb } in self.cfg.pred_iter(ebb) {
if !lr.reaches_use(pred, ebb, lr_ctx) {
if !lr.reaches_use(pred, ebb, self.liveness.forest(), &self.func.layout) {
return fatal!(
errors,
pred,