Remove imm_with_name

It is only used once to rename an imm field to mask
This commit is contained in:
bjorn3
2021-10-31 18:48:07 +01:00
parent 74261ccd79
commit 2fbd57e9e2
5 changed files with 6 additions and 15 deletions

View File

@@ -122,15 +122,6 @@ impl InstructionFormatBuilder {
self
}
pub fn imm_with_name(mut self, member: &'static str, operand_kind: &OperandKind) -> Self {
let field = FormatField {
kind: operand_kind.clone(),
member,
};
self.imm_fields.push(field);
self
}
pub fn typevar_operand(mut self, operand_index: usize) -> Self {
assert!(self.typevar_operand.is_none());
assert!(operand_index < self.num_value_operands);

View File

@@ -101,7 +101,7 @@ impl Formats {
shuffle: Builder::new("Shuffle")
.value()
.value()
.imm_with_name("mask", &imm.uimm128)
.imm(&imm.uimm128)
.build(),
int_compare: Builder::new("IntCompare")

View File

@@ -319,7 +319,7 @@ impl InstructionData {
// included in the `InstructionData` for memory-size reasons. This case, returning
// `None`, is left here to alert users of this method that they should retrieve the
// value using the `DataFlowGraph`.
&InstructionData::Shuffle { mask: _, .. } => None,
&InstructionData::Shuffle { imm: _, .. } => None,
_ => None,
}
}

View File

@@ -1264,8 +1264,8 @@ impl<'func, I: VCodeInst> LowerCtx for Lower<'func, I> {
fn get_immediate(&self, ir_inst: Inst) -> Option<DataValue> {
let inst_data = self.data(ir_inst);
match inst_data {
InstructionData::Shuffle { mask, .. } => {
let buffer = self.f.dfg.immediates.get(mask.clone()).unwrap().as_slice();
InstructionData::Shuffle { imm, .. } => {
let buffer = self.f.dfg.immediates.get(imm.clone()).unwrap().as_slice();
let value = DataValue::V128(buffer.try_into().expect("a 16-byte data buffer"));
Some(value)
}

View File

@@ -395,8 +395,8 @@ pub fn write_operands(w: &mut dyn Write, dfg: &DataFlowGraph, inst: Inst) -> fmt
}
NullAry { .. } => write!(w, " "),
TernaryImm8 { imm, args, .. } => write!(w, " {}, {}, {}", args[0], args[1], imm),
Shuffle { mask, args, .. } => {
let data = dfg.immediates.get(mask).expect(
Shuffle { imm, args, .. } => {
let data = dfg.immediates.get(imm).expect(
"Expected the shuffle mask to already be inserted into the immediates table",
);
write!(w, " {}, {}, {}", args[0], args[1], data)