diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2021-02-01 10:11:46 +0100 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2021-02-01 10:11:46 +0100 |
| commit | 27855331e8fc27163bac49c9dc10ab0fe6a04d5a (patch) | |
| tree | b019249ee1989c6d0ef7dc62dc18df644619c4ec /compiler/rustc_codegen_cranelift/src/base.rs | |
| parent | fee0d31397c5ac46d08867e903131d1d73825a9e (diff) | |
| parent | d556c56f792756dd7cfec742b9f2e07612dc10f4 (diff) | |
| download | rust-27855331e8fc27163bac49c9dc10ab0fe6a04d5a.tar.gz rust-27855331e8fc27163bac49c9dc10ab0fe6a04d5a.zip | |
Merge commit 'd556c56f792756dd7cfec742b9f2e07612dc10f4' into sync_cg_clif-2021-02-01
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/base.rs')
| -rw-r--r-- | compiler/rustc_codegen_cranelift/src/base.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs index 34c9561d676..4842628a99d 100644 --- a/compiler/rustc_codegen_cranelift/src/base.rs +++ b/compiler/rustc_codegen_cranelift/src/base.rs @@ -2,6 +2,8 @@ use rustc_index::vec::IndexVec; use rustc_middle::ty::adjustment::PointerCast; +use rustc_middle::ty::layout::FnAbiExt; +use rustc_target::abi::call::FnAbi; use crate::prelude::*; @@ -19,7 +21,8 @@ pub(crate) fn codegen_fn<'tcx>( let mir = tcx.instance_mir(instance.def); // Declare function - let (name, sig) = get_function_name_and_sig(tcx, cx.module.isa().triple(), instance, false); + let name = tcx.symbol_name(instance).name.to_string(); + let sig = get_function_sig(tcx, cx.module.isa().triple(), instance); let func_id = cx.module.declare_function(&name, linkage, &sig).unwrap(); cx.cached_context.clear(); @@ -50,6 +53,7 @@ pub(crate) fn codegen_fn<'tcx>( instance, mir, + fn_abi: Some(FnAbi::of_instance(&RevealAllLayoutCx(tcx), instance, &[])), bcx, block_map, @@ -117,6 +121,9 @@ pub(crate) fn codegen_fn<'tcx>( context.compute_domtree(); context.eliminate_unreachable_code(cx.module.isa()).unwrap(); context.dce(cx.module.isa()).unwrap(); + // Some Cranelift optimizations expect the domtree to not yet be computed and as such don't + // invalidate it when it would change. + context.domtree.clear(); context.want_disasm = crate::pretty_clif::should_write_ir(tcx); @@ -1053,7 +1060,11 @@ pub(crate) fn codegen_panic_inner<'tcx>( fx.lib_call( &*symbol_name, - vec![fx.pointer_type, fx.pointer_type, fx.pointer_type], + vec![ + AbiParam::new(fx.pointer_type), + AbiParam::new(fx.pointer_type), + AbiParam::new(fx.pointer_type), + ], vec![], args, ); |
