mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-18 02:16:43 +00:00
[X86] Add the remaining 11 possible exact ModRM formats. This makes their encodings linear which can then be used to simplify some other code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229279 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
16035d6c0c
commit
e2f7231e45
@ -302,19 +302,21 @@ namespace X86II {
|
||||
|
||||
//// MRM_XX - A mod/rm byte of exactly 0xXX.
|
||||
MRM_C0 = 32, MRM_C1 = 33, MRM_C2 = 34, MRM_C3 = 35,
|
||||
MRM_C4 = 36, MRM_C8 = 37, MRM_C9 = 38, MRM_CA = 39,
|
||||
MRM_CB = 40, MRM_CF = 41, MRM_D0 = 42, MRM_D1 = 43,
|
||||
MRM_D4 = 44, MRM_D5 = 45, MRM_D6 = 46, MRM_D7 = 47,
|
||||
MRM_D8 = 48, MRM_D9 = 49, MRM_DA = 50, MRM_DB = 51,
|
||||
MRM_DC = 52, MRM_DD = 53, MRM_DE = 54, MRM_DF = 55,
|
||||
MRM_E0 = 56, MRM_E1 = 57, MRM_E2 = 58, MRM_E3 = 59,
|
||||
MRM_E4 = 60, MRM_E5 = 61, MRM_E8 = 62, MRM_E9 = 63,
|
||||
MRM_EA = 64, MRM_EB = 65, MRM_EC = 66, MRM_ED = 67,
|
||||
MRM_EE = 68, MRM_F0 = 69, MRM_F1 = 70, MRM_F2 = 71,
|
||||
MRM_F3 = 72, MRM_F4 = 73, MRM_F5 = 74, MRM_F6 = 75,
|
||||
MRM_F7 = 76, MRM_F8 = 77, MRM_F9 = 78, MRM_FA = 79,
|
||||
MRM_FB = 80, MRM_FC = 81, MRM_FD = 82, MRM_FE = 83,
|
||||
MRM_FF = 84,
|
||||
MRM_C4 = 36, MRM_C5 = 37, MRM_C6 = 38, MRM_C7 = 39,
|
||||
MRM_C8 = 40, MRM_C9 = 41, MRM_CA = 42, MRM_CB = 43,
|
||||
MRM_CC = 44, MRM_CD = 45, MRM_CE = 46, MRM_CF = 47,
|
||||
MRM_D0 = 48, MRM_D1 = 49, MRM_D2 = 50, MRM_D3 = 51,
|
||||
MRM_D4 = 52, MRM_D5 = 53, MRM_D6 = 54, MRM_D7 = 55,
|
||||
MRM_D8 = 56, MRM_D9 = 57, MRM_DA = 58, MRM_DB = 59,
|
||||
MRM_DC = 60, MRM_DD = 61, MRM_DE = 62, MRM_DF = 63,
|
||||
MRM_E0 = 64, MRM_E1 = 65, MRM_E2 = 66, MRM_E3 = 67,
|
||||
MRM_E4 = 68, MRM_E5 = 69, MRM_E6 = 70, MRM_E7 = 71,
|
||||
MRM_E8 = 72, MRM_E9 = 73, MRM_EA = 74, MRM_EB = 75,
|
||||
MRM_EC = 76, MRM_ED = 77, MRM_EE = 78, MRM_EF = 79,
|
||||
MRM_F0 = 80, MRM_F1 = 81, MRM_F2 = 82, MRM_F3 = 83,
|
||||
MRM_F4 = 84, MRM_F5 = 85, MRM_F6 = 86, MRM_F7 = 87,
|
||||
MRM_F8 = 88, MRM_F9 = 89, MRM_FA = 90, MRM_FB = 91,
|
||||
MRM_FC = 92, MRM_FD = 93, MRM_FE = 94, MRM_FF = 95,
|
||||
|
||||
FormMask = 127,
|
||||
|
||||
|
@ -1426,83 +1426,31 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS,
|
||||
break;
|
||||
}
|
||||
case X86II::MRM_C0: case X86II::MRM_C1: case X86II::MRM_C2:
|
||||
case X86II::MRM_C3: case X86II::MRM_C4: case X86II::MRM_C8:
|
||||
case X86II::MRM_C3: case X86II::MRM_C4: case X86II::MRM_C5:
|
||||
case X86II::MRM_C6: case X86II::MRM_C7: case X86II::MRM_C8:
|
||||
case X86II::MRM_C9: case X86II::MRM_CA: case X86II::MRM_CB:
|
||||
case X86II::MRM_CC: case X86II::MRM_CD: case X86II::MRM_CE:
|
||||
case X86II::MRM_CF: case X86II::MRM_D0: case X86II::MRM_D1:
|
||||
case X86II::MRM_D4: case X86II::MRM_D5: case X86II::MRM_D6:
|
||||
case X86II::MRM_D7: case X86II::MRM_D8: case X86II::MRM_D9:
|
||||
case X86II::MRM_DA: case X86II::MRM_DB: case X86II::MRM_DC:
|
||||
case X86II::MRM_DD: case X86II::MRM_DE: case X86II::MRM_DF:
|
||||
case X86II::MRM_E0: case X86II::MRM_E1: case X86II::MRM_E2:
|
||||
case X86II::MRM_E3: case X86II::MRM_E4: case X86II::MRM_E5:
|
||||
case X86II::MRM_E8: case X86II::MRM_E9: case X86II::MRM_EA:
|
||||
case X86II::MRM_EB: case X86II::MRM_EC: case X86II::MRM_ED:
|
||||
case X86II::MRM_EE: case X86II::MRM_F0: case X86II::MRM_F1:
|
||||
case X86II::MRM_F2: case X86II::MRM_F3: case X86II::MRM_F4:
|
||||
case X86II::MRM_F5: case X86II::MRM_F6: case X86II::MRM_F7:
|
||||
case X86II::MRM_F8: case X86II::MRM_F9: case X86II::MRM_FA:
|
||||
case X86II::MRM_FB: case X86II::MRM_FC: case X86II::MRM_FD:
|
||||
case X86II::MRM_FE: case X86II::MRM_FF:
|
||||
case X86II::MRM_D2: case X86II::MRM_D3: case X86II::MRM_D4:
|
||||
case X86II::MRM_D5: case X86II::MRM_D6: case X86II::MRM_D7:
|
||||
case X86II::MRM_D8: case X86II::MRM_D9: case X86II::MRM_DA:
|
||||
case X86II::MRM_DB: case X86II::MRM_DC: case X86II::MRM_DD:
|
||||
case X86II::MRM_DE: case X86II::MRM_DF: case X86II::MRM_E0:
|
||||
case X86II::MRM_E1: case X86II::MRM_E2: case X86II::MRM_E3:
|
||||
case X86II::MRM_E4: case X86II::MRM_E5: case X86II::MRM_E6:
|
||||
case X86II::MRM_E7: case X86II::MRM_E8: case X86II::MRM_E9:
|
||||
case X86II::MRM_EA: case X86II::MRM_EB: case X86II::MRM_EC:
|
||||
case X86II::MRM_ED: case X86II::MRM_EE: case X86II::MRM_EF:
|
||||
case X86II::MRM_F0: case X86II::MRM_F1: case X86II::MRM_F2:
|
||||
case X86II::MRM_F3: case X86II::MRM_F4: case X86II::MRM_F5:
|
||||
case X86II::MRM_F6: case X86II::MRM_F7: case X86II::MRM_F8:
|
||||
case X86II::MRM_F9: case X86II::MRM_FA: case X86II::MRM_FB:
|
||||
case X86II::MRM_FC: case X86II::MRM_FD: case X86II::MRM_FE:
|
||||
case X86II::MRM_FF:
|
||||
EmitByte(BaseOpcode, CurByte, OS);
|
||||
|
||||
unsigned char MRM;
|
||||
switch (TSFlags & X86II::FormMask) {
|
||||
default: llvm_unreachable("Invalid Form");
|
||||
case X86II::MRM_C0: MRM = 0xC0; break;
|
||||
case X86II::MRM_C1: MRM = 0xC1; break;
|
||||
case X86II::MRM_C2: MRM = 0xC2; break;
|
||||
case X86II::MRM_C3: MRM = 0xC3; break;
|
||||
case X86II::MRM_C4: MRM = 0xC4; break;
|
||||
case X86II::MRM_C8: MRM = 0xC8; break;
|
||||
case X86II::MRM_C9: MRM = 0xC9; break;
|
||||
case X86II::MRM_CA: MRM = 0xCA; break;
|
||||
case X86II::MRM_CB: MRM = 0xCB; break;
|
||||
case X86II::MRM_CF: MRM = 0xCF; break;
|
||||
case X86II::MRM_D0: MRM = 0xD0; break;
|
||||
case X86II::MRM_D1: MRM = 0xD1; break;
|
||||
case X86II::MRM_D4: MRM = 0xD4; break;
|
||||
case X86II::MRM_D5: MRM = 0xD5; break;
|
||||
case X86II::MRM_D6: MRM = 0xD6; break;
|
||||
case X86II::MRM_D7: MRM = 0xD7; break;
|
||||
case X86II::MRM_D8: MRM = 0xD8; break;
|
||||
case X86II::MRM_D9: MRM = 0xD9; break;
|
||||
case X86II::MRM_DA: MRM = 0xDA; break;
|
||||
case X86II::MRM_DB: MRM = 0xDB; break;
|
||||
case X86II::MRM_DC: MRM = 0xDC; break;
|
||||
case X86II::MRM_DD: MRM = 0xDD; break;
|
||||
case X86II::MRM_DE: MRM = 0xDE; break;
|
||||
case X86II::MRM_DF: MRM = 0xDF; break;
|
||||
case X86II::MRM_E0: MRM = 0xE0; break;
|
||||
case X86II::MRM_E1: MRM = 0xE1; break;
|
||||
case X86II::MRM_E2: MRM = 0xE2; break;
|
||||
case X86II::MRM_E3: MRM = 0xE3; break;
|
||||
case X86II::MRM_E4: MRM = 0xE4; break;
|
||||
case X86II::MRM_E5: MRM = 0xE5; break;
|
||||
case X86II::MRM_E8: MRM = 0xE8; break;
|
||||
case X86II::MRM_E9: MRM = 0xE9; break;
|
||||
case X86II::MRM_EA: MRM = 0xEA; break;
|
||||
case X86II::MRM_EB: MRM = 0xEB; break;
|
||||
case X86II::MRM_EC: MRM = 0xEC; break;
|
||||
case X86II::MRM_ED: MRM = 0xED; break;
|
||||
case X86II::MRM_EE: MRM = 0xEE; break;
|
||||
case X86II::MRM_F0: MRM = 0xF0; break;
|
||||
case X86II::MRM_F1: MRM = 0xF1; break;
|
||||
case X86II::MRM_F2: MRM = 0xF2; break;
|
||||
case X86II::MRM_F3: MRM = 0xF3; break;
|
||||
case X86II::MRM_F4: MRM = 0xF4; break;
|
||||
case X86II::MRM_F5: MRM = 0xF5; break;
|
||||
case X86II::MRM_F6: MRM = 0xF6; break;
|
||||
case X86II::MRM_F7: MRM = 0xF7; break;
|
||||
case X86II::MRM_F8: MRM = 0xF8; break;
|
||||
case X86II::MRM_F9: MRM = 0xF9; break;
|
||||
case X86II::MRM_FA: MRM = 0xFA; break;
|
||||
case X86II::MRM_FB: MRM = 0xFB; break;
|
||||
case X86II::MRM_FC: MRM = 0xFC; break;
|
||||
case X86II::MRM_FD: MRM = 0xFD; break;
|
||||
case X86II::MRM_FE: MRM = 0xFE; break;
|
||||
case X86II::MRM_FF: MRM = 0xFF; break;
|
||||
}
|
||||
EmitByte(MRM, CurByte, OS);
|
||||
uint64_t Form = TSFlags & X86II::FormMask;
|
||||
EmitByte(0xC0 + Form - X86II::MRM_C0, CurByte, OS);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -34,23 +34,27 @@ def MRM0m : Format<24>; def MRM1m : Format<25>; def MRM2m : Format<26>;
|
||||
def MRM3m : Format<27>; def MRM4m : Format<28>; def MRM5m : Format<29>;
|
||||
def MRM6m : Format<30>; def MRM7m : Format<31>;
|
||||
def MRM_C0 : Format<32>; def MRM_C1 : Format<33>; def MRM_C2 : Format<34>;
|
||||
def MRM_C3 : Format<35>; def MRM_C4 : Format<36>; def MRM_C8 : Format<37>;
|
||||
def MRM_C9 : Format<38>; def MRM_CA : Format<39>; def MRM_CB : Format<40>;
|
||||
def MRM_CF : Format<41>; def MRM_D0 : Format<42>; def MRM_D1 : Format<43>;
|
||||
def MRM_D4 : Format<44>; def MRM_D5 : Format<45>; def MRM_D6 : Format<46>;
|
||||
def MRM_D7 : Format<47>; def MRM_D8 : Format<48>; def MRM_D9 : Format<49>;
|
||||
def MRM_DA : Format<50>; def MRM_DB : Format<51>; def MRM_DC : Format<52>;
|
||||
def MRM_DD : Format<53>; def MRM_DE : Format<54>; def MRM_DF : Format<55>;
|
||||
def MRM_E0 : Format<56>; def MRM_E1 : Format<57>; def MRM_E2 : Format<58>;
|
||||
def MRM_E3 : Format<59>; def MRM_E4 : Format<60>; def MRM_E5 : Format<61>;
|
||||
def MRM_E8 : Format<62>; def MRM_E9 : Format<63>; def MRM_EA : Format<64>;
|
||||
def MRM_EB : Format<65>; def MRM_EC : Format<66>; def MRM_ED : Format<67>;
|
||||
def MRM_EE : Format<68>; def MRM_F0 : Format<69>; def MRM_F1 : Format<70>;
|
||||
def MRM_F2 : Format<71>; def MRM_F3 : Format<72>; def MRM_F4 : Format<73>;
|
||||
def MRM_F5 : Format<74>; def MRM_F6 : Format<75>; def MRM_F7 : Format<76>;
|
||||
def MRM_F8 : Format<77>; def MRM_F9 : Format<78>; def MRM_FA : Format<79>;
|
||||
def MRM_FB : Format<80>; def MRM_FC : Format<81>; def MRM_FD : Format<82>;
|
||||
def MRM_FE : Format<83>; def MRM_FF : Format<84>;
|
||||
def MRM_C3 : Format<35>; def MRM_C4 : Format<36>; def MRM_C5 : Format<37>;
|
||||
def MRM_C6 : Format<38>; def MRM_C7 : Format<39>; def MRM_C8 : Format<40>;
|
||||
def MRM_C9 : Format<41>; def MRM_CA : Format<42>; def MRM_CB : Format<43>;
|
||||
def MRM_CC : Format<44>; def MRM_CD : Format<45>; def MRM_CE : Format<46>;
|
||||
def MRM_CF : Format<47>; def MRM_D0 : Format<48>; def MRM_D1 : Format<49>;
|
||||
def MRM_D2 : Format<50>; def MRM_D3 : Format<51>; def MRM_D4 : Format<52>;
|
||||
def MRM_D5 : Format<53>; def MRM_D6 : Format<54>; def MRM_D7 : Format<55>;
|
||||
def MRM_D8 : Format<56>; def MRM_D9 : Format<57>; def MRM_DA : Format<58>;
|
||||
def MRM_DB : Format<59>; def MRM_DC : Format<60>; def MRM_DD : Format<61>;
|
||||
def MRM_DE : Format<62>; def MRM_DF : Format<63>; def MRM_E0 : Format<64>;
|
||||
def MRM_E1 : Format<65>; def MRM_E2 : Format<66>; def MRM_E3 : Format<67>;
|
||||
def MRM_E4 : Format<68>; def MRM_E5 : Format<69>; def MRM_E6 : Format<70>;
|
||||
def MRM_E7 : Format<71>; def MRM_E8 : Format<72>; def MRM_E9 : Format<73>;
|
||||
def MRM_EA : Format<74>; def MRM_EB : Format<75>; def MRM_EC : Format<76>;
|
||||
def MRM_ED : Format<77>; def MRM_EE : Format<78>; def MRM_EF : Format<79>;
|
||||
def MRM_F0 : Format<80>; def MRM_F1 : Format<81>; def MRM_F2 : Format<82>;
|
||||
def MRM_F3 : Format<83>; def MRM_F4 : Format<84>; def MRM_F5 : Format<85>;
|
||||
def MRM_F6 : Format<86>; def MRM_F7 : Format<87>; def MRM_F8 : Format<88>;
|
||||
def MRM_F9 : Format<89>; def MRM_FA : Format<90>; def MRM_FB : Format<91>;
|
||||
def MRM_FC : Format<92>; def MRM_FD : Format<93>; def MRM_FE : Format<94>;
|
||||
def MRM_FF : Format<95>;
|
||||
|
||||
// ImmType - This specifies the immediate type used by an instruction. This is
|
||||
// part of the ad-hoc solution used to emit machine instruction encodings by our
|
||||
|
@ -28,54 +28,65 @@ using namespace llvm;
|
||||
MAP(C2, 34) \
|
||||
MAP(C3, 35) \
|
||||
MAP(C4, 36) \
|
||||
MAP(C8, 37) \
|
||||
MAP(C9, 38) \
|
||||
MAP(CA, 39) \
|
||||
MAP(CB, 40) \
|
||||
MAP(CF, 41) \
|
||||
MAP(D0, 42) \
|
||||
MAP(D1, 43) \
|
||||
MAP(D4, 44) \
|
||||
MAP(D5, 45) \
|
||||
MAP(D6, 46) \
|
||||
MAP(D7, 47) \
|
||||
MAP(D8, 48) \
|
||||
MAP(D9, 49) \
|
||||
MAP(DA, 50) \
|
||||
MAP(DB, 51) \
|
||||
MAP(DC, 52) \
|
||||
MAP(DD, 53) \
|
||||
MAP(DE, 54) \
|
||||
MAP(DF, 55) \
|
||||
MAP(E0, 56) \
|
||||
MAP(E1, 57) \
|
||||
MAP(E2, 58) \
|
||||
MAP(E3, 59) \
|
||||
MAP(E4, 60) \
|
||||
MAP(E5, 61) \
|
||||
MAP(E8, 62) \
|
||||
MAP(E9, 63) \
|
||||
MAP(EA, 64) \
|
||||
MAP(EB, 65) \
|
||||
MAP(EC, 66) \
|
||||
MAP(ED, 67) \
|
||||
MAP(EE, 68) \
|
||||
MAP(F0, 69) \
|
||||
MAP(F1, 70) \
|
||||
MAP(F2, 71) \
|
||||
MAP(F3, 72) \
|
||||
MAP(F4, 73) \
|
||||
MAP(F5, 74) \
|
||||
MAP(F6, 75) \
|
||||
MAP(F7, 76) \
|
||||
MAP(F8, 77) \
|
||||
MAP(F9, 78) \
|
||||
MAP(FA, 79) \
|
||||
MAP(FB, 80) \
|
||||
MAP(FC, 81) \
|
||||
MAP(FD, 82) \
|
||||
MAP(FE, 83) \
|
||||
MAP(FF, 84)
|
||||
MAP(C5, 37) \
|
||||
MAP(C6, 38) \
|
||||
MAP(C7, 39) \
|
||||
MAP(C8, 40) \
|
||||
MAP(C9, 41) \
|
||||
MAP(CA, 42) \
|
||||
MAP(CB, 43) \
|
||||
MAP(CC, 44) \
|
||||
MAP(CD, 45) \
|
||||
MAP(CE, 46) \
|
||||
MAP(CF, 47) \
|
||||
MAP(D0, 48) \
|
||||
MAP(D1, 49) \
|
||||
MAP(D2, 50) \
|
||||
MAP(D3, 51) \
|
||||
MAP(D4, 52) \
|
||||
MAP(D5, 53) \
|
||||
MAP(D6, 54) \
|
||||
MAP(D7, 55) \
|
||||
MAP(D8, 56) \
|
||||
MAP(D9, 57) \
|
||||
MAP(DA, 58) \
|
||||
MAP(DB, 59) \
|
||||
MAP(DC, 60) \
|
||||
MAP(DD, 61) \
|
||||
MAP(DE, 62) \
|
||||
MAP(DF, 63) \
|
||||
MAP(E0, 64) \
|
||||
MAP(E1, 65) \
|
||||
MAP(E2, 66) \
|
||||
MAP(E3, 67) \
|
||||
MAP(E4, 68) \
|
||||
MAP(E5, 69) \
|
||||
MAP(E6, 70) \
|
||||
MAP(E7, 71) \
|
||||
MAP(E8, 72) \
|
||||
MAP(E9, 73) \
|
||||
MAP(EA, 74) \
|
||||
MAP(EB, 75) \
|
||||
MAP(EC, 76) \
|
||||
MAP(ED, 77) \
|
||||
MAP(EE, 78) \
|
||||
MAP(EF, 79) \
|
||||
MAP(F0, 80) \
|
||||
MAP(F1, 81) \
|
||||
MAP(F2, 82) \
|
||||
MAP(F3, 83) \
|
||||
MAP(F4, 84) \
|
||||
MAP(F5, 85) \
|
||||
MAP(F6, 86) \
|
||||
MAP(F7, 87) \
|
||||
MAP(F8, 88) \
|
||||
MAP(F9, 89) \
|
||||
MAP(FA, 90) \
|
||||
MAP(FB, 91) \
|
||||
MAP(FC, 92) \
|
||||
MAP(FD, 93) \
|
||||
MAP(FE, 94) \
|
||||
MAP(FF, 95)
|
||||
|
||||
// A clone of X86 since we can't depend on something that is generated.
|
||||
namespace X86Local {
|
||||
@ -803,9 +814,7 @@ void RecognizableInstr::emitDecodePath(DisassemblerTables &tables) const {
|
||||
// Special cases where the LLVM tables are not complete
|
||||
|
||||
#define MAP(from, to) \
|
||||
case X86Local::MRM_##from: \
|
||||
filter = new ExactFilter(0x##from); \
|
||||
break;
|
||||
case X86Local::MRM_##from:
|
||||
|
||||
OpcodeType opcodeType = (OpcodeType)-1;
|
||||
|
||||
@ -854,6 +863,8 @@ void RecognizableInstr::emitDecodePath(DisassemblerTables &tables) const {
|
||||
filter = new ExtendedFilter(false, Form - X86Local::MRM0m);
|
||||
break;
|
||||
MRM_MAPPING
|
||||
filter = new ExactFilter(0xC0 + Form - X86Local::MRM_C0); \
|
||||
break;
|
||||
} // switch (Form)
|
||||
|
||||
opcodeToSet = Opcode;
|
||||
|
Loading…
x
Reference in New Issue
Block a user