Rustup to rustc 1.49.0-nightly (beb5ae474 2020-10-04)
This commit is contained in:
parent
ab92638735
commit
3fc673d0a9
@ -24,7 +24,8 @@ export RUSTFLAGS="$RUSTFLAGS -Zforce-unstable-if-unmarked -Cpanic=abort"
|
||||
if [[ "$1" == "--release" ]]; then
|
||||
sysroot_channel='release'
|
||||
# FIXME Enable incremental again once rust-lang/rust#74946 is fixed
|
||||
CARGO_INCREMENTAL=0 RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=2" cargo build --target $TARGET_TRIPLE --release
|
||||
# FIXME Enable -Zmir-opt-level=2 again once it doesn't ice anymore
|
||||
CARGO_INCREMENTAL=0 RUSTFLAGS="$RUSTFLAGS" cargo build --target $TARGET_TRIPLE --release
|
||||
else
|
||||
sysroot_channel='debug'
|
||||
cargo build --target $TARGET_TRIPLE
|
||||
|
@ -1 +1 @@
|
||||
nightly-2020-10-02
|
||||
nightly-2020-10-05
|
||||
|
@ -4,6 +4,7 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
/// Returns whether an allocator shim was created
|
||||
pub(crate) fn codegen(
|
||||
@ -87,10 +88,9 @@ fn codegen_inner(
|
||||
.collect::<Vec<Value>>();
|
||||
|
||||
let callee_func_ref = module.declare_func_in_func(callee_func_id, &mut bcx.func);
|
||||
|
||||
let call_inst = bcx.ins().call(callee_func_ref, &args);
|
||||
|
||||
let results = bcx.inst_results(call_inst).to_vec(); // Clone to prevent borrow error
|
||||
|
||||
bcx.ins().return_(&results);
|
||||
bcx.seal_all_blocks();
|
||||
bcx.finalize();
|
||||
@ -104,4 +104,50 @@ fn codegen_inner(
|
||||
.unwrap();
|
||||
unwind_context.add_function(func_id, &ctx, module.isa());
|
||||
}
|
||||
|
||||
let sig = Signature {
|
||||
call_conv: CallConv::triple_default(module.isa().triple()),
|
||||
params: vec![AbiParam::new(usize_ty), AbiParam::new(usize_ty)],
|
||||
returns: vec![],
|
||||
};
|
||||
|
||||
let callee_name = kind.fn_name(sym::oom);
|
||||
//eprintln!("Codegen allocator shim {} -> {} ({:?} -> {:?})", caller_name, callee_name, sig.params, sig.returns);
|
||||
|
||||
let func_id = module
|
||||
.declare_function("__rust_alloc_error_handler", Linkage::Export, &sig)
|
||||
.unwrap();
|
||||
|
||||
let callee_func_id = module
|
||||
.declare_function(&callee_name, Linkage::Import, &sig)
|
||||
.unwrap();
|
||||
|
||||
let mut ctx = Context::new();
|
||||
ctx.func = Function::with_name_signature(ExternalName::user(0, 0), sig.clone());
|
||||
{
|
||||
let mut func_ctx = FunctionBuilderContext::new();
|
||||
let mut bcx = FunctionBuilder::new(&mut ctx.func, &mut func_ctx);
|
||||
|
||||
let block = bcx.create_block();
|
||||
bcx.switch_to_block(block);
|
||||
let args = (&[usize_ty, usize_ty])
|
||||
.into_iter()
|
||||
.map(|&ty| bcx.append_block_param(block, ty))
|
||||
.collect::<Vec<Value>>();
|
||||
|
||||
let callee_func_ref = module.declare_func_in_func(callee_func_id, &mut bcx.func);
|
||||
bcx.ins().call(callee_func_ref, &args);
|
||||
|
||||
bcx.ins().trap(TrapCode::UnreachableCodeReached);
|
||||
bcx.seal_all_blocks();
|
||||
bcx.finalize();
|
||||
}
|
||||
module
|
||||
.define_function(
|
||||
func_id,
|
||||
&mut ctx,
|
||||
&mut cranelift_codegen::binemit::NullTrapSink {},
|
||||
)
|
||||
.unwrap();
|
||||
unwind_context.add_function(func_id, &ctx, module.isa());
|
||||
}
|
||||
|
@ -72,7 +72,6 @@ mod num;
|
||||
mod optimize;
|
||||
mod pointer;
|
||||
mod pretty_clif;
|
||||
mod target_features_whitelist;
|
||||
mod toolchain;
|
||||
mod trap;
|
||||
mod unsize;
|
||||
@ -207,11 +206,11 @@ impl CodegenBackend for CraneliftCodegenBackend {
|
||||
if tcx.sess.opts.actually_rustdoc {
|
||||
// rustdoc needs to be able to document functions that use all the features, so
|
||||
// whitelist them all
|
||||
target_features_whitelist::all_known_features()
|
||||
rustc_codegen_ssa::target_features::all_known_features()
|
||||
.map(|(a, b)| (a.to_string(), b))
|
||||
.collect()
|
||||
} else {
|
||||
target_features_whitelist::supported_target_features(tcx.sess)
|
||||
rustc_codegen_ssa::target_features::supported_target_features(tcx.sess)
|
||||
.iter()
|
||||
.map(|&(a, b)| (a.to_string(), b))
|
||||
.collect()
|
||||
|
@ -1,158 +0,0 @@
|
||||
#![rustfmt::skip]
|
||||
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
|
||||
use rustc_session::Session;
|
||||
|
||||
// Copied from https://github.com/rust-lang/rust/blob/e7f6ed14d5de2199d0e8a3c1e41f80e43885cb5c/src/librustc_codegen_llvm/llvm_util.rs#L139-L275
|
||||
|
||||
// WARNING: the features after applying `to_llvm_feature` must be known
|
||||
// to LLVM or the feature detection code will walk past the end of the feature
|
||||
// array, leading to crashes.
|
||||
|
||||
const ARM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
||||
("aclass", Some(sym::arm_target_feature)),
|
||||
("mclass", Some(sym::arm_target_feature)),
|
||||
("rclass", Some(sym::arm_target_feature)),
|
||||
("dsp", Some(sym::arm_target_feature)),
|
||||
("neon", Some(sym::arm_target_feature)),
|
||||
("crc", Some(sym::arm_target_feature)),
|
||||
("crypto", Some(sym::arm_target_feature)),
|
||||
("v5te", Some(sym::arm_target_feature)),
|
||||
("v6", Some(sym::arm_target_feature)),
|
||||
("v6k", Some(sym::arm_target_feature)),
|
||||
("v6t2", Some(sym::arm_target_feature)),
|
||||
("v7", Some(sym::arm_target_feature)),
|
||||
("v8", Some(sym::arm_target_feature)),
|
||||
("vfp2", Some(sym::arm_target_feature)),
|
||||
("vfp3", Some(sym::arm_target_feature)),
|
||||
("vfp4", Some(sym::arm_target_feature)),
|
||||
// This is needed for inline assembly, but shouldn't be stabilized as-is
|
||||
// since it should be enabled per-function using #[instruction_set], not
|
||||
// #[target_feature].
|
||||
("thumb-mode", Some(sym::arm_target_feature)),
|
||||
];
|
||||
|
||||
const AARCH64_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
||||
("fp", Some(sym::aarch64_target_feature)),
|
||||
("neon", Some(sym::aarch64_target_feature)),
|
||||
("sve", Some(sym::aarch64_target_feature)),
|
||||
("crc", Some(sym::aarch64_target_feature)),
|
||||
("crypto", Some(sym::aarch64_target_feature)),
|
||||
("ras", Some(sym::aarch64_target_feature)),
|
||||
("lse", Some(sym::aarch64_target_feature)),
|
||||
("rdm", Some(sym::aarch64_target_feature)),
|
||||
("fp16", Some(sym::aarch64_target_feature)),
|
||||
("rcpc", Some(sym::aarch64_target_feature)),
|
||||
("dotprod", Some(sym::aarch64_target_feature)),
|
||||
("tme", Some(sym::aarch64_target_feature)),
|
||||
("v8.1a", Some(sym::aarch64_target_feature)),
|
||||
("v8.2a", Some(sym::aarch64_target_feature)),
|
||||
("v8.3a", Some(sym::aarch64_target_feature)),
|
||||
];
|
||||
|
||||
const X86_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
||||
("adx", Some(sym::adx_target_feature)),
|
||||
("aes", None),
|
||||
("avx", None),
|
||||
("avx2", None),
|
||||
("avx512bw", Some(sym::avx512_target_feature)),
|
||||
("avx512cd", Some(sym::avx512_target_feature)),
|
||||
("avx512dq", Some(sym::avx512_target_feature)),
|
||||
("avx512er", Some(sym::avx512_target_feature)),
|
||||
("avx512f", Some(sym::avx512_target_feature)),
|
||||
("avx512ifma", Some(sym::avx512_target_feature)),
|
||||
("avx512pf", Some(sym::avx512_target_feature)),
|
||||
("avx512vbmi", Some(sym::avx512_target_feature)),
|
||||
("avx512vl", Some(sym::avx512_target_feature)),
|
||||
("avx512vpopcntdq", Some(sym::avx512_target_feature)),
|
||||
("bmi1", None),
|
||||
("bmi2", None),
|
||||
("cmpxchg16b", Some(sym::cmpxchg16b_target_feature)),
|
||||
("f16c", Some(sym::f16c_target_feature)),
|
||||
("fma", None),
|
||||
("fxsr", None),
|
||||
("lzcnt", None),
|
||||
("movbe", Some(sym::movbe_target_feature)),
|
||||
("pclmulqdq", None),
|
||||
("popcnt", None),
|
||||
("rdrand", None),
|
||||
("rdseed", None),
|
||||
("rtm", Some(sym::rtm_target_feature)),
|
||||
("sha", None),
|
||||
("sse", None),
|
||||
("sse2", None),
|
||||
("sse3", None),
|
||||
("sse4.1", None),
|
||||
("sse4.2", None),
|
||||
("sse4a", Some(sym::sse4a_target_feature)),
|
||||
("ssse3", None),
|
||||
("tbm", Some(sym::tbm_target_feature)),
|
||||
("xsave", None),
|
||||
("xsavec", None),
|
||||
("xsaveopt", None),
|
||||
("xsaves", None),
|
||||
];
|
||||
|
||||
const HEXAGON_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
||||
("hvx", Some(sym::hexagon_target_feature)),
|
||||
("hvx-length128b", Some(sym::hexagon_target_feature)),
|
||||
];
|
||||
|
||||
const POWERPC_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
||||
("altivec", Some(sym::powerpc_target_feature)),
|
||||
("power8-altivec", Some(sym::powerpc_target_feature)),
|
||||
("power9-altivec", Some(sym::powerpc_target_feature)),
|
||||
("power8-vector", Some(sym::powerpc_target_feature)),
|
||||
("power9-vector", Some(sym::powerpc_target_feature)),
|
||||
("vsx", Some(sym::powerpc_target_feature)),
|
||||
];
|
||||
|
||||
const MIPS_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] =
|
||||
&[("fp64", Some(sym::mips_target_feature)), ("msa", Some(sym::mips_target_feature))];
|
||||
|
||||
const RISCV_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
||||
("m", Some(sym::riscv_target_feature)),
|
||||
("a", Some(sym::riscv_target_feature)),
|
||||
("c", Some(sym::riscv_target_feature)),
|
||||
("f", Some(sym::riscv_target_feature)),
|
||||
("d", Some(sym::riscv_target_feature)),
|
||||
("e", Some(sym::riscv_target_feature)),
|
||||
];
|
||||
|
||||
const WASM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
||||
("simd128", Some(sym::wasm_target_feature)),
|
||||
("atomics", Some(sym::wasm_target_feature)),
|
||||
("nontrapping-fptoint", Some(sym::wasm_target_feature)),
|
||||
];
|
||||
|
||||
/// When rustdoc is running, provide a list of all known features so that all their respective
|
||||
/// primitives may be documented.
|
||||
///
|
||||
/// IMPORTANT: If you're adding another feature list above, make sure to add it to this iterator!
|
||||
pub fn all_known_features() -> impl Iterator<Item = (&'static str, Option<Symbol>)> {
|
||||
std::iter::empty()
|
||||
.chain(ARM_ALLOWED_FEATURES.iter())
|
||||
.chain(AARCH64_ALLOWED_FEATURES.iter())
|
||||
.chain(X86_ALLOWED_FEATURES.iter())
|
||||
.chain(HEXAGON_ALLOWED_FEATURES.iter())
|
||||
.chain(POWERPC_ALLOWED_FEATURES.iter())
|
||||
.chain(MIPS_ALLOWED_FEATURES.iter())
|
||||
.chain(RISCV_ALLOWED_FEATURES.iter())
|
||||
.chain(WASM_ALLOWED_FEATURES.iter())
|
||||
.cloned()
|
||||
}
|
||||
|
||||
pub fn supported_target_features(sess: &Session) -> &'static [(&'static str, Option<Symbol>)] {
|
||||
match &*sess.target.target.arch {
|
||||
"arm" => ARM_ALLOWED_FEATURES,
|
||||
"aarch64" => AARCH64_ALLOWED_FEATURES,
|
||||
"x86" | "x86_64" => X86_ALLOWED_FEATURES,
|
||||
"hexagon" => HEXAGON_ALLOWED_FEATURES,
|
||||
"mips" | "mips64" => MIPS_ALLOWED_FEATURES,
|
||||
"powerpc" | "powerpc64" => POWERPC_ALLOWED_FEATURES,
|
||||
"riscv32" | "riscv64" => RISCV_ALLOWED_FEATURES,
|
||||
"wasm32" => WASM_ALLOWED_FEATURES,
|
||||
_ => &[],
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user