Convert return formats to value lists.
With the Return and ReturnReg formats converted to using value lists for storing their arguments, thee are no remaining instruction formats with variable argument lists in boxed storage. The Return and ReturnReg formats are also going to be merged since they are identical now.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
use ir::{types, instructions};
|
||||
use ir::{InstructionData, DataFlowGraph, Cursor};
|
||||
use ir::{Opcode, Type, Inst, Value, Ebb, JumpTable, VariableArgs, SigRef, FuncRef, ValueList};
|
||||
use ir::{Opcode, Type, Inst, Value, Ebb, JumpTable, SigRef, FuncRef, ValueList};
|
||||
use ir::immediates::{Imm64, Uimm8, Ieee32, Ieee64, ImmVector};
|
||||
use ir::condcodes::{IntCC, FloatCC};
|
||||
|
||||
|
||||
@@ -228,12 +228,12 @@ pub enum InstructionData {
|
||||
Return {
|
||||
opcode: Opcode,
|
||||
ty: Type,
|
||||
data: Box<ReturnData>,
|
||||
args: ValueList,
|
||||
},
|
||||
ReturnReg {
|
||||
opcode: Opcode,
|
||||
ty: Type,
|
||||
data: Box<ReturnRegData>,
|
||||
args: ValueList,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -331,34 +331,6 @@ impl Display for TernaryOverflowData {
|
||||
}
|
||||
}
|
||||
|
||||
/// Payload of a return instruction.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ReturnData {
|
||||
/// Dynamically sized array containing return values.
|
||||
pub varargs: VariableArgs,
|
||||
}
|
||||
|
||||
/// Payload of a return instruction.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ReturnRegData {
|
||||
/// Return address.
|
||||
pub arg: Value,
|
||||
/// Dynamically sized array containing return values.
|
||||
pub varargs: VariableArgs,
|
||||
}
|
||||
|
||||
impl ReturnRegData {
|
||||
/// Get references to the arguments.
|
||||
pub fn arguments(&self) -> [&[Value]; 2] {
|
||||
[ref_slice(&self.arg), &self.varargs]
|
||||
}
|
||||
|
||||
/// Get mutable references to the arguments.
|
||||
pub fn arguments_mut(&mut self) -> [&mut [Value]; 2] {
|
||||
[ref_slice_mut(&mut self.arg), &mut self.varargs]
|
||||
}
|
||||
}
|
||||
|
||||
/// Analyzing an instruction.
|
||||
///
|
||||
/// Avoid large matches on instruction formats by using the methods defined here to examine
|
||||
|
||||
@@ -282,19 +282,19 @@ fn write_instruction(w: &mut Write,
|
||||
args[0],
|
||||
DisplayValues(&args[1..]))
|
||||
}
|
||||
Return { ref data, .. } => {
|
||||
if data.varargs.is_empty() {
|
||||
Return { ref args, .. } => {
|
||||
if args.is_empty() {
|
||||
writeln!(w, "")
|
||||
} else {
|
||||
writeln!(w, " {}", data.varargs)
|
||||
writeln!(w,
|
||||
" {}",
|
||||
DisplayValues(args.as_slice(&func.dfg.value_lists)))
|
||||
}
|
||||
}
|
||||
ReturnReg { ref data, .. } => {
|
||||
if data.varargs.is_empty() {
|
||||
writeln!(w, " {}", data.arg)
|
||||
} else {
|
||||
writeln!(w, " {}, {}", data.arg, data.varargs)
|
||||
}
|
||||
ReturnReg { ref args, .. } => {
|
||||
writeln!(w,
|
||||
" {}",
|
||||
DisplayValues(args.as_slice(&func.dfg.value_lists)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user