Coalesce some formats into MultiAry.
Allow some flexibility in the signature matching for instruction formats. In particular, look for a value list format as a second chance option. The Return, ReturnReg, and TernaryOverflow formats all fit the single MultiAry catch-all format for instructions without immediate operands.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
//! A `Builder` provides a convenient interface for inserting instructions into a Cretonne
|
||||
//! function. Many of its methods are generated from the meta language instruction definitions.
|
||||
|
||||
use ir::{types, instructions};
|
||||
use ir::types;
|
||||
use ir::{InstructionData, DataFlowGraph, Cursor};
|
||||
use ir::{Opcode, Type, Inst, Value, Ebb, JumpTable, SigRef, FuncRef, ValueList};
|
||||
use ir::immediates::{Imm64, Uimm8, Ieee32, Ieee64};
|
||||
|
||||
@@ -151,11 +151,11 @@ pub enum InstructionData {
|
||||
ty: Type,
|
||||
args: [Value; 3],
|
||||
},
|
||||
TernaryOverflow {
|
||||
MultiAry {
|
||||
opcode: Opcode,
|
||||
ty: Type,
|
||||
second_result: PackedOption<Value>,
|
||||
data: Box<TernaryOverflowData>,
|
||||
args: ValueList,
|
||||
},
|
||||
InsertLane {
|
||||
opcode: Opcode,
|
||||
@@ -213,16 +213,6 @@ pub enum InstructionData {
|
||||
sig_ref: SigRef,
|
||||
args: ValueList,
|
||||
},
|
||||
Return {
|
||||
opcode: Opcode,
|
||||
ty: Type,
|
||||
args: ValueList,
|
||||
},
|
||||
ReturnReg {
|
||||
opcode: Opcode,
|
||||
ty: Type,
|
||||
args: ValueList,
|
||||
},
|
||||
}
|
||||
|
||||
/// A variable list of `Value` operands used for function call arguments and passing arguments to
|
||||
@@ -289,19 +279,6 @@ impl Default for VariableArgs {
|
||||
}
|
||||
}
|
||||
|
||||
/// Payload data for ternary instructions with multiple results, such as `iadd_carry`.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct TernaryOverflowData {
|
||||
/// Value arguments.
|
||||
pub args: [Value; 3],
|
||||
}
|
||||
|
||||
impl Display for TernaryOverflowData {
|
||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||
write!(f, "{}, {}, {}", self.args[0], self.args[1], self.args[2])
|
||||
}
|
||||
}
|
||||
|
||||
/// Analyzing an instruction.
|
||||
///
|
||||
/// Avoid large matches on instruction formats by using the methods defined here to examine
|
||||
|
||||
Reference in New Issue
Block a user