1
Fork 0

Factor out a repeated config.no_integrated_as test.

This commit is contained in:
Nicholas Nethercote 2020-03-21 09:25:20 +11:00
parent a147cd070e
commit ca0f997519

View file

@ -749,29 +749,31 @@ pub(crate) unsafe fn codegen(
})?; })?;
} }
if config_emit_normal_obj && !config.no_integrated_as { if config_emit_normal_obj {
let _timer = cgcx if !config.no_integrated_as {
.prof let _timer = cgcx
.generic_activity_with_arg("LLVM_module_codegen_emit_obj", &module.name[..]); .prof
with_codegen(tm, llmod, config.no_builtins, |cpm| { .generic_activity_with_arg("LLVM_module_codegen_emit_obj", &module.name[..]);
write_output_file( with_codegen(tm, llmod, config.no_builtins, |cpm| {
diag_handler, write_output_file(
tm, diag_handler,
cpm, tm,
llmod, cpm,
&obj_out, llmod,
llvm::FileType::ObjectFile, &obj_out,
) llvm::FileType::ObjectFile,
})?; )
} else if config_emit_normal_obj && config.no_integrated_as { })?;
let _timer = cgcx } else {
.prof let _timer = cgcx
.generic_activity_with_arg("LLVM_module_codegen_asm_to_obj", &module.name[..]); .prof
let assembly = cgcx.output_filenames.temp_path(OutputType::Assembly, module_name); .generic_activity_with_arg("LLVM_module_codegen_asm_to_obj", &module.name[..]);
run_assembler(cgcx, diag_handler, &assembly, &obj_out); let assembly = cgcx.output_filenames.temp_path(OutputType::Assembly, module_name);
run_assembler(cgcx, diag_handler, &assembly, &obj_out);
if !config.emit_asm && !cgcx.save_temps { if !config.emit_asm && !cgcx.save_temps {
drop(fs::remove_file(&assembly)); drop(fs::remove_file(&assembly));
}
} }
} }