@@ -2918,65 +2918,7 @@ impl DerefMut for Target {
2918
2918
2919
2919
impl Target {
2920
2920
pub fn is_abi_supported ( & self , abi : ExternAbi ) -> bool {
2921
- use ExternAbi :: * ;
2922
- match abi {
2923
- Rust | C { .. } | System { .. } | RustCall | Unadjusted | Cdecl { .. } | RustCold => {
2924
- true
2925
- }
2926
- EfiApi => {
2927
- [ "arm" , "aarch64" , "riscv32" , "riscv64" , "x86" , "x86_64" ] . contains ( & & self . arch [ ..] )
2928
- }
2929
- X86Interrupt => [ "x86" , "x86_64" ] . contains ( & & self . arch [ ..] ) ,
2930
- Aapcs { .. } => "arm" == self . arch ,
2931
- CCmseNonSecureCall | CCmseNonSecureEntry => {
2932
- [ "thumbv8m.main-none-eabi" , "thumbv8m.main-none-eabihf" , "thumbv8m.base-none-eabi" ]
2933
- . contains ( & & self . llvm_target [ ..] )
2934
- }
2935
- Win64 { .. } | SysV64 { .. } => self . arch == "x86_64" ,
2936
- PtxKernel => self . arch == "nvptx64" ,
2937
- GpuKernel => [ "amdgpu" , "nvptx64" ] . contains ( & & self . arch [ ..] ) ,
2938
- Msp430Interrupt => self . arch == "msp430" ,
2939
- RiscvInterruptM | RiscvInterruptS => [ "riscv32" , "riscv64" ] . contains ( & & self . arch [ ..] ) ,
2940
- AvrInterrupt | AvrNonBlockingInterrupt => self . arch == "avr" ,
2941
- Thiscall { .. } => self . arch == "x86" ,
2942
- // On windows these fall-back to platform native calling convention (C) when the
2943
- // architecture is not supported.
2944
- //
2945
- // This is I believe a historical accident that has occurred as part of Microsoft
2946
- // striving to allow most of the code to "just" compile when support for 64-bit x86
2947
- // was added and then later again, when support for ARM architectures was added.
2948
- //
2949
- // This is well documented across MSDN. Support for this in Rust has been added in
2950
- // #54576. This makes much more sense in context of Microsoft's C++ than it does in
2951
- // Rust, but there isn't much leeway remaining here to change it back at the time this
2952
- // comment has been written.
2953
- //
2954
- // Following are the relevant excerpts from the MSDN documentation.
2955
- //
2956
- // > The __vectorcall calling convention is only supported in native code on x86 and
2957
- // x64 processors that include Streaming SIMD Extensions 2 (SSE2) and above.
2958
- // > ...
2959
- // > On ARM machines, __vectorcall is accepted and ignored by the compiler.
2960
- //
2961
- // -- https://docs.microsoft.com/en-us/cpp/cpp/vectorcall?view=msvc-160
2962
- //
2963
- // > On ARM and x64 processors, __stdcall is accepted and ignored by the compiler;
2964
- //
2965
- // -- https://docs.microsoft.com/en-us/cpp/cpp/stdcall?view=msvc-160
2966
- //
2967
- // > In most cases, keywords or compiler switches that specify an unsupported
2968
- // > convention on a particular platform are ignored, and the platform default
2969
- // > convention is used.
2970
- //
2971
- // -- https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions
2972
- Stdcall { .. } | Fastcall { .. } | Vectorcall { .. } if self . is_like_windows => true ,
2973
- // Outside of Windows we want to only support these calling conventions for the
2974
- // architectures for which these calling conventions are actually well defined.
2975
- Stdcall { .. } | Fastcall { .. } if self . arch == "x86" => true ,
2976
- Vectorcall { .. } if [ "x86" , "x86_64" ] . contains ( & & self . arch [ ..] ) => true ,
2977
- // Reject these calling conventions everywhere else.
2978
- Stdcall { .. } | Fastcall { .. } | Vectorcall { .. } => false ,
2979
- }
2921
+ self . abi_map . normalize_abi ( abi, false ) . is_ok ( )
2980
2922
}
2981
2923
2982
2924
/// Minimum integer size in bits that this target can perform atomic
0 commit comments