Only use coresimd when codegen_backend is LLVM

This commit is contained in:
bjorn3 2018-06-23 17:23:04 +02:00
parent c7c534fa0e
commit a5330415aa
5 changed files with 31 additions and 7 deletions

View File

@ -107,6 +107,13 @@ fn main() {
env::join_paths(&dylib_path).unwrap());
let mut maybe_crate = None;
// Don't use metadata only backend for snapshot compiler, because it may be broken
if env::var("RUSTC_SHOULD_USE_METADATA_ONLY_BACKEND").is_ok() && stage != "0" {
//cmd.arg("-Zcodegen-backend=metadata_only");
} else {
cmd.arg("--cfg").arg("codegen_backend=\"llvm\"");
}
// Print backtrace in case of ICE
if env::var("RUSTC_BACKTRACE_ON_ICE").is_ok() && env::var("RUST_BACKTRACE").is_err() {
cmd.env("RUST_BACKTRACE", "1");

View File

@ -747,6 +747,10 @@ impl<'a> Builder<'a> {
stage = compiler.stage;
}
if self.config.rust_codegen_backends.is_empty() {
cargo.env("RUSTC_SHOULD_USE_METADATA_ONLY_BACKEND", "1");
}
let mut extra_args = env::var(&format!("RUSTFLAGS_STAGE_{}", stage)).unwrap_or_default();
if stage != 0 {
let s = env::var("RUSTFLAGS_STAGE_NOT_0").unwrap_or_default();

View File

@ -241,12 +241,13 @@ macro_rules! vector_impl { ($([$f:ident, $($args:tt)*]),*) => { $($f!($($args)*)
#[path = "../stdsimd/coresimd/mod.rs"]
#[allow(missing_docs, missing_debug_implementations, dead_code, unused_imports)]
#[unstable(feature = "stdsimd", issue = "48556")]
#[cfg(not(stage0))] // allow changes to how stdsimd works in stage0
// allow changes to how stdsimd works in stage0 and don't use whithout LLVM
#[cfg(all(not(stage0), codegen_backend="llvm"))]
mod coresimd;
#[unstable(feature = "stdsimd", issue = "48556")]
#[cfg(not(stage0))]
#[cfg(all(not(stage0), codegen_backend="llvm"))]
pub use coresimd::simd;
#[stable(feature = "simd_arch", since = "1.27.0")]
#[cfg(not(stage0))]
#[cfg(all(not(stage0), codegen_backend="llvm"))]
pub use coresimd::arch;

View File

@ -1418,6 +1418,18 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
if sess.opts.crate_types.contains(&CrateTypeProcMacro) {
ret.insert((Symbol::intern("proc_macro"), None));
}
/*if nightly_options::is_nightly_build() {
let backend_name = sess.opts
.debugging_opts
.codegen_backend
.as_ref()
.map(|s| s as &str)
.unwrap_or("llvm");
ret.insert((
Symbol::intern("codegen_backend"),
Some(Symbol::intern(backend_name)),
));
}*/
return ret;
}

View File

@ -523,22 +523,22 @@ pub mod rt;
#[path = "../stdsimd/stdsimd/mod.rs"]
#[allow(missing_debug_implementations, missing_docs, dead_code)]
#[unstable(feature = "stdsimd", issue = "48556")]
#[cfg(all(not(stage0), not(test)))]
#[cfg(all(not(stage0), not(test), codegen_backend="llvm"))]
mod stdsimd;
// A "fake" module needed by the `stdsimd` module to compile, not actually
// exported though.
#[cfg(not(stage0))]
#[cfg(all(not(stage0), codegen_backend="llvm"))]
mod coresimd {
pub use core::arch;
pub use core::simd;
}
#[unstable(feature = "stdsimd", issue = "48556")]
#[cfg(all(not(stage0), not(test)))]
#[cfg(all(not(stage0), not(test), codegen_backend="llvm"))]
pub use stdsimd::simd;
#[stable(feature = "simd_arch", since = "1.27.0")]
#[cfg(all(not(stage0), not(test)))]
#[cfg(all(not(stage0), not(test), codegen_backend="llvm"))]
pub use stdsimd::arch;
// Include a number of private modules that exist solely to provide