Don't require that the fallthrough instruction has an encoding.
A fallthrough jump is actually represented as 0 bytes, so no encoding is needed. Also allow for unencoded instructions in the generated emit_inst implementations. The verifier has stricter rules for when this is allowed.
This commit is contained in:
@@ -57,7 +57,7 @@ use flowgraph::ControlFlowGraph;
|
||||
use ir::entities::AnyEntity;
|
||||
use ir::instructions::{InstructionFormat, BranchInfo, ResolvedConstraint, CallInfo};
|
||||
use ir::{types, Function, ValueDef, Ebb, Inst, SigRef, FuncRef, ValueList, JumpTable, StackSlot,
|
||||
Value, Type};
|
||||
Value, Type, Opcode};
|
||||
use isa::TargetIsa;
|
||||
use std::error as std_error;
|
||||
use std::fmt::{self, Display, Formatter};
|
||||
@@ -711,6 +711,12 @@ impl<'a> Verifier<'a> {
|
||||
// Instructions with side effects are not allowed to be ghost instructions.
|
||||
let opcode = self.func.dfg[inst].opcode();
|
||||
|
||||
// The `fallthrough` instruction is marked as a terminator and a branch, but it is not
|
||||
// required to have an encoding.
|
||||
if opcode == Opcode::Fallthrough {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if opcode.is_branch() {
|
||||
return err!(inst, "Branch must have an encoding");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user