Convert the Branch and Jump instruction formats to value_list.
The Branch format also stores its fixed argument in the value list. This requires the value pool to be passed to a few more functions. Note that this actually makes the Branch and Jump variants of InstructionData identical. The instruction format hashing does not yet understand that all value operands are stored in the value list. We'll fix that in a later patch. Also convert IndirectCall, noting that Call and IndirectCall remain separate instruction formats because they have different immediate fields.
This commit is contained in:
@@ -206,12 +206,19 @@ def gen_instruction_data_impl(fmt):
|
||||
|
||||
fmt.doc_comment('Get the controlling type variable operand.')
|
||||
with fmt.indented(
|
||||
'pub fn typevar_operand(&self) -> Option<Value> {', '}'):
|
||||
'pub fn typevar_operand(&self, pool: &ValueListPool) -> '
|
||||
'Option<Value> {', '}'):
|
||||
with fmt.indented('match *self {', '}'):
|
||||
for f in InstructionFormat.all_formats:
|
||||
n = 'InstructionData::' + f.name
|
||||
if f.typevar_operand is None:
|
||||
fmt.line(n + ' { .. } => None,')
|
||||
elif f.has_value_list:
|
||||
# We keep all arguments in a value list.
|
||||
i = f.value_operands.index(f.typevar_operand)
|
||||
fmt.line(
|
||||
'{} {{ ref args, .. }} => '
|
||||
'args.get({}, pool),'.format(n, i))
|
||||
elif len(f.value_operands) == 1:
|
||||
# We have a single value operand called 'arg'.
|
||||
if f.boxed_storage:
|
||||
|
||||
Reference in New Issue
Block a user