Change dfg.inst_results to return a slice.

Now we can access instruction results and arguments as well as EBB
arguments as slices.

Delete the Values iterator which was traversing the linked lists of
values. It is no longer needed.
This commit is contained in:
Jakob Stoklund Olesen
2017-04-11 16:53:54 -07:00
parent 3a36435c3b
commit 322a8db839
9 changed files with 33 additions and 81 deletions

View File

@@ -693,14 +693,17 @@ def gen_inst_builder(inst, fmt):
fmt.line(fcall + '.0')
return
fmt.line('let (inst, dfg) = {};'.format(fcall))
if len(inst.value_results) == 1:
fmt.line('Value::new_direct({}.0)'.format(fcall))
fmt.line('dfg.first_result(inst)')
return
fmt.line('let (inst, dfg) = {};'.format(fcall))
fmt.line('let mut results = dfg.inst_results(inst);')
fmt.line('({})'.format(', '.join(
len(inst.value_results) * ['results.next().unwrap()'])))
fmt.format(
'let results = &dfg.inst_results(inst)[0..{}];',
len(inst.value_results))
fmt.format('({})', ', '.join(
'results[{}]'.format(i) for i in range(len(inst.value_results))))
def gen_builder(insts, fmt):