diff --git a/src/ion/mod.rs b/src/ion/mod.rs index e7b7028..4d1ab99 100644 --- a/src/ion/mod.rs +++ b/src/ion/mod.rs @@ -97,7 +97,7 @@ impl<'a, F: Function> Env<'a, F> { self.fixup_multi_fixed_vregs(); self.merge_vreg_bundles(); self.queue_bundles(); - if log::log_enabled!(log::Level::Trace) { + if trace_enabled!() { self.dump_state(); } Ok(()) diff --git a/src/ion/moves.rs b/src/ion/moves.rs index 3e01417..1647768 100644 --- a/src/ion/moves.rs +++ b/src/ion/moves.rs @@ -435,19 +435,17 @@ impl<'a, F: Function> Env<'a, F> { alloc, ); #[cfg(debug_assertions)] - { - if log::log_enabled!(log::Level::Trace) { - self.annotate( - self.cfginfo.block_entry[block.index()], - format!( - "blockparam-in: block{} to block{}:into v{} in {}", - from_block.index(), - to_block.index(), - to_vreg.index(), - alloc - ), - ); - } + if self.annotations_enabled { + self.annotate( + self.cfginfo.block_entry[block.index()], + format!( + "blockparam-in: block{} to block{}:into v{} in {}", + from_block.index(), + to_block.index(), + to_vreg.index(), + alloc + ), + ); } } blockparam_in_idx += 1; @@ -831,16 +829,11 @@ impl<'a, F: Function> Env<'a, F> { ); if input_alloc != output_alloc { #[cfg(debug_assertions)] - { - if log::log_enabled!(log::Level::Trace) { - self.annotate( - ProgPoint::before(inst), - format!( - " reuse-input-copy: {} -> {}", - input_alloc, output_alloc - ), - ); - } + if self.annotations_enabled { + self.annotate( + ProgPoint::before(inst), + format!(" reuse-input-copy: {} -> {}", input_alloc, output_alloc), + ); } let input_operand = self.func.inst_operands(inst)[input_idx]; self.insert_move( diff --git a/src/lib.rs b/src/lib.rs index be7552c..2243f08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,6 +22,12 @@ macro_rules! trace { }; } +macro_rules! trace_enabled { + () => { + cfg!(feature = "trace-log") + }; +} + pub(crate) mod cfg; pub(crate) mod domtree; pub mod indexset;