Separate uarch data retrieval from tooltip display.

This commit is contained in:
Bartosz Taudul 2020-04-27 15:31:32 +02:00
parent abd00e28b8
commit adc60bf394

View File

@ -1765,12 +1765,8 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip
ImGui::SameLine( 0, ty );
}
const auto msz = line.mnemonic.size();
memcpy( buf, line.mnemonic.c_str(), msz );
memset( buf+msz, ' ', m_maxMnemonicLen-msz );
memcpy( buf+m_maxMnemonicLen, line.operands.c_str(), line.operands.size() + 1 );
ImGui::TextUnformatted( buf );
if( ( m_cpuArch == CpuArchX64 || m_cpuArch == CpuArchX86 ) && ImGui::IsItemHovered() )
const AsmVar* asmVar = nullptr;
if( ( m_cpuArch == CpuArchX64 || m_cpuArch == CpuArchX86 ) )
{
auto uarch = MicroArchitectureData[m_idxMicroArch];
char tmp[32];
@ -1822,7 +1818,21 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip
if( !res.empty() )
{
pdqsort_branchless( res.begin(), res.end(), []( const auto& l, const auto& r ) { return l.second < r.second; } );
const auto& var = *op->variant[res[0].first];
asmVar = op->variant[res[0].first];
}
}
}
}
const auto msz = line.mnemonic.size();
memcpy( buf, line.mnemonic.c_str(), msz );
memset( buf+msz, ' ', m_maxMnemonicLen-msz );
memcpy( buf+m_maxMnemonicLen, line.operands.c_str(), line.operands.size() + 1 );
ImGui::TextUnformatted( buf );
if( asmVar && ImGui::IsItemHovered() )
{
const auto& var = *asmVar;
if( m_font ) ImGui::PopFont();
ImGui::BeginTooltip();
TextFocused( "Throughput:", RealToString( var.tp ) );
@ -1919,9 +1929,6 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip
ImGui::EndTooltip();
if( m_font ) ImGui::PushFont( m_font );
}
}
}
}
if( line.jumpAddr != 0 )
{