diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 5d379e02..468b6285 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -47,6 +47,8 @@ static constexpr MicroArchUx s_uArchUx[] = { { "AMD Zen 2", "Ryzen 7 3700X", "ZEN2" }, }; +static SourceView::RegsX86 s_regMapX86[X86_REG_ENDING]; + enum { JumpSeparation = 6 }; enum { JumpArrowBase = 9 }; @@ -80,6 +82,197 @@ SourceView::SourceView( ImFont* font ) { m_microArchOpMap.emplace( OpsList[i], i ); } + + memset( s_regMapX86, 0, sizeof( s_regMapX86 ) ); + + s_regMapX86[X86_REG_AH] = RegsX86::rax; + s_regMapX86[X86_REG_AL] = RegsX86::rax; + s_regMapX86[X86_REG_AX] = RegsX86::rax; + s_regMapX86[X86_REG_EAX] = RegsX86::rax; + s_regMapX86[X86_REG_RAX] = RegsX86::rax; + s_regMapX86[X86_REG_BH] = RegsX86::rbx; + s_regMapX86[X86_REG_BL] = RegsX86::rbx; + s_regMapX86[X86_REG_BX] = RegsX86::rbx; + s_regMapX86[X86_REG_EBX] = RegsX86::rbx; + s_regMapX86[X86_REG_RBX] = RegsX86::rbx; + s_regMapX86[X86_REG_CH] = RegsX86::rcx; + s_regMapX86[X86_REG_CL] = RegsX86::rcx; + s_regMapX86[X86_REG_CX] = RegsX86::rcx; + s_regMapX86[X86_REG_ECX] = RegsX86::rcx; + s_regMapX86[X86_REG_RCX] = RegsX86::rcx; + s_regMapX86[X86_REG_DH] = RegsX86::rdx; + s_regMapX86[X86_REG_DL] = RegsX86::rdx; + s_regMapX86[X86_REG_DX] = RegsX86::rdx; + s_regMapX86[X86_REG_EDX] = RegsX86::rdx; + s_regMapX86[X86_REG_RDX] = RegsX86::rdx; + s_regMapX86[X86_REG_SIL] = RegsX86::rsi; + s_regMapX86[X86_REG_SI] = RegsX86::rsi; + s_regMapX86[X86_REG_ESI] = RegsX86::rsi; + s_regMapX86[X86_REG_RSI] = RegsX86::rsi; + s_regMapX86[X86_REG_DIL] = RegsX86::rdi; + s_regMapX86[X86_REG_DI] = RegsX86::rdi; + s_regMapX86[X86_REG_EDI] = RegsX86::rdi; + s_regMapX86[X86_REG_RDI] = RegsX86::rdi; + s_regMapX86[X86_REG_BP] = RegsX86::rbp; + s_regMapX86[X86_REG_BP] = RegsX86::rbp; + s_regMapX86[X86_REG_EBP] = RegsX86::rbp; + s_regMapX86[X86_REG_RBP] = RegsX86::rbp; + s_regMapX86[X86_REG_SPL] = RegsX86::rsp; + s_regMapX86[X86_REG_SP] = RegsX86::rsp; + s_regMapX86[X86_REG_ESP] = RegsX86::rsp; + s_regMapX86[X86_REG_RSP] = RegsX86::rsp; + s_regMapX86[X86_REG_R8B] = RegsX86::r8; + s_regMapX86[X86_REG_R8W] = RegsX86::r8; + s_regMapX86[X86_REG_R8D] = RegsX86::r8; + s_regMapX86[X86_REG_R8] = RegsX86::r8; + s_regMapX86[X86_REG_R9B] = RegsX86::r9; + s_regMapX86[X86_REG_R9W] = RegsX86::r9; + s_regMapX86[X86_REG_R9D] = RegsX86::r9; + s_regMapX86[X86_REG_R9] = RegsX86::r9; + s_regMapX86[X86_REG_R10B] = RegsX86::r10; + s_regMapX86[X86_REG_R10W] = RegsX86::r10; + s_regMapX86[X86_REG_R10D] = RegsX86::r10; + s_regMapX86[X86_REG_R10] = RegsX86::r10; + s_regMapX86[X86_REG_R11B] = RegsX86::r11; + s_regMapX86[X86_REG_R11W] = RegsX86::r11; + s_regMapX86[X86_REG_R11D] = RegsX86::r11; + s_regMapX86[X86_REG_R11] = RegsX86::r11; + s_regMapX86[X86_REG_R12B] = RegsX86::r12; + s_regMapX86[X86_REG_R12W] = RegsX86::r12; + s_regMapX86[X86_REG_R12D] = RegsX86::r12; + s_regMapX86[X86_REG_R12] = RegsX86::r12; + s_regMapX86[X86_REG_R13B] = RegsX86::r13; + s_regMapX86[X86_REG_R13W] = RegsX86::r13; + s_regMapX86[X86_REG_R13D] = RegsX86::r13; + s_regMapX86[X86_REG_R13] = RegsX86::r13; + s_regMapX86[X86_REG_R14B] = RegsX86::r14; + s_regMapX86[X86_REG_R14W] = RegsX86::r14; + s_regMapX86[X86_REG_R14D] = RegsX86::r14; + s_regMapX86[X86_REG_R14] = RegsX86::r14; + s_regMapX86[X86_REG_R15B] = RegsX86::r15; + s_regMapX86[X86_REG_R15W] = RegsX86::r15; + s_regMapX86[X86_REG_R15D] = RegsX86::r15; + s_regMapX86[X86_REG_R15] = RegsX86::r15; + s_regMapX86[X86_REG_MM0] = RegsX86::mm0; + s_regMapX86[X86_REG_MM1] = RegsX86::mm1; + s_regMapX86[X86_REG_MM2] = RegsX86::mm2; + s_regMapX86[X86_REG_MM3] = RegsX86::mm3; + s_regMapX86[X86_REG_MM4] = RegsX86::mm4; + s_regMapX86[X86_REG_MM5] = RegsX86::mm5; + s_regMapX86[X86_REG_MM6] = RegsX86::mm6; + s_regMapX86[X86_REG_MM7] = RegsX86::mm7; + s_regMapX86[X86_REG_ST0] = RegsX86::mm0; + s_regMapX86[X86_REG_ST1] = RegsX86::mm1; + s_regMapX86[X86_REG_ST2] = RegsX86::mm2; + s_regMapX86[X86_REG_ST3] = RegsX86::mm3; + s_regMapX86[X86_REG_ST4] = RegsX86::mm4; + s_regMapX86[X86_REG_ST5] = RegsX86::mm5; + s_regMapX86[X86_REG_ST6] = RegsX86::mm6; + s_regMapX86[X86_REG_ST7] = RegsX86::mm7; + s_regMapX86[X86_REG_XMM0] = RegsX86::xmm0; + s_regMapX86[X86_REG_YMM0] = RegsX86::xmm0; + s_regMapX86[X86_REG_ZMM0] = RegsX86::xmm0; + s_regMapX86[X86_REG_XMM1] = RegsX86::xmm1; + s_regMapX86[X86_REG_YMM1] = RegsX86::xmm1; + s_regMapX86[X86_REG_ZMM1] = RegsX86::xmm1; + s_regMapX86[X86_REG_XMM2] = RegsX86::xmm2; + s_regMapX86[X86_REG_YMM2] = RegsX86::xmm2; + s_regMapX86[X86_REG_ZMM2] = RegsX86::xmm2; + s_regMapX86[X86_REG_XMM3] = RegsX86::xmm3; + s_regMapX86[X86_REG_YMM3] = RegsX86::xmm3; + s_regMapX86[X86_REG_ZMM3] = RegsX86::xmm3; + s_regMapX86[X86_REG_XMM4] = RegsX86::xmm4; + s_regMapX86[X86_REG_YMM4] = RegsX86::xmm4; + s_regMapX86[X86_REG_ZMM4] = RegsX86::xmm4; + s_regMapX86[X86_REG_XMM5] = RegsX86::xmm5; + s_regMapX86[X86_REG_YMM5] = RegsX86::xmm5; + s_regMapX86[X86_REG_ZMM5] = RegsX86::xmm5; + s_regMapX86[X86_REG_XMM6] = RegsX86::xmm6; + s_regMapX86[X86_REG_YMM6] = RegsX86::xmm6; + s_regMapX86[X86_REG_ZMM6] = RegsX86::xmm6; + s_regMapX86[X86_REG_XMM7] = RegsX86::xmm7; + s_regMapX86[X86_REG_YMM7] = RegsX86::xmm7; + s_regMapX86[X86_REG_ZMM7] = RegsX86::xmm7; + s_regMapX86[X86_REG_XMM8] = RegsX86::xmm8; + s_regMapX86[X86_REG_YMM8] = RegsX86::xmm8; + s_regMapX86[X86_REG_ZMM8] = RegsX86::xmm8; + s_regMapX86[X86_REG_XMM9] = RegsX86::xmm9; + s_regMapX86[X86_REG_YMM9] = RegsX86::xmm9; + s_regMapX86[X86_REG_ZMM9] = RegsX86::xmm9; + s_regMapX86[X86_REG_XMM10] = RegsX86::xmm10; + s_regMapX86[X86_REG_YMM10] = RegsX86::xmm10; + s_regMapX86[X86_REG_ZMM10] = RegsX86::xmm10; + s_regMapX86[X86_REG_XMM11] = RegsX86::xmm11; + s_regMapX86[X86_REG_YMM11] = RegsX86::xmm11; + s_regMapX86[X86_REG_ZMM11] = RegsX86::xmm11; + s_regMapX86[X86_REG_XMM12] = RegsX86::xmm12; + s_regMapX86[X86_REG_YMM12] = RegsX86::xmm12; + s_regMapX86[X86_REG_ZMM12] = RegsX86::xmm12; + s_regMapX86[X86_REG_XMM13] = RegsX86::xmm13; + s_regMapX86[X86_REG_YMM13] = RegsX86::xmm13; + s_regMapX86[X86_REG_ZMM13] = RegsX86::xmm13; + s_regMapX86[X86_REG_XMM14] = RegsX86::xmm14; + s_regMapX86[X86_REG_YMM14] = RegsX86::xmm14; + s_regMapX86[X86_REG_ZMM14] = RegsX86::xmm14; + s_regMapX86[X86_REG_XMM15] = RegsX86::xmm15; + s_regMapX86[X86_REG_YMM15] = RegsX86::xmm15; + s_regMapX86[X86_REG_ZMM15] = RegsX86::xmm15; + s_regMapX86[X86_REG_XMM16] = RegsX86::xmm16; + s_regMapX86[X86_REG_YMM16] = RegsX86::xmm16; + s_regMapX86[X86_REG_ZMM16] = RegsX86::xmm16; + s_regMapX86[X86_REG_XMM17] = RegsX86::xmm17; + s_regMapX86[X86_REG_YMM17] = RegsX86::xmm17; + s_regMapX86[X86_REG_ZMM17] = RegsX86::xmm17; + s_regMapX86[X86_REG_XMM18] = RegsX86::xmm18; + s_regMapX86[X86_REG_YMM18] = RegsX86::xmm18; + s_regMapX86[X86_REG_ZMM18] = RegsX86::xmm18; + s_regMapX86[X86_REG_XMM19] = RegsX86::xmm19; + s_regMapX86[X86_REG_YMM19] = RegsX86::xmm19; + s_regMapX86[X86_REG_ZMM19] = RegsX86::xmm19; + s_regMapX86[X86_REG_XMM20] = RegsX86::xmm20; + s_regMapX86[X86_REG_YMM20] = RegsX86::xmm20; + s_regMapX86[X86_REG_ZMM20] = RegsX86::xmm20; + s_regMapX86[X86_REG_XMM21] = RegsX86::xmm21; + s_regMapX86[X86_REG_YMM21] = RegsX86::xmm21; + s_regMapX86[X86_REG_ZMM21] = RegsX86::xmm21; + s_regMapX86[X86_REG_XMM22] = RegsX86::xmm22; + s_regMapX86[X86_REG_YMM22] = RegsX86::xmm22; + s_regMapX86[X86_REG_ZMM22] = RegsX86::xmm22; + s_regMapX86[X86_REG_XMM23] = RegsX86::xmm23; + s_regMapX86[X86_REG_YMM23] = RegsX86::xmm23; + s_regMapX86[X86_REG_ZMM23] = RegsX86::xmm23; + s_regMapX86[X86_REG_XMM24] = RegsX86::xmm24; + s_regMapX86[X86_REG_YMM24] = RegsX86::xmm24; + s_regMapX86[X86_REG_ZMM24] = RegsX86::xmm24; + s_regMapX86[X86_REG_XMM25] = RegsX86::xmm25; + s_regMapX86[X86_REG_YMM25] = RegsX86::xmm25; + s_regMapX86[X86_REG_ZMM25] = RegsX86::xmm25; + s_regMapX86[X86_REG_XMM26] = RegsX86::xmm26; + s_regMapX86[X86_REG_YMM26] = RegsX86::xmm26; + s_regMapX86[X86_REG_ZMM26] = RegsX86::xmm26; + s_regMapX86[X86_REG_XMM27] = RegsX86::xmm27; + s_regMapX86[X86_REG_YMM27] = RegsX86::xmm27; + s_regMapX86[X86_REG_ZMM27] = RegsX86::xmm27; + s_regMapX86[X86_REG_XMM28] = RegsX86::xmm28; + s_regMapX86[X86_REG_YMM28] = RegsX86::xmm28; + s_regMapX86[X86_REG_ZMM28] = RegsX86::xmm28; + s_regMapX86[X86_REG_XMM29] = RegsX86::xmm29; + s_regMapX86[X86_REG_YMM29] = RegsX86::xmm29; + s_regMapX86[X86_REG_ZMM29] = RegsX86::xmm29; + s_regMapX86[X86_REG_XMM30] = RegsX86::xmm30; + s_regMapX86[X86_REG_YMM30] = RegsX86::xmm30; + s_regMapX86[X86_REG_ZMM30] = RegsX86::xmm30; + s_regMapX86[X86_REG_XMM31] = RegsX86::xmm31; + s_regMapX86[X86_REG_YMM31] = RegsX86::xmm31; + s_regMapX86[X86_REG_ZMM31] = RegsX86::xmm31; + s_regMapX86[X86_REG_K0] = RegsX86::k0; + s_regMapX86[X86_REG_K1] = RegsX86::k1; + s_regMapX86[X86_REG_K2] = RegsX86::k2; + s_regMapX86[X86_REG_K3] = RegsX86::k3; + s_regMapX86[X86_REG_K4] = RegsX86::k4; + s_regMapX86[X86_REG_K5] = RegsX86::k5; + s_regMapX86[X86_REG_K6] = RegsX86::k6; + s_regMapX86[X86_REG_K7] = RegsX86::k7; } SourceView::~SourceView() diff --git a/server/TracySourceView.hpp b/server/TracySourceView.hpp index 27bfb909..c76a3af7 100644 --- a/server/TracySourceView.hpp +++ b/server/TracySourceView.hpp @@ -19,6 +19,19 @@ class Worker; class SourceView { +public: + enum class RegsX86 : uint8_t + { + invalid, + rax, rbx, rcx, rdx, rsi, rdi, rbp, rsp, r8, r9, r10, r11, r12, r13, r14, r15, + mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7, + xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, + xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm16, xmm17, xmm18, xmm19, + xmm20, xmm21, xmm22, xmm23, xmm24, xmm25, xmm26, xmm27, xmm28, xmm29, + xmm30, xmm31, k0, k1, k2, k3, k4, k5, k6, k7 + }; + +private: enum class TokenColor : uint8_t { Default,