Update to the rustfmt in rust 1.28, which is now stable.
Also, rustfmt's --write-mode=check is now named --check.
This commit is contained in:
@@ -621,7 +621,8 @@ impl<F: Forest> Path<F> {
|
||||
|
||||
/// Update the critical key for the right sibling node at `level`.
|
||||
fn update_right_crit_key(&self, level: usize, crit_key: F::Key, pool: &mut NodePool<F>) {
|
||||
let bl = self.right_sibling_branch_level(level, pool)
|
||||
let bl = self
|
||||
.right_sibling_branch_level(level, pool)
|
||||
.expect("No right sibling exists");
|
||||
match pool[self.node[bl]] {
|
||||
NodeData::Inner { ref mut keys, .. } => {
|
||||
|
||||
@@ -151,7 +151,8 @@ fn relax_branch(
|
||||
// Pick the first encoding that can handle the branch range.
|
||||
let dfg = &cur.func.dfg;
|
||||
let ctrl_type = dfg.ctrl_typevar(inst);
|
||||
if let Some(enc) = isa.legal_encodings(cur.func, &dfg[inst], ctrl_type)
|
||||
if let Some(enc) = isa
|
||||
.legal_encodings(cur.func, &dfg[inst], ctrl_type)
|
||||
.find(|&enc| {
|
||||
let range = encinfo.branch_range(enc).expect("Branch with no range");
|
||||
if !range.contains(offset, dest_offset) {
|
||||
|
||||
@@ -38,14 +38,15 @@ pub fn shrink_instructions(func: &mut Function, isa: &TargetIsa) {
|
||||
| InstructionData::RegSpill { .. } => {
|
||||
divert.apply(&func.dfg[inst]);
|
||||
continue;
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
let ctrl_type = func.dfg.ctrl_typevar(inst);
|
||||
|
||||
// Pick the last encoding with constraints that are satisfied.
|
||||
let best_enc = isa.legal_encodings(func, &func.dfg[inst], ctrl_type)
|
||||
let best_enc = isa
|
||||
.legal_encodings(func, &func.dfg[inst], ctrl_type)
|
||||
.filter(|e| encinfo.constraints[e.recipe()].satisfied(inst, &divert, &func))
|
||||
.min_by_key(|e| encinfo.bytes(*e))
|
||||
.unwrap();
|
||||
|
||||
@@ -752,7 +752,8 @@ impl<'c, 'f> ir::InstInserterBase<'c> for &'c mut EncCursor<'f> {
|
||||
// Assign an encoding.
|
||||
// XXX Is there a way to describe this error to the user?
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(match_wild_err_arm))]
|
||||
match self.isa
|
||||
match self
|
||||
.isa
|
||||
.encode(&self.func, &self.func.dfg[inst], ctrl_typevar)
|
||||
{
|
||||
Ok(e) => self.func.encodings[inst] = e,
|
||||
|
||||
@@ -422,7 +422,8 @@ impl DominatorTree {
|
||||
// Get an iterator with just the reachable, already visited predecessors to `ebb`.
|
||||
// Note that during the first pass, `rpo_number` is 1 for reachable blocks that haven't
|
||||
// been visited yet, 0 for unreachable blocks.
|
||||
let mut reachable_preds = cfg.pred_iter(ebb)
|
||||
let mut reachable_preds = cfg
|
||||
.pred_iter(ebb)
|
||||
.filter(|&BasicBlock { ebb: pred, .. }| self.nodes[pred].rpo_number > 1);
|
||||
|
||||
// The RPO must visit at least one predecessor before this node.
|
||||
@@ -453,7 +454,8 @@ impl DominatorTree {
|
||||
}
|
||||
// We use the RPO comparison on the postorder list so we invert the operands of the
|
||||
// comparison
|
||||
let old_ebb_postorder_index = self.postorder
|
||||
let old_ebb_postorder_index = self
|
||||
.postorder
|
||||
.as_slice()
|
||||
.binary_search_by(|probe| self.rpo_cmp_ebb(old_ebb, *probe))
|
||||
.expect("the old ebb is not declared to the dominator tree");
|
||||
|
||||
@@ -62,7 +62,8 @@ impl Signature {
|
||||
/// Even if there are no stack arguments, this will set `params` to `Some(0)` instead
|
||||
/// of `None`. This indicates that the signature has been legalized.
|
||||
pub fn compute_argument_bytes(&mut self) {
|
||||
let bytes = self.params
|
||||
let bytes = self
|
||||
.params
|
||||
.iter()
|
||||
.filter_map(|arg| match arg.location {
|
||||
ArgumentLoc::Stack(offset) if offset >= 0 => {
|
||||
|
||||
@@ -182,7 +182,8 @@ impl Layout {
|
||||
/// Assign a valid sequence number to `inst` such that the numbers are still monotonic. This may
|
||||
/// require renumbering.
|
||||
fn assign_inst_seq(&mut self, inst: Inst) {
|
||||
let ebb = self.inst_ebb(inst)
|
||||
let ebb = self
|
||||
.inst_ebb(inst)
|
||||
.expect("inst must be inserted before assigning an seq");
|
||||
|
||||
// Get the sequence number immediately before `inst`.
|
||||
@@ -569,7 +570,8 @@ impl Layout {
|
||||
/// Insert `inst` before the instruction `before` in the same EBB.
|
||||
pub fn insert_inst(&mut self, inst: Inst, before: Inst) {
|
||||
debug_assert_eq!(self.inst_ebb(inst), None);
|
||||
let ebb = self.inst_ebb(before)
|
||||
let ebb = self
|
||||
.inst_ebb(before)
|
||||
.expect("Instruction before insertion point not in the layout");
|
||||
let after = self.insts[before].prev;
|
||||
{
|
||||
@@ -643,7 +645,8 @@ impl Layout {
|
||||
/// i4
|
||||
/// ```
|
||||
pub fn split_ebb(&mut self, new_ebb: Ebb, before: Inst) {
|
||||
let old_ebb = self.inst_ebb(before)
|
||||
let old_ebb = self
|
||||
.inst_ebb(before)
|
||||
.expect("The `before` instruction must be in the layout");
|
||||
debug_assert!(!self.is_ebb_inserted(new_ebb));
|
||||
|
||||
|
||||
@@ -309,7 +309,8 @@ impl StackSlots {
|
||||
let size = spill_size(ty);
|
||||
|
||||
// Find the smallest existing slot that can fit the type.
|
||||
if let Some(&ss) = self.emergency
|
||||
if let Some(&ss) = self
|
||||
.emergency
|
||||
.iter()
|
||||
.filter(|&&ss| self[ss].size >= size && !in_use.contains(&ss.into()))
|
||||
.min_by_key(|&&ss| self[ss].size)
|
||||
@@ -318,7 +319,8 @@ impl StackSlots {
|
||||
}
|
||||
|
||||
// Alternatively, use the largest available slot and make it larger.
|
||||
if let Some(&ss) = self.emergency
|
||||
if let Some(&ss) = self
|
||||
.emergency
|
||||
.iter()
|
||||
.filter(|&&ss| !in_use.contains(&ss.into()))
|
||||
.max_by_key(|&&ss| self[ss].size)
|
||||
|
||||
@@ -345,7 +345,8 @@ fn expand_fcvt_to_sint(
|
||||
let mut pos = FuncCursor::new(func).after_inst(inst);
|
||||
pos.use_srcloc(inst);
|
||||
|
||||
let is_done = pos.ins()
|
||||
let is_done = pos
|
||||
.ins()
|
||||
.icmp_imm(IntCC::NotEqual, result, 1 << (ty.lane_bits() - 1));
|
||||
pos.ins().brnz(is_done, done, &[]);
|
||||
|
||||
|
||||
@@ -13,11 +13,7 @@ pub trait IteratorExtras: Iterator {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> IteratorExtras for T
|
||||
where
|
||||
T: Iterator,
|
||||
{
|
||||
}
|
||||
impl<T> IteratorExtras for T where T: Iterator {}
|
||||
|
||||
/// Adjacent pairs iterator returned by `adjacent_pairs()`.
|
||||
///
|
||||
|
||||
@@ -187,7 +187,8 @@ fn legalize_inst_results<ResType>(pos: &mut FuncCursor, mut get_abi_type: ResTyp
|
||||
where
|
||||
ResType: FnMut(&Function, usize) -> AbiParam,
|
||||
{
|
||||
let call = pos.current_inst()
|
||||
let call = pos
|
||||
.current_inst()
|
||||
.expect("Cursor must point to a call instruction");
|
||||
|
||||
// We theoretically allow for call instructions that return a number of fixed results before
|
||||
@@ -419,7 +420,8 @@ fn legalize_inst_arguments<ArgType>(
|
||||
) where
|
||||
ArgType: FnMut(&Function, usize) -> AbiParam,
|
||||
{
|
||||
let inst = pos.current_inst()
|
||||
let inst = pos
|
||||
.current_inst()
|
||||
.expect("Cursor must point to a call instruction");
|
||||
|
||||
// Lift the value list out of the call instruction so we modify it.
|
||||
@@ -550,7 +552,8 @@ pub fn handle_return_abi(inst: Inst, func: &mut Function, cfg: &ControlFlowGraph
|
||||
|
||||
// Count the special-purpose return values (`link`, `sret`, and `vmctx`) that were appended to
|
||||
// the legalized signature.
|
||||
let special_args = func.signature
|
||||
let special_args = func
|
||||
.signature
|
||||
.returns
|
||||
.iter()
|
||||
.rev()
|
||||
@@ -591,7 +594,8 @@ pub fn handle_return_abi(inst: Inst, func: &mut Function, cfg: &ControlFlowGraph
|
||||
// A `link`/`sret`/`vmctx` return value can only appear in a signature that has a
|
||||
// unique matching argument. They are appended at the end, so search the signature from
|
||||
// the end.
|
||||
let idx = pos.func
|
||||
let idx = pos
|
||||
.func
|
||||
.signature
|
||||
.params
|
||||
.iter()
|
||||
@@ -599,7 +603,8 @@ pub fn handle_return_abi(inst: Inst, func: &mut Function, cfg: &ControlFlowGraph
|
||||
.expect("No matching special purpose argument.");
|
||||
// Get the corresponding entry block value and add it to the return instruction's
|
||||
// arguments.
|
||||
let val = pos.func
|
||||
let val = pos
|
||||
.func
|
||||
.dfg
|
||||
.ebb_params(pos.func.layout.entry_block().unwrap())[idx];
|
||||
debug_assert_eq!(pos.func.dfg.value_type(val), arg.value_type);
|
||||
@@ -641,9 +646,11 @@ fn spill_entry_params(func: &mut Function, entry: Ebb) {
|
||||
/// or calls between writing the stack slots and the call instruction. Writing the slots earlier
|
||||
/// could help reduce register pressure before the call.
|
||||
fn spill_call_arguments(pos: &mut FuncCursor) -> bool {
|
||||
let inst = pos.current_inst()
|
||||
let inst = pos
|
||||
.current_inst()
|
||||
.expect("Cursor must point to a call instruction");
|
||||
let sig_ref = pos.func
|
||||
let sig_ref = pos
|
||||
.func
|
||||
.dfg
|
||||
.call_signature(inst)
|
||||
.expect("Call instruction expected.");
|
||||
|
||||
@@ -37,7 +37,8 @@ pub fn expand_global_value(
|
||||
/// Expand a `global_value` instruction for a vmctx global.
|
||||
fn vmctx_addr(inst: ir::Inst, func: &mut ir::Function, offset: i64) {
|
||||
// Get the value representing the `vmctx` argument.
|
||||
let vmctx = func.special_param(ir::ArgumentPurpose::VMContext)
|
||||
let vmctx = func
|
||||
.special_param(ir::ArgumentPurpose::VMContext)
|
||||
.expect("Missing vmctx parameter");
|
||||
|
||||
// Simply replace the `global_value` instruction with an `iadd_imm`, reusing the result value.
|
||||
|
||||
@@ -61,20 +61,23 @@ fn dynamic_addr(
|
||||
let oob;
|
||||
if access_size == 1 {
|
||||
// `offset > bound - 1` is the same as `offset >= bound`.
|
||||
oob = pos.ins()
|
||||
oob = pos
|
||||
.ins()
|
||||
.icmp(IntCC::UnsignedGreaterThanOrEqual, offset, bound);
|
||||
} else if access_size <= min_size {
|
||||
// We know that bound >= min_size, so here we can compare `offset > bound - access_size` without
|
||||
// wrapping.
|
||||
let adj_bound = pos.ins().iadd_imm(bound, -access_size);
|
||||
oob = pos.ins()
|
||||
oob = pos
|
||||
.ins()
|
||||
.icmp(IntCC::UnsignedGreaterThan, offset, adj_bound);
|
||||
} else {
|
||||
// We need an overflow check for the adjusted offset.
|
||||
let access_size_val = pos.ins().iconst(offset_ty, access_size);
|
||||
let (adj_offset, overflow) = pos.ins().iadd_cout(offset, access_size_val);
|
||||
pos.ins().trapnz(overflow, ir::TrapCode::HeapOutOfBounds);
|
||||
oob = pos.ins()
|
||||
oob = pos
|
||||
.ins()
|
||||
.icmp(IntCC::UnsignedGreaterThan, adj_offset, bound);
|
||||
}
|
||||
pos.ins().trapnz(oob, ir::TrapCode::HeapOutOfBounds);
|
||||
|
||||
@@ -139,7 +139,8 @@ fn split_any(
|
||||
.expect("Branches must have value lists.");
|
||||
let num_args = args.len(&pos.func.dfg.value_lists);
|
||||
// Get the old value passed to the EBB argument we're repairing.
|
||||
let old_arg = args.get(fixed_args + repair.num, &pos.func.dfg.value_lists)
|
||||
let old_arg = args
|
||||
.get(fixed_args + repair.num, &pos.func.dfg.value_lists)
|
||||
.expect("Too few branch arguments");
|
||||
|
||||
// It's possible that the CFG's predecessor list has duplicates. Detect them here.
|
||||
@@ -153,13 +154,15 @@ fn split_any(
|
||||
let (lo, hi) = split_value(pos, old_arg, repair.concat, &mut repairs);
|
||||
|
||||
// The `lo` part replaces the original argument.
|
||||
*args.get_mut(fixed_args + repair.num, &mut pos.func.dfg.value_lists)
|
||||
*args
|
||||
.get_mut(fixed_args + repair.num, &mut pos.func.dfg.value_lists)
|
||||
.unwrap() = lo;
|
||||
|
||||
// The `hi` part goes at the end. Since multiple repairs may have been scheduled to the
|
||||
// same EBB, there could be multiple arguments missing.
|
||||
if num_args > fixed_args + repair.hi_num {
|
||||
*args.get_mut(fixed_args + repair.hi_num, &mut pos.func.dfg.value_lists)
|
||||
*args
|
||||
.get_mut(fixed_args + repair.hi_num, &mut pos.func.dfg.value_lists)
|
||||
.unwrap() = hi;
|
||||
} else {
|
||||
// We need to append one or more arguments. If we're adding more than one argument,
|
||||
|
||||
@@ -334,7 +334,8 @@ pub fn do_postopt(func: &mut Function, isa: &TargetIsa) {
|
||||
optimize_cpu_flags(&mut pos, inst, last_flags_clobber, isa);
|
||||
|
||||
// Track the most recent seen instruction that clobbers the flags.
|
||||
if let Some(constraints) = isa.encoding_info()
|
||||
if let Some(constraints) = isa
|
||||
.encoding_info()
|
||||
.operand_constraints(pos.func.encodings[inst])
|
||||
{
|
||||
if constraints.clobbers_flags {
|
||||
|
||||
@@ -307,7 +307,8 @@ impl<'a> Context<'a> {
|
||||
// Create a live range for the new value.
|
||||
// TODO: Should we handle ghost values?
|
||||
let affinity = Affinity::new(
|
||||
&self.encinfo
|
||||
&self
|
||||
.encinfo
|
||||
.operand_constraints(pos.func.encodings[inst])
|
||||
.expect("Bad copy encoding")
|
||||
.outs[0],
|
||||
@@ -352,7 +353,8 @@ impl<'a> Context<'a> {
|
||||
// Create a live range for the new value.
|
||||
// TODO: Handle affinity for ghost values.
|
||||
let affinity = Affinity::new(
|
||||
&self.encinfo
|
||||
&self
|
||||
.encinfo
|
||||
.operand_constraints(pos.func.encodings[inst])
|
||||
.expect("Bad copy encoding")
|
||||
.outs[0],
|
||||
@@ -419,7 +421,8 @@ impl<'a> Context<'a> {
|
||||
let node = Node::value(value, 0, self.func);
|
||||
|
||||
// Push this value and get the nearest dominating def back.
|
||||
let parent = match self.forest
|
||||
let parent = match self
|
||||
.forest
|
||||
.push_node(node, self.func, self.domtree, self.preorder)
|
||||
{
|
||||
None => continue,
|
||||
|
||||
@@ -527,7 +527,8 @@ impl<'a> Context<'a> {
|
||||
/// all values used by the instruction.
|
||||
fn program_complete_input_constraints(&mut self) {
|
||||
let inst = self.cur.current_inst().expect("Not on an instruction");
|
||||
let constraints = self.encinfo
|
||||
let constraints = self
|
||||
.encinfo
|
||||
.operand_constraints(self.cur.func.encodings[inst])
|
||||
.expect("Current instruction not encoded")
|
||||
.ins;
|
||||
@@ -643,7 +644,8 @@ impl<'a> Context<'a> {
|
||||
Pred: FnMut(&LiveRange, LiveRangeContext<Layout>) -> bool,
|
||||
{
|
||||
for rdiv in self.divert.all() {
|
||||
let lr = self.liveness
|
||||
let lr = self
|
||||
.liveness
|
||||
.get(rdiv.value)
|
||||
.expect("Missing live range for diverted register");
|
||||
if pred(lr, self.liveness.context(&self.cur.func.layout)) {
|
||||
@@ -942,7 +944,8 @@ impl<'a> Context<'a> {
|
||||
..
|
||||
} => {
|
||||
debug_assert_eq!(slot[to_slot].expand(), None, "Overwriting slot in use");
|
||||
let ss = self.cur
|
||||
let ss = self
|
||||
.cur
|
||||
.func
|
||||
.stack_slots
|
||||
.get_emergency_slot(self.cur.func.dfg.value_type(value), &slot[0..spills]);
|
||||
|
||||
@@ -187,7 +187,8 @@ impl LiveValueTracker {
|
||||
// If the immediate dominator exits, we must have a stored list for it. This is a
|
||||
// requirement to the order EBBs are visited: All dominators must have been processed
|
||||
// before the current EBB.
|
||||
let idom_live_list = self.idom_sets
|
||||
let idom_live_list = self
|
||||
.idom_sets
|
||||
.get(&idom)
|
||||
.expect("No stored live set for dominator");
|
||||
let ctx = liveness.context(layout);
|
||||
|
||||
@@ -340,7 +340,8 @@ impl Liveness {
|
||||
where
|
||||
PP: Into<ProgramPoint>,
|
||||
{
|
||||
let old = self.ranges
|
||||
let old = self
|
||||
.ranges
|
||||
.insert(LiveRange::new(value, def.into(), affinity));
|
||||
debug_assert!(old.is_none(), "{} already has a live range", value);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,8 @@ impl Pressure {
|
||||
}
|
||||
|
||||
// Compute per-class limits from `usable`.
|
||||
for (toprc, rc) in p.toprc
|
||||
for (toprc, rc) in p
|
||||
.toprc
|
||||
.iter_mut()
|
||||
.take_while(|t| t.num_toprcs > 0)
|
||||
.zip(reginfo.classes)
|
||||
|
||||
@@ -166,7 +166,8 @@ impl<'a> Context<'a> {
|
||||
if arg.affinity.is_stack() {
|
||||
// An incoming register parameter was spilled. Replace the parameter value
|
||||
// with a temporary register value that is immediately spilled.
|
||||
let reg = self.cur
|
||||
let reg = self
|
||||
.cur
|
||||
.func
|
||||
.dfg
|
||||
.replace_ebb_param(arg.value, abi.value_type);
|
||||
@@ -199,7 +200,8 @@ impl<'a> Context<'a> {
|
||||
self.cur.use_srcloc(inst);
|
||||
|
||||
// Get the operand constraints for `inst` that we are trying to satisfy.
|
||||
let constraints = self.encinfo
|
||||
let constraints = self
|
||||
.encinfo
|
||||
.operand_constraints(encoding)
|
||||
.expect("Missing instruction encoding");
|
||||
|
||||
@@ -276,7 +278,8 @@ impl<'a> Context<'a> {
|
||||
// Same thing for spilled call return values.
|
||||
let retvals = &defs[constraints.outs.len()..];
|
||||
if !retvals.is_empty() {
|
||||
let sig = self.cur
|
||||
let sig = self
|
||||
.cur
|
||||
.func
|
||||
.dfg
|
||||
.call_signature(inst)
|
||||
|
||||
@@ -125,7 +125,8 @@ impl<'a> Context<'a> {
|
||||
self.process_spills(tracker);
|
||||
|
||||
while let Some(inst) = self.cur.next_inst() {
|
||||
if let Some(constraints) = self.encinfo
|
||||
if let Some(constraints) = self
|
||||
.encinfo
|
||||
.operand_constraints(self.cur.func.encodings[inst])
|
||||
{
|
||||
self.visit_inst(inst, ebb, constraints, tracker);
|
||||
@@ -494,7 +495,8 @@ impl<'a> Context<'a> {
|
||||
}
|
||||
|
||||
// Assign a spill slot for the whole virtual register.
|
||||
let ss = self.cur
|
||||
let ss = self
|
||||
.cur
|
||||
.func
|
||||
.stack_slots
|
||||
.make_spill_slot(self.cur.func.dfg.value_type(value));
|
||||
|
||||
@@ -152,7 +152,8 @@ impl VirtRegs {
|
||||
});
|
||||
|
||||
// Determine the insertion position for `single`.
|
||||
let index = match self.values(vreg)
|
||||
let index = match self
|
||||
.values(vreg)
|
||||
.binary_search_by(|&v| preorder.pre_cmp_def(v, single, func))
|
||||
{
|
||||
Ok(_) => panic!("{} already in {}", single, vreg),
|
||||
|
||||
@@ -49,7 +49,8 @@ pub fn layout_stack(frame: &mut StackSlots, alignment: StackSize) -> CodegenResu
|
||||
incoming_min = min(incoming_min, slot.offset.unwrap());
|
||||
}
|
||||
StackSlotKind::OutgoingArg => {
|
||||
let offset = slot.offset
|
||||
let offset = slot
|
||||
.offset
|
||||
.unwrap()
|
||||
.checked_add(slot.size as StackOffset)
|
||||
.ok_or(CodegenError::ImplLimitExceeded)?;
|
||||
|
||||
@@ -98,7 +98,8 @@ impl<'a> FlagsVerifier<'a> {
|
||||
}
|
||||
|
||||
// Does the instruction have an encoding that clobbers the CPU flags?
|
||||
if self.encinfo
|
||||
if self
|
||||
.encinfo
|
||||
.as_ref()
|
||||
.and_then(|ei| ei.operand_constraints(self.func.encodings[inst]))
|
||||
.map_or(false, |c| c.clobbers_flags) && live_val.is_some()
|
||||
|
||||
@@ -87,7 +87,8 @@ impl<'a> LocationVerifier<'a> {
|
||||
enc: isa::Encoding,
|
||||
divert: &RegDiversions,
|
||||
) -> VerifierResult<()> {
|
||||
let constraints = self.encinfo
|
||||
let constraints = self
|
||||
.encinfo
|
||||
.operand_constraints(enc)
|
||||
.expect("check_enc_constraints requires a legal encoding");
|
||||
|
||||
|
||||
@@ -191,7 +191,8 @@ impl<'a> Verifier<'a> {
|
||||
}
|
||||
|
||||
if let ir::GlobalValueData::VMContext { .. } = self.func.global_values[cur] {
|
||||
if self.func
|
||||
if self
|
||||
.func
|
||||
.special_param(ir::ArgumentPurpose::VMContext)
|
||||
.is_none()
|
||||
{
|
||||
@@ -253,7 +254,8 @@ impl<'a> Verifier<'a> {
|
||||
|
||||
let fixed_results = inst_data.opcode().constraints().fixed_results();
|
||||
// var_results is 0 if we aren't a call instruction
|
||||
let var_results = dfg.call_signature(inst)
|
||||
let var_results = dfg
|
||||
.call_signature(inst)
|
||||
.map_or(0, |sig| dfg.signatures[sig].returns.len());
|
||||
let total_results = fixed_results + var_results;
|
||||
|
||||
@@ -498,7 +500,8 @@ impl<'a> Verifier<'a> {
|
||||
}
|
||||
// Defining instruction dominates the instruction that uses the value.
|
||||
if is_reachable {
|
||||
if !self.expected_domtree
|
||||
if !self
|
||||
.expected_domtree
|
||||
.dominates(def_inst, loc_inst, &self.func.layout)
|
||||
{
|
||||
return err!(loc_inst, "uses value from non-dominating {}", def_inst);
|
||||
@@ -529,7 +532,8 @@ impl<'a> Verifier<'a> {
|
||||
}
|
||||
// The defining EBB dominates the instruction using this value.
|
||||
if is_reachable
|
||||
&& !self.expected_domtree
|
||||
&& !self
|
||||
.expected_domtree
|
||||
.dominates(ebb, loc_inst, &self.func.layout)
|
||||
{
|
||||
return err!(loc_inst, "uses value arg from non-dominating {}", ebb);
|
||||
@@ -604,7 +608,8 @@ impl<'a> Verifier<'a> {
|
||||
}
|
||||
// We verify rpo_cmp on pairs of adjacent ebbs in the postorder
|
||||
for (&prev_ebb, &next_ebb) in domtree.cfg_postorder().iter().adjacent_pairs() {
|
||||
if self.expected_domtree
|
||||
if self
|
||||
.expected_domtree
|
||||
.rpo_cmp(prev_ebb, next_ebb, &self.func.layout) != Ordering::Greater
|
||||
{
|
||||
return err!(
|
||||
@@ -743,7 +748,8 @@ impl<'a> Verifier<'a> {
|
||||
fn typecheck_variable_args(&self, inst: Inst) -> VerifierResult<()> {
|
||||
match self.func.dfg.analyze_branch(inst) {
|
||||
BranchInfo::SingleDest(ebb, _) => {
|
||||
let iter = self.func
|
||||
let iter = self
|
||||
.func
|
||||
.dfg
|
||||
.ebb_params(ebb)
|
||||
.iter()
|
||||
@@ -1038,11 +1044,12 @@ impl<'a> Verifier<'a> {
|
||||
|
||||
let encoding = self.func.encodings[inst];
|
||||
if encoding.is_legal() {
|
||||
let mut encodings = isa.legal_encodings(
|
||||
&self.func,
|
||||
&self.func.dfg[inst],
|
||||
self.func.dfg.ctrl_typevar(inst),
|
||||
).peekable();
|
||||
let mut encodings =
|
||||
isa.legal_encodings(
|
||||
&self.func,
|
||||
&self.func.dfg[inst],
|
||||
self.func.dfg.ctrl_typevar(inst),
|
||||
).peekable();
|
||||
|
||||
if encodings.peek().is_none() {
|
||||
return err!(
|
||||
|
||||
Reference in New Issue
Block a user