@@ -772,7 +772,7 @@ pub fn handle_call_abi(
772
772
773
773
// Start by checking if the argument types already match the signature.
774
774
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 ) ,
776
776
Err ( s) => s,
777
777
} ;
778
778
@@ -809,7 +809,7 @@ pub fn handle_call_abi(
809
809
810
810
// Go back and insert spills for any stack arguments.
811
811
pos. goto_inst ( inst) ;
812
- spill_call_arguments ( pos) ;
812
+ spill_call_arguments ( pos, isa ) ;
813
813
814
814
// Yes, we changed stuff.
815
815
true
@@ -1010,7 +1010,7 @@ fn spill_entry_params(func: &mut Function, entry: Block) {
1010
1010
/// TODO: The outgoing stack slots can be written a bit earlier, as long as there are no branches
1011
1011
/// or calls between writing the stack slots and the call instruction. Writing the slots earlier
1012
1012
/// 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 {
1014
1014
let inst = pos
1015
1015
. current_inst ( )
1016
1016
. expect ( "Cursor must point to a call instruction" ) ;
@@ -1070,10 +1070,11 @@ fn spill_call_arguments(pos: &mut FuncCursor) -> bool {
1070
1070
let dest = pos. ins ( ) . stack_addr ( pointer_type, ss, 0 ) ;
1071
1071
let size = pos. ins ( ) . iconst ( pointer_type, i64:: from ( size) ) ;
1072
1072
let signature = {
1073
- let mut s = Signature :: new ( CallConv :: SystemV /*config .default_call_conv*/ ) ;
1073
+ let mut s = Signature :: new ( isa . default_call_conv ( ) ) ;
1074
1074
s. params . push ( AbiParam :: new ( pointer_type) ) ;
1075
1075
s. params . push ( AbiParam :: new ( pointer_type) ) ;
1076
1076
s. params . push ( AbiParam :: new ( pointer_type) ) ;
1077
+ legalize_libcall_signature ( & mut s, isa) ;
1077
1078
pos. func . import_signature ( s)
1078
1079
} ;
1079
1080
0 commit comments