11//! This module ensures that if a function's ABI requires a particular target feature,
22//! that target feature is enabled both on the callee and all callers.
3- use rustc_abi:: { BackendRepr , RegKind } ;
3+ use rustc_abi:: { BackendRepr , ExternAbi , RegKind } ;
44use rustc_hir:: { CRATE_HIR_ID , HirId } ;
55use rustc_middle:: mir:: { self , Location , traversal} ;
66use rustc_middle:: ty:: layout:: LayoutCx ;
@@ -49,11 +49,6 @@ fn do_check_simd_vector_abi<'tcx>(
4949 // Find the first feature that provides at least this vector size.
5050 let feature = match feature_def. iter ( ) . find ( |( bits, _) | size. bits ( ) <= * bits) {
5151 Some ( ( _, feature) ) => feature,
52- None if matches ! ( & * tcx. sess. target. arch, "x86" | "x86_64" )
53- && size. bits ( ) == 8192 =>
54- {
55- "amx-tile"
56- }
5752 None => {
5853 let ( span, _hir_id) = loc ( ) ;
5954 tcx. dcx ( ) . emit_err ( errors:: AbiErrorUnsupportedVectorType {
@@ -158,6 +153,13 @@ fn do_check_wasm_abi<'tcx>(
158153/// or return values for which the corresponding target feature is not enabled.
159154fn check_instance_abi < ' tcx > ( tcx : TyCtxt < ' tcx > , instance : Instance < ' tcx > ) {
160155 let typing_env = ty:: TypingEnv :: fully_monomorphized ( ) ;
156+ let ty = instance. ty ( tcx, typing_env) ;
157+ if ty. is_fn ( ) {
158+ if ty. fn_sig ( tcx) . abi ( ) == ExternAbi :: Unadjusted {
159+ // we disable all checks for the unadjusted abi
160+ return ;
161+ }
162+ }
161163 let Ok ( abi) = tcx. fn_abi_of_instance ( typing_env. as_query_input ( ( instance, ty:: List :: empty ( ) ) ) )
162164 else {
163165 // An error will be reported during codegen if we cannot determine the ABI of this
@@ -183,8 +185,10 @@ fn check_call_site_abi<'tcx>(
183185 caller : InstanceKind < ' tcx > ,
184186 loc : impl Fn ( ) -> ( Span , HirId ) + Copy ,
185187) {
186- if callee. fn_sig ( tcx) . abi ( ) . is_rustic_abi ( ) {
188+ let extern_abi = callee. fn_sig ( tcx) . abi ( ) ;
189+ if extern_abi. is_rustic_abi ( ) || extern_abi == ExternAbi :: Unadjusted {
187190 // we directly handle the soundness of Rust ABIs
191+ // we disable all checks for the unadjusted abi
188192 return ;
189193 }
190194 let typing_env = ty:: TypingEnv :: fully_monomorphized ( ) ;
0 commit comments