diff options
| author | Caleb Zulawski <caleb.zulawski@gmail.com> | 2024-08-04 15:32:17 -0400 | 
|---|---|---|
| committer | Caleb Zulawski <caleb.zulawski@gmail.com> | 2024-08-07 00:41:48 -0400 | 
| commit | 6b96a60611c5edaa107b109b5a50e58a64a33fc2 (patch) | |
| tree | b1780983896f1b503edb4d729c5cf84a677b7a09 /compiler/rustc_codegen_llvm | |
| parent | 500671174444bb53072abf2d7f09211cdcba8315 (diff) | |
| download | rust-6b96a60611c5edaa107b109b5a50e58a64a33fc2.tar.gz rust-6b96a60611c5edaa107b109b5a50e58a64a33fc2.zip | |
Add implied features to non-target-feature functions
Diffstat (limited to 'compiler/rustc_codegen_llvm')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm_util.rs | 26 | 
1 files changed, 21 insertions, 5 deletions
| diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 10cba179c75..1a80824a3b7 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -8,6 +8,7 @@ use libc::c_int; use rustc_codegen_ssa::base::wants_wasm_eh; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::small_c_str::SmallCStr; +use rustc_data_structures::unord::UnordSet; use rustc_fs_util::path_to_c_string; use rustc_middle::bug; use rustc_session::config::{PrintKind, PrintRequest}; @@ -553,11 +554,26 @@ pub(crate) fn global_llvm_features( let supported_features = sess.target.supported_target_features(); let (llvm_major, _, _) = get_version(); let mut featsmap = FxHashMap::default(); - let feats = sess - .opts - .cg - .target_feature - .split(',') + + // insert implied features + let mut all_rust_features = vec![]; + for feature in sess.opts.cg.target_feature.split(',') { + match feature.strip_prefix('+') { + Some(feature) => all_rust_features.extend( + UnordSet::from( + sess.target + .implied_target_features(std::iter::once(Symbol::intern(feature))), + ) + .to_sorted_stable_ord() + .iter() + .map(|s| format!("+{}", s.as_str())), + ), + _ => all_rust_features.push(feature.to_string()), + } + } + + let feats = all_rust_features + .iter() .filter_map(|s| { let enable_disable = match s.chars().next() { None => return None, | 
