PPCTables: Use std::array instead of raw C arrays
This commit is contained in:
parent
1a1ce42889
commit
6c61021eb1
|
@ -484,7 +484,7 @@ void Jit64::mtcrf(UGeckoInstruction inst)
|
|||
}
|
||||
else
|
||||
{
|
||||
MOV(64, R(RSCRATCH2), ImmPtr(m_crTable));
|
||||
MOV(64, R(RSCRATCH2), ImmPtr(m_crTable.data()));
|
||||
gpr.Lock(inst.RS);
|
||||
gpr.BindToRegister(inst.RS, true, false);
|
||||
for (int i = 0; i < 8; i++)
|
||||
|
@ -531,7 +531,7 @@ void Jit64::mcrxr(UGeckoInstruction inst)
|
|||
// [SO OV CA 0] << 3
|
||||
SHL(32, R(RSCRATCH), Imm8(4));
|
||||
|
||||
MOV(64, R(RSCRATCH2), ImmPtr(m_crTable));
|
||||
MOV(64, R(RSCRATCH2), ImmPtr(m_crTable.data()));
|
||||
MOV(64, R(RSCRATCH), MRegSum(RSCRATCH, RSCRATCH2));
|
||||
MOV(64, PPCSTATE(cr_val[inst.CRFD]), R(RSCRATCH));
|
||||
|
||||
|
@ -623,7 +623,7 @@ void Jit64::mcrfs(UGeckoInstruction inst)
|
|||
}
|
||||
AND(32, R(RSCRATCH), Imm32(mask));
|
||||
MOV(32, PPCSTATE(fpscr), R(RSCRATCH));
|
||||
LEA(64, RSCRATCH, M(&m_crTable));
|
||||
LEA(64, RSCRATCH, M(m_crTable.data()));
|
||||
MOV(64, R(RSCRATCH), MComplex(RSCRATCH, RSCRATCH2, SCALE_8, 0));
|
||||
MOV(64, PPCSTATE(cr_val[inst.CRFD]), R(RSCRATCH));
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ void JitArm64::mcrxr(UGeckoInstruction inst)
|
|||
// [SO OV CA 0] << 3
|
||||
LSL(WA, WA, 4);
|
||||
|
||||
MOVP2R(XB, m_crTable);
|
||||
MOVP2R(XB, m_crTable.data());
|
||||
LDR(XB, XB, XA);
|
||||
STR(INDEX_UNSIGNED, XB, PPC_REG, PPCSTATE_OFF(cr_val[inst.CRFD]));
|
||||
|
||||
|
@ -636,7 +636,7 @@ void JitArm64::mtcrf(UGeckoInstruction inst)
|
|||
ARM64Reg XA = EncodeRegTo64(WA);
|
||||
ARM64Reg WB = gpr.GetReg();
|
||||
ARM64Reg XB = EncodeRegTo64(WB);
|
||||
MOVP2R(XB, m_crTable);
|
||||
MOVP2R(XB, m_crTable.data());
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
if ((crm & (0x80 >> i)) != 0)
|
||||
|
|
|
@ -2,8 +2,12 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/PowerPC/PPCTables.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cinttypes>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
@ -13,25 +17,24 @@
|
|||
#include "Core/PowerPC/Interpreter/Interpreter.h"
|
||||
#include "Core/PowerPC/Interpreter/Interpreter_Tables.h"
|
||||
#include "Core/PowerPC/JitInterface.h"
|
||||
#include "Core/PowerPC/PPCTables.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
|
||||
GekkoOPInfo* m_infoTable[64];
|
||||
GekkoOPInfo* m_infoTable4[1024];
|
||||
GekkoOPInfo* m_infoTable19[1024];
|
||||
GekkoOPInfo* m_infoTable31[1024];
|
||||
GekkoOPInfo* m_infoTable59[32];
|
||||
GekkoOPInfo* m_infoTable63[1024];
|
||||
std::array<GekkoOPInfo*, 64> m_infoTable;
|
||||
std::array<GekkoOPInfo*, 1024> m_infoTable4;
|
||||
std::array<GekkoOPInfo*, 1024> m_infoTable19;
|
||||
std::array<GekkoOPInfo*, 1024> m_infoTable31;
|
||||
std::array<GekkoOPInfo*, 32> m_infoTable59;
|
||||
std::array<GekkoOPInfo*, 1024> m_infoTable63;
|
||||
|
||||
GekkoOPInfo* m_allInstructions[512];
|
||||
int m_numInstructions;
|
||||
std::array<GekkoOPInfo*, 512> m_allInstructions;
|
||||
size_t m_numInstructions;
|
||||
|
||||
const u64 m_crTable[16] = {
|
||||
const std::array<u64, 16> m_crTable = {{
|
||||
PPCCRToInternal(0x0), PPCCRToInternal(0x1), PPCCRToInternal(0x2), PPCCRToInternal(0x3),
|
||||
PPCCRToInternal(0x4), PPCCRToInternal(0x5), PPCCRToInternal(0x6), PPCCRToInternal(0x7),
|
||||
PPCCRToInternal(0x8), PPCCRToInternal(0x9), PPCCRToInternal(0xA), PPCCRToInternal(0xB),
|
||||
PPCCRToInternal(0xC), PPCCRToInternal(0xD), PPCCRToInternal(0xE), PPCCRToInternal(0xF),
|
||||
};
|
||||
}};
|
||||
|
||||
GekkoOPInfo* GetOpInfo(UGeckoInstruction _inst)
|
||||
{
|
||||
|
@ -152,7 +155,7 @@ void PrintInstructionRunCounts()
|
|||
typedef std::pair<const char*, u64> OpInfo;
|
||||
std::vector<OpInfo> temp;
|
||||
temp.reserve(m_numInstructions);
|
||||
for (int i = 0; i < m_numInstructions; ++i)
|
||||
for (size_t i = 0; i < m_numInstructions; ++i)
|
||||
{
|
||||
GekkoOPInfo* pInst = m_allInstructions[i];
|
||||
temp.emplace_back(pInst->opname, pInst->runCount);
|
||||
|
@ -175,7 +178,7 @@ void LogCompiledInstructions()
|
|||
|
||||
File::IOFile f(StringFromFormat("%sinst_log%i.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time),
|
||||
"w");
|
||||
for (int i = 0; i < m_numInstructions; i++)
|
||||
for (size_t i = 0; i < m_numInstructions; i++)
|
||||
{
|
||||
GekkoOPInfo* pInst = m_allInstructions[i];
|
||||
if (pInst->compileCount > 0)
|
||||
|
@ -186,7 +189,7 @@ void LogCompiledInstructions()
|
|||
}
|
||||
|
||||
f.Open(StringFromFormat("%sinst_not%i.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time), "w");
|
||||
for (int i = 0; i < m_numInstructions; i++)
|
||||
for (size_t i = 0; i < m_numInstructions; i++)
|
||||
{
|
||||
GekkoOPInfo* pInst = m_allInstructions[i];
|
||||
if (pInst->compileCount == 0)
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
|
||||
#include "Core/PowerPC/Gekko.h"
|
||||
#include "Core/PowerPC/Interpreter/Interpreter.h"
|
||||
|
||||
|
@ -92,16 +95,15 @@ struct GekkoOPInfo
|
|||
int compileCount;
|
||||
u32 lastUse;
|
||||
};
|
||||
extern GekkoOPInfo* m_infoTable[64];
|
||||
extern GekkoOPInfo* m_infoTable4[1024];
|
||||
extern GekkoOPInfo* m_infoTable19[1024];
|
||||
extern GekkoOPInfo* m_infoTable31[1024];
|
||||
extern GekkoOPInfo* m_infoTable59[32];
|
||||
extern GekkoOPInfo* m_infoTable63[1024];
|
||||
extern std::array<GekkoOPInfo*, 64> m_infoTable;
|
||||
extern std::array<GekkoOPInfo*, 1024> m_infoTable4;
|
||||
extern std::array<GekkoOPInfo*, 1024> m_infoTable19;
|
||||
extern std::array<GekkoOPInfo*, 1024> m_infoTable31;
|
||||
extern std::array<GekkoOPInfo*, 32> m_infoTable59;
|
||||
extern std::array<GekkoOPInfo*, 1024> m_infoTable63;
|
||||
|
||||
extern GekkoOPInfo* m_allInstructions[512];
|
||||
|
||||
extern int m_numInstructions;
|
||||
extern std::array<GekkoOPInfo*, 512> m_allInstructions;
|
||||
extern size_t m_numInstructions;
|
||||
|
||||
GekkoOPInfo* GetOpInfo(UGeckoInstruction _inst);
|
||||
Interpreter::Instruction GetInterpreterOp(UGeckoInstruction _inst);
|
||||
|
|
|
@ -325,7 +325,7 @@ inline u64 PPCCRToInternal(u8 value)
|
|||
}
|
||||
|
||||
// convert flags into 64-bit CR values with a lookup table
|
||||
extern const u64 m_crTable[16];
|
||||
extern const std::array<u64, 16> m_crTable;
|
||||
|
||||
// Warning: these CR operations are fairly slow since they need to convert from
|
||||
// PowerPC format (4 bit) to our internal 64 bit format. See the definition of
|
||||
|
|
Loading…
Reference in New Issue