Assign call arguments to stack slots.
When making an outgoing call, some arguments may have to be passed on the stack. Allocate OutgoingArg stack slots for these arguments and write them immediately before the outgoing call instruction. Do the same for incoming function arguments on the stack, but use IncomingArg stack slots instead. This was previously done in the spiller, but we move it to the legalizer so it is done at the same time as outgoing stack arguments. These stack slot assignments are done in the legalizer before live range analysis because the outgoing arguments usually are in different SSSA values with their own short live ranges.
This commit is contained in:
@@ -51,7 +51,12 @@ pub fn legalize_function(func: &mut Function,
|
||||
let opcode = func.dfg[inst].opcode();
|
||||
|
||||
// Check for ABI boundaries that need to be converted to the legalized signature.
|
||||
if opcode.is_call() && boundary::handle_call_abi(&mut func.dfg, cfg, &mut pos) {
|
||||
if opcode.is_call() &&
|
||||
boundary::handle_call_abi(&mut func.dfg,
|
||||
&mut func.locations,
|
||||
&mut func.stack_slots,
|
||||
cfg,
|
||||
&mut pos) {
|
||||
// Go back and legalize the inserted argument conversion instructions.
|
||||
pos.set_position(prev_pos);
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user