2013-04-17 22:43:11 -04:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-10 13:54:46 -05:00
|
|
|
#pragma once
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-17 05:18:15 -05:00
|
|
|
#include "Core/PowerPC/Gekko.h"
|
|
|
|
#include "Core/PowerPC/Interpreter/Interpreter.h"
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2014-02-09 16:03:16 -05:00
|
|
|
FL_SET_CR0 = (1<<0), //
|
|
|
|
FL_SET_CR1 = (1<<1), //
|
|
|
|
FL_SET_CRn = (1<<2), //
|
|
|
|
FL_SET_CRx = FL_SET_CR0 | FL_SET_CR1 | FL_SET_CRn, //
|
|
|
|
FL_SET_CA = (1<<3), // carry
|
|
|
|
FL_READ_CA = (1<<4), // carry
|
|
|
|
FL_RC_BIT = (1<<5),
|
|
|
|
FL_RC_BIT_F = (1<<6),
|
|
|
|
FL_ENDBLOCK = (1<<7),
|
|
|
|
FL_IN_A = (1<<8),
|
|
|
|
FL_IN_A0 = (1<<9),
|
|
|
|
FL_IN_B = (1<<10),
|
|
|
|
FL_IN_C = (1<<11),
|
|
|
|
FL_IN_S = (1<<12),
|
|
|
|
FL_IN_AB = FL_IN_A | FL_IN_B,
|
|
|
|
FL_IN_SB = FL_IN_S | FL_IN_B,
|
|
|
|
FL_IN_A0B = FL_IN_A0 | FL_IN_B,
|
|
|
|
FL_IN_A0BC = FL_IN_A0 | FL_IN_B | FL_IN_C,
|
|
|
|
FL_OUT_D = (1<<13),
|
|
|
|
FL_OUT_S = FL_OUT_D,
|
|
|
|
FL_OUT_A = (1<<14),
|
|
|
|
FL_OUT_AD = FL_OUT_A | FL_OUT_D,
|
|
|
|
FL_TIMER = (1<<15),
|
2008-12-08 04:46:09 +00:00
|
|
|
FL_CHECKEXCEPTIONS = (1<<16),
|
2014-02-09 16:03:16 -05:00
|
|
|
FL_EVIL = (1<<17),
|
|
|
|
FL_USE_FPU = (1<<18),
|
|
|
|
FL_LOADSTORE = (1<<19),
|
2008-12-08 04:46:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
OPTYPE_INVALID ,
|
|
|
|
OPTYPE_SUBTABLE,
|
|
|
|
OPTYPE_INTEGER ,
|
|
|
|
OPTYPE_CR ,
|
|
|
|
OPTYPE_SPR ,
|
|
|
|
OPTYPE_SYSTEM ,
|
|
|
|
OPTYPE_SYSTEMFP,
|
|
|
|
OPTYPE_LOAD ,
|
|
|
|
OPTYPE_STORE ,
|
|
|
|
OPTYPE_LOADFP ,
|
|
|
|
OPTYPE_STOREFP ,
|
|
|
|
OPTYPE_FPU ,
|
|
|
|
OPTYPE_PS ,
|
|
|
|
OPTYPE_DCACHE ,
|
|
|
|
OPTYPE_ICACHE ,
|
|
|
|
OPTYPE_BRANCH ,
|
|
|
|
OPTYPE_UNKNOWN ,
|
|
|
|
};
|
|
|
|
|
2014-02-09 16:03:16 -05:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
OPCD_HLEFUNCTION = 1,
|
2008-12-18 10:44:03 +00:00
|
|
|
OPCD_COMPILEDBLOCK = 2,
|
2014-02-09 16:03:16 -05:00
|
|
|
OPCD_BCx = 16,
|
|
|
|
OPCD_SC = 17,
|
|
|
|
OPCD_Bx = 18,
|
2008-12-18 10:44:03 +00:00
|
|
|
};
|
|
|
|
|
2014-02-09 16:03:16 -05:00
|
|
|
enum
|
|
|
|
{
|
2008-12-18 10:44:03 +00:00
|
|
|
OP_BLR = 0x4e800020,
|
|
|
|
};
|
2014-02-09 16:03:16 -05:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
struct GekkoOPInfo
|
|
|
|
{
|
|
|
|
const char *opname;
|
|
|
|
int type;
|
|
|
|
int flags;
|
|
|
|
int numCyclesMinusOne;
|
2013-07-16 22:20:18 -05:00
|
|
|
u64 runCount;
|
2008-12-08 04:46:09 +00:00
|
|
|
int compileCount;
|
|
|
|
u32 lastUse;
|
|
|
|
};
|
2009-07-10 19:25:58 +00:00
|
|
|
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 GekkoOPInfo *m_allInstructions[512];
|
|
|
|
|
|
|
|
extern int m_numInstructions;
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst);
|
|
|
|
Interpreter::_interpreterInstruction GetInterpreterOp(UGeckoInstruction _inst);
|
|
|
|
|
2009-07-10 19:25:58 +00:00
|
|
|
class cJit64;
|
2008-12-18 13:21:02 +00:00
|
|
|
|
2008-12-18 10:44:03 +00:00
|
|
|
namespace PPCTables
|
2008-12-08 04:46:09 +00:00
|
|
|
{
|
|
|
|
|
2010-08-26 17:44:13 +00:00
|
|
|
void InitTables(int cpu_core);
|
2008-12-18 10:44:03 +00:00
|
|
|
bool IsValidInstruction(UGeckoInstruction _instCode);
|
|
|
|
bool UsesFPU(UGeckoInstruction _inst);
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2008-12-18 10:44:03 +00:00
|
|
|
void CountInstruction(UGeckoInstruction _inst);
|
|
|
|
void PrintInstructionRunCounts();
|
|
|
|
void LogCompiledInstructions();
|
2009-06-17 19:50:59 +00:00
|
|
|
const char *GetInstructionName(UGeckoInstruction _inst);
|
2008-12-18 10:44:03 +00:00
|
|
|
|
|
|
|
} // namespace
|