about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-01-18 14:48:50 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2021-01-21 19:33:29 +0100
commit173ec34e3db3bbbbe0117e2f831053a183d99a40 (patch)
treecdce0c47cb05c2900a7537bbb4d1e75c5945ce93 /src
parenta19ef67f146df8da634cbab1e5ff5f3c2f3176d1 (diff)
downloadrust-173ec34e3db3bbbbe0117e2f831053a183d99a40.tar.gz
rust-173ec34e3db3bbbbe0117e2f831053a183d99a40.zip
Add a feature flag to switch between oldbe and newbe
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 4b6431e42b5..2152d2ebdef 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -339,7 +339,12 @@ fn build_isa(sess: &Session) -> Box<dyn isa::TargetIsa + 'static> {
 
     let flags = settings::Flags::new(flags_builder);
 
-    let mut isa_builder = cranelift_codegen::isa::lookup(target_triple).unwrap();
+    let variant = if cfg!(feature = "newbe") {
+        cranelift_codegen::isa::BackendVariant::MachInst
+    } else {
+        cranelift_codegen::isa::BackendVariant::Legacy
+    };
+    let mut isa_builder = cranelift_codegen::isa::lookup_variant(target_triple, variant).unwrap();
     // Don't use "haswell", as it implies `has_lzcnt`.macOS CI is still at Ivy Bridge EP, so `lzcnt`
     // is interpreted as `bsr`.
     isa_builder.enable("nehalem").unwrap();