From f70978d92e940c0ab5ecb6bdd97c9708940c0d48 Mon Sep 17 00:00:00 2001 From: Timothy Hoffman <4001421+tim-hoffman@users.noreply.github.com> Date: Wed, 16 Aug 2023 11:14:22 -0500 Subject: [PATCH] move error printout to the end (after dump) (#43) also add template vs. function to the "Running" debug line --- circuit_passes/src/bucket_interpreter/env.rs | 2 +- circuit_passes/src/passes/memory.rs | 2 +- code_producers/src/llvm_elements/mod.rs | 10 +++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/circuit_passes/src/bucket_interpreter/env.rs b/circuit_passes/src/bucket_interpreter/env.rs index 7c584ff7c..f94292b46 100644 --- a/circuit_passes/src/bucket_interpreter/env.rs +++ b/circuit_passes/src/bucket_interpreter/env.rs @@ -238,7 +238,7 @@ impl<'a> Env<'a> { observe: bool, ) -> Value { if cfg!(debug_assertions) { - println!("Running {}", name); + println!("Running function {}", name); } let code = &self.functions_library[name].body; let mut function_env = diff --git a/circuit_passes/src/passes/memory.rs b/circuit_passes/src/passes/memory.rs index fc41322cf..55b8631b3 100644 --- a/circuit_passes/src/passes/memory.rs +++ b/circuit_passes/src/passes/memory.rs @@ -48,7 +48,7 @@ impl PassMemory { pub fn run_template(&self, observer: &dyn InterpreterObserver, template: &TemplateCode) { assert!(!self.current_scope.is_empty()); if cfg!(debug_assertions) { - println!("Running {}", self.current_scope); + println!("Running template {}", self.current_scope); } let interpreter = self.build_interpreter(observer); let env = Env::new(&self.templates_library, &self.functions_library, self); diff --git a/code_producers/src/llvm_elements/mod.rs b/code_producers/src/llvm_elements/mod.rs index 57a7a66c6..f78aa6cb1 100644 --- a/code_producers/src/llvm_elements/mod.rs +++ b/code_producers/src/llvm_elements/mod.rs @@ -43,10 +43,7 @@ pub trait BodyCtx<'a> { index: IntValue<'a>, ) -> AnyValueEnum<'a>; - fn get_variable_array( - &self, - producer: &dyn LLVMIRProducer<'a>, - ) -> AnyValueEnum<'a>; + fn get_variable_array(&self, producer: &dyn LLVMIRProducer<'a>) -> AnyValueEnum<'a>; } pub trait LLVMIRProducer<'a> { @@ -63,7 +60,6 @@ pub trait LLVMIRProducer<'a> { pub type IndexMapping = HashMap>; - #[derive(Default, Eq, PartialEq, Debug)] pub struct LLVMCircuitData { pub field_tracking: Vec, @@ -294,13 +290,13 @@ impl<'a> LLVM<'a> { } // Run module verification self.module.verify().map_err(|llvm_err| { + eprintln!("Generated LLVM:"); + self.module.print_to_stderr(); eprintln!( "{}: {}", Colour::Red.paint("LLVM Module verification failed"), llvm_err.to_string() ); - eprintln!("Generated LLVM:"); - self.module.print_to_stderr(); })?; // Verify that bitcode can be written, parsed, and re-verified {