Move emit_module a bit up

This commit is contained in:
bjorn3 2018-12-13 15:08:11 +01:00
parent 978add3698
commit 77e3612581

View File

@ -237,13 +237,6 @@ impl CodegenBackend for CraneliftCodegenBackend {
module
};
let mut faerie_module = new_module("some_file".to_string());
codegen_cgus(tcx, &mut faerie_module, &mut log);
crate::allocator::codegen(tcx.sess, &mut faerie_module);
tcx.sess.abort_if_errors();
let emit_module = |name: &str, kind: ModuleKind, mut module: Module<FaerieBackend>| {
module.finalize_definitions();
let artifact = module.finish().artifact;
@ -262,6 +255,13 @@ impl CodegenBackend for CraneliftCodegenBackend {
}
};
let mut faerie_module = new_module("some_file".to_string());
codegen_cgus(tcx, &mut faerie_module, &mut log);
crate::allocator::codegen(tcx.sess, &mut faerie_module);
tcx.sess.abort_if_errors();
return Box::new(CodegenResults {
crate_name: tcx.crate_name(LOCAL_CRATE),
modules: vec![emit_module("dummy_name", ModuleKind::Regular, faerie_module)],