diff options
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h | 116 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86InstrFormats.td | 80 |
2 files changed, 104 insertions, 92 deletions
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h b/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h index 3f9f3bd16f0..0493ccb7b11 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h +++ b/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h @@ -234,88 +234,94 @@ namespace X86II { /// their one register operand added to their opcode. AddRegFrm = 2, - /// MRMDestReg - This form is used for instructions that use the Mod/RM byte - /// to specify a destination, which in this case is a register. - /// - MRMDestReg = 3, - - /// MRMDestMem - This form is used for instructions that use the Mod/RM byte - /// to specify a destination, which in this case is memory. - /// - MRMDestMem = 4, - - /// MRMSrcReg - This form is used for instructions that use the Mod/RM byte - /// to specify a source, which in this case is a register. - /// - MRMSrcReg = 5, - - /// MRMSrcMem - This form is used for instructions that use the Mod/RM byte - /// to specify a source, which in this case is memory. - /// - MRMSrcMem = 6, - /// RawFrmMemOffs - This form is for instructions that store an absolute /// memory offset as an immediate with a possible segment override. - RawFrmMemOffs = 7, + RawFrmMemOffs = 3, /// RawFrmSrc - This form is for instructions that use the source index /// register SI/ESI/RSI with a possible segment override. - RawFrmSrc = 8, + RawFrmSrc = 4, /// RawFrmDst - This form is for instructions that use the destination index /// register DI/EDI/ESI. - RawFrmDst = 9, + RawFrmDst = 5, /// RawFrmSrc - This form is for instructions that use the source index /// register SI/ESI/ERI with a possible segment override, and also the /// destination index register DI/ESI/RDI. - RawFrmDstSrc = 10, + RawFrmDstSrc = 6, /// RawFrmImm8 - This is used for the ENTER instruction, which has two /// immediates, the first of which is a 16-bit immediate (specified by /// the imm encoding) and the second is a 8-bit fixed value. - RawFrmImm8 = 11, + RawFrmImm8 = 7, /// RawFrmImm16 - This is used for CALL FAR instructions, which have two /// immediates, the first of which is a 16 or 32-bit immediate (specified by /// the imm encoding) and the second is a 16-bit fixed value. In the AMD /// manual, this operand is described as pntr16:32 and pntr16:16 - RawFrmImm16 = 12, - - /// MRMX[rm] - The forms are used to represent instructions that use a - /// Mod/RM byte, and don't use the middle field for anything. - MRMXr = 14, MRMXm = 15, + RawFrmImm16 = 8, /// MRM[0-7][rm] - These forms are used to represent instructions that use /// a Mod/RM byte, and use the middle field to hold extended opcode /// information. In the intel manual these are represented as /0, /1, ... /// - // First, instructions that operate on a register r/m operand... - MRM0r = 16, MRM1r = 17, MRM2r = 18, MRM3r = 19, // Format /0 /1 /2 /3 - MRM4r = 20, MRM5r = 21, MRM6r = 22, MRM7r = 23, // Format /4 /5 /6 /7 + /// MRMDestMem - This form is used for instructions that use the Mod/RM byte + /// to specify a destination, which in this case is memory. + /// + MRMDestMem = 32, + + /// MRMSrcMem - This form is used for instructions that use the Mod/RM byte + /// to specify a source, which in this case is memory. + /// + MRMSrcMem = 33, + + /// MRMXm - This form is used for instructions that use the Mod/RM byte + /// to specify a memory source, but doesn't use the middle field. + /// + MRMXm = 39, // Instruction that uses Mod/RM but not the middle field. // Next, instructions that operate on a memory r/m operand... - MRM0m = 24, MRM1m = 25, MRM2m = 26, MRM3m = 27, // Format /0 /1 /2 /3 - MRM4m = 28, MRM5m = 29, MRM6m = 30, MRM7m = 31, // Format /4 /5 /6 /7 - - //// 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_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, + MRM0m = 40, MRM1m = 41, MRM2m = 42, MRM3m = 43, // Format /0 /1 /2 /3 + MRM4m = 44, MRM5m = 45, MRM6m = 46, MRM7m = 47, // Format /4 /5 /6 /7 + + /// MRMDestReg - This form is used for instructions that use the Mod/RM byte + /// to specify a destination, which in this case is a register. + /// + MRMDestReg = 48, + + /// MRMSrcReg - This form is used for instructions that use the Mod/RM byte + /// to specify a source, which in this case is a register. + /// + MRMSrcReg = 49, + + /// MRMXr - This form is used for instructions that use the Mod/RM byte + /// to specify a register source, but doesn't use the middle field. + /// + MRMXr = 55, // Instruction that uses Mod/RM but not the middle field. + + // Instructions that operate on a register r/m operand... + MRM0r = 56, MRM1r = 57, MRM2r = 58, MRM3r = 59, // Format /0 /1 /2 /3 + MRM4r = 60, MRM5r = 61, MRM6r = 62, MRM7r = 63, // Format /4 /5 /6 /7 + + /// MRM_XX - A mod/rm byte of exactly 0xXX. + MRM_C0 = 64, MRM_C1 = 65, MRM_C2 = 66, MRM_C3 = 67, + MRM_C4 = 68, MRM_C5 = 69, MRM_C6 = 70, MRM_C7 = 71, + MRM_C8 = 72, MRM_C9 = 73, MRM_CA = 74, MRM_CB = 75, + MRM_CC = 76, MRM_CD = 77, MRM_CE = 78, MRM_CF = 79, + MRM_D0 = 80, MRM_D1 = 81, MRM_D2 = 82, MRM_D3 = 83, + MRM_D4 = 84, MRM_D5 = 85, MRM_D6 = 86, MRM_D7 = 87, + MRM_D8 = 88, MRM_D9 = 89, MRM_DA = 90, MRM_DB = 91, + MRM_DC = 92, MRM_DD = 93, MRM_DE = 94, MRM_DF = 95, + MRM_E0 = 96, MRM_E1 = 97, MRM_E2 = 98, MRM_E3 = 99, + MRM_E4 = 100, MRM_E5 = 101, MRM_E6 = 102, MRM_E7 = 103, + MRM_E8 = 104, MRM_E9 = 105, MRM_EA = 106, MRM_EB = 107, + MRM_EC = 108, MRM_ED = 109, MRM_EE = 110, MRM_EF = 111, + MRM_F0 = 112, MRM_F1 = 113, MRM_F2 = 114, MRM_F3 = 115, + MRM_F4 = 116, MRM_F5 = 117, MRM_F6 = 118, MRM_F7 = 119, + MRM_F8 = 120, MRM_F9 = 121, MRM_FA = 122, MRM_FB = 123, + MRM_FC = 124, MRM_FD = 125, MRM_FE = 126, MRM_FF = 127, FormMask = 127, @@ -651,8 +657,6 @@ namespace X86II { case X86II::Pseudo: case X86II::RawFrm: case X86II::AddRegFrm: - case X86II::MRMDestReg: - case X86II::MRMSrcReg: case X86II::RawFrmImm8: case X86II::RawFrmImm16: case X86II::RawFrmMemOffs: @@ -666,6 +670,8 @@ namespace X86II { // Start from 1, skip any registers encoded in VEX_VVVV or I8IMM, or a // mask register. return 1 + HasVEX_4V + HasMemOp4 + HasEVEX_K; + case X86II::MRMDestReg: + case X86II::MRMSrcReg: case X86II::MRMXr: case X86II::MRM0r: case X86II::MRM1r: case X86II::MRM2r: case X86II::MRM3r: diff --git a/llvm/lib/Target/X86/X86InstrFormats.td b/llvm/lib/Target/X86/X86InstrFormats.td index 688d050d20d..b881b5351f1 100644 --- a/llvm/lib/Target/X86/X86InstrFormats.td +++ b/llvm/lib/Target/X86/X86InstrFormats.td @@ -18,43 +18,49 @@ class Format<bits<7> val> { bits<7> Value = val; } -def Pseudo : Format<0>; def RawFrm : Format<1>; -def AddRegFrm : Format<2>; def MRMDestReg : Format<3>; -def MRMDestMem : Format<4>; def MRMSrcReg : Format<5>; -def MRMSrcMem : Format<6>; def RawFrmMemOffs : Format<7>; -def RawFrmSrc : Format<8>; def RawFrmDst : Format<9>; -def RawFrmDstSrc: Format<10>; -def RawFrmImm8 : Format<11>; -def RawFrmImm16 : Format<12>; -def MRMXr : Format<14>; def MRMXm : Format<15>; -def MRM0r : Format<16>; def MRM1r : Format<17>; def MRM2r : Format<18>; -def MRM3r : Format<19>; def MRM4r : Format<20>; def MRM5r : Format<21>; -def MRM6r : Format<22>; def MRM7r : Format<23>; -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_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>; +def Pseudo : Format<0>; +def RawFrm : Format<1>; +def AddRegFrm : Format<2>; +def RawFrmMemOffs : Format<3>; +def RawFrmSrc : Format<4>; +def RawFrmDst : Format<5>; +def RawFrmDstSrc : Format<6>; +def RawFrmImm8 : Format<7>; +def RawFrmImm16 : Format<8>; +def MRMDestMem : Format<32>; +def MRMSrcMem : Format<33>; +def MRMXm : Format<39>; +def MRM0m : Format<40>; def MRM1m : Format<41>; def MRM2m : Format<42>; +def MRM3m : Format<43>; def MRM4m : Format<44>; def MRM5m : Format<45>; +def MRM6m : Format<46>; def MRM7m : Format<47>; +def MRMDestReg : Format<48>; +def MRMSrcReg : Format<49>; +def MRMXr : Format<55>; +def MRM0r : Format<56>; def MRM1r : Format<57>; def MRM2r : Format<58>; +def MRM3r : Format<59>; def MRM4r : Format<60>; def MRM5r : Format<61>; +def MRM6r : Format<62>; def MRM7r : Format<63>; +def MRM_C0 : Format<64>; def MRM_C1 : Format<65>; def MRM_C2 : Format<66>; +def MRM_C3 : Format<67>; def MRM_C4 : Format<68>; def MRM_C5 : Format<69>; +def MRM_C6 : Format<70>; def MRM_C7 : Format<71>; def MRM_C8 : Format<72>; +def MRM_C9 : Format<73>; def MRM_CA : Format<74>; def MRM_CB : Format<75>; +def MRM_CC : Format<76>; def MRM_CD : Format<77>; def MRM_CE : Format<78>; +def MRM_CF : Format<79>; def MRM_D0 : Format<80>; def MRM_D1 : Format<81>; +def MRM_D2 : Format<82>; def MRM_D3 : Format<83>; def MRM_D4 : Format<84>; +def MRM_D5 : Format<85>; def MRM_D6 : Format<86>; def MRM_D7 : Format<87>; +def MRM_D8 : Format<88>; def MRM_D9 : Format<89>; def MRM_DA : Format<90>; +def MRM_DB : Format<91>; def MRM_DC : Format<92>; def MRM_DD : Format<93>; +def MRM_DE : Format<94>; def MRM_DF : Format<95>; def MRM_E0 : Format<96>; +def MRM_E1 : Format<97>; def MRM_E2 : Format<98>; def MRM_E3 : Format<99>; +def MRM_E4 : Format<100>; def MRM_E5 : Format<101>; def MRM_E6 : Format<102>; +def MRM_E7 : Format<103>; def MRM_E8 : Format<104>; def MRM_E9 : Format<105>; +def MRM_EA : Format<106>; def MRM_EB : Format<107>; def MRM_EC : Format<108>; +def MRM_ED : Format<109>; def MRM_EE : Format<110>; def MRM_EF : Format<111>; +def MRM_F0 : Format<112>; def MRM_F1 : Format<113>; def MRM_F2 : Format<114>; +def MRM_F3 : Format<115>; def MRM_F4 : Format<116>; def MRM_F5 : Format<117>; +def MRM_F6 : Format<118>; def MRM_F7 : Format<119>; def MRM_F8 : Format<120>; +def MRM_F9 : Format<121>; def MRM_FA : Format<122>; def MRM_FB : Format<123>; +def MRM_FC : Format<124>; def MRM_FD : Format<125>; def MRM_FE : Format<126>; +def MRM_FF : Format<127>; // 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 |