verbose_debugging_output: Use actual names

This commit is contained in:
Merry 2023-02-04 14:11:56 +00:00
parent 8c9a3e16f5
commit 2636da8821
9 changed files with 15 additions and 20 deletions

View file

@ -242,17 +242,16 @@ void RegAlloc::AssertNoMoreUses() const {
ASSERT(std::all_of(spills.begin(), spills.end(), is_empty));
}
void RegAlloc::EmitVerboseDebuggingOutput(EmitContext& ctx) {
void RegAlloc::EmitVerboseDebuggingOutput() {
code.MOV(X19, mcl::bit_cast<u64>(&PrintVerboseDebuggingOutputLine)); // Non-volatile register
const auto do_location = [&](HostLocInfo& info, HostLocType type, size_t index) {
using namespace oaknut::util;
for (const IR::Inst* value : info.values) {
const auto inst_offset = std::distance(ctx.block.begin(), IR::Block::iterator(const_cast<IR::Inst*>(value)));
code.MOV(X0, SP);
code.MOV(X1, static_cast<u64>(type));
code.MOV(X2, index);
code.MOV(X3, mcl::bit_cast<u64>(inst_offset));
code.MOV(X3, value->GetName());
code.MOV(X4, static_cast<u64>(value->GetType()));
code.BLR(X19);
}

View file

@ -24,7 +24,6 @@
namespace Dynarmic::Backend::Arm64 {
struct EmitContext;
class FpsrManager;
class RegAlloc;
@ -296,7 +295,7 @@ public:
void AssertAllUnlocked() const;
void AssertNoMoreUses() const;
void EmitVerboseDebuggingOutput(EmitContext& ctx);
void EmitVerboseDebuggingOutput();
private:
friend struct Argument;

View file

@ -33,7 +33,7 @@ void EmitVerboseDebuggingOutput(oaknut::CodeGenerator& code, EmitContext& ctx) {
code.ADD(X0, SP, sizeof(RegisterData) + offsetof(StackLayout, spill));
code.STR(X0, SP, offsetof(RegisterData, spill));
ctx.reg_alloc.EmitVerboseDebuggingOutput(ctx);
ctx.reg_alloc.EmitVerboseDebuggingOutput();
code.LDR(X0, SP, offsetof(RegisterData, nzcv));
code.MSR(oaknut::SystemReg::NZCV, X0);

View file

@ -150,7 +150,7 @@ A32EmitX64::BlockDescriptor A32EmitX64::Emit(IR::Block& block) {
reg_alloc.EndOfAllocScope();
if (conf.very_verbose_debugging_output) {
EmitVerboseDebuggingOutput(reg_alloc, block);
EmitVerboseDebuggingOutput(reg_alloc);
}
}

View file

@ -121,7 +121,7 @@ A64EmitX64::BlockDescriptor A64EmitX64::Emit(IR::Block& block) {
ctx.reg_alloc.EndOfAllocScope();
if (conf.very_verbose_debugging_output) {
EmitVerboseDebuggingOutput(reg_alloc, block);
EmitVerboseDebuggingOutput(reg_alloc);
}
}

View file

@ -99,7 +99,7 @@ void EmitX64::PushRSBHelper(Xbyak::Reg64 loc_desc_reg, Xbyak::Reg64 index_reg, I
code.mov(dword[r15 + code.GetJitStateInfo().offsetof_rsb_ptr], index_reg.cvt32());
}
void EmitX64::EmitVerboseDebuggingOutput(RegAlloc& reg_alloc, const IR::Block& block) {
void EmitX64::EmitVerboseDebuggingOutput(RegAlloc& reg_alloc) {
code.sub(rsp, sizeof(RegisterData));
code.stmxcsr(dword[rsp + offsetof(RegisterData, mxcsr)]);
for (int i = 0; i < 16; i++) {
@ -114,7 +114,7 @@ void EmitX64::EmitVerboseDebuggingOutput(RegAlloc& reg_alloc, const IR::Block& b
code.lea(rax, ptr[rsp + sizeof(RegisterData) + offsetof(StackLayout, spill)]);
code.mov(xword[rsp + offsetof(RegisterData, spill)], rax);
reg_alloc.EmitVerboseDebuggingOutput(block);
reg_alloc.EmitVerboseDebuggingOutput();
for (int i = 0; i < 16; i++) {
if (rsp.getIdx() == i) {

View file

@ -107,7 +107,7 @@ protected:
BlockDescriptor RegisterBlock(const IR::LocationDescriptor& location_descriptor, CodePtr entrypoint, size_t size);
void PushRSBHelper(Xbyak::Reg64 loc_desc_reg, Xbyak::Reg64 index_reg, IR::LocationDescriptor target);
void EmitVerboseDebuggingOutput(RegAlloc& reg_alloc, const IR::Block& block);
void EmitVerboseDebuggingOutput(RegAlloc& reg_alloc);
// Terminal instruction emitters
void EmitTerminal(IR::Terminal terminal, IR::LocationDescriptor initial_location, bool is_single_step);

View file

@ -17,7 +17,6 @@
#include "dynarmic/backend/x64/abi.h"
#include "dynarmic/backend/x64/stack_layout.h"
#include "dynarmic/backend/x64/verbose_debugging_output.h"
#include "dynarmic/ir/basic_block.h"
namespace Dynarmic::Backend::X64 {
@ -158,13 +157,12 @@ void HostLocInfo::AddValue(IR::Inst* inst) {
max_bit_width = std::max(max_bit_width, GetBitWidth(inst->GetType()));
}
void HostLocInfo::EmitVerboseDebuggingOutput(BlockOfCode& code, size_t host_loc_index, const IR::Block& block) const {
void HostLocInfo::EmitVerboseDebuggingOutput(BlockOfCode& code, size_t host_loc_index) const {
using namespace Xbyak::util;
for (IR::Inst* value : values) {
const auto inst_offset = std::distance(block.begin(), IR::Block::const_iterator(value));
code.mov(code.ABI_PARAM1, rsp);
code.mov(code.ABI_PARAM2, host_loc_index);
code.mov(code.ABI_PARAM3, mcl::bit_cast<u64>(inst_offset));
code.mov(code.ABI_PARAM3, value->GetName());
code.mov(code.ABI_PARAM4, GetBitWidth(value->GetType()));
code.CallFunction(PrintVerboseDebuggingOutputLine);
}
@ -515,9 +513,9 @@ void RegAlloc::AssertNoMoreUses() {
ASSERT(std::all_of(hostloc_info.begin(), hostloc_info.end(), [](const auto& i) { return i.IsEmpty(); }));
}
void RegAlloc::EmitVerboseDebuggingOutput(const IR::Block& block) {
void RegAlloc::EmitVerboseDebuggingOutput() {
for (size_t i = 0; i < hostloc_info.size(); i++) {
hostloc_info[i].EmitVerboseDebuggingOutput(code, i, block);
hostloc_info[i].EmitVerboseDebuggingOutput(code, i);
}
}

View file

@ -23,7 +23,6 @@
namespace Dynarmic::IR {
enum class AccType;
class Block;
} // namespace Dynarmic::IR
namespace Dynarmic::Backend::X64 {
@ -49,7 +48,7 @@ public:
void AddValue(IR::Inst* inst);
void EmitVerboseDebuggingOutput(BlockOfCode& code, size_t host_loc_index, const IR::Block& block) const;
void EmitVerboseDebuggingOutput(BlockOfCode& code, size_t host_loc_index) const;
private:
// Current instruction state
@ -148,7 +147,7 @@ public:
void AssertNoMoreUses();
void EmitVerboseDebuggingOutput(const IR::Block& block);
void EmitVerboseDebuggingOutput();
private:
friend struct Argument;