[meta] Rename Operand::is_immediate to is_immediate_or_entityref
This commit is contained in:
@@ -86,11 +86,12 @@ impl EncodingBuilder {
|
||||
}
|
||||
|
||||
// Add immediate value predicates
|
||||
for (immediate_value, immediate_operand) in inst
|
||||
.immediate_values
|
||||
.iter()
|
||||
.zip(inst.inst.operands_in.iter().filter(|o| o.is_immediate()))
|
||||
{
|
||||
for (immediate_value, immediate_operand) in inst.immediate_values.iter().zip(
|
||||
inst.inst
|
||||
.operands_in
|
||||
.iter()
|
||||
.filter(|o| o.is_pure_immediate()),
|
||||
) {
|
||||
let immediate_predicate = InstructionPredicate::new_is_field_equal(
|
||||
&inst.inst.format,
|
||||
immediate_operand
|
||||
|
||||
@@ -322,7 +322,7 @@ impl InstructionBuilder {
|
||||
for (i, op) in operands_in.iter().enumerate() {
|
||||
if op.is_value() {
|
||||
value_opnums.push(i);
|
||||
} else if op.is_immediate() {
|
||||
} else if op.is_immediate_or_entityref() {
|
||||
imm_opnums.push(i);
|
||||
} else {
|
||||
assert!(op.is_varargs());
|
||||
@@ -500,7 +500,7 @@ impl BoundInstruction {
|
||||
.inst
|
||||
.operands_in
|
||||
.iter()
|
||||
.filter(|o| o.is_immediate())
|
||||
.filter(|o| o.is_immediate_or_entityref())
|
||||
.count();
|
||||
if self.immediate_values.len() > immediate_count {
|
||||
return Err(format!(
|
||||
|
||||
@@ -46,8 +46,7 @@ impl Operand {
|
||||
}
|
||||
|
||||
/// Returns true if the operand has an immediate kind or is an EntityRef.
|
||||
// TODO inherited name from the python, rename to is_immediate_or_entityref later.
|
||||
pub fn is_immediate(&self) -> bool {
|
||||
pub fn is_immediate_or_entityref(&self) -> bool {
|
||||
match self.kind.fields {
|
||||
OperandKindFields::ImmEnum(_)
|
||||
| OperandKindFields::ImmValue
|
||||
|
||||
@@ -66,7 +66,7 @@ fn unwrap_inst(transform: &Transform, fmt: &mut Formatter) -> bool {
|
||||
let mut imm_and_varargs = inst
|
||||
.operands_in
|
||||
.iter()
|
||||
.filter(|op| op.is_immediate())
|
||||
.filter(|op| op.is_immediate_or_entityref())
|
||||
.count();
|
||||
if iform.has_value_list {
|
||||
imm_and_varargs += 1;
|
||||
@@ -115,7 +115,7 @@ fn unwrap_inst(transform: &Transform, fmt: &mut Formatter) -> bool {
|
||||
let emit_one_value =
|
||||
|fmt: &mut Formatter, needs_comma: bool, op_num: usize, op: &Operand| {
|
||||
let comma = if needs_comma { "," } else { "" };
|
||||
if op.is_immediate() {
|
||||
if op.is_immediate_or_entityref() {
|
||||
let n = inst.imm_opnums.iter().position(|&i| i == op_num).unwrap();
|
||||
fmtln!(fmt, "{}{}", iform.imm_fields[n].member, comma);
|
||||
} else if op.is_value() {
|
||||
|
||||
Reference in New Issue
Block a user