@@ -6,6 +6,7 @@ use std::{ptr, slice, str};
6
6
7
7
use libc:: c_int;
8
8
use rustc_codegen_ssa:: base:: wants_wasm_eh;
9
+ use rustc_codegen_ssa:: codegen_attrs:: check_tied_features;
9
10
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
10
11
use rustc_data_structures:: small_c_str:: SmallCStr ;
11
12
use rustc_data_structures:: unord:: UnordSet ;
@@ -19,8 +20,8 @@ use rustc_target::target_features::{RUSTC_SPECIAL_FEATURES, RUSTC_SPECIFIC_FEATU
19
20
20
21
use crate :: back:: write:: create_informational_target_machine;
21
22
use crate :: errors:: {
22
- FixedX18InvalidArch , InvalidTargetFeaturePrefix , PossibleFeature , TargetFeatureDisableOrEnable ,
23
- UnknownCTargetFeature , UnknownCTargetFeaturePrefix , UnstableCTargetFeature ,
23
+ FixedX18InvalidArch , InvalidTargetFeaturePrefix , PossibleFeature , UnknownCTargetFeature ,
24
+ UnknownCTargetFeaturePrefix , UnstableCTargetFeature ,
24
25
} ;
25
26
use crate :: llvm;
26
27
@@ -247,7 +248,9 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
247
248
( "aarch64" , "pmuv3" ) => Some ( LLVMFeature :: new ( "perfmon" ) ) ,
248
249
( "aarch64" , "paca" ) => Some ( LLVMFeature :: new ( "pauth" ) ) ,
249
250
( "aarch64" , "pacg" ) => Some ( LLVMFeature :: new ( "pauth" ) ) ,
250
- ( "aarch64" , "sve-b16b16" ) => Some ( LLVMFeature :: new ( "b16b16" ) ) ,
251
+ // Before LLVM 20 those two features were packaged together as b16b16
252
+ ( "aarch64" , "sve-b16b16" ) if get_version ( ) . 0 < 20 => Some ( LLVMFeature :: new ( "b16b16" ) ) ,
253
+ ( "aarch64" , "sme-b16b16" ) if get_version ( ) . 0 < 20 => Some ( LLVMFeature :: new ( "b16b16" ) ) ,
251
254
( "aarch64" , "flagm2" ) => Some ( LLVMFeature :: new ( "altnzcv" ) ) ,
252
255
// Rust ties fp and neon together.
253
256
( "aarch64" , "neon" ) => {
@@ -276,25 +279,6 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
276
279
}
277
280
}
278
281
279
- /// Given a map from target_features to whether they are enabled or disabled,
280
- /// ensure only valid combinations are allowed.
281
- pub ( crate ) fn check_tied_features (
282
- sess : & Session ,
283
- features : & FxHashMap < & str , bool > ,
284
- ) -> Option < & ' static [ & ' static str ] > {
285
- if !features. is_empty ( ) {
286
- for tied in sess. target . tied_target_features ( ) {
287
- // Tied features must be set to the same value, or not set at all
288
- let mut tied_iter = tied. iter ( ) ;
289
- let enabled = features. get ( tied_iter. next ( ) . unwrap ( ) ) ;
290
- if tied_iter. any ( |f| enabled != features. get ( f) ) {
291
- return Some ( tied) ;
292
- }
293
- }
294
- }
295
- None
296
- }
297
-
298
282
/// Used to generate cfg variables and apply features
299
283
/// Must express features in the way Rust understands them
300
284
pub fn target_features ( sess : & Session , allow_unstable : bool ) -> Vec < Symbol > {
@@ -685,7 +669,7 @@ pub(crate) fn global_llvm_features(
685
669
features. extend ( feats) ;
686
670
687
671
if diagnostics && let Some ( f) = check_tied_features ( sess, & featsmap) {
688
- sess. dcx ( ) . emit_err ( TargetFeatureDisableOrEnable {
672
+ sess. dcx ( ) . emit_err ( rustc_codegen_ssa :: errors :: TargetFeatureDisableOrEnable {
689
673
features : f,
690
674
span : None ,
691
675
missing_features : None ,
0 commit comments