CPU: Force-inline some accessor functions

This commit is contained in:
Connor McLaughlin 2019-12-05 23:02:03 +10:00
parent 8b9d44f4dc
commit 9fa8eb239e

View file

@ -9,6 +9,7 @@
class StateWrapper; class StateWrapper;
class Bus; class Bus;
class System;
namespace CPU { namespace CPU {
@ -41,19 +42,20 @@ public:
void Execute(); void Execute();
const Registers& GetRegs() const { return m_regs; } ALWAYS_INLINE Bus* GetBus() const { return m_bus; }
Registers& GetRegs() { return m_regs; }
TickCount GetPendingTicks() const { return m_pending_ticks; } ALWAYS_INLINE const Registers& GetRegs() const { return m_regs; }
void ResetPendingTicks() { m_pending_ticks = 0; } ALWAYS_INLINE Registers& GetRegs() { return m_regs; }
void AddPendingTicks(TickCount ticks)
ALWAYS_INLINE TickCount GetPendingTicks() const { return m_pending_ticks; }
ALWAYS_INLINE void ResetPendingTicks() { m_pending_ticks = 0; }
ALWAYS_INLINE void AddPendingTicks(TickCount ticks) { m_pending_ticks += ticks; }
ALWAYS_INLINE void SetDowncount(TickCount downcount)
{ {
m_pending_ticks += ticks; m_downcount = (downcount < m_downcount) ? downcount : m_downcount;
m_downcount -= ticks;
} }
ALWAYS_INLINE void ResetDowncount() { m_downcount = MAX_SLICE_SIZE; }
void SetDowncount(TickCount downcount) { m_downcount = (downcount < m_downcount) ? downcount : m_downcount; }
void ResetDowncount() { m_downcount = MAX_SLICE_SIZE; }
// Sets the PC and flushes the pipeline. // Sets the PC and flushes the pipeline.
void SetPC(u32 new_pc); void SetPC(u32 new_pc);
@ -88,8 +90,8 @@ private:
bool WriteMemoryWord(VirtualMemoryAddress addr, u32 value); bool WriteMemoryWord(VirtualMemoryAddress addr, u32 value);
// state helpers // state helpers
bool InUserMode() const { return m_cop0_regs.sr.KUc; } ALWAYS_INLINE bool InUserMode() const { return m_cop0_regs.sr.KUc; }
bool InKernelMode() const { return !m_cop0_regs.sr.KUc; } ALWAYS_INLINE bool InKernelMode() const { return !m_cop0_regs.sr.KUc; }
void DisassembleAndPrint(u32 addr); void DisassembleAndPrint(u32 addr);
void DisassembleAndLog(u32 addr); void DisassembleAndLog(u32 addr);
@ -164,6 +166,7 @@ private:
u32 m_next_load_delay_value = 0; u32 m_next_load_delay_value = 0;
u32 m_cache_control = 0; u32 m_cache_control = 0;
System* m_system = nullptr;
// data cache (used as scratchpad) // data cache (used as scratchpad)
std::array<u8, DCACHE_SIZE> m_dcache = {}; std::array<u8, DCACHE_SIZE> m_dcache = {};