Merge pull request #18224 from unknownbrackets/x86-ir-dis

irjit: Describe native offsets better
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2023-09-24 16:29:34 +02:00
commit fcb5042eaa
2 files changed
+46 -6

No files matched your search

+20 -5
View File
@@ -15,6 +15,7 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <climits>
#include "Common/Profiler/Profiler.h"
#include "Common/StringUtils.h"
#include "Common/TimeUtil.h"
@@ -443,13 +444,27 @@ bool IRNativeJit::DescribeCodePtr(const u8 *ptr, std::string &name) {
return false;
int block_num = -1;
int block_offset = INT_MAX;
for (int i = 0; i < blocks_.GetNumBlocks(); ++i) {
const auto &b = blocks_.GetBlock(i);
// We allocate linearly.
if (b->GetTargetOffset() <= offset)
int b_start = b->GetTargetOffset();
if (b_start > offset)
continue;
int b_end = backend_->GetNativeBlock(i)->checkedOffset;
int b_offset = offset - b_start;
if (b_end > b_start && b_end >= offset) {
// For sure within the block.
block_num = i;
if (b->GetTargetOffset() > offset)
block_offset = b_offset;
break;
}
if (b_offset < block_offset) {
// Possibly within the block, unless in some other block...
block_num = i;
block_offset = b_offset;
}
}
// Used by profiling tools that don't like spaces.
@@ -466,9 +481,9 @@ bool IRNativeJit::DescribeCodePtr(const u8 *ptr, std::string &name) {
// It helps to know which func this block is inside.
const std::string label = g_symbolMap ? g_symbolMap->GetDescription(start) : "";
if (!label.empty())
name = StringFromFormat("block%d_%08x_%s", block_num, start, label.c_str());
name = StringFromFormat("block%d_%08x_%s_0x%x", block_num, start, label.c_str(), block_offset);
else
name = StringFromFormat("block%d_%08x", block_num, start);
name = StringFromFormat("block%d_%08x_0x%x", block_num, start, block_offset);
return true;
}
return false;
+26 -1
View File
@@ -19,6 +19,7 @@
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include <cstddef>
#include "Common/StringUtils.h"
#include "Core/MemMap.h"
#include "Core/MIPS/MIPSTables.h"
#include "Core/MIPS/x86/X64IRJit.h"
@@ -265,7 +266,31 @@ bool X64JitBackend::DescribeCodePtr(const u8 *ptr, std::string &name) const {
} else if (ptr == applyRoundingMode_) {
name = "applyRoundingMode";
} else if (ptr >= GetBasePtr() && ptr < GetBasePtr() + jitStartOffset_) {
name = "fixedCode";
if (ptr == constants.noSignMask) {
name = "constants.noSignMask";
} else if (ptr == constants.signBitAll) {
name = "constants.signBitAll";
} else if (ptr == constants.positiveZeroes) {
name = "constants.positiveZeroes";
} else if (ptr == constants.positiveInfinity) {
name = "constants.positiveInfinity";
} else if (ptr == constants.positiveOnes) {
name = "constants.positiveOnes";
} else if (ptr == constants.negativeOnes) {
name = "constants.negativeOnes";
} else if (ptr == constants.qNAN) {
name = "constants.qNAN";
} else if (ptr == constants.maxIntBelowAsFloat) {
name = "constants.maxIntBelowAsFloat";
} else if ((const float *)ptr >= constants.mulTableVi2f && (const float *)ptr < constants.mulTableVi2f + 32) {
name = StringFromFormat("constants.mulTableVi2f[%d]", (int)((const float *)ptr - constants.mulTableVi2f));
} else if ((const float *)ptr >= constants.mulTableVf2i && (const float *)ptr < constants.mulTableVf2i + 32) {
name = StringFromFormat("constants.mulTableVf2i[%d]", (int)((const float *)ptr - constants.mulTableVf2i));
} else if ((const Float4Constant *)ptr >= constants.vec4InitValues && (const Float4Constant *)ptr < constants.vec4InitValues + 8) {
name = StringFromFormat("constants.vec4InitValues[%d]", (int)((const Float4Constant *)ptr - constants.vec4InitValues));
} else {
name = "fixedCode";
}
} else {
return IRNativeBackend::DescribeCodePtr(ptr, name);
}