about summary refs log tree commit diff
path: root/compiler/rustc_target/src
diff options
context:
space:
mode:
authordaxpedda <daxpedda@gmail.com>2024-07-13 00:10:33 +0200
committerdaxpedda <daxpedda@gmail.com>2024-08-04 08:44:23 +0200
commit80b74d397fffc9deaafd2b44552ba3a9107b4d5b (patch)
tree62a2706369f5088b13cbb77ef3145f764a843fe8 /compiler/rustc_target/src
parent90521399b4bfa889916cb62e2394b69f295e22cf (diff)
downloadrust-80b74d397fffc9deaafd2b44552ba3a9107b4d5b.tar.gz
rust-80b74d397fffc9deaafd2b44552ba3a9107b4d5b.zip
Implement a implicit target feature mechanism
Diffstat (limited to 'compiler/rustc_target/src')
-rw-r--r--compiler/rustc_target/src/target_features.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs
index 843e28b17b0..4e2617c4679 100644
--- a/compiler/rustc_target/src/target_features.rs
+++ b/compiler/rustc_target/src/target_features.rs
@@ -339,6 +339,8 @@ const WASM_ALLOWED_FEATURES: &[(&str, Stability)] = &[
     // tidy-alphabetical-end
 ];
 
+const WASM_IMPLICIT_FEATURES: &[(&str, &str)] = &[("relaxed-simd", "simd128")];
+
 const BPF_ALLOWED_FEATURES: &[(&str, Stability)] = &[("alu32", Unstable(sym::bpf_target_feature))];
 
 const CSKY_ALLOWED_FEATURES: &[(&str, Stability)] = &[
@@ -455,4 +457,13 @@ impl super::spec::Target {
             _ => &[],
         }
     }
+
+    /// Returns a list of target features. Each items first target feature
+    /// implicitly enables the second one.
+    pub fn implicit_target_features(&self) -> &'static [(&'static str, &'static str)] {
+        match &*self.arch {
+            "wasm32" | "wasm64" => WASM_IMPLICIT_FEATURES,
+            _ => &[],
+        }
+    }
 }