CPU/CodeCache: Remove InstructionInfo pc field

No longer needed since oldrecs are gone.
This commit is contained in:
Stenzek 2024-12-27 13:12:47 +10:00
parent ce71b168c3
commit 4b34825afd
No known key found for this signature in database
7 changed files with 12 additions and 13 deletions

View File

@ -948,7 +948,6 @@ bool CPU::CodeCache::ReadBlockInstructions(u32 start_pc, BlockInstructionList* i
InstructionInfo info;
std::memset(&info, 0, sizeof(info));
info.pc = pc;
info.is_branch_delay_slot = is_branch_delay_slot;
info.is_load_delay_slot = is_load_delay_slot;
info.is_branch_instruction = IsBranchInstruction(instruction);
@ -985,18 +984,18 @@ bool CPU::CodeCache::ReadBlockInstructions(u32 start_pc, BlockInstructionList* i
const BlockInstructionInfoPair& prev = instructions->back();
if (!prev.second.is_unconditional_branch_instruction || !prev.second.is_direct_branch_instruction)
{
WARNING_LOG("Conditional or indirect branch delay slot at {:08X}, skipping block", info.pc);
WARNING_LOG("Conditional or indirect branch delay slot at {:08X}, skipping block", pc);
return false;
}
if (!IsDirectBranchInstruction(instruction))
{
WARNING_LOG("Indirect branch in delay slot at {:08X}, skipping block", info.pc);
WARNING_LOG("Indirect branch in delay slot at {:08X}, skipping block", pc);
return false;
}
// we _could_ fetch the delay slot from the first branch's target, but it's probably in a different
// page, and that's an invalidation nightmare. so just fallback to the int, this is very rare anyway.
WARNING_LOG("Direct branch in delay slot at {:08X}, skipping block", info.pc);
WARNING_LOG("Direct branch in delay slot at {:08X}, skipping block", pc);
return false;
}
@ -1029,14 +1028,16 @@ bool CPU::CodeCache::ReadBlockInstructions(u32 start_pc, BlockInstructionList* i
#if defined(_DEBUG) || defined(_DEVEL)
SmallString disasm;
u32 disasm_pc = start_pc;
DEBUG_LOG("Block at 0x{:08X}", start_pc);
DEBUG_LOG(" Uncached fetch ticks: {}", metadata->uncached_fetch_ticks);
DEBUG_LOG(" ICache line count: {}", metadata->icache_line_count);
for (const auto& cbi : *instructions)
{
CPU::DisassembleInstruction(&disasm, cbi.second.pc, cbi.first.bits);
CPU::DisassembleInstruction(&disasm, disasm_pc, cbi.first.bits);
DEBUG_LOG("[{} {} 0x{:08X}] {:08X} {}", cbi.second.is_branch_delay_slot ? "BD" : " ",
cbi.second.is_load_delay_slot ? "LD" : " ", cbi.second.pc, cbi.first.bits, disasm);
cbi.second.is_load_delay_slot ? "LD" : " ", disasm_pc, cbi.first.bits, disasm);
disasm_pc += sizeof(Instruction);
}
#endif

View File

@ -37,8 +37,6 @@ enum RegInfoFlags : u8
struct InstructionInfo
{
u32 pc; // TODO: Remove this, old recs still depend on it.
bool is_branch_instruction : 1;
bool is_direct_branch_instruction : 1;
bool is_unconditional_branch_instruction : 1;

View File

@ -2549,7 +2549,7 @@ void CPU::CodeCache::InterpretCachedBlock(const Block* block)
// now executing the instruction we previously fetched
g_state.current_instruction.bits = instruction->bits;
g_state.current_instruction_pc = info->pc;
g_state.current_instruction_pc = g_state.pc;
g_state.current_instruction_in_branch_delay_slot = info->is_branch_delay_slot; // TODO: let int set it instead
g_state.current_instruction_was_branch_taken = g_state.branch_was_taken;
g_state.branch_was_taken = false;

View File

@ -1024,7 +1024,7 @@ void CPU::ARM32Recompiler::Flush(u32 flags)
void CPU::ARM32Recompiler::Compile_Fallback()
{
WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", iinfo->pc, inst->bits);
WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", m_current_instruction_pc, inst->bits);
Flush(FLUSH_FOR_INTERPRETER);

View File

@ -1174,7 +1174,7 @@ void CPU::ARM64Recompiler::Flush(u32 flags)
void CPU::ARM64Recompiler::Compile_Fallback()
{
WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", iinfo->pc, inst->bits);
WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", m_current_instruction_pc, inst->bits);
Flush(FLUSH_FOR_INTERPRETER);

View File

@ -996,7 +996,7 @@ void CPU::RISCV64Recompiler::Flush(u32 flags)
void CPU::RISCV64Recompiler::Compile_Fallback()
{
WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", iinfo->pc, inst->bits);
WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", m_current_instruction_pc, inst->bits);
Flush(FLUSH_FOR_INTERPRETER);

View File

@ -928,7 +928,7 @@ void CPU::X64Recompiler::Flush(u32 flags)
void CPU::X64Recompiler::Compile_Fallback()
{
WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", iinfo->pc, inst->bits);
WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", m_current_instruction_pc, inst->bits);
Flush(FLUSH_FOR_INTERPRETER);