x86emitter: add the new x86_64 registers set

This commit is contained in:
Gregory Hainaut 2016-01-16 20:26:53 +01:00
parent 366f793cf0
commit 53b5ecf34a
2 changed files with 50 additions and 12 deletions

View File

@ -546,12 +546,20 @@ template< typename T > void xWrite( T val );
extern const xRegisterSSE extern const xRegisterSSE
xmm0, xmm1, xmm2, xmm3, xmm0, xmm1, xmm2, xmm3,
xmm4, xmm5, xmm6, xmm7; xmm4, xmm5, xmm6, xmm7,
xmm8, xmm9, xmm10, xmm11,
xmm12, xmm13, xmm14, xmm15;
extern const xRegisterMMX extern const xRegisterMMX
mm0, mm1, mm2, mm3, mm0, mm1, mm2, mm3,
mm4, mm5, mm6, mm7; mm4, mm5, mm6, mm7;
extern const xAddressReg
rax, rbx, rcx, rdx,
rsi, rdi, rbp, rsp,
r8, r9, r10, r11,
r12, r13, r14, r15;
extern const xAddressReg extern const xAddressReg
eax, ebx, ecx, edx, eax, ebx, ecx, edx,
esi, edi, ebp, esp; esi, edi, ebp, esp;
@ -570,10 +578,10 @@ template< typename T > void xWrite( T val );
{ {
static const xRegisterSSE *const m_tbl_xmmRegs[] = static const xRegisterSSE *const m_tbl_xmmRegs[] =
{ {
&xmm0, &xmm1, &xmm0, &xmm1, &xmm2, &xmm3,
&xmm2, &xmm3, &xmm4, &xmm5, &xmm6, &xmm7,
&xmm4, &xmm5, &xmm8, &xmm9, &xmm10, &xmm11,
&xmm6, &xmm7 &xmm12, &xmm13, &xmm14, &xmm15
}; };
pxAssert(id < iREGCNT_XMM); pxAssert(id < iREGCNT_XMM);

View File

@ -110,7 +110,11 @@ const xRegisterSSE
xmm0( 0 ), xmm1( 1 ), xmm0( 0 ), xmm1( 1 ),
xmm2( 2 ), xmm3( 3 ), xmm2( 2 ), xmm3( 3 ),
xmm4( 4 ), xmm5( 5 ), xmm4( 4 ), xmm5( 5 ),
xmm6( 6 ), xmm7( 7 ); xmm6( 6 ), xmm7( 7 ),
xmm8( 8 ), xmm9( 9 ),
xmm10( 10 ), xmm11( 11 ),
xmm12( 12 ), xmm13( 13 ),
xmm14( 14 ), xmm15( 15 );
const xRegisterMMX const xRegisterMMX
mm0( 0 ), mm1( 1 ), mm0( 0 ), mm1( 1 ),
@ -118,6 +122,16 @@ const xRegisterMMX
mm4( 4 ), mm5( 5 ), mm4( 4 ), mm5( 5 ),
mm6( 6 ), mm7( 7 ); mm6( 6 ), mm7( 7 );
const xAddressReg
rax( 0 ), rbx( 3 ),
rcx( 1 ), rdx( 2 ),
rsp( 4 ), rbp( 5 ),
rsi( 6 ), rdi( 7 ),
r8( 8 ) , r9( 9 ) ,
r10( 10 ), r11( 11 ),
r12( 12 ), r13( 13 ),
r14( 14 ), r15( 15 );
const xAddressReg const xAddressReg
eax( 0 ), ebx( 3 ), eax( 0 ), ebx( 3 ),
ecx( 1 ), edx( 2 ), ecx( 1 ), edx( 2 ),
@ -144,25 +158,37 @@ const char *const x86_regnames_gpr8[8] =
"ah", "ch", "dh", "bh" "ah", "ch", "dh", "bh"
}; };
const char *const x86_regnames_gpr16[8] = const char *const x86_regnames_gpr16[] =
{ {
"ax", "cx", "dx", "bx", "ax", "cx", "dx", "bx",
"sp", "bp", "si", "di" "sp", "bp", "si", "di"
}; };
const char *const x86_regnames_gpr32[8] = const char *const x86_regnames_gpr32[] =
{ {
"eax", "ecx", "edx", "ebx", "eax", "ecx", "edx", "ebx",
"esp", "ebp", "esi", "edi" "esp", "ebp", "esi", "edi",
"e8", "e9", "e10", "e11",
"e12", "e13", "e14", "e15"
}; };
const char *const x86_regnames_sse[8] = const char *const x86_regnames_gpr64[] =
{
"rax", "rcx", "rdx", "rbx",
"rsp", "rbp", "rsi", "rdi",
"r8" , "r9" , "r10", "r11",
"r12", "r13", "r14", "r15"
};
const char *const x86_regnames_sse[] =
{ {
"xmm0", "xmm1", "xmm2", "xmm3", "xmm0", "xmm1", "xmm2", "xmm3",
"xmm4", "xmm5", "xmm6", "xmm7" "xmm4", "xmm5", "xmm6", "xmm7",
"xmm8", "xmm9", "xmm10", "xmm11",
"xmm12", "xmm13", "xmm14", "xmm15"
}; };
const char *const x86_regnames_mmx[8] = const char *const x86_regnames_mmx[] =
{ {
"mm0", "mm1", "mm2", "mm3", "mm0", "mm1", "mm2", "mm3",
"mm4", "mm5", "mm6", "mm7" "mm4", "mm5", "mm6", "mm7"
@ -182,7 +208,11 @@ const char* xRegisterBase::GetName()
case 1: return x86_regnames_gpr8[ Id ]; case 1: return x86_regnames_gpr8[ Id ];
case 2: return x86_regnames_gpr16[ Id ]; case 2: return x86_regnames_gpr16[ Id ];
case 4: return x86_regnames_gpr32[ Id ]; case 4: return x86_regnames_gpr32[ Id ];
#ifdef __x86_64__
case 8: return x86_regnames_gpr64[ Id ];
#else
case 8: return x86_regnames_mmx[ Id ]; case 8: return x86_regnames_mmx[ Id ];
#endif
case 16: return x86_regnames_sse[ Id ]; case 16: return x86_regnames_sse[ Id ];
} }