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