Remove unused pred_pos
This commit is contained in:
24
src/cfg.rs
24
src/cfg.rs
@@ -26,15 +26,6 @@ pub struct CFGInfo {
|
||||
pub block_entry: Vec<ProgPoint>,
|
||||
/// For each block, the last instruction.
|
||||
pub block_exit: Vec<ProgPoint>,
|
||||
/// For each block, what is its position in its successor's preds,
|
||||
/// if it has a single successor?
|
||||
///
|
||||
/// (Because we require split critical edges, we always either have a single
|
||||
/// successor (which itself may have multiple preds), or we have multiple
|
||||
/// successors but each successor itself has only one pred; so we can store
|
||||
/// just one value per block and always know any block's position in its
|
||||
/// successors' preds lists.)
|
||||
pub pred_pos: Vec<usize>,
|
||||
/// For each block, what is the approximate loop depth?
|
||||
///
|
||||
/// This measure is fully precise iff the input CFG is reducible
|
||||
@@ -60,7 +51,6 @@ impl CFGInfo {
|
||||
let mut vreg_def_blockparam = vec![(Block::invalid(), 0); f.num_vregs()];
|
||||
let mut block_entry = vec![ProgPoint::before(Inst::invalid()); f.blocks()];
|
||||
let mut block_exit = vec![ProgPoint::before(Inst::invalid()); f.blocks()];
|
||||
let mut pred_pos = vec![0; f.blocks()];
|
||||
let mut backedge_in = vec![0; f.blocks()];
|
||||
let mut backedge_out = vec![0; f.blocks()];
|
||||
|
||||
@@ -88,12 +78,11 @@ impl CFGInfo {
|
||||
// (this block).
|
||||
let preds = f.block_preds(block).len() + if block == f.entry_block() { 1 } else { 0 };
|
||||
if preds > 1 {
|
||||
for (i, &pred) in f.block_preds(block).iter().enumerate() {
|
||||
for &pred in f.block_preds(block) {
|
||||
let succs = f.block_succs(pred).len();
|
||||
if succs > 1 {
|
||||
return Err(RegAllocError::CritEdge(pred, block));
|
||||
}
|
||||
pred_pos[pred.index()] = i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +142,6 @@ impl CFGInfo {
|
||||
vreg_def_blockparam,
|
||||
block_entry,
|
||||
block_exit,
|
||||
pred_pos,
|
||||
approx_loop_depth,
|
||||
})
|
||||
}
|
||||
@@ -161,14 +149,4 @@ impl CFGInfo {
|
||||
pub fn dominates(&self, a: Block, b: Block) -> bool {
|
||||
domtree::dominates(&self.domtree[..], a, b)
|
||||
}
|
||||
|
||||
/// Return the position of this block in its successor's predecessor list.
|
||||
///
|
||||
/// Because the CFG must have split critical edges, we actually do not need
|
||||
/// to know *which* successor: if there is more than one, then each
|
||||
/// successor has only one predecessor (that's this block), so the answer is
|
||||
/// `0` no matter which successor we are considering.
|
||||
pub fn pred_position(&self, block: Block) -> usize {
|
||||
self.pred_pos[block.index()]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user