1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Display list of read and write registers.

This commit is contained in:
Bartosz Taudul 2020-05-01 13:20:19 +02:00
parent 8014fce6e1
commit 611bfe49df
2 changed files with 144 additions and 80 deletions

View File

@ -47,6 +47,17 @@ static constexpr MicroArchUx s_uArchUx[] = {
{ "AMD Zen 2", "Ryzen 7 3700X", "ZEN2" },
};
static constexpr const char* s_regNameX86[] = {
"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"
};
static_assert( sizeof( s_regNameX86 ) / sizeof( *s_regNameX86 ) == (size_t)SourceView::RegsX86::NUMBER_OF_ENTRIES, "Invalid x86 register name table" );
static SourceView::RegsX86 s_regMapX86[X86_REG_ENDING];
@ -2077,7 +2088,9 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip
memcpy( buf+m_maxMnemonicLen, line.operands.c_str(), line.operands.size() + 1 );
ImGui::TextUnformatted( buf );
if( asmVar && ImGui::IsItemHovered() )
if( ImGui::IsItemHovered() )
{
if( asmVar )
{
const auto& var = *asmVar;
if( m_font ) ImGui::PopFont();
@ -2176,6 +2189,56 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip
ImGui::EndTooltip();
if( m_font ) ImGui::PushFont( m_font );
}
if( m_cpuArch == CpuArchX86 || m_cpuArch == CpuArchX64 )
{
if( line.readX86[0] != RegsX86::invalid || line.writeX86[0] != RegsX86::invalid )
{
if( m_font ) ImGui::PopFont();
ImGui::BeginTooltip();
if( asmVar ) ImGui::Separator();
if( line.readX86[0] != RegsX86::invalid )
{
TextDisabledUnformatted( "Read:" );
ImGui::SameLine();
int idx = 0;
for(;;)
{
if( line.readX86[idx] == RegsX86::invalid ) break;
if( idx == 0 )
{
ImGui::TextUnformatted( s_regNameX86[(int)line.readX86[idx++]] );
}
else
{
ImGui::SameLine( 0, 0 );
ImGui::Text( ", %s", s_regNameX86[(int)line.readX86[idx++]] );
}
}
}
if( line.writeX86[0] != RegsX86::invalid )
{
TextDisabledUnformatted( "Write:" );
ImGui::SameLine();
int idx = 0;
for(;;)
{
if( line.writeX86[idx] == RegsX86::invalid ) break;
if( idx == 0 )
{
ImGui::TextUnformatted( s_regNameX86[(int)line.writeX86[idx++]] );
}
else
{
ImGui::SameLine( 0, 0 );
ImGui::Text( ", %s", s_regNameX86[(int)line.writeX86[idx++]] );
}
}
}
ImGui::EndTooltip();
if( m_font ) ImGui::PushFont( m_font );
}
}
}
if( line.jumpAddr != 0 )
{

View File

@ -28,7 +28,8 @@ public:
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
xmm30, xmm31, k0, k1, k2, k3, k4, k5, k6, k7,
NUMBER_OF_ENTRIES
};
private: