Remove the first_type() methods from InstructionData.

Also remove the type field from all the variants. The type of the first
result value can be recovered from the value table now.
This commit is contained in:
Jakob Stoklund Olesen
2017-04-12 13:43:24 -07:00
parent 9c6a36d36d
commit 7cac9dcb41
7 changed files with 26 additions and 171 deletions

View File

@@ -100,161 +100,107 @@ impl FromStr for Opcode {
#[derive(Clone, Debug)]
#[allow(missing_docs)]
pub enum InstructionData {
Nullary { opcode: Opcode, ty: Type },
Unary {
opcode: Opcode,
ty: Type,
arg: Value,
},
UnaryImm {
opcode: Opcode,
ty: Type,
imm: Imm64,
},
UnaryIeee32 {
opcode: Opcode,
ty: Type,
imm: Ieee32,
},
UnaryIeee64 {
opcode: Opcode,
ty: Type,
imm: Ieee64,
},
UnarySplit {
opcode: Opcode,
ty: Type,
arg: Value,
},
Binary {
opcode: Opcode,
ty: Type,
args: [Value; 2],
},
Nullary { opcode: Opcode },
Unary { opcode: Opcode, arg: Value },
UnaryImm { opcode: Opcode, imm: Imm64 },
UnaryIeee32 { opcode: Opcode, imm: Ieee32 },
UnaryIeee64 { opcode: Opcode, imm: Ieee64 },
UnarySplit { opcode: Opcode, arg: Value },
Binary { opcode: Opcode, args: [Value; 2] },
BinaryImm {
opcode: Opcode,
ty: Type,
arg: Value,
imm: Imm64,
},
BinaryOverflow {
opcode: Opcode,
ty: Type,
args: [Value; 2],
},
Ternary {
opcode: Opcode,
ty: Type,
args: [Value; 3],
},
MultiAry {
opcode: Opcode,
ty: Type,
args: ValueList,
},
BinaryOverflow { opcode: Opcode, args: [Value; 2] },
Ternary { opcode: Opcode, args: [Value; 3] },
MultiAry { opcode: Opcode, args: ValueList },
InsertLane {
opcode: Opcode,
ty: Type,
lane: Uimm8,
args: [Value; 2],
},
ExtractLane {
opcode: Opcode,
ty: Type,
lane: Uimm8,
arg: Value,
},
IntCompare {
opcode: Opcode,
ty: Type,
cond: IntCC,
args: [Value; 2],
},
IntCompareImm {
opcode: Opcode,
ty: Type,
cond: IntCC,
arg: Value,
imm: Imm64,
},
FloatCompare {
opcode: Opcode,
ty: Type,
cond: FloatCC,
args: [Value; 2],
},
Jump {
opcode: Opcode,
ty: Type,
destination: Ebb,
args: ValueList,
},
Branch {
opcode: Opcode,
ty: Type,
destination: Ebb,
args: ValueList,
},
BranchIcmp {
opcode: Opcode,
ty: Type,
cond: IntCC,
destination: Ebb,
args: ValueList,
},
BranchTable {
opcode: Opcode,
ty: Type,
arg: Value,
table: JumpTable,
},
Call {
opcode: Opcode,
ty: Type,
func_ref: FuncRef,
args: ValueList,
},
IndirectCall {
opcode: Opcode,
ty: Type,
sig_ref: SigRef,
args: ValueList,
},
StackLoad {
opcode: Opcode,
ty: Type,
stack_slot: StackSlot,
offset: Offset32,
},
StackStore {
opcode: Opcode,
ty: Type,
arg: Value,
stack_slot: StackSlot,
offset: Offset32,
},
HeapLoad {
opcode: Opcode,
ty: Type,
arg: Value,
offset: Uoffset32,
},
HeapStore {
opcode: Opcode,
ty: Type,
args: [Value; 2],
offset: Uoffset32,
},
Load {
opcode: Opcode,
ty: Type,
flags: MemFlags,
arg: Value,
offset: Offset32,
},
Store {
opcode: Opcode,
ty: Type,
flags: MemFlags,
args: [Value; 2],
offset: Offset32,