diff options
author | iximeow <me@iximeow.net> | 2025-06-02 08:03:12 +0000 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2025-06-02 08:03:12 +0000 |
commit | 276172a5a888165f82075eba48bd6f79246c2dcc (patch) | |
tree | dc0e018f59fdbe18d9323bff22edcb530e1d2967 /src/armv7.rs | |
parent | 614d7e8bc6325dd3e632b3e83da627fa6ff9f31a (diff) |
some armv7 decode helpers are trivial functions but didn't inline
both from_u8 and the build function here compiled to truly trivial code:
four instructions (mov rdi, rax; cmp 0xlim, rax; jae panic; ret) in the
hot path, and constrained register choice on the caller side. inlining
these makes for a *smaller* armv7 decoder, on the order of 5kb down from
5.5kb. in the process it also gets about 45% faster (400mb/s to 560mb/s)
inlining decode_into, then, really just helps the standalone decoder
benchmark case. this moves decode throughput from 560mb/s to 724mb/s.
Diffstat (limited to 'src/armv7.rs')
-rw-r--r-- | src/armv7.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/armv7.rs b/src/armv7.rs index e025267..b8f33d3 100644 --- a/src/armv7.rs +++ b/src/armv7.rs @@ -1291,6 +1291,7 @@ impl Reg { /// create a new `Reg` with the specified number. /// /// panics if `bits` is out of range (16 or above). + #[inline] pub fn from_u8(bits: u8) -> Reg { if bits > 0b1111 { panic!("register number out of range"); @@ -1322,6 +1323,7 @@ impl CReg { /// create a new `CReg` with the specified number. /// /// panics if `bits` is out of range (16 or above). + #[inline] pub fn from_u8(bits: u8) -> CReg { if bits > 0b1111 { panic!("register number out of range"); @@ -1936,6 +1938,7 @@ impl Display for ConditionCode { } impl ConditionCode { + #[inline] fn build(value: u8) -> ConditionCode { match value { 0b0000 => ConditionCode::EQ, @@ -2204,6 +2207,7 @@ impl InstDecoder { #[allow(non_snake_case)] impl Decoder<ARMv7> for InstDecoder { + #[inline] fn decode_into<T: Reader<<ARMv7 as Arch>::Address, <ARMv7 as Arch>::Word>>(&self, inst: &mut Instruction, words: &mut T) -> Result<(), <ARMv7 as Arch>::DecodeError> { inst.set_w(false); inst.set_wide(false); |