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 {
let mut builder = ObjectBuilder::new(
isa,
name + ".o",
cranelift_module::default_libcall_names(),
)
.unwrap();
let mut builder =
ObjectBuilder::new(isa, name + ".o", cranelift_module::default_libcall_names()).unwrap();
// 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
// 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
tcx.sess.time("optimize clif ir", || {
crate::optimize::optimize_function(
tcx,
instance,
context,
&mut clif_comments,
);
crate::optimize::optimize_function(tcx, instance, context, &mut clif_comments);
});
// 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: _,
} => {
fx.tcx.sess.time("codegen call", || {
crate::abi::codegen_terminator_call(
fx,
*fn_span,
func,
args,
*destination,
)
crate::abi::codegen_terminator_call(fx, *fn_span, func, args, *destination)
});
}
TerminatorKind::InlineAsm {

View File

@ -227,7 +227,8 @@ pub(super) fn run_aot(
tcx.sess.abort_if_errors();
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());
let mut allocator_unwind_context = UnwindContext::new(tcx, allocator_module.isa(), true);
let created_alloc_shim =

View File

@ -162,7 +162,6 @@ fn finalize(self) -> (String, Option<DebugContext<'tcx>>, UnwindContext<'tcx>) {
}
}
pub struct CraneliftCodegenBackend {
pub config: Option<BackendConfig>,
}

View File

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