From 6b0a7aa23f1f125213081cee1f37079e53f05882 Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 18 Jun 2024 23:37:41 -0700 Subject: configurable inlining to help with opts --- src/long_mode/display.rs | 3 ++- src/long_mode/mod.rs | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src/long_mode') diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs index 77111b8..d0aef26 100644 --- a/src/long_mode/display.rs +++ b/src/long_mode/display.rs @@ -384,7 +384,6 @@ pub trait DisplaySink: fmt::Write { /// utf-8 string. this may corrupt Rust strings. unsafe fn write_lt_32(&mut self, s: &str) -> Result<(), core::fmt::Error> { self.write_str(s) - } /// write a string to this sink that is less than 16 bytes. this is provided for optimization /// opportunities when writing a variable-length string with known max size. @@ -5769,12 +5768,14 @@ impl Instruction { Ok(()) } + #[cfg_attr(feature="profiling", inline(never))] pub fn write_to(&self, out: &mut T) -> fmt::Result { contextualize_intel(self, out) // self.display_with(DisplayStyle::Intel).contextualize(&NoColors, 0, Some(&NoContext), out) } } +#[cfg_attr(feature="profiling", inline(never))] fn contextualize_intel(instr: &Instruction, out: &mut T) -> fmt::Result { if instr.xacquire() { out.write_fixed_size("xacquire ")?; diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index e6d0a02..5a5b89a 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -4383,6 +4383,7 @@ impl Instruction { /// if the work you expect to do per-operand is very small, constructing an `Operand` and /// dispatching on tags may be a substantial factor of overall runtime. `visit_operand` can /// reduce total overhead in such cases. + #[cfg_attr(features="profiling", inline(never))] fn visit_operand(&self, i: u8, visitor: &mut T) -> Result { assert!(i < 4); let spec = self.operands[i as usize]; @@ -6009,7 +6010,8 @@ const OPCODES: [OpcodeRecord; 256] = [ ]; #[allow(non_snake_case)] -#[inline(always)] +#[cfg_attr(feature="profiling", inline(never))] +#[cfg_attr(not(feature="profiling"), inline(always))] pub(self) fn read_E< T: Reader<::Address, ::Word>, S: DescriptionSink, @@ -6638,6 +6640,7 @@ impl DecodeCtx { self.rb_size } +#[cfg_attr(feature="profiling", inline(never))] fn read_opc_hotpath< T: Reader<::Address, ::Word>, S: DescriptionSink, @@ -6694,7 +6697,8 @@ fn read_opc_hotpath< } } -#[inline(always)] +#[cfg_attr(feature="profiling", inline(never))] +#[cfg_attr(not(feature="profiling"), inline(always))] fn read_with_annotations< T: Reader<::Address, ::Word>, S: DescriptionSink, @@ -6912,7 +6916,8 @@ fn read_avx_prefixed< return Ok(()); } -#[inline(always)] +#[cfg_attr(feature="profiling", inline(never))] +#[cfg_attr(not(feature="profiling"), inline(always))] fn read_operands< T: Reader<::Address, ::Word>, S: DescriptionSink -- cgit v1.1