forked from M-Labs/nac3
1
0
Fork 0

core: Remove emit_llvm from CodeGenLLVMOptions

We instead output an LLVM bitcode file when the option is specified on
the command-line.
This commit is contained in:
David Mak 2023-09-15 13:26:15 +08:00
parent ee1ee4ab3b
commit ab2360d7a0
4 changed files with 9 additions and 13 deletions

View File

@ -916,7 +916,6 @@ impl Nac3 {
llvm_options: CodeGenLLVMOptions {
opt_level: OptimizationLevel::Default,
target: Nac3::get_llvm_target_options(isa),
emit_llvm: false,
}
})
}

View File

@ -61,9 +61,6 @@ pub struct CodeGenLLVMOptions {
/// Options related to the target machine.
pub target: CodeGenTargetMachineOptions,
/// Whether to output the LLVM IR after generation is complete.
pub emit_llvm: bool,
}
/// Additional options for code generation for the target machine.
@ -339,11 +336,6 @@ impl WorkerRegistry {
err.to_string());
}
if self.llvm_options.emit_llvm {
println!("LLVM IR for {}\n{}", module.get_name().to_str().unwrap(), module.to_string());
println!();
}
f.run(&module);
let mut lock = self.task_count.lock();
*lock += 1;

View File

@ -222,7 +222,6 @@ fn test_primitives() {
let llvm_options = CodeGenLLVMOptions {
opt_level: OptimizationLevel::Default,
target: CodeGenTargetMachineOptions::from_host_triple(),
emit_llvm: false,
};
let (registry, handles) = WorkerRegistry::create_workers(
threads,
@ -413,7 +412,6 @@ fn test_simple_call() {
let llvm_options = CodeGenLLVMOptions {
opt_level: OptimizationLevel::Default,
target: CodeGenTargetMachineOptions::from_host_triple(),
emit_llvm: false,
};
let (registry, handles) = WorkerRegistry::create_workers(
threads,

View File

@ -305,7 +305,6 @@ fn main() {
features: target_features,
..host_target_machine
},
emit_llvm,
};
let task = CodeGenTask {
@ -340,11 +339,19 @@ fn main() {
let main = context
.create_module_from_ir(MemoryBuffer::create_from_memory_range(&buffers[0], "main"))
.unwrap();
for buffer in buffers.iter().skip(1) {
if emit_llvm {
main.write_bitcode_to_path(Path::new("main.bc"));
}
for (idx, buffer) in buffers.iter().skip(1).enumerate() {
let other = context
.create_module_from_ir(MemoryBuffer::create_from_memory_range(buffer, "main"))
.unwrap();
if emit_llvm {
other.write_bitcode_to_path(Path::new(&format!("module{}.bc", idx)));
}
main.link_in_module(other).unwrap();
}
main.link_in_module(load_irrt(&context)).unwrap();