@@ -18,11 +18,11 @@ pub(crate) use self::returning::codegen_return;
1818
1919fn clif_sig_from_fn_abi < ' tcx > (
2020 tcx : TyCtxt < ' tcx > ,
21- triple : & target_lexicon :: Triple ,
21+ default_call_conv : CallConv ,
2222 fn_abi : & FnAbi < ' tcx , Ty < ' tcx > > ,
2323) -> Signature {
2424 let call_conv = match fn_abi. conv {
25- Conv :: Rust | Conv :: C => CallConv :: triple_default ( triple ) ,
25+ Conv :: Rust | Conv :: C => default_call_conv ,
2626 Conv :: X86_64SysV => CallConv :: SystemV ,
2727 Conv :: X86_64Win64 => CallConv :: WindowsFastcall ,
2828 Conv :: ArmAapcs
@@ -55,7 +55,7 @@ pub(crate) fn get_function_sig<'tcx>(
5555 assert ! ( !inst. substs. needs_infer( ) ) ;
5656 clif_sig_from_fn_abi (
5757 tcx,
58- triple,
58+ CallConv :: triple_default ( triple) ,
5959 & RevealAllLayoutCx ( tcx) . fn_abi_of_instance ( inst, ty:: List :: empty ( ) ) ,
6060 )
6161}
@@ -91,7 +91,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
9191 returns : Vec < AbiParam > ,
9292 args : & [ Value ] ,
9393 ) -> & [ Value ] {
94- let sig = Signature { params, returns, call_conv : CallConv :: triple_default ( self . triple ( ) ) } ;
94+ let sig = Signature { params, returns, call_conv : self . target_config . default_call_conv } ;
9595 let func_id = self . module . declare_function ( name, Linkage :: Import , & sig) . unwrap ( ) ;
9696 let func_ref = self . module . declare_func_in_func ( func_id, & mut self . bcx . func ) ;
9797 let call_inst = self . bcx . ins ( ) . call ( func_ref, args) ;
@@ -420,7 +420,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
420420 }
421421
422422 let ( ptr, method) = crate :: vtable:: get_ptr_and_method_ref ( fx, args[ 0 ] . value , idx) ;
423- let sig = clif_sig_from_fn_abi ( fx. tcx , fx. triple ( ) , & fn_abi) ;
423+ let sig = clif_sig_from_fn_abi ( fx. tcx , fx. target_config . default_call_conv , & fn_abi) ;
424424 let sig = fx. bcx . import_signature ( sig) ;
425425
426426 ( CallTarget :: Indirect ( sig, method) , Some ( ptr) )
@@ -440,7 +440,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
440440 }
441441
442442 let func = codegen_operand ( fx, func) . load_scalar ( fx) ;
443- let sig = clif_sig_from_fn_abi ( fx. tcx , fx. triple ( ) , & fn_abi) ;
443+ let sig = clif_sig_from_fn_abi ( fx. tcx , fx. target_config . default_call_conv , & fn_abi) ;
444444 let sig = fx. bcx . import_signature ( sig) ;
445445
446446 ( CallTarget :: Indirect ( sig, func) , None )
@@ -531,7 +531,7 @@ pub(crate) fn codegen_drop<'tcx>(
531531 let fn_abi =
532532 RevealAllLayoutCx ( fx. tcx ) . fn_abi_of_instance ( virtual_drop, ty:: List :: empty ( ) ) ;
533533
534- let sig = clif_sig_from_fn_abi ( fx. tcx , fx. triple ( ) , & fn_abi) ;
534+ let sig = clif_sig_from_fn_abi ( fx. tcx , fx. target_config . default_call_conv , & fn_abi) ;
535535 let sig = fx. bcx . import_signature ( sig) ;
536536 fx. bcx . ins ( ) . call_indirect ( sig, drop_fn, & [ ptr] ) ;
537537 }
0 commit comments