@@ -12,9 +12,7 @@ use rustc_middle::ty::layout::{
12
12
use rustc_middle:: ty:: { self , InstanceKind , Ty , TyCtxt } ;
13
13
use rustc_session:: config:: OptLevel ;
14
14
use rustc_span:: def_id:: DefId ;
15
- use rustc_target:: callconv:: {
16
- ArgAbi , ArgAttribute , ArgAttributes , ArgExtension , Conv , FnAbi , PassMode , RiscvInterruptKind ,
17
- } ;
15
+ use rustc_target:: callconv:: { ArgAbi , ArgAttribute , ArgAttributes , ArgExtension , FnAbi , PassMode } ;
18
16
use tracing:: debug;
19
17
20
18
pub ( crate ) fn provide ( providers : & mut Providers ) {
@@ -240,45 +238,6 @@ fn fn_sig_for_fn_abi<'tcx>(
240
238
}
241
239
}
242
240
243
- #[ inline]
244
- fn conv_from_spec_abi ( tcx : TyCtxt < ' _ > , abi : ExternAbi , c_variadic : bool ) -> Conv {
245
- use rustc_abi:: ExternAbi :: * ;
246
- match tcx. sess . target . adjust_abi ( abi, c_variadic) {
247
- Rust | RustCall => Conv :: Rust ,
248
-
249
- // This is intentionally not using `Conv::Cold`, as that has to preserve
250
- // even SIMD registers, which is generally not a good trade-off.
251
- RustCold => Conv :: PreserveMost ,
252
-
253
- // It's the ABI's job to select this, not ours.
254
- System { .. } => bug ! ( "system abi should be selected elsewhere" ) ,
255
- EfiApi => bug ! ( "eficall abi should be selected elsewhere" ) ,
256
-
257
- Stdcall { .. } => Conv :: X86Stdcall ,
258
- Fastcall { .. } => Conv :: X86Fastcall ,
259
- Vectorcall { .. } => Conv :: X86VectorCall ,
260
- Thiscall { .. } => Conv :: X86ThisCall ,
261
- C { .. } => Conv :: C ,
262
- Unadjusted => Conv :: C ,
263
- Win64 { .. } => Conv :: X86_64Win64 ,
264
- SysV64 { .. } => Conv :: X86_64SysV ,
265
- Aapcs { .. } => Conv :: ArmAapcs ,
266
- CCmseNonSecureCall => Conv :: CCmseNonSecureCall ,
267
- CCmseNonSecureEntry => Conv :: CCmseNonSecureEntry ,
268
- PtxKernel => Conv :: GpuKernel ,
269
- Msp430Interrupt => Conv :: Msp430Intr ,
270
- X86Interrupt => Conv :: X86Intr ,
271
- GpuKernel => Conv :: GpuKernel ,
272
- AvrInterrupt => Conv :: AvrInterrupt ,
273
- AvrNonBlockingInterrupt => Conv :: AvrNonBlockingInterrupt ,
274
- RiscvInterruptM => Conv :: RiscvInterrupt { kind : RiscvInterruptKind :: Machine } ,
275
- RiscvInterruptS => Conv :: RiscvInterrupt { kind : RiscvInterruptKind :: Supervisor } ,
276
-
277
- // These API constants ought to be more specific...
278
- Cdecl { .. } => Conv :: C ,
279
- }
280
- }
281
-
282
241
fn fn_abi_of_fn_ptr < ' tcx > (
283
242
tcx : TyCtxt < ' tcx > ,
284
243
query : ty:: PseudoCanonicalInput < ' tcx , ( ty:: PolyFnSig < ' tcx > , & ' tcx ty:: List < Ty < ' tcx > > ) > ,
@@ -528,9 +487,8 @@ fn fn_abi_new_uncached<'tcx>(
528
487
( None , None , false )
529
488
} ;
530
489
let sig = tcx. normalize_erasing_regions ( cx. typing_env , sig) ;
531
-
532
- let conv = conv_from_spec_abi ( cx. tcx ( ) , sig. abi , sig. c_variadic ) ;
533
-
490
+ // normalize recklessly because we should have rejected bad ABIs already
491
+ let conv = tcx. sess . target . abi_map . normalize_abi ( sig. abi , sig. c_variadic ) . unwrap ( ) ;
534
492
let mut inputs = sig. inputs ( ) ;
535
493
let extra_args = if sig. abi == ExternAbi :: RustCall {
536
494
assert ! ( !sig. c_variadic && extra_args. is_empty( ) ) ;
0 commit comments