From 39724de5985843b8bd1a13e125412a8bd3715dfb Mon Sep 17 00:00:00 2001 From: David Mak Date: Tue, 12 Sep 2023 10:09:11 +0800 Subject: [PATCH] core: Add CodeGenLLVMOptions For specifying LLVM options during code generation. --- nac3core/src/codegen/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nac3core/src/codegen/mod.rs b/nac3core/src/codegen/mod.rs index 3c213b34..e68f909f 100644 --- a/nac3core/src/codegen/mod.rs +++ b/nac3core/src/codegen/mod.rs @@ -59,6 +59,15 @@ lazy_static!( static ref PASSES_INIT_LOCK: Mutex = Mutex::new(AtomicBool::new(true)); ); +/// Additional options for LLVM during codegen. +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct CodeGenLLVMOptions { + /// The optimization level to apply on the generated LLVM IR. + pub opt_level: OptimizationLevel, + /// Whether to output the LLVM IR after generation is complete. + pub emit_llvm: bool, +} + pub struct CodeGenContext<'ctx, 'a> { pub ctx: &'ctx Context, pub builder: Builder<'ctx>,