mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
merge llvm ir optimization locations
This commit is contained in:
parent
d5dfdfb36e
commit
87537b800e
5 changed files with 92 additions and 143 deletions
|
@ -263,43 +263,7 @@ fn gen_from_mono_module_llvm<'a>(
|
|||
let generate_final_ir = all_code_gen_start.elapsed();
|
||||
let code_gen_object_start = Instant::now();
|
||||
|
||||
env.dibuilder.finalize();
|
||||
|
||||
if !emit_debug_info {
|
||||
module.strip_debug_info();
|
||||
}
|
||||
|
||||
// Uncomment this to see the module's optimized LLVM instruction output:
|
||||
// env.module.print_to_stderr();
|
||||
|
||||
let inkwell_opt_level = crate::target::convert_opt_level(opt_level);
|
||||
let inkwell_llvm_passes = crate::llvm_passes::get_llvm_passes_str(opt_level);
|
||||
let inkwell_target_machine =
|
||||
crate::target::target_machine(target, inkwell_opt_level, inkwell::targets::RelocMode::PIC)
|
||||
.expect("should be a valid target machine");
|
||||
|
||||
module
|
||||
.run_passes(
|
||||
inkwell_llvm_passes,
|
||||
&inkwell_target_machine,
|
||||
inkwell::passes::PassBuilderOptions::create(),
|
||||
)
|
||||
.expect("valid llvm optimization passes");
|
||||
|
||||
// Verify the module
|
||||
if let Err(errors) = env.module.verify() {
|
||||
// write the ll code to a file, so we can modify it
|
||||
env.module.print_to_file(&app_ll_file).unwrap();
|
||||
|
||||
internal_error!(
|
||||
"😱 LLVM errors when defining module; I wrote the full LLVM IR to {:?}\n\n {}",
|
||||
app_ll_file,
|
||||
errors.to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
// Uncomment this to see the module's optimized LLVM instruction output:
|
||||
// env.module.print_to_stderr();
|
||||
crate::llvm_passes::optimize_llvm_ir(&env, target, opt_level, emit_debug_info, &app_ll_file);
|
||||
|
||||
let gen_sanitizers = cfg!(feature = "sanitizers") && std::env::var("ROC_SANITIZERS").is_ok();
|
||||
let memory_buffer = if fuzz || gen_sanitizers {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue