Improve disassembly of CallReplacement IR op

This commit is contained in:
Henrik Rydgård
2024-06-06 15:24:58 +02:00
parent cd38db16db
commit d1a00f61de
5 changed files with 29 additions and 5 deletions
+13 -1
View File
@@ -1,6 +1,7 @@
#include "Common/CommonFuncs.h"
#include "Core/MIPS/IR/IRInst.h"
#include "Core/MIPS/MIPSDebugInterface.h"
#include "Core/HLE/ReplaceTables.h"
// Legend
// ======================
@@ -13,6 +14,7 @@
// 2 = FPR register, Vec2 (uncommon)
// v = Vec4Init constant, chosen by immediate
// s = Shuffle immediate (4 2-bit fields, choosing a xyzw shuffle)
// r = Replacement function (in constant field)
static const IRMeta irMeta[] = {
{ IROp::Nop, "Nop", "" },
@@ -165,7 +167,7 @@ static const IRMeta irMeta[] = {
{ IROp::Break, "Break", "", IRFLAG_EXIT },
{ IROp::SetPC, "SetPC", "_G" },
{ IROp::SetPCConst, "SetPC", "_C" },
{ IROp::CallReplacement, "CallRepl", "GC", IRFLAG_BARRIER },
{ IROp::CallReplacement, "CallRepl", "Gr", IRFLAG_BARRIER },
{ IROp::Breakpoint, "Breakpoint", "_C", IRFLAG_BARRIER },
{ IROp::MemoryCheck, "MemoryCheck", "IGC", IRFLAG_BARRIER },
@@ -306,6 +308,16 @@ void DisassembleParam(char *buf, int bufSize, u8 param, char type, u32 constant)
case 's':
snprintf(buf, bufSize, "%c%c%c%c", xyzw[param & 3], xyzw[(param >> 2) & 3], xyzw[(param >> 4) & 3], xyzw[(param >> 6) & 3]);
break;
case 'r':
{
const ReplacementTableEntry *entry = GetReplacementFunc(constant);
if (entry) {
snprintf(buf, bufSize, "%s", entry->name);
} else {
snprintf(buf, bufSize, "(unkn. repl %d)", constant);
}
break;
}
case '_':
case '\0':
buf[0] = 0;
+1 -1
View File
@@ -188,7 +188,7 @@ static const MIPSInstruction tableSpecial[64] = // 000000 ..... ..... ..... ....
INSTR("jalr", JITFUNC(Comp_JumpReg), Dis_JumpRegType, Int_JumpRegType, IS_JUMP|IN_RS|OUT_RD|DELAYSLOT),
INSTR("movz", JITFUNC(Comp_RType3), Dis_RType3, Int_RType3, OUT_RD|IN_RS|IN_RT|IS_CONDMOVE|CONDTYPE_EQ),
INSTR("movn", JITFUNC(Comp_RType3), Dis_RType3, Int_RType3, OUT_RD|IN_RS|IN_RT|IS_CONDMOVE|CONDTYPE_NE),
INSTR("syscall", JITFUNC(Comp_Syscall), Dis_Syscall, Int_Syscall, IN_MEM|IN_OTHER|OUT_MEM|OUT_OTHER),
INSTR("syscall", JITFUNC(Comp_Syscall), Dis_Syscall, Int_Syscall, IN_MEM|IN_OTHER|OUT_MEM|OUT_OTHER|IS_SYSCALL),
INSTR("break", JITFUNC(Comp_Break), Dis_Generic, Int_Break, 0),
INVALID,
INSTR("sync", JITFUNC(Comp_DoNothing), Dis_Generic, Int_Sync, 0),
+2
View File
@@ -92,6 +92,8 @@
#define OUT_VD 0x100000000000ULL
#define IS_SYSCALL 0x200000000000ULL
#ifndef CDECL
#define CDECL
#endif
+12 -2
View File
@@ -9,6 +9,13 @@
#include "Core/MIPS/JitCommon/JitState.h"
JitCompareScreen::JitCompareScreen() : UIDialogScreenWithBackground() {
JitBlockCacheDebugInterface *blockCacheDebug = MIPSComp::jit->GetBlockCacheDebugInterface();
// The only defaults that make sense.
if (blockCacheDebug->SupportsProfiling()) {
listSort_ = ListSort::TIME_SPENT;
} else {
listSort_ = ListSort::BLOCK_LENGTH_DESC;
}
FillBlockList();
}
@@ -166,12 +173,15 @@ void JitCompareScreen::FillBlockList() {
case ListType::FPU_BLOCKS:
case ListType::VFPU_BLOCKS:
{
const int flags = listType_ == ListType::FPU_BLOCKS ? IS_FPU : IS_VFPU;
const uint64_t flags = listType_ == ListType::FPU_BLOCKS ? IS_FPU : IS_VFPU;
// const uint64_t antiFlags = IS_SYSCALL;
const uint64_t antiFlags = 0;
JitBlockMeta meta = blockCacheDebug->GetBlockMeta(i);
if (meta.valid) {
for (u32 addr = meta.addr; addr < meta.addr + meta.sizeInBytes; addr += 4) {
MIPSOpcode opcode = Memory::Read_Instruction(addr);
if (MIPSGetInfo(opcode) & flags) {
MIPSInfo info = MIPSGetInfo(opcode);
if ((info & flags) && !(info & antiFlags)) {
blockList_.push_back(i);
break;
}
+1 -1
View File
@@ -46,7 +46,7 @@ private:
};
ViewMode viewMode_ = ViewMode::BLOCK_LIST;
ListType listType_ = ListType::ALL_BLOCKS;
ListSort listSort_ = ListSort::BLOCK_LENGTH_DESC;
ListSort listSort_ = ListSort::TIME_SPENT;
int currentBlock_ = -1; // For DISASM mode
int64_t sumTotalNanos_ = 0;