Misc: Replace log printf calls with fmt
This commit is contained in:
@ -71,7 +71,7 @@ void CPU::NewRec::Compiler::BeginBlock()
|
||||
|
||||
if (m_block->protection == CodeCache::PageProtectionMode::ManualCheck)
|
||||
{
|
||||
Log_DebugPrintf("Generate manual protection for PC %08X", m_block->pc);
|
||||
Log_DebugFmt("Generate manual protection for PC {:08X}", m_block->pc);
|
||||
const u8* ram_ptr = Bus::g_ram + VirtualAddressToPhysical(m_block->pc);
|
||||
const u8* shadow_ptr = reinterpret_cast<const u8*>(m_block->Instructions());
|
||||
GenerateBlockProtectCheck(ram_ptr, shadow_ptr, m_block->size * sizeof(Instruction));
|
||||
@ -103,7 +103,7 @@ const void* CPU::NewRec::Compiler::CompileBlock(CodeCache::Block* block, u32* ho
|
||||
Reset(block, buffer.GetFreeCodePointer(), buffer.GetFreeCodeSpace(), buffer.GetFreeFarCodePointer(),
|
||||
buffer.GetFreeFarCodeSpace());
|
||||
|
||||
Log_DebugPrintf("Block range: %08X -> %08X", block->pc, block->pc + block->size * 4);
|
||||
Log_DebugFmt("Block range: {:08X} -> {:08X}", block->pc, block->pc + block->size * 4);
|
||||
|
||||
BeginBlock();
|
||||
|
||||
@ -167,8 +167,8 @@ void CPU::NewRec::Compiler::SetConstantReg(Reg r, u32 v)
|
||||
|
||||
if (const std::optional<u32> hostreg = CheckHostReg(0, HR_TYPE_CPU_REG, r); hostreg.has_value())
|
||||
{
|
||||
Log_DebugPrintf("Discarding guest register %s in host register %s due to constant set", GetRegName(r),
|
||||
GetHostRegName(hostreg.value()));
|
||||
Log_DebugFmt("Discarding guest register {} in host register {} due to constant set", GetRegName(r),
|
||||
GetHostRegName(hostreg.value()));
|
||||
FreeHostReg(hostreg.value());
|
||||
}
|
||||
}
|
||||
@ -178,7 +178,7 @@ void CPU::NewRec::Compiler::CancelLoadDelaysToReg(Reg reg)
|
||||
if (m_load_delay_register != reg)
|
||||
return;
|
||||
|
||||
Log_DebugPrintf("Cancelling load delay to %s", GetRegName(reg));
|
||||
Log_DebugFmt("Cancelling load delay to {}", GetRegName(reg));
|
||||
m_load_delay_register = Reg::count;
|
||||
if (m_load_delay_value_register != NUM_HOST_REGS)
|
||||
ClearHostReg(m_load_delay_value_register);
|
||||
@ -196,7 +196,7 @@ void CPU::NewRec::Compiler::UpdateLoadDelay()
|
||||
// thankfully since this only happens on the first instruction, we can get away with just killing anything which
|
||||
// isn't in write mode, because nothing could've been written before it, and the new value overwrites any
|
||||
// load-delayed value
|
||||
Log_DebugPrintf("Invalidating non-dirty registers, and flushing load delay from state");
|
||||
Log_DebugPrint("Invalidating non-dirty registers, and flushing load delay from state");
|
||||
|
||||
constexpr u32 req_flags = (HR_ALLOCATED | HR_MODE_WRITE);
|
||||
|
||||
@ -206,7 +206,7 @@ void CPU::NewRec::Compiler::UpdateLoadDelay()
|
||||
if (ra.type != HR_TYPE_CPU_REG || !IsHostRegAllocated(i) || ((ra.flags & req_flags) == req_flags))
|
||||
continue;
|
||||
|
||||
Log_DebugPrintf("Freeing non-dirty cached register %s in %s", GetRegName(ra.reg), GetHostRegName(i));
|
||||
Log_DebugFmt("Freeing non-dirty cached register {} in {}", GetRegName(ra.reg), GetHostRegName(i));
|
||||
DebugAssert(!(ra.flags & HR_MODE_WRITE));
|
||||
ClearHostReg(i);
|
||||
}
|
||||
@ -217,7 +217,7 @@ void CPU::NewRec::Compiler::UpdateLoadDelay()
|
||||
if (!HasConstantReg(static_cast<Reg>(i)) || HasDirtyConstantReg(static_cast<Reg>(i)))
|
||||
continue;
|
||||
|
||||
Log_DebugPrintf("Clearing non-dirty constant %s", GetRegName(static_cast<Reg>(i)));
|
||||
Log_DebugFmt("Clearing non-dirty constant {}", GetRegName(static_cast<Reg>(i)));
|
||||
ClearConstantReg(static_cast<Reg>(i));
|
||||
}
|
||||
|
||||
@ -264,8 +264,8 @@ void CPU::NewRec::Compiler::FinishLoadDelay()
|
||||
// kill any (old) cached value for this register
|
||||
DeleteMIPSReg(m_load_delay_register, false);
|
||||
|
||||
Log_DebugPrintf("Finished delayed load to %s in host register %s", GetRegName(m_load_delay_register),
|
||||
GetHostRegName(m_load_delay_value_register));
|
||||
Log_DebugFmt("Finished delayed load to {} in host register {}", GetRegName(m_load_delay_register),
|
||||
GetHostRegName(m_load_delay_value_register));
|
||||
|
||||
// and swap the mode over so it gets written back later
|
||||
HostRegAlloc& ra = m_host_regs[m_load_delay_value_register];
|
||||
@ -275,7 +275,7 @@ void CPU::NewRec::Compiler::FinishLoadDelay()
|
||||
ra.type = HR_TYPE_CPU_REG;
|
||||
|
||||
// constants are gone
|
||||
Log_DebugPrintf("Clearing constant in %s due to load delay", GetRegName(m_load_delay_register));
|
||||
Log_DebugFmt("Clearing constant in {} due to load delay", GetRegName(m_load_delay_register));
|
||||
ClearConstantReg(m_load_delay_register);
|
||||
|
||||
m_load_delay_register = Reg::count;
|
||||
@ -598,8 +598,8 @@ u32 CPU::NewRec::Compiler::GetFreeHostReg(u32 flags)
|
||||
|
||||
if (caller_saved_lowest_count < lowest_count)
|
||||
{
|
||||
Log_DebugPrintf("Moving caller-saved host register %s with MIPS register %s to %s for allocation",
|
||||
GetHostRegName(lowest), GetRegName(ra.reg), GetHostRegName(caller_saved_lowest));
|
||||
Log_DebugFmt("Moving caller-saved host register {} with MIPS register {} to {} for allocation",
|
||||
GetHostRegName(lowest), GetRegName(ra.reg), GetHostRegName(caller_saved_lowest));
|
||||
if (IsHostRegAllocated(caller_saved_lowest))
|
||||
FreeHostReg(caller_saved_lowest);
|
||||
CopyHostReg(caller_saved_lowest, lowest);
|
||||
@ -609,20 +609,20 @@ u32 CPU::NewRec::Compiler::GetFreeHostReg(u32 flags)
|
||||
}
|
||||
}
|
||||
|
||||
Log_DebugPrintf("Freeing register %s in host register %s for allocation", GetRegName(ra.reg),
|
||||
GetHostRegName(lowest));
|
||||
Log_DebugFmt("Freeing register {} in host register {} for allocation", GetRegName(ra.reg),
|
||||
GetHostRegName(lowest));
|
||||
}
|
||||
break;
|
||||
case HR_TYPE_LOAD_DELAY_VALUE:
|
||||
{
|
||||
Log_DebugPrintf("Freeing load delay register %s in host register %s for allocation", GetHostRegName(lowest),
|
||||
GetRegName(ra.reg));
|
||||
Log_DebugFmt("Freeing load delay register {} in host register {} for allocation", GetHostRegName(lowest),
|
||||
GetRegName(ra.reg));
|
||||
}
|
||||
break;
|
||||
case HR_TYPE_NEXT_LOAD_DELAY_VALUE:
|
||||
{
|
||||
Log_DebugPrintf("Freeing next load delay register %s in host register %s due for allocation", GetRegName(ra.reg),
|
||||
GetHostRegName(lowest));
|
||||
Log_DebugFmt("Freeing next load delay register {} in host register {} due for allocation", GetRegName(ra.reg),
|
||||
GetHostRegName(lowest));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -680,8 +680,8 @@ u32 CPU::NewRec::Compiler::AllocateHostReg(u32 flags, HostRegAllocType type /* =
|
||||
{
|
||||
DebugAssert(reg != Reg::zero);
|
||||
|
||||
Log_DebugPrintf("Allocate host reg %s to guest reg %s in %s mode", GetHostRegName(hreg), GetRegName(reg),
|
||||
GetReadWriteModeString(flags));
|
||||
Log_DebugFmt("Allocate host reg {} to guest reg {} in {} mode", GetHostRegName(hreg), GetRegName(reg),
|
||||
GetReadWriteModeString(flags));
|
||||
|
||||
if (flags & HR_MODE_READ)
|
||||
{
|
||||
@ -690,8 +690,7 @@ u32 CPU::NewRec::Compiler::AllocateHostReg(u32 flags, HostRegAllocType type /* =
|
||||
if (HasConstantReg(reg))
|
||||
{
|
||||
// may as well flush it now
|
||||
Log_DebugPrintf("Flush constant register in guest reg %s to host reg %s", GetRegName(reg),
|
||||
GetHostRegName(hreg));
|
||||
Log_DebugFmt("Flush constant register in guest reg {} to host reg {}", GetRegName(reg), GetHostRegName(hreg));
|
||||
LoadHostRegWithConstant(hreg, GetConstantRegU32(reg));
|
||||
m_constant_regs_dirty.reset(static_cast<u8>(reg));
|
||||
ra.flags |= HR_MODE_WRITE;
|
||||
@ -705,8 +704,8 @@ u32 CPU::NewRec::Compiler::AllocateHostReg(u32 flags, HostRegAllocType type /* =
|
||||
if (flags & HR_MODE_WRITE && HasConstantReg(reg))
|
||||
{
|
||||
DebugAssert(reg != Reg::zero);
|
||||
Log_DebugPrintf("Clearing constant register in guest reg %s due to write mode in %s", GetRegName(reg),
|
||||
GetHostRegName(hreg));
|
||||
Log_DebugFmt("Clearing constant register in guest reg {} due to write mode in {}", GetRegName(reg),
|
||||
GetHostRegName(hreg));
|
||||
|
||||
ClearConstantReg(reg);
|
||||
}
|
||||
@ -716,8 +715,8 @@ u32 CPU::NewRec::Compiler::AllocateHostReg(u32 flags, HostRegAllocType type /* =
|
||||
case HR_TYPE_LOAD_DELAY_VALUE:
|
||||
{
|
||||
DebugAssert(!m_load_delay_dirty && (!HasLoadDelay() || !(flags & HR_MODE_WRITE)));
|
||||
Log_DebugPrintf("Allocating load delayed guest register %s in host reg %s in %s mode", GetRegName(reg),
|
||||
GetHostRegName(hreg), GetReadWriteModeString(flags));
|
||||
Log_DebugFmt("Allocating load delayed guest register {} in host reg {} in {} mode", GetRegName(reg),
|
||||
GetHostRegName(hreg), GetReadWriteModeString(flags));
|
||||
m_load_delay_register = reg;
|
||||
m_load_delay_value_register = hreg;
|
||||
if (flags & HR_MODE_READ)
|
||||
@ -727,8 +726,8 @@ u32 CPU::NewRec::Compiler::AllocateHostReg(u32 flags, HostRegAllocType type /* =
|
||||
|
||||
case HR_TYPE_NEXT_LOAD_DELAY_VALUE:
|
||||
{
|
||||
Log_DebugPrintf("Allocating next load delayed guest register %s in host reg %s in %s mode", GetRegName(reg),
|
||||
GetHostRegName(hreg), GetReadWriteModeString(flags));
|
||||
Log_DebugFmt("Allocating next load delayed guest register {} in host reg {} in {} mode", GetRegName(reg),
|
||||
GetHostRegName(hreg), GetReadWriteModeString(flags));
|
||||
m_next_load_delay_register = reg;
|
||||
m_next_load_delay_value_register = hreg;
|
||||
if (flags & HR_MODE_READ)
|
||||
@ -739,7 +738,7 @@ u32 CPU::NewRec::Compiler::AllocateHostReg(u32 flags, HostRegAllocType type /* =
|
||||
case HR_TYPE_TEMP:
|
||||
{
|
||||
DebugAssert(!(flags & (HR_MODE_READ | HR_MODE_WRITE)));
|
||||
Log_DebugPrintf("Allocate host reg %s as temporary", GetHostRegName(hreg));
|
||||
Log_DebugFmt("Allocate host reg {} as temporary", GetHostRegName(hreg));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -765,16 +764,13 @@ std::optional<u32> CPU::NewRec::Compiler::CheckHostReg(u32 flags, HostRegAllocTy
|
||||
{
|
||||
DebugAssert(type == HR_TYPE_CPU_REG);
|
||||
if (!(ra.flags & HR_MODE_WRITE))
|
||||
{
|
||||
Log_DebugPrintf("Switch guest reg %s from read to read-write in host reg %s", GetRegName(reg),
|
||||
GetHostRegName(i));
|
||||
}
|
||||
Log_DebugFmt("Switch guest reg {} from read to read-write in host reg {}", GetRegName(reg), GetHostRegName(i));
|
||||
|
||||
if (HasConstantReg(reg))
|
||||
{
|
||||
DebugAssert(reg != Reg::zero);
|
||||
Log_DebugPrintf("Clearing constant register in guest reg %s due to write mode in %s", GetRegName(reg),
|
||||
GetHostRegName(i));
|
||||
Log_DebugFmt("Clearing constant register in guest reg {} due to write mode in {}", GetRegName(reg),
|
||||
GetHostRegName(i));
|
||||
|
||||
ClearConstantReg(reg);
|
||||
}
|
||||
@ -788,7 +784,7 @@ std::optional<u32> CPU::NewRec::Compiler::CheckHostReg(u32 flags, HostRegAllocTy
|
||||
{
|
||||
// Need to move it to one which is
|
||||
const u32 new_reg = GetFreeHostReg(HR_CALLEE_SAVED);
|
||||
Log_DebugPrintf("Rename host reg %s to %s for callee saved", GetHostRegName(i), GetHostRegName(new_reg));
|
||||
Log_DebugFmt("Rename host reg {} to {} for callee saved", GetHostRegName(i), GetHostRegName(new_reg));
|
||||
|
||||
CopyHostReg(new_reg, i);
|
||||
SwapHostRegAlloc(i, new_reg);
|
||||
@ -830,7 +826,7 @@ void CPU::NewRec::Compiler::FlushHostReg(u32 reg)
|
||||
case HR_TYPE_CPU_REG:
|
||||
{
|
||||
DebugAssert(ra.reg > Reg::zero && ra.reg < Reg::count);
|
||||
Log_DebugPrintf("Flushing register %s in host register %s to state", GetRegName(ra.reg), GetHostRegName(reg));
|
||||
Log_DebugFmt("Flushing register {} in host register {} to state", GetRegName(ra.reg), GetHostRegName(reg));
|
||||
StoreHostRegToCPUPointer(reg, &g_state.regs.r[static_cast<u8>(ra.reg)]);
|
||||
}
|
||||
break;
|
||||
@ -838,8 +834,8 @@ void CPU::NewRec::Compiler::FlushHostReg(u32 reg)
|
||||
case HR_TYPE_LOAD_DELAY_VALUE:
|
||||
{
|
||||
DebugAssert(m_load_delay_value_register == reg);
|
||||
Log_DebugPrintf("Flushing load delayed register %s in host register %s to state", GetRegName(ra.reg),
|
||||
GetHostRegName(reg));
|
||||
Log_DebugFmt("Flushing load delayed register {} in host register {} to state", GetRegName(ra.reg),
|
||||
GetHostRegName(reg));
|
||||
|
||||
StoreHostRegToCPUPointer(reg, &g_state.load_delay_value);
|
||||
m_load_delay_value_register = NUM_HOST_REGS;
|
||||
@ -849,8 +845,8 @@ void CPU::NewRec::Compiler::FlushHostReg(u32 reg)
|
||||
case HR_TYPE_NEXT_LOAD_DELAY_VALUE:
|
||||
{
|
||||
DebugAssert(m_next_load_delay_value_register == reg);
|
||||
Log_WarningPrintf("Flushing NEXT load delayed register %s in host register %s to state", GetRegName(ra.reg),
|
||||
GetHostRegName(reg));
|
||||
Log_WarningFmt("Flushing NEXT load delayed register {} in host register {} to state", GetRegName(ra.reg),
|
||||
GetHostRegName(reg));
|
||||
|
||||
StoreHostRegToCPUPointer(reg, &g_state.next_load_delay_value);
|
||||
m_next_load_delay_value_register = NUM_HOST_REGS;
|
||||
@ -868,7 +864,7 @@ void CPU::NewRec::Compiler::FlushHostReg(u32 reg)
|
||||
void CPU::NewRec::Compiler::FreeHostReg(u32 reg)
|
||||
{
|
||||
DebugAssert(IsHostRegAllocated(reg));
|
||||
Log_DebugPrintf("Freeing host register %s", GetHostRegName(reg));
|
||||
Log_DebugFmt("Freeing host register {}", GetHostRegName(reg));
|
||||
FlushHostReg(reg);
|
||||
ClearHostReg(reg);
|
||||
}
|
||||
@ -910,18 +906,18 @@ void CPU::NewRec::Compiler::RenameHostReg(u32 reg, u32 new_flags, HostRegAllocTy
|
||||
|
||||
if (new_type == HR_TYPE_CPU_REG)
|
||||
{
|
||||
Log_DebugPrintf("Renaming host reg %s to guest reg %s", GetHostRegName(reg), GetRegName(new_reg));
|
||||
Log_DebugFmt("Renaming host reg {} to guest reg {}", GetHostRegName(reg), GetRegName(new_reg));
|
||||
}
|
||||
else if (new_type == HR_TYPE_NEXT_LOAD_DELAY_VALUE)
|
||||
{
|
||||
Log_DebugPrintf("Renaming host reg %s to load delayed guest reg %s", GetHostRegName(reg), GetRegName(new_reg));
|
||||
Log_DebugFmt("Renaming host reg {} to load delayed guest reg {}", GetHostRegName(reg), GetRegName(new_reg));
|
||||
DebugAssert(m_next_load_delay_register == Reg::count && m_next_load_delay_value_register == NUM_HOST_REGS);
|
||||
m_next_load_delay_register = new_reg;
|
||||
m_next_load_delay_value_register = reg;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log_DebugPrintf("Renaming host reg %s to temp", GetHostRegName(reg));
|
||||
Log_DebugFmt("Renaming host reg {} to temp", GetHostRegName(reg));
|
||||
}
|
||||
|
||||
HostRegAlloc& ra = m_host_regs[reg];
|
||||
@ -987,7 +983,7 @@ bool CPU::NewRec::Compiler::TryRenameMIPSReg(Reg to, Reg from, u32 fromhost, Reg
|
||||
if (to == from || to == other || !iinfo->RenameTest(from))
|
||||
return false;
|
||||
|
||||
Log_DebugPrintf("Renaming MIPS register %s to %s", GetRegName(from), GetRegName(to));
|
||||
Log_DebugFmt("Renaming MIPS register {} to {}", GetRegName(from), GetRegName(to));
|
||||
|
||||
if (iinfo->LiveTest(from))
|
||||
FlushHostReg(fromhost);
|
||||
@ -1094,8 +1090,8 @@ void CPU::NewRec::Compiler::Flush(u32 flags)
|
||||
void CPU::NewRec::Compiler::FlushConstantReg(Reg r)
|
||||
{
|
||||
DebugAssert(m_constant_regs_valid.test(static_cast<u32>(r)));
|
||||
Log_DebugPrintf("Writing back register %s with constant value 0x%08X", GetRegName(r),
|
||||
m_constant_reg_values[static_cast<u32>(r)]);
|
||||
Log_DebugFmt("Writing back register {} with constant value 0x{:08X}", GetRegName(r),
|
||||
m_constant_reg_values[static_cast<u32>(r)]);
|
||||
StoreConstantToCPUPointer(m_constant_reg_values[static_cast<u32>(r)], &g_state.regs.r[static_cast<u32>(r)]);
|
||||
m_constant_regs_dirty.reset(static_cast<u32>(r));
|
||||
}
|
||||
@ -1394,7 +1390,7 @@ void CPU::NewRec::Compiler::CompileTemplate(void (Compiler::*const_func)(Compile
|
||||
if (!(tflags & TF_NO_NOP) && (!g_settings.cpu_recompiler_memory_exceptions || !(tflags & TF_CAN_OVERFLOW)) &&
|
||||
((tflags & TF_WRITES_T && rt == Reg::zero) || (tflags & TF_WRITES_D && rd == Reg::zero)))
|
||||
{
|
||||
Log_DebugPrintf("Skipping instruction because it writes to zero");
|
||||
Log_DebugPrint("Skipping instruction because it writes to zero");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1441,7 +1437,7 @@ void CPU::NewRec::Compiler::CompileTemplate(void (Compiler::*const_func)(Compile
|
||||
if (tflags & TF_COMMUTATIVE && !(tflags & TF_WRITES_T) &&
|
||||
((HasConstantReg(rs) && !HasConstantReg(rt)) || (tflags & TF_WRITES_D && rd == rt)))
|
||||
{
|
||||
Log_DebugPrintf("Swapping S:%s and T:%s due to commutative op and constants", GetRegName(rs), GetRegName(rt));
|
||||
Log_DebugFmt("Swapping S:{} and T:{} due to commutative op and constants", GetRegName(rs), GetRegName(rt));
|
||||
std::swap(rs, rt);
|
||||
}
|
||||
|
||||
@ -2202,7 +2198,7 @@ void CPU::NewRec::Compiler::Compile_mfc0(CompileFlags cf)
|
||||
const u32* ptr = GetCop0RegPtr(r);
|
||||
if (!ptr)
|
||||
{
|
||||
Log_ErrorPrintf("Read from unknown cop0 reg %u", static_cast<u32>(r));
|
||||
Log_ErrorFmt("Read from unknown cop0 reg {}", static_cast<u32>(r));
|
||||
Compile_Fallback();
|
||||
return;
|
||||
}
|
||||
@ -2308,7 +2304,7 @@ void CPU::NewRec::Compiler::AddGTETicks(TickCount ticks)
|
||||
{
|
||||
// TODO: check, int has +1 here
|
||||
m_gte_done_cycle = m_cycles + ticks;
|
||||
Log_DebugPrintf("Adding %d GTE ticks", ticks);
|
||||
Log_DebugFmt("Adding {} GTE ticks", ticks);
|
||||
}
|
||||
|
||||
void CPU::NewRec::Compiler::StallUntilGTEComplete()
|
||||
@ -2323,14 +2319,14 @@ void CPU::NewRec::Compiler::StallUntilGTEComplete()
|
||||
// simple case - in block scheduling
|
||||
if (m_gte_done_cycle > m_cycles)
|
||||
{
|
||||
Log_DebugPrintf("Stalling for %d ticks from GTE", m_gte_done_cycle - m_cycles);
|
||||
Log_DebugFmt("Stalling for {} ticks from GTE", m_gte_done_cycle - m_cycles);
|
||||
m_cycles += (m_gte_done_cycle - m_cycles);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// switch to in block scheduling
|
||||
Log_DebugPrintf("Flushing GTE stall from state");
|
||||
Log_DebugPrint("Flushing GTE stall from state");
|
||||
Flush(FLUSH_GTE_STALL_FROM_STATE);
|
||||
}
|
||||
|
||||
@ -2353,7 +2349,7 @@ void CPU::NewRec::BackpatchLoadStore(void* exception_pc, const CodeCache::Loadst
|
||||
info.gpr_bitmask, info.address_register, info.data_register, info.AccessSize(), info.is_signed, info.is_load);
|
||||
|
||||
#if 0
|
||||
Log_DebugPrintf("**Backpatch Thunk**");
|
||||
Log_DebugPrint("**Backpatch Thunk**");
|
||||
CodeCache::DisassembleAndLogHostCode(thunk_address, thunk_size);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user