Rename some local variables for consistency with the rest of the codebase.

This commit is contained in:
Dan Gohman
2018-04-18 17:02:32 -07:00
parent d122d16f79
commit eefa1de4da
2 changed files with 12 additions and 13 deletions

View File

@@ -84,7 +84,7 @@ impl Affinity {
/// ///
/// Note that this does not guarantee that the register allocator will pick a register that /// Note that this does not guarantee that the register allocator will pick a register that
/// satisfies the constraint. /// satisfies the constraint.
pub fn merge(&mut self, constraint: &OperandConstraint, reg_info: &RegInfo) { pub fn merge(&mut self, constraint: &OperandConstraint, reginfo: &RegInfo) {
match *self { match *self {
Affinity::Unassigned => *self = Self::new(constraint), Affinity::Unassigned => *self = Self::new(constraint),
Affinity::Reg(rc) => { Affinity::Reg(rc) => {
@@ -95,7 +95,7 @@ impl Affinity {
{ {
// If the register classes don't overlap, `intersect` returns `Unassigned`, and // If the register classes don't overlap, `intersect` returns `Unassigned`, and
// we just keep our previous affinity. // we just keep our previous affinity.
if let Some(subclass) = constraint.regclass.intersect_index(reg_info.rc(rc)) { if let Some(subclass) = constraint.regclass.intersect_index(reginfo.rc(rc)) {
// This constraint shrinks our preferred register class. // This constraint shrinks our preferred register class.
*self = Affinity::Reg(subclass); *self = Affinity::Reg(subclass);
} }

View File

@@ -197,7 +197,7 @@ fn get_or_create<'a>(
value: Value, value: Value,
isa: &TargetIsa, isa: &TargetIsa,
func: &Function, func: &Function,
enc_info: &EncInfo, encinfo: &EncInfo,
) -> &'a mut LiveRange { ) -> &'a mut LiveRange {
// It would be better to use `get_mut()` here, but that leads to borrow checker fighting // It would be better to use `get_mut()` here, but that leads to borrow checker fighting
// which can probably only be resolved by non-lexical lifetimes. // which can probably only be resolved by non-lexical lifetimes.
@@ -211,7 +211,7 @@ fn get_or_create<'a>(
def = inst.into(); def = inst.into();
// Initialize the affinity from the defining instruction's result constraints. // Initialize the affinity from the defining instruction's result constraints.
// Don't do this for call return values which are always tied to a single register. // Don't do this for call return values which are always tied to a single register.
affinity = enc_info affinity = encinfo
.operand_constraints(func.encodings[inst]) .operand_constraints(func.encodings[inst])
.and_then(|rc| rc.outs.get(rnum)) .and_then(|rc| rc.outs.get(rnum))
.map(Affinity::new) .map(Affinity::new)
@@ -385,8 +385,8 @@ impl Liveness {
self.ranges.clear(); self.ranges.clear();
// Get ISA data structures used for computing live range affinities. // Get ISA data structures used for computing live range affinities.
let enc_info = isa.encoding_info(); let encinfo = isa.encoding_info();
let reg_info = isa.register_info(); let reginfo = isa.register_info();
// The liveness computation needs to visit all uses, but the order doesn't matter. // The liveness computation needs to visit all uses, but the order doesn't matter.
// TODO: Perhaps this traversal of the function could be combined with a dead code // TODO: Perhaps this traversal of the function could be combined with a dead code
@@ -397,7 +397,7 @@ impl Liveness {
// TODO: If these parameters are really dead, we could remove them, except for the // TODO: If these parameters are really dead, we could remove them, except for the
// entry block which must match the function signature. // entry block which must match the function signature.
for &arg in func.dfg.ebb_params(ebb) { for &arg in func.dfg.ebb_params(ebb) {
get_or_create(&mut self.ranges, arg, isa, func, &enc_info); get_or_create(&mut self.ranges, arg, isa, func, &encinfo);
} }
for inst in func.layout.ebb_insts(ebb) { for inst in func.layout.ebb_insts(ebb) {
@@ -408,19 +408,18 @@ impl Liveness {
// TODO: When we implement DCE, we can use the absence of a live range to indicate // TODO: When we implement DCE, we can use the absence of a live range to indicate
// an unused value. // an unused value.
for &def in func.dfg.inst_results(inst) { for &def in func.dfg.inst_results(inst) {
get_or_create(&mut self.ranges, def, isa, func, &enc_info); get_or_create(&mut self.ranges, def, isa, func, &encinfo);
} }
// Iterator of constraints, one per value operand. // Iterator of constraints, one per value operand.
let encoding = func.encodings[inst]; let encoding = func.encodings[inst];
let operand_constraint_slice: &[OperandConstraint] = enc_info let operand_constraint_slice: &[OperandConstraint] =
.operand_constraints(encoding) encinfo.operand_constraints(encoding).map_or(&[], |c| c.ins);
.map_or(&[], |c| c.ins);
let mut operand_constraints = operand_constraint_slice.iter(); let mut operand_constraints = operand_constraint_slice.iter();
for &arg in func.dfg.inst_args(inst) { for &arg in func.dfg.inst_args(inst) {
// Get the live range, create it as a dead range if necessary. // Get the live range, create it as a dead range if necessary.
let lr = get_or_create(&mut self.ranges, arg, isa, func, &enc_info); let lr = get_or_create(&mut self.ranges, arg, isa, func, &encinfo);
// Extend the live range to reach this use. // Extend the live range to reach this use.
extend_to_use( extend_to_use(
@@ -437,7 +436,7 @@ impl Liveness {
// operands described by `operand_constraints`. Variable arguments are either // operands described by `operand_constraints`. Variable arguments are either
// EBB arguments or call/return ABI arguments. // EBB arguments or call/return ABI arguments.
if let Some(constraint) = operand_constraints.next() { if let Some(constraint) = operand_constraints.next() {
lr.affinity.merge(constraint, &reg_info); lr.affinity.merge(constraint, &reginfo);
} }
} }
} }