Regalloc: remove the transient LiveRangeContext data structure;
This commit is contained in:
@@ -118,8 +118,12 @@ impl<'a> CssaVerifier<'a> {
|
||||
if self.preorder.dominates(prev_ebb, def_ebb)
|
||||
&& self.domtree.dominates(prev_def, def, &self.func.layout)
|
||||
{
|
||||
let ctx = self.liveness.context(&self.func.layout);
|
||||
if self.liveness[prev_val].overlaps_def(def, def_ebb, ctx) {
|
||||
if self.liveness[prev_val].overlaps_def(
|
||||
def,
|
||||
def_ebb,
|
||||
self.liveness.forest(),
|
||||
&self.func.layout,
|
||||
) {
|
||||
return fatal!(
|
||||
errors,
|
||||
val,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -334,10 +334,10 @@ impl<'a> LocationVerifier<'a> {
|
||||
let lr = &liveness[value];
|
||||
if is_after_branch && unique_predecessor {
|
||||
// Forward diversions based on the targeted branch.
|
||||
if !lr.is_livein(ebb, liveness.context(&self.func.layout)) {
|
||||
if !lr.is_livein(ebb, liveness.forest(), &self.func.layout) {
|
||||
val_to_remove.push(value)
|
||||
}
|
||||
} else if lr.is_livein(ebb, liveness.context(&self.func.layout)) {
|
||||
} else if lr.is_livein(ebb, liveness.forest(), &self.func.layout) {
|
||||
return fatal!(
|
||||
errors,
|
||||
inst,
|
||||
@@ -359,7 +359,7 @@ impl<'a> LocationVerifier<'a> {
|
||||
for (&value, d) in divert.iter() {
|
||||
let lr = &liveness[value];
|
||||
if let Some(ebb) = ebb {
|
||||
if lr.is_livein(ebb, liveness.context(&self.func.layout)) {
|
||||
if lr.is_livein(ebb, liveness.forest(), &self.func.layout) {
|
||||
return fatal!(
|
||||
errors,
|
||||
inst,
|
||||
@@ -371,7 +371,7 @@ impl<'a> LocationVerifier<'a> {
|
||||
}
|
||||
}
|
||||
for ebb in self.func.jump_tables[jt].iter() {
|
||||
if lr.is_livein(*ebb, liveness.context(&self.func.layout)) {
|
||||
if lr.is_livein(*ebb, liveness.forest(), &self.func.layout) {
|
||||
return fatal!(
|
||||
errors,
|
||||
inst,
|
||||
|
||||
Reference in New Issue
Block a user