Prefix fixed_results/fixed_value_arguments with num to indicate they return a usize;
This commit is contained in:
committed by
Dan Gohman
parent
e13b0886dc
commit
f896bfb946
@@ -201,8 +201,14 @@ where
|
||||
|
||||
// We theoretically allow for call instructions that return a number of fixed results before
|
||||
// the call return values. In practice, it doesn't happen.
|
||||
let fixed_results = pos.func.dfg[call].opcode().constraints().fixed_results();
|
||||
debug_assert_eq!(fixed_results, 0, "Fixed results on calls not supported");
|
||||
debug_assert_eq!(
|
||||
pos.func.dfg[call]
|
||||
.opcode()
|
||||
.constraints()
|
||||
.num_fixed_results(),
|
||||
0,
|
||||
"Fixed results on calls not supported"
|
||||
);
|
||||
|
||||
let results = pos.func.dfg.detach_results(call);
|
||||
let mut next_res = 0;
|
||||
@@ -440,11 +446,11 @@ fn legalize_inst_arguments<ArgType>(
|
||||
// The value list contains all arguments to the instruction, including the callee on an
|
||||
// indirect call which isn't part of the call arguments that must match the ABI signature.
|
||||
// Figure out how many fixed values are at the front of the list. We won't touch those.
|
||||
let fixed_values = pos.func.dfg[inst]
|
||||
let num_fixed_values = pos.func.dfg[inst]
|
||||
.opcode()
|
||||
.constraints()
|
||||
.fixed_value_arguments();
|
||||
let have_args = vlist.len(&pos.func.dfg.value_lists) - fixed_values;
|
||||
.num_fixed_value_arguments();
|
||||
let have_args = vlist.len(&pos.func.dfg.value_lists) - num_fixed_values;
|
||||
|
||||
// Grow the value list to the right size and shift all the existing arguments to the right.
|
||||
// This lets us write the new argument values into the list without overwriting the old
|
||||
@@ -472,11 +478,11 @@ fn legalize_inst_arguments<ArgType>(
|
||||
// [FFFFNNNNNNNNNNNNNNNNNNNN]
|
||||
//
|
||||
vlist.grow_at(
|
||||
fixed_values,
|
||||
num_fixed_values,
|
||||
abi_args - have_args,
|
||||
&mut pos.func.dfg.value_lists,
|
||||
);
|
||||
let old_arg_offset = fixed_values + abi_args - have_args;
|
||||
let old_arg_offset = num_fixed_values + abi_args - have_args;
|
||||
|
||||
let mut abi_arg = 0;
|
||||
for old_arg in 0..have_args {
|
||||
@@ -487,7 +493,7 @@ fn legalize_inst_arguments<ArgType>(
|
||||
let abi_type = get_abi_type(func, abi_arg);
|
||||
if func.dfg.value_type(arg) == abi_type.value_type {
|
||||
// This is the argument type we need.
|
||||
vlist.as_mut_slice(&mut func.dfg.value_lists)[fixed_values + abi_arg] = arg;
|
||||
vlist.as_mut_slice(&mut func.dfg.value_lists)[num_fixed_values + abi_arg] = arg;
|
||||
abi_arg += 1;
|
||||
Ok(())
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user