From bedc305b648a1e4fef775f1a48e3eb8ba34ee590 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 26 Oct 2019 15:44:03 +1000 Subject: [PATCH] CPU: Inline instruction accessor functions --- src/core/cpu_types.h | 15 +++++++++------ src/core/gte_types.h | 6 +++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/core/cpu_types.h b/src/core/cpu_types.h index 2952572cb..1cc597af9 100644 --- a/src/core/cpu_types.h +++ b/src/core/cpu_types.h @@ -151,8 +151,8 @@ union Instruction BitField rt; BitField imm; - u32 imm_sext32() const { return SignExtend32(imm.GetValue()); } - u32 imm_zext32() const { return ZeroExtend32(imm.GetValue()); } + ALWAYS_INLINE u32 imm_sext32() const { return SignExtend32(imm.GetValue()); } + ALWAYS_INLINE u32 imm_zext32() const { return ZeroExtend32(imm.GetValue()); } } i; union @@ -176,11 +176,14 @@ union Instruction BitField imm16; BitField imm25; - bool IsCommonInstruction() const { return (bits & (UINT32_C(1) << 25)) == 0; } + ALWAYS_INLINE bool IsCommonInstruction() const { return (bits & (UINT32_C(1) << 25)) == 0; } - CopCommonInstruction CommonOp() const { return static_cast((bits >> 21) & UINT32_C(0b1111)); } + ALWAYS_INLINE CopCommonInstruction CommonOp() const + { + return static_cast((bits >> 21) & UINT32_C(0b1111)); + } - Cop0Instruction Cop0Op() const { return static_cast(bits & UINT32_C(0x3F)); } + ALWAYS_INLINE Cop0Instruction Cop0Op() const { return static_cast(bits & UINT32_C(0x3F)); } } cop; bool IsCop2Instruction() const @@ -274,7 +277,7 @@ struct Cop0Registers { u32 BPC; // breakpoint on execute u32 BDA; // breakpoint on data access - u32 TAR; // randomly memorized jump address + u32 TAR; // randomly memorized jump address u32 BadVaddr; // bad virtual address value u32 BDAM; // data breakpoint mask u32 BPCM; // execute breakpoint mask diff --git a/src/core/gte_types.h b/src/core/gte_types.h index 22be1c559..16824e92c 100644 --- a/src/core/gte_types.h +++ b/src/core/gte_types.h @@ -34,10 +34,10 @@ union FLAGS static constexpr u32 WRITE_MASK = UINT32_C(0xFFFFF000); - void Clear() { bits = 0; } + ALWAYS_INLINE void Clear() { bits = 0; } // Bits 30..23, 18..13 OR'ed - void UpdateError() { error = (bits & UINT32_C(0x7F87E000)) != UINT32_C(0); } + ALWAYS_INLINE void UpdateError() { error = (bits & UINT32_C(0x7F87E000)) != UINT32_C(0); } }; union Regs @@ -130,7 +130,7 @@ union Instruction BitField lm; // saturate IR1, IR2, IR3 result BitField command; - u8 GetShift() const { return sf ? 12 : 0; } + ALWAYS_INLINE u8 GetShift() const { return sf ? 12 : 0; } }; } // namespace GTE \ No newline at end of file