Core: Code clean up for clang

This commit is contained in:
zilmar 2022-12-19 15:35:17 +10:30
parent ae62981aef
commit c0341bb759
13 changed files with 20 additions and 32 deletions

View File

@ -5,8 +5,8 @@
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h> #include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
#include <Project64-core/N64System/Mips/Rumblepak.h> #include <Project64-core/N64System/Mips/Rumblepak.h>
#include <Project64-core/N64System/Mips/Transferpak.h> #include <Project64-core/N64System/Mips/Transferpak.h>
#include <Project64-core/N64System/SystemGlobals.h>
#include <Project64-core/N64System/N64System.h> #include <Project64-core/N64System/N64System.h>
#include <Project64-core/N64System/SystemGlobals.h>
PifRamHandler::PifRamHandler(CN64System & System, bool SavesReadOnly) : PifRamHandler::PifRamHandler(CN64System & System, bool SavesReadOnly) :
m_MMU(System.m_MMU_VM), m_MMU(System.m_MMU_VM),
@ -134,9 +134,7 @@ void PifRamHandler::DMA_READ()
HexData[0] = '\0'; HexData[0] = '\0';
AsciiData[0] = '\0'; AsciiData[0] = '\0';
} }
sprintf(Addon, "%02X %02X %02X %02X", sprintf(Addon, "%02X %02X %02X %02X", m_PifRam[(count << 2) + 0], m_PifRam[(count << 2) + 1], m_PifRam[(count << 2) + 2], m_PifRam[(count << 2) + 3]);
m_PifRam[(count << 2) + 0], m_PifRam[(count << 2) + 1],
m_PifRam[(count << 2) + 2], m_PifRam[(count << 2) + 3]);
strcat(HexData, Addon); strcat(HexData, Addon);
if (((count + 1) % 4) != 0) if (((count + 1) % 4) != 0)
{ {
@ -144,9 +142,7 @@ void PifRamHandler::DMA_READ()
strcat(HexData, Addon); strcat(HexData, Addon);
} }
sprintf(Addon, "%c%c%c%c", sprintf(Addon, "%c%c%c%c", m_PifRam[(count << 2) + 0], m_PifRam[(count << 2) + 1], m_PifRam[(count << 2) + 2], m_PifRam[(count << 2) + 3]);
m_PifRam[(count << 2) + 0], m_PifRam[(count << 2) + 1],
m_PifRam[(count << 2) + 2], m_PifRam[(count << 2) + 3]);
strcat(AsciiData, Addon); strcat(AsciiData, Addon);
if (((count + 1) % 4) == 0) if (((count + 1) % 4) == 0)
@ -236,9 +232,7 @@ void PifRamHandler::DMA_WRITE()
HexData[0] = '\0'; HexData[0] = '\0';
AsciiData[0] = '\0'; AsciiData[0] = '\0';
} }
sprintf(Addon, "%02X %02X %02X %02X", sprintf(Addon, "%02X %02X %02X %02X", m_PifRam[(count << 2) + 0], m_PifRam[(count << 2) + 1], m_PifRam[(count << 2) + 2], m_PifRam[(count << 2) + 3]);
m_PifRam[(count << 2) + 0], m_PifRam[(count << 2) + 1],
m_PifRam[(count << 2) + 2], m_PifRam[(count << 2) + 3]);
strcat(HexData, Addon); strcat(HexData, Addon);
if (((count + 1) % 4) != 0) if (((count + 1) % 4) != 0)
{ {
@ -246,9 +240,7 @@ void PifRamHandler::DMA_WRITE()
strcat(HexData, Addon); strcat(HexData, Addon);
} }
sprintf(Addon, "%c%c%c%c", sprintf(Addon, "%c%c%c%c", m_PifRam[(count << 2) + 0], m_PifRam[(count << 2) + 1], m_PifRam[(count << 2) + 2], m_PifRam[(count << 2) + 3]);
m_PifRam[(count << 2) + 0], m_PifRam[(count << 2) + 1],
m_PifRam[(count << 2) + 2], m_PifRam[(count << 2) + 3]);
strcat(AsciiData, Addon); strcat(AsciiData, Addon);
if (((count + 1) % 4) == 0) if (((count + 1) % 4) == 0)
@ -515,9 +507,7 @@ void PifRamHandler::LogControllerPakData(const char * Description)
HexData[0] = '\0'; HexData[0] = '\0';
AsciiData[0] = '\0'; AsciiData[0] = '\0';
} }
sprintf(Addon, "%02X %02X %02X %02X", sprintf(Addon, "%02X %02X %02X %02X", m_PifRam[(count << 2) + 0], m_PifRam[(count << 2) + 1], m_PifRam[(count << 2) + 2], m_PifRam[(count << 2) + 3]);
m_PifRam[(count << 2) + 0], m_PifRam[(count << 2) + 1],
m_PifRam[(count << 2) + 2], m_PifRam[(count << 2) + 3]);
strcat(HexData, Addon); strcat(HexData, Addon);
if (((count + 1) % 4) != 0) if (((count + 1) % 4) != 0)
{ {

View File

@ -148,7 +148,6 @@ public:
return m_PifRamHandler; return m_PifRamHandler;
}; };
private: private:
CMipsMemoryVM(); CMipsMemoryVM();
CMipsMemoryVM(const CMipsMemoryVM &); CMipsMemoryVM(const CMipsMemoryVM &);

View File

@ -107,7 +107,6 @@ bool R4300iInstruction::DelaySlotEffectsCompare(uint32_t DelayInstruction) const
return false; return false;
} }
void R4300iInstruction::ReadsGPR(uint32_t & Reg1, uint32_t & Reg2) const void R4300iInstruction::ReadsGPR(uint32_t & Reg1, uint32_t & Reg2) const
{ {
uint32_t op = m_Instruction.op; uint32_t op = m_Instruction.op;
@ -233,7 +232,7 @@ bool R4300iInstruction::WritesHI() const
return false; return false;
} }
bool R4300iInstruction::WritesLO() const bool R4300iInstruction::WritesLO() const
{ {
if (m_Instruction.op == R4300i_SPECIAL) if (m_Instruction.op == R4300i_SPECIAL)
{ {

View File

@ -1681,7 +1681,7 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU)
{ {
#if defined(__aarch64__) || defined(__amd64__) || defined(_M_X64) #if defined(__aarch64__) || defined(__amd64__) || defined(_M_X64)
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
#else #else
uint32_t StackPointer = (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF); uint32_t StackPointer = (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF);
uint32_t TargetStackPos = 0; uint32_t TargetStackPos = 0;
if (StackPointer < m_MMU_VM.RdramSize()) if (StackPointer < m_MMU_VM.RdramSize())

View File

@ -21,7 +21,7 @@ public:
asmjit::CodeHolder & CodeHolder(void) asmjit::CodeHolder & CodeHolder(void)
{ {
return m_CodeHolder; return m_CodeHolder;
} }
uint32_t VAddrEnter() const uint32_t VAddrEnter() const
{ {
@ -103,7 +103,7 @@ private:
void LogSectionInfo(); void LogSectionInfo();
bool SetSection(CCodeSection *& Section, CCodeSection * CurrentSection, uint32_t TargetPC, bool LinkAllowed, uint32_t CurrentPC); bool SetSection(CCodeSection *& Section, CCodeSection * CurrentSection, uint32_t TargetPC, bool LinkAllowed, uint32_t CurrentPC);
bool AnalyzeInstruction(uint32_t PC, uint32_t & TargetPC, uint32_t & ContinuePC, bool & LikelyBranch, bool & IncludeDelaySlot, bool & EndBlock, bool & PermLoop); bool AnalyzeInstruction(uint32_t PC, uint32_t & TargetPC, uint32_t & ContinuePC, bool & LikelyBranch, bool & IncludeDelaySlot, bool & EndBlock, bool & PermLoop);
void handleError(asmjit::Error err, const char* message, asmjit::BaseEmitter* origin); void handleError(asmjit::Error err, const char * message, asmjit::BaseEmitter * origin);
asmjit::Environment m_Environment; asmjit::Environment m_Environment;
asmjit::CodeHolder m_CodeHolder; asmjit::CodeHolder m_CodeHolder;

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include <Project64-core/N64System/N64Types.h> #include <Project64-core/N64System/N64Types.h>
#include <Project64-core/N64System/Recompiler/asmjit.h>
#include <Project64-core/N64System/Recompiler/RegInfo.h> #include <Project64-core/N64System/Recompiler/RegInfo.h>
#include <Project64-core/N64System/Recompiler/asmjit.h>
class CCodeBlock; class CCodeBlock;

View File

@ -405,7 +405,7 @@ CCompiledFunc * CRecompiler::CompileCode()
WriteTrace(TraceRecompiler, TraceDebug, "Info->Function() = %X", Func->Function()); WriteTrace(TraceRecompiler, TraceDebug, "Info->Function() = %X", Func->Function());
std::string dumpline; std::string dumpline;
uint32_t start_address = (uint32_t)(Func->Function()) & ~1; uint32_t start_address = (uint32_t)(Func->Function()) & ~1;
for (uint8_t * ptr = (uint8_t *)start_address, * ptr_end = ((uint8_t *)start_address) + CodeLen; ptr < ptr_end; ptr++) for (uint8_t *ptr = (uint8_t *)start_address, *ptr_end = ((uint8_t *)start_address) + CodeLen; ptr < ptr_end; ptr++)
{ {
if (dumpline.empty()) if (dumpline.empty())
{ {

View File

@ -9837,7 +9837,7 @@ void CX86RecompilerOps::CompileStoreMemoryValue(asmjit::x86::Gp AddressReg, asmj
} }
else else
{ {
m_Assembler.mov(asmjit::x86::dword_ptr(AddressReg, TempReg), ValueReg ); m_Assembler.mov(asmjit::x86::dword_ptr(AddressReg, TempReg), ValueReg);
} }
} }
else if (ValueSize == 64) else if (ValueSize == 64)

View File

@ -4,11 +4,11 @@
#include <Project64-core/N64System/Interpreter/InterpreterOps.h> #include <Project64-core/N64System/Interpreter/InterpreterOps.h>
#include <Project64-core/N64System/Mips/R4300iOpcode.h> #include <Project64-core/N64System/Mips/R4300iOpcode.h>
#include <Project64-core/N64System/Mips/Register.h> #include <Project64-core/N64System/Mips/Register.h>
#include <Project64-core/N64System/Recompiler/asmjit.h>
#include <Project64-core/N64System/Recompiler/ExitInfo.h> #include <Project64-core/N64System/Recompiler/ExitInfo.h>
#include <Project64-core/N64System/Recompiler/JumpInfo.h> #include <Project64-core/N64System/Recompiler/JumpInfo.h>
#include <Project64-core/N64System/Recompiler/RecompilerOps.h> #include <Project64-core/N64System/Recompiler/RecompilerOps.h>
#include <Project64-core/N64System/Recompiler/RegInfo.h> #include <Project64-core/N64System/Recompiler/RegInfo.h>
#include <Project64-core/N64System/Recompiler/asmjit.h>
#include <Project64-core/N64System/Recompiler/x86/x86ops.h> #include <Project64-core/N64System/Recompiler/x86/x86ops.h>
#include <Project64-core/Settings/GameSettings.h> #include <Project64-core/Settings/GameSettings.h>
#include <Project64-core/Settings/N64SystemSettings.h> #include <Project64-core/Settings/N64SystemSettings.h>

View File

@ -2,8 +2,8 @@
#if defined(__i386__) || defined(_M_IX86) #if defined(__i386__) || defined(_M_IX86)
#include <Project64-core/N64System/Mips/Register.h> #include <Project64-core/N64System/Mips/Register.h>
#include <Project64-core/N64System/Recompiler/asmjit.h>
#include <Project64-core/N64System/Recompiler/RegBase.h> #include <Project64-core/N64System/Recompiler/RegBase.h>
#include <Project64-core/N64System/Recompiler/asmjit.h>
#include <Project64-core/N64System/Recompiler/x86/x86ops.h> #include <Project64-core/N64System/Recompiler/x86/x86ops.h>
#include <Project64-core/Settings/DebugSettings.h> #include <Project64-core/Settings/DebugSettings.h>

View File

@ -452,7 +452,7 @@ void CX86Ops::MoveX86regHalfToVariable(void * Variable, const char * VariableNam
if (CDebugSettings::bRecordRecompilerAsm()) if (CDebugSettings::bRecordRecompilerAsm())
{ {
std::string SymbolKey = VariableSymbol(Variable); std::string SymbolKey = VariableSymbol(Variable);
AddSymbol(SymbolKey.c_str(), VariableName); AddSymbol(SymbolKey.c_str(), VariableName);
mov(asmjit::x86::word_ptr((uint64_t)(Variable)), Reg.r16()); mov(asmjit::x86::word_ptr((uint64_t)(Variable)), Reg.r16());
RemoveSymbol(SymbolKey.c_str()); RemoveSymbol(SymbolKey.c_str());
@ -944,12 +944,12 @@ CX86Ops::x86Reg CX86Ops::RegValue(const asmjit::x86::Gp & Reg)
else if (Reg == asmjit::x86::dh) else if (Reg == asmjit::x86::dh)
{ {
return x86_DH; return x86_DH;
} }
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
return x86_EAX; return x86_EAX;
} }
asmjit::Error CX86Ops::_log(const char* data, size_t size) noexcept asmjit::Error CX86Ops::_log(const char * data, size_t size) noexcept
{ {
stdstr AsmjitLog(std::string(data, size)); stdstr AsmjitLog(std::string(data, size));
AsmjitLog.Trim("\n"); AsmjitLog.Trim("\n");

View File

@ -1,8 +1,8 @@
#include "stdafx.h" #include "stdafx.h"
#include <Project64-core\N64System\Mips\R4300iInstruction.h>
#include "Debugger-RegisterTabs.h" #include "Debugger-RegisterTabs.h"
#include "OpInfo.h" #include "OpInfo.h"
#include <Project64-core\N64System\Mips\R4300iInstruction.h>
bool CRegisterTabs::m_bColorsEnabled = false; bool CRegisterTabs::m_bColorsEnabled = false;
CDebuggerUI * CRegisterTabs::m_Debugger = nullptr; CDebuggerUI * CRegisterTabs::m_Debugger = nullptr;

View File

@ -1,7 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include <Project64-core\N64System\Mips\R4300iInstruction.h>
#include "DebuggerUI.h" #include "DebuggerUI.h"
#include <Project64-core\N64System\Mips\R4300iInstruction.h>
#include "CPULog.h" #include "CPULog.h"
#include "DMALog.h" #include "DMALog.h"