Skip to content

Commit 2d60da4

Browse files
committed
Legalize memcpy function signature
1 parent 02c10db commit 2d60da4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cranelift/codegen/src/legalizer/boundary.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ pub fn handle_call_abi(
772772

773773
// Start by checking if the argument types already match the signature.
774774
let sig_ref = match check_call_signature(&pos.func.dfg, inst) {
775-
Ok(_) => return spill_call_arguments(pos),
775+
Ok(_) => return spill_call_arguments(pos, isa),
776776
Err(s) => s,
777777
};
778778

@@ -809,7 +809,7 @@ pub fn handle_call_abi(
809809

810810
// Go back and insert spills for any stack arguments.
811811
pos.goto_inst(inst);
812-
spill_call_arguments(pos);
812+
spill_call_arguments(pos, isa);
813813

814814
// Yes, we changed stuff.
815815
true
@@ -1010,7 +1010,7 @@ fn spill_entry_params(func: &mut Function, entry: Block) {
10101010
/// TODO: The outgoing stack slots can be written a bit earlier, as long as there are no branches
10111011
/// or calls between writing the stack slots and the call instruction. Writing the slots earlier
10121012
/// could help reduce register pressure before the call.
1013-
fn spill_call_arguments(pos: &mut FuncCursor) -> bool {
1013+
fn spill_call_arguments(pos: &mut FuncCursor, isa: &dyn TargetIsa) -> bool {
10141014
let inst = pos
10151015
.current_inst()
10161016
.expect("Cursor must point to a call instruction");
@@ -1070,10 +1070,11 @@ fn spill_call_arguments(pos: &mut FuncCursor) -> bool {
10701070
let dest = pos.ins().stack_addr(pointer_type, ss, 0);
10711071
let size = pos.ins().iconst(pointer_type, i64::from(size));
10721072
let signature = {
1073-
let mut s = Signature::new(CallConv::SystemV /*config.default_call_conv*/);
1073+
let mut s = Signature::new(isa.default_call_conv());
10741074
s.params.push(AbiParam::new(pointer_type));
10751075
s.params.push(AbiParam::new(pointer_type));
10761076
s.params.push(AbiParam::new(pointer_type));
1077+
legalize_libcall_signature(&mut s, isa);
10771078
pos.func.import_signature(s)
10781079
};
10791080

0 commit comments

Comments
 (0)