1
Fork 0
This commit is contained in:
bjorn3 2021-04-12 12:09:05 +02:00
parent 53bfc6729a
commit 29a4a551eb
5 changed files with 7 additions and 25 deletions

View file

@ -142,12 +142,8 @@ pub(crate) fn with_object(sess: &Session, name: &str, f: impl FnOnce(&mut Object
} }
pub(crate) fn make_module(sess: &Session, isa: Box<dyn TargetIsa>, name: String) -> ObjectModule { pub(crate) fn make_module(sess: &Session, isa: Box<dyn TargetIsa>, name: String) -> ObjectModule {
let mut builder = ObjectBuilder::new( let mut builder =
isa, ObjectBuilder::new(isa, name + ".o", cranelift_module::default_libcall_names()).unwrap();
name + ".o",
cranelift_module::default_libcall_names(),
)
.unwrap();
// Unlike cg_llvm, cg_clif defaults to disabling -Zfunction-sections. For cg_llvm binary size // Unlike cg_llvm, cg_clif defaults to disabling -Zfunction-sections. For cg_llvm binary size
// is important, while cg_clif cares more about compilation times. Enabling -Zfunction-sections // is important, while cg_clif cares more about compilation times. Enabling -Zfunction-sections
// can easily double the amount of time necessary to perform linking. // can easily double the amount of time necessary to perform linking.

View file

@ -101,12 +101,7 @@ pub(crate) fn codegen_fn<'tcx>(cx: &mut crate::CodegenCx<'_, 'tcx>, instance: In
// Perform rust specific optimizations // Perform rust specific optimizations
tcx.sess.time("optimize clif ir", || { tcx.sess.time("optimize clif ir", || {
crate::optimize::optimize_function( crate::optimize::optimize_function(tcx, instance, context, &mut clif_comments);
tcx,
instance,
context,
&mut clif_comments,
);
}); });
// If the return block is not reachable, then the SSA builder may have inserted an `iconst.i128` // If the return block is not reachable, then the SSA builder may have inserted an `iconst.i128`
@ -351,13 +346,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, '_>) {
from_hir_call: _, from_hir_call: _,
} => { } => {
fx.tcx.sess.time("codegen call", || { fx.tcx.sess.time("codegen call", || {
crate::abi::codegen_terminator_call( crate::abi::codegen_terminator_call(fx, *fn_span, func, args, *destination)
fx,
*fn_span,
func,
args,
*destination,
)
}); });
} }
TerminatorKind::InlineAsm { TerminatorKind::InlineAsm {

View file

@ -227,7 +227,8 @@ pub(super) fn run_aot(
tcx.sess.abort_if_errors(); tcx.sess.abort_if_errors();
let isa = crate::build_isa(tcx.sess, &backend_config); let isa = crate::build_isa(tcx.sess, &backend_config);
let mut allocator_module = crate::backend::make_module(tcx.sess, isa, "allocator_shim".to_string()); let mut allocator_module =
crate::backend::make_module(tcx.sess, isa, "allocator_shim".to_string());
assert_eq!(pointer_ty(tcx), allocator_module.target_config().pointer_type()); assert_eq!(pointer_ty(tcx), allocator_module.target_config().pointer_type());
let mut allocator_unwind_context = UnwindContext::new(tcx, allocator_module.isa(), true); let mut allocator_unwind_context = UnwindContext::new(tcx, allocator_module.isa(), true);
let created_alloc_shim = let created_alloc_shim =

View file

@ -162,7 +162,6 @@ impl<'m, 'tcx> CodegenCx<'m, 'tcx> {
} }
} }
pub struct CraneliftCodegenBackend { pub struct CraneliftCodegenBackend {
pub config: Option<BackendConfig>, pub config: Option<BackendConfig>,
} }

View file

@ -247,10 +247,7 @@ pub(crate) fn write_clif_file<'tcx>(
&mut clif_comments, &mut clif_comments,
&mut clif, &mut clif,
&context.func, &context.func,
&DisplayFunctionAnnotations { &DisplayFunctionAnnotations { isa, value_ranges: value_ranges.as_ref() },
isa,
value_ranges: value_ranges.as_ref(),
},
) )
.unwrap(); .unwrap();