[meta] Remove OperandKind::imm_name method;

This commit is contained in:
Benjamin Bouvier
2019-10-29 15:24:52 +01:00
parent ae3ea47dbd
commit 4f5b0689f3
2 changed files with 7 additions and 16 deletions

View File

@@ -555,7 +555,7 @@ fn verify_format(inst_name: &str, operands_in: &[Operand], format: &InstructionF
// - its number and names of input immediate operands,
// - whether it has a value list or not.
let mut num_values = 0;
let mut imm_index = 0;
let mut num_immediates = 0;
for operand in operands_in.iter() {
if operand.is_varargs() {
@@ -569,15 +569,15 @@ fn verify_format(inst_name: &str, operands_in: &[Operand], format: &InstructionF
if operand.is_value() {
num_values += 1;
}
if let Some(imm_name) = operand.kind.imm_name() {
if let Some(format_field) = format.imm_fields.get(imm_index) {
if operand.is_immediate_or_entityref() {
if let Some(format_field) = format.imm_fields.get(num_immediates) {
assert_eq!(
format_field.kind.name, imm_name,
format_field.kind.name, operand.kind.name,
"{}th operand of {} should be {} (according to format), not {} (according to \
inst definition). You may need to use a different format.",
imm_index, inst_name, format_field.kind.name, imm_name
num_immediates, inst_name, format_field.kind.name, operand.kind.name
);
imm_index += 1;
num_immediates += 1;
}
}
}
@@ -590,7 +590,7 @@ fn verify_format(inst_name: &str, operands_in: &[Operand], format: &InstructionF
);
assert_eq!(
imm_index,
num_immediates,
format.imm_fields.len(),
"inst {} doesn't have as many immediate input \
operands as its format {} declares; you may need to use a different format.",

View File

@@ -172,15 +172,6 @@ impl OperandKind {
| OperandKindFields::VariableArgs => None,
}
}
pub fn imm_name(&self) -> Option<&str> {
match self.fields {
OperandKindFields::ImmEnum(_)
| OperandKindFields::ImmValue
| OperandKindFields::EntityRef => Some(&self.name),
_ => None,
}
}
}
impl Into<OperandKind> for &TypeVar {