x64Emitter: Remove unused code
This commit is contained in:
parent
b903921b14
commit
a59f00a5e4
|
@ -473,30 +473,6 @@ void XEmitter::SetJumpTarget(const FixupBranch& branch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// INC/DEC considered harmful on newer CPUs due to partial flag set.
|
|
||||||
// Use ADD, SUB instead.
|
|
||||||
|
|
||||||
/*
|
|
||||||
void XEmitter::INC(int bits, OpArg arg)
|
|
||||||
{
|
|
||||||
if (arg.IsImm()) _assert_msg_(DYNA_REC, 0, "INC - Imm argument");
|
|
||||||
arg.operandReg = 0;
|
|
||||||
if (bits == 16) {Write8(0x66);}
|
|
||||||
arg.WriteREX(this, bits, bits);
|
|
||||||
Write8(bits == 8 ? 0xFE : 0xFF);
|
|
||||||
arg.WriteRest(this);
|
|
||||||
}
|
|
||||||
void XEmitter::DEC(int bits, OpArg arg)
|
|
||||||
{
|
|
||||||
if (arg.IsImm()) _assert_msg_(DYNA_REC, 0, "DEC - Imm argument");
|
|
||||||
arg.operandReg = 1;
|
|
||||||
if (bits == 16) {Write8(0x66);}
|
|
||||||
arg.WriteREX(this, bits, bits);
|
|
||||||
Write8(bits == 8 ? 0xFE : 0xFF);
|
|
||||||
arg.WriteRest(this);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//Single byte opcodes
|
//Single byte opcodes
|
||||||
//There is no PUSHAD/POPAD in 64-bit mode.
|
//There is no PUSHAD/POPAD in 64-bit mode.
|
||||||
void XEmitter::INT3() {Write8(0xCC);}
|
void XEmitter::INT3() {Write8(0xCC);}
|
||||||
|
@ -2035,113 +2011,4 @@ void XEmitter::FNSTSW_AX() { Write8(0xDF); Write8(0xE0); }
|
||||||
|
|
||||||
void XEmitter::RDTSC() { Write8(0x0F); Write8(0x31); }
|
void XEmitter::RDTSC() { Write8(0x0F); Write8(0x31); }
|
||||||
|
|
||||||
// helper routines for setting pointers
|
|
||||||
void XEmitter::CallCdeclFunction3(void* fnptr, u32 arg0, u32 arg1, u32 arg2)
|
|
||||||
{
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
MOV(32, R(RCX), Imm32(arg0));
|
|
||||||
MOV(32, R(RDX), Imm32(arg1));
|
|
||||||
MOV(32, R(R8), Imm32(arg2));
|
|
||||||
CALL(fnptr);
|
|
||||||
#else
|
|
||||||
MOV(32, R(RDI), Imm32(arg0));
|
|
||||||
MOV(32, R(RSI), Imm32(arg1));
|
|
||||||
MOV(32, R(RDX), Imm32(arg2));
|
|
||||||
CALL(fnptr);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void XEmitter::CallCdeclFunction4(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3)
|
|
||||||
{
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
MOV(32, R(RCX), Imm32(arg0));
|
|
||||||
MOV(32, R(RDX), Imm32(arg1));
|
|
||||||
MOV(32, R(R8), Imm32(arg2));
|
|
||||||
MOV(32, R(R9), Imm32(arg3));
|
|
||||||
CALL(fnptr);
|
|
||||||
#else
|
|
||||||
MOV(32, R(RDI), Imm32(arg0));
|
|
||||||
MOV(32, R(RSI), Imm32(arg1));
|
|
||||||
MOV(32, R(RDX), Imm32(arg2));
|
|
||||||
MOV(32, R(RCX), Imm32(arg3));
|
|
||||||
CALL(fnptr);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void XEmitter::CallCdeclFunction5(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
|
|
||||||
{
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
MOV(32, R(RCX), Imm32(arg0));
|
|
||||||
MOV(32, R(RDX), Imm32(arg1));
|
|
||||||
MOV(32, R(R8), Imm32(arg2));
|
|
||||||
MOV(32, R(R9), Imm32(arg3));
|
|
||||||
MOV(32, MDisp(RSP, 0x20), Imm32(arg4));
|
|
||||||
CALL(fnptr);
|
|
||||||
#else
|
|
||||||
MOV(32, R(RDI), Imm32(arg0));
|
|
||||||
MOV(32, R(RSI), Imm32(arg1));
|
|
||||||
MOV(32, R(RDX), Imm32(arg2));
|
|
||||||
MOV(32, R(RCX), Imm32(arg3));
|
|
||||||
MOV(32, R(R8), Imm32(arg4));
|
|
||||||
CALL(fnptr);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void XEmitter::CallCdeclFunction6(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
|
|
||||||
{
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
MOV(32, R(RCX), Imm32(arg0));
|
|
||||||
MOV(32, R(RDX), Imm32(arg1));
|
|
||||||
MOV(32, R(R8), Imm32(arg2));
|
|
||||||
MOV(32, R(R9), Imm32(arg3));
|
|
||||||
MOV(32, MDisp(RSP, 0x20), Imm32(arg4));
|
|
||||||
MOV(32, MDisp(RSP, 0x28), Imm32(arg5));
|
|
||||||
CALL(fnptr);
|
|
||||||
#else
|
|
||||||
MOV(32, R(RDI), Imm32(arg0));
|
|
||||||
MOV(32, R(RSI), Imm32(arg1));
|
|
||||||
MOV(32, R(RDX), Imm32(arg2));
|
|
||||||
MOV(32, R(RCX), Imm32(arg3));
|
|
||||||
MOV(32, R(R8), Imm32(arg4));
|
|
||||||
MOV(32, R(R9), Imm32(arg5));
|
|
||||||
CALL(fnptr);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// See header
|
|
||||||
void XEmitter::___CallCdeclImport3(void* impptr, u32 arg0, u32 arg1, u32 arg2)
|
|
||||||
{
|
|
||||||
MOV(32, R(RCX), Imm32(arg0));
|
|
||||||
MOV(32, R(RDX), Imm32(arg1));
|
|
||||||
MOV(32, R(R8), Imm32(arg2));
|
|
||||||
CALLptr(M(impptr));
|
|
||||||
}
|
|
||||||
void XEmitter::___CallCdeclImport4(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3)
|
|
||||||
{
|
|
||||||
MOV(32, R(RCX), Imm32(arg0));
|
|
||||||
MOV(32, R(RDX), Imm32(arg1));
|
|
||||||
MOV(32, R(R8), Imm32(arg2));
|
|
||||||
MOV(32, R(R9), Imm32(arg3));
|
|
||||||
CALLptr(M(impptr));
|
|
||||||
}
|
|
||||||
void XEmitter::___CallCdeclImport5(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
|
|
||||||
{
|
|
||||||
MOV(32, R(RCX), Imm32(arg0));
|
|
||||||
MOV(32, R(RDX), Imm32(arg1));
|
|
||||||
MOV(32, R(R8), Imm32(arg2));
|
|
||||||
MOV(32, R(R9), Imm32(arg3));
|
|
||||||
MOV(32, MDisp(RSP, 0x20), Imm32(arg4));
|
|
||||||
CALLptr(M(impptr));
|
|
||||||
}
|
|
||||||
void XEmitter::___CallCdeclImport6(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
|
|
||||||
{
|
|
||||||
MOV(32, R(RCX), Imm32(arg0));
|
|
||||||
MOV(32, R(RDX), Imm32(arg1));
|
|
||||||
MOV(32, R(R8), Imm32(arg2));
|
|
||||||
MOV(32, R(R9), Imm32(arg3));
|
|
||||||
MOV(32, MDisp(RSP, 0x20), Imm32(arg4));
|
|
||||||
MOV(32, MDisp(RSP, 0x28), Imm32(arg5));
|
|
||||||
CALLptr(M(impptr));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,8 +271,6 @@ struct FixupBranch
|
||||||
int type; //0 = 8bit 1 = 32bit
|
int type; //0 = 8bit 1 = 32bit
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef const u8* JumpTarget;
|
|
||||||
|
|
||||||
class XEmitter
|
class XEmitter
|
||||||
{
|
{
|
||||||
friend struct OpArg; // for Write8 etc
|
friend struct OpArg; // for Write8 etc
|
||||||
|
@ -381,7 +379,6 @@ public:
|
||||||
void CALLptr(OpArg arg);
|
void CALLptr(OpArg arg);
|
||||||
|
|
||||||
FixupBranch J_CC(CCFlags conditionCode, bool force5bytes = false);
|
FixupBranch J_CC(CCFlags conditionCode, bool force5bytes = false);
|
||||||
//void J_CC(CCFlags conditionCode, JumpTarget target);
|
|
||||||
void J_CC(CCFlags conditionCode, const u8* addr);
|
void J_CC(CCFlags conditionCode, const u8* addr);
|
||||||
|
|
||||||
void SetJumpTarget(const FixupBranch& branch);
|
void SetJumpTarget(const FixupBranch& branch);
|
||||||
|
@ -941,32 +938,6 @@ public:
|
||||||
size_t ABI_PushRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size = 0);
|
size_t ABI_PushRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size = 0);
|
||||||
void ABI_PopRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size = 0);
|
void ABI_PopRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size = 0);
|
||||||
|
|
||||||
inline int ABI_GetNumXMMRegs() { return 16; }
|
|
||||||
|
|
||||||
// Strange call wrappers.
|
|
||||||
void CallCdeclFunction3(void* fnptr, u32 arg0, u32 arg1, u32 arg2);
|
|
||||||
void CallCdeclFunction4(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3);
|
|
||||||
void CallCdeclFunction5(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
|
|
||||||
void CallCdeclFunction6(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5);
|
|
||||||
|
|
||||||
// Comments from VertexLoader.cpp about these horrors:
|
|
||||||
|
|
||||||
// This is a horrible hack that is necessary in 64-bit mode because Opengl32.dll is based way, way above the 32-bit
|
|
||||||
// address space that is within reach of a CALL, and just doing &fn gives us these high uncallable addresses. So we
|
|
||||||
// want to grab the function pointers from the import table instead.
|
|
||||||
|
|
||||||
void ___CallCdeclImport3(void* impptr, u32 arg0, u32 arg1, u32 arg2);
|
|
||||||
void ___CallCdeclImport4(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3);
|
|
||||||
void ___CallCdeclImport5(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
|
|
||||||
void ___CallCdeclImport6(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5);
|
|
||||||
|
|
||||||
#define CallCdeclFunction3_I(a,b,c,d) ___CallCdeclImport3(&__imp_##a,b,c,d)
|
|
||||||
#define CallCdeclFunction4_I(a,b,c,d,e) ___CallCdeclImport4(&__imp_##a,b,c,d,e)
|
|
||||||
#define CallCdeclFunction5_I(a,b,c,d,e,f) ___CallCdeclImport5(&__imp_##a,b,c,d,e,f)
|
|
||||||
#define CallCdeclFunction6_I(a,b,c,d,e,f,g) ___CallCdeclImport6(&__imp_##a,b,c,d,e,f,g)
|
|
||||||
|
|
||||||
#define DECLARE_IMPORT(x) extern "C" void *__imp_##x
|
|
||||||
|
|
||||||
// Utility to generate a call to a std::function object.
|
// Utility to generate a call to a std::function object.
|
||||||
//
|
//
|
||||||
// Unfortunately, calling operator() directly is undefined behavior in C++
|
// Unfortunately, calling operator() directly is undefined behavior in C++
|
||||||
|
|
Loading…
Reference in New Issue