mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #6462 from lioncash/ppc
PPCTables: Make the op type enum an enum class
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -772,7 +772,7 @@ void JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBlock*
|
||||
}
|
||||
|
||||
CompileInstruction(ops[i]);
|
||||
if (!CanMergeNextInstructions(1) || js.op[1].opinfo->type != OPTYPE_INTEGER)
|
||||
if (!CanMergeNextInstructions(1) || js.op[1].opinfo->type != ::OpType::Integer)
|
||||
FlushCarry();
|
||||
|
||||
// If we have a register that will never be used again, flush it.
|
||||
|
||||
@@ -56,7 +56,7 @@ void JitArm64::ComputeCarry()
|
||||
return;
|
||||
|
||||
js.carryFlagSet = true;
|
||||
if (CanMergeNextInstructions(1) && js.op[1].opinfo->type == OPTYPE_INTEGER)
|
||||
if (CanMergeNextInstructions(1) && js.op[1].opinfo->type == ::OpType::Integer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -241,8 +241,8 @@ void CompileExceptionCheck(ExceptionType type)
|
||||
if (type == ExceptionType::FIFOWrite)
|
||||
{
|
||||
// Check in case the code has been replaced since: do we need to do this?
|
||||
int optype = GetOpInfo(PowerPC::HostRead_U32(PC))->type;
|
||||
if (optype != OPTYPE_STORE && optype != OPTYPE_STOREFP && (optype != OPTYPE_STOREPS))
|
||||
const ::OpType optype = GetOpInfo(PowerPC::HostRead_U32(PC))->type;
|
||||
if (optype != ::OpType::Store && optype != ::OpType::StoreFP && optype != ::OpType::StorePS)
|
||||
return;
|
||||
}
|
||||
exception_addresses->insert(PC);
|
||||
|
||||
@@ -252,11 +252,11 @@ static bool CanSwapAdjacentOps(const CodeOp& a, const CodeOp& b)
|
||||
// a crash caused by this error.
|
||||
//
|
||||
// [1] https://bugs.dolphin-emu.org/issues/5864#note-7
|
||||
if (b_info->type != OPTYPE_INTEGER)
|
||||
if (b_info->type != OpType::Integer)
|
||||
return false;
|
||||
|
||||
// And it's possible a might raise an interrupt too (fcmpo/fcmpu)
|
||||
if (a_info->type != OPTYPE_INTEGER)
|
||||
if (a_info->type != OpType::Integer)
|
||||
return false;
|
||||
|
||||
// Check that we have no register collisions.
|
||||
@@ -464,7 +464,7 @@ static bool isCmp(const CodeOp& a)
|
||||
static bool isCarryOp(const CodeOp& a)
|
||||
{
|
||||
return (a.opinfo->flags & FL_SET_CA) && !(a.opinfo->flags & FL_SET_OE) &&
|
||||
a.opinfo->type == OPTYPE_INTEGER;
|
||||
a.opinfo->type == OpType::Integer;
|
||||
}
|
||||
|
||||
static bool isCror(const CodeOp& a)
|
||||
@@ -581,7 +581,7 @@ void PPCAnalyzer::SetInstructionStats(CodeBlock* block, CodeOp* code, const Gekk
|
||||
// If the instruction reads CA but doesn't write it, we still need to store CA in XER; we can't
|
||||
// leave it in flags.
|
||||
if (HasOption(OPTION_CARRY_MERGE))
|
||||
code->wantsCAInFlags = code->wantsCA && code->outputCA && opinfo->type == OPTYPE_INTEGER;
|
||||
code->wantsCAInFlags = code->wantsCA && code->outputCA && opinfo->type == OpType::Integer;
|
||||
else
|
||||
code->wantsCAInFlags = false;
|
||||
|
||||
@@ -659,16 +659,16 @@ void PPCAnalyzer::SetInstructionStats(CodeBlock* block, CodeOp* code, const Gekk
|
||||
|
||||
switch (opinfo->type)
|
||||
{
|
||||
case OPTYPE_INTEGER:
|
||||
case OPTYPE_LOAD:
|
||||
case OPTYPE_STORE:
|
||||
case OPTYPE_LOADFP:
|
||||
case OPTYPE_STOREFP:
|
||||
case OpType::Integer:
|
||||
case OpType::Load:
|
||||
case OpType::Store:
|
||||
case OpType::LoadFP:
|
||||
case OpType::StoreFP:
|
||||
break;
|
||||
case OPTYPE_SINGLEFP:
|
||||
case OPTYPE_DOUBLEFP:
|
||||
case OpType::SingleFP:
|
||||
case OpType::DoubleFP:
|
||||
break;
|
||||
case OPTYPE_BRANCH:
|
||||
case OpType::Branch:
|
||||
if (code->inst.hex == 0x4e800020)
|
||||
{
|
||||
// For analysis purposes, we can assume that blr eats opinfo->flags.
|
||||
@@ -676,8 +676,8 @@ void PPCAnalyzer::SetInstructionStats(CodeBlock* block, CodeOp* code, const Gekk
|
||||
code->outputCR1 = true;
|
||||
}
|
||||
break;
|
||||
case OPTYPE_SYSTEM:
|
||||
case OPTYPE_SYSTEMFP:
|
||||
case OpType::System:
|
||||
case OpType::SystemFP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -924,7 +924,7 @@ u32 PPCAnalyzer::Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, u32
|
||||
fprIsDuplicated[code[i].fregOut] = false;
|
||||
fprIsStoreSafe[code[i].fregOut] = false;
|
||||
// Single, duplicated, and doesn't need PPC_FP.
|
||||
if (code[i].opinfo->type == OPTYPE_SINGLEFP)
|
||||
if (code[i].opinfo->type == OpType::SingleFP)
|
||||
{
|
||||
fprIsSingle[code[i].fregOut] = true;
|
||||
fprIsDuplicated[code[i].fregOut] = true;
|
||||
@@ -940,7 +940,7 @@ u32 PPCAnalyzer::Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, u32
|
||||
fprIsDuplicated[code[i].fregOut] = true;
|
||||
}
|
||||
// Paired are still floats, but the top/bottom halves may differ.
|
||||
if (code[i].opinfo->type == OPTYPE_PS || code[i].opinfo->type == OPTYPE_LOADPS)
|
||||
if (code[i].opinfo->type == OpType::PS || code[i].opinfo->type == OpType::LoadPS)
|
||||
{
|
||||
fprIsSingle[code[i].fregOut] = true;
|
||||
fprIsStoreSafe[code[i].fregOut] = true;
|
||||
@@ -952,7 +952,7 @@ u32 PPCAnalyzer::Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, u32
|
||||
fprIsStoreSafe = BitSet32(0);
|
||||
}
|
||||
|
||||
if (code[i].opinfo->type == OPTYPE_STOREPS || code[i].opinfo->type == OPTYPE_LOADPS)
|
||||
if (code[i].opinfo->type == OpType::StorePS || code[i].opinfo->type == OpType::LoadPS)
|
||||
{
|
||||
int gqr = code[i].inst.OPCD == 4 ? code[i].inst.Ix : code[i].inst.I;
|
||||
gqrUsed[gqr] = true;
|
||||
|
||||
@@ -41,7 +41,7 @@ const std::array<u64, 16> m_crTable = {{
|
||||
GekkoOPInfo* GetOpInfo(UGeckoInstruction _inst)
|
||||
{
|
||||
GekkoOPInfo* info = m_infoTable[_inst.OPCD];
|
||||
if (info->type == OPTYPE_SUBTABLE)
|
||||
if (info->type == OpType::Subtable)
|
||||
{
|
||||
switch (_inst.OPCD)
|
||||
{
|
||||
@@ -62,7 +62,7 @@ GekkoOPInfo* GetOpInfo(UGeckoInstruction _inst)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (info->type == OPTYPE_INVALID)
|
||||
if (info->type == OpType::Invalid)
|
||||
{
|
||||
ASSERT_MSG(POWERPC, 0, "GetOpInfo - invalid op %08x @ %08x", _inst.hex, PC);
|
||||
return nullptr;
|
||||
@@ -74,7 +74,7 @@ GekkoOPInfo* GetOpInfo(UGeckoInstruction _inst)
|
||||
Interpreter::Instruction GetInterpreterOp(UGeckoInstruction _inst)
|
||||
{
|
||||
const GekkoOPInfo* info = m_infoTable[_inst.OPCD];
|
||||
if (info->type == OPTYPE_SUBTABLE)
|
||||
if (info->type == OpType::Subtable)
|
||||
{
|
||||
switch (_inst.OPCD)
|
||||
{
|
||||
@@ -95,7 +95,7 @@ Interpreter::Instruction GetInterpreterOp(UGeckoInstruction _inst)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (info->type == OPTYPE_INVALID)
|
||||
if (info->type == OpType::Invalid)
|
||||
{
|
||||
ASSERT_MSG(POWERPC, 0, "GetInterpreterOp - invalid op %08x @ %08x", _inst.hex, PC);
|
||||
return nullptr;
|
||||
@@ -131,7 +131,7 @@ const char* GetInstructionName(UGeckoInstruction _inst)
|
||||
bool IsValidInstruction(UGeckoInstruction _inst)
|
||||
{
|
||||
const GekkoOPInfo* info = GetOpInfo(_inst);
|
||||
return info != nullptr && info->type != OPTYPE_UNKNOWN;
|
||||
return info != nullptr && info->type != OpType::Unknown;
|
||||
}
|
||||
|
||||
void CountInstruction(UGeckoInstruction _inst)
|
||||
|
||||
@@ -61,34 +61,34 @@ enum
|
||||
FL_INOUT_FLOAT_D = FL_IN_FLOAT_D | FL_OUT_FLOAT_D,
|
||||
};
|
||||
|
||||
enum
|
||||
enum class OpType
|
||||
{
|
||||
OPTYPE_INVALID,
|
||||
OPTYPE_SUBTABLE,
|
||||
OPTYPE_INTEGER,
|
||||
OPTYPE_CR,
|
||||
OPTYPE_SPR,
|
||||
OPTYPE_SYSTEM,
|
||||
OPTYPE_SYSTEMFP,
|
||||
OPTYPE_LOAD,
|
||||
OPTYPE_STORE,
|
||||
OPTYPE_LOADFP,
|
||||
OPTYPE_STOREFP,
|
||||
OPTYPE_DOUBLEFP,
|
||||
OPTYPE_SINGLEFP,
|
||||
OPTYPE_LOADPS,
|
||||
OPTYPE_STOREPS,
|
||||
OPTYPE_PS,
|
||||
OPTYPE_DCACHE,
|
||||
OPTYPE_ICACHE,
|
||||
OPTYPE_BRANCH,
|
||||
OPTYPE_UNKNOWN,
|
||||
Invalid,
|
||||
Subtable,
|
||||
Integer,
|
||||
CR,
|
||||
SPR,
|
||||
System,
|
||||
SystemFP,
|
||||
Load,
|
||||
Store,
|
||||
LoadFP,
|
||||
StoreFP,
|
||||
DoubleFP,
|
||||
SingleFP,
|
||||
LoadPS,
|
||||
StorePS,
|
||||
PS,
|
||||
DataCache,
|
||||
InstructionCache,
|
||||
Branch,
|
||||
Unknown,
|
||||
};
|
||||
|
||||
struct GekkoOPInfo
|
||||
{
|
||||
const char* opname;
|
||||
int type;
|
||||
OpType type;
|
||||
int flags;
|
||||
int numCycles;
|
||||
u64 runCount;
|
||||
|
||||
Reference in New Issue
Block a user