Upgrade to rustfmt 0.8.0.
Lots of changes this time. Worked around what looks like a rustfmt bug in parse_inst_operands where a large match was nested inside Ok().
This commit is contained in:
@@ -118,21 +118,21 @@ mod tests {
|
||||
|
||||
// Register classes for testing.
|
||||
const GPR: RegClass = &RegClassData {
|
||||
name: "GPR",
|
||||
index: 0,
|
||||
width: 1,
|
||||
first: 28,
|
||||
subclasses: 0,
|
||||
mask: [0xf0000000, 0x0000000f, 0],
|
||||
};
|
||||
name: "GPR",
|
||||
index: 0,
|
||||
width: 1,
|
||||
first: 28,
|
||||
subclasses: 0,
|
||||
mask: [0xf0000000, 0x0000000f, 0],
|
||||
};
|
||||
const DPR: RegClass = &RegClassData {
|
||||
name: "DPR",
|
||||
index: 0,
|
||||
width: 2,
|
||||
first: 28,
|
||||
subclasses: 0,
|
||||
mask: [0x50000000, 0x0000000a, 0],
|
||||
};
|
||||
name: "DPR",
|
||||
index: 0,
|
||||
width: 2,
|
||||
first: 28,
|
||||
subclasses: 0,
|
||||
mask: [0x50000000, 0x0000000a, 0],
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn put_and_take() {
|
||||
|
||||
@@ -200,7 +200,10 @@ impl<'a> Context<'a> {
|
||||
|
||||
for lv in liveins {
|
||||
let value = lv.value;
|
||||
let affinity = self.liveness.get(value).expect("No live range for live-in").affinity;
|
||||
let affinity = self.liveness
|
||||
.get(value)
|
||||
.expect("No live range for live-in")
|
||||
.affinity;
|
||||
if let Affinity::Reg(rc_index) = affinity {
|
||||
let regclass = self.reginfo.rc(rc_index);
|
||||
match func.locations[value] {
|
||||
|
||||
@@ -69,10 +69,10 @@ impl LiveValueVec {
|
||||
/// Add a new live value to `values`.
|
||||
fn push(&mut self, value: Value, endpoint: Inst, affinity: Affinity) {
|
||||
self.values.push(LiveValue {
|
||||
value: value,
|
||||
endpoint: endpoint,
|
||||
affinity: affinity,
|
||||
});
|
||||
value: value,
|
||||
endpoint: endpoint,
|
||||
affinity: affinity,
|
||||
});
|
||||
}
|
||||
|
||||
/// Remove all elements.
|
||||
@@ -167,8 +167,7 @@ impl LiveValueTracker {
|
||||
self.idom_sets.get(&idom).expect("No stored live set for dominator");
|
||||
// Get just the values that are live-in to `ebb`.
|
||||
for &value in idom_live_list.as_slice(&self.idom_pool) {
|
||||
let lr = liveness.get(value)
|
||||
.expect("Immediate dominator value has no live range");
|
||||
let lr = liveness.get(value).expect("Immediate dominator value has no live range");
|
||||
|
||||
// Check if this value is live-in here.
|
||||
if let Some(endpoint) = lr.livein_local_end(ebb, program_order) {
|
||||
@@ -260,13 +259,16 @@ impl LiveValueTracker {
|
||||
|
||||
/// Save the current set of live values so it is associated with `idom`.
|
||||
fn save_idom_live_set(&mut self, idom: Inst) {
|
||||
let values = self.live.values.iter().map(|lv| lv.value);
|
||||
let values = self.live
|
||||
.values
|
||||
.iter()
|
||||
.map(|lv| lv.value);
|
||||
let pool = &mut self.idom_pool;
|
||||
// If there already is a set saved for `idom`, just keep it.
|
||||
self.idom_sets.entry(idom).or_insert_with(|| {
|
||||
let mut list = ValueList::default();
|
||||
list.extend(values, pool);
|
||||
list
|
||||
});
|
||||
let mut list = ValueList::default();
|
||||
list.extend(values, pool);
|
||||
list
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,8 +315,10 @@ impl Liveness {
|
||||
let recipe = func.encodings[inst].recipe();
|
||||
// Iterator of constraints, one per value operand.
|
||||
// TODO: Should we fail here if the instruction doesn't have a valid encoding?
|
||||
let mut operand_constraints =
|
||||
recipe_constraints.get(recipe).map(|c| c.ins).unwrap_or(&[]).iter();
|
||||
let mut operand_constraints = recipe_constraints.get(recipe)
|
||||
.map(|c| c.ins)
|
||||
.unwrap_or(&[])
|
||||
.iter();
|
||||
|
||||
for &arg in func.dfg[inst].arguments(&func.dfg.value_lists) {
|
||||
// Get the live range, create it as a dead range if necessary.
|
||||
|
||||
@@ -221,16 +221,14 @@ impl LiveRange {
|
||||
/// Return `Ok(n)` if `liveins[n]` already contains `ebb`.
|
||||
/// Otherwise, return `Err(n)` with the index where such an interval should be inserted.
|
||||
fn find_ebb_interval<PO: ProgramOrder>(&self, ebb: Ebb, order: &PO) -> Result<usize, usize> {
|
||||
self.liveins
|
||||
.binary_search_by(|intv| order.cmp(intv.begin, ebb))
|
||||
.or_else(|n| {
|
||||
// The interval at `n-1` may cover `ebb`.
|
||||
if n > 0 && order.cmp(self.liveins[n - 1].end, ebb) == Ordering::Greater {
|
||||
Ok(n - 1)
|
||||
} else {
|
||||
Err(n)
|
||||
}
|
||||
})
|
||||
self.liveins.binary_search_by(|intv| order.cmp(intv.begin, ebb)).or_else(|n| {
|
||||
// The interval at `n-1` may cover `ebb`.
|
||||
if n > 0 && order.cmp(self.liveins[n - 1].end, ebb) == Ordering::Greater {
|
||||
Ok(n - 1)
|
||||
} else {
|
||||
Err(n)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Extend the local interval for `ebb` so it reaches `to` which must belong to `ebb`.
|
||||
|
||||
Reference in New Issue
Block a user