Move second_result outside boxed storage.

In instruction formats that have multiple results AND boxed storage,
place the second_result field outside the boxed storage. The 16-byte
instruction format has room for opcode, type, second_result in the first
8 bytes, and the boxed pointer in the last 8 bytes.

This provides a simpler implementation of the second_result() and
second_result_mut() InstructionData methods.
This commit is contained in:
Jakob Stoklund Olesen
2016-10-12 16:01:06 -07:00
parent 3ff28ed064
commit 93f79d7a48
3 changed files with 16 additions and 34 deletions

View File

@@ -158,6 +158,7 @@ pub enum InstructionData {
TernaryOverflow {
opcode: Opcode,
ty: Type,
second_result: Value,
data: Box<TernaryOverflowData>,
},
InsertLane {
@@ -203,6 +204,7 @@ pub enum InstructionData {
Call {
opcode: Opcode,
ty: Type,
second_result: Value,
data: Box<CallData>,
},
Return {
@@ -284,7 +286,6 @@ impl Display for UnaryImmVectorData {
/// Payload data for ternary instructions with multiple results, such as `iadd_carry`.
#[derive(Clone, Debug)]
pub struct TernaryOverflowData {
pub second_result: Value,
pub args: [Value; 3],
}
@@ -334,9 +335,6 @@ impl Display for BranchData {
/// Payload of a call instruction.
#[derive(Clone, Debug)]
pub struct CallData {
/// Second result value for a call producing multiple return values.
second_result: Value,
/// Callee function.
pub func_ref: FuncRef,

View File

@@ -1089,10 +1089,8 @@ impl<'a> Parser<'a> {
InstructionData::TernaryOverflow {
opcode: opcode,
ty: VOID,
data: Box::new(TernaryOverflowData {
second_result: NO_VALUE,
args: [lhs, rhs, cin],
}),
second_result: NO_VALUE,
data: Box::new(TernaryOverflowData { args: [lhs, rhs, cin] }),
}
}
InstructionFormat::Jump => {