llvm.org GIT mirror llvm / 059f03a
[X86] Moving X86Local namespace from .cpp to .h file to use it in memory folding TableGen backend. Differential Revision: https://reviews.llvm.org/D32797 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302791 91177308-0d34-0410-b5e6-96231b3b80d8 Ayman Musa 3 years ago
2 changed file(s) with 123 addition(s) and 124 deletion(s). Raw diff Collapse all Expand all
2020 #include
2121
2222 using namespace llvm;
23
24 #define MRM_MAPPING \
25 MAP(C0, 64) \
26 MAP(C1, 65) \
27 MAP(C2, 66) \
28 MAP(C3, 67) \
29 MAP(C4, 68) \
30 MAP(C5, 69) \
31 MAP(C6, 70) \
32 MAP(C7, 71) \
33 MAP(C8, 72) \
34 MAP(C9, 73) \
35 MAP(CA, 74) \
36 MAP(CB, 75) \
37 MAP(CC, 76) \
38 MAP(CD, 77) \
39 MAP(CE, 78) \
40 MAP(CF, 79) \
41 MAP(D0, 80) \
42 MAP(D1, 81) \
43 MAP(D2, 82) \
44 MAP(D3, 83) \
45 MAP(D4, 84) \
46 MAP(D5, 85) \
47 MAP(D6, 86) \
48 MAP(D7, 87) \
49 MAP(D8, 88) \
50 MAP(D9, 89) \
51 MAP(DA, 90) \
52 MAP(DB, 91) \
53 MAP(DC, 92) \
54 MAP(DD, 93) \
55 MAP(DE, 94) \
56 MAP(DF, 95) \
57 MAP(E0, 96) \
58 MAP(E1, 97) \
59 MAP(E2, 98) \
60 MAP(E3, 99) \
61 MAP(E4, 100) \
62 MAP(E5, 101) \
63 MAP(E6, 102) \
64 MAP(E7, 103) \
65 MAP(E8, 104) \
66 MAP(E9, 105) \
67 MAP(EA, 106) \
68 MAP(EB, 107) \
69 MAP(EC, 108) \
70 MAP(ED, 109) \
71 MAP(EE, 110) \
72 MAP(EF, 111) \
73 MAP(F0, 112) \
74 MAP(F1, 113) \
75 MAP(F2, 114) \
76 MAP(F3, 115) \
77 MAP(F4, 116) \
78 MAP(F5, 117) \
79 MAP(F6, 118) \
80 MAP(F7, 119) \
81 MAP(F8, 120) \
82 MAP(F9, 121) \
83 MAP(FA, 122) \
84 MAP(FB, 123) \
85 MAP(FC, 124) \
86 MAP(FD, 125) \
87 MAP(FE, 126) \
88 MAP(FF, 127)
89
90 // A clone of X86 since we can't depend on something that is generated.
91 namespace X86Local {
92 enum {
93 Pseudo = 0,
94 RawFrm = 1,
95 AddRegFrm = 2,
96 RawFrmMemOffs = 3,
97 RawFrmSrc = 4,
98 RawFrmDst = 5,
99 RawFrmDstSrc = 6,
100 RawFrmImm8 = 7,
101 RawFrmImm16 = 8,
102 MRMDestMem = 32,
103 MRMSrcMem = 33,
104 MRMSrcMem4VOp3 = 34,
105 MRMSrcMemOp4 = 35,
106 MRMXm = 39,
107 MRM0m = 40, MRM1m = 41, MRM2m = 42, MRM3m = 43,
108 MRM4m = 44, MRM5m = 45, MRM6m = 46, MRM7m = 47,
109 MRMDestReg = 48,
110 MRMSrcReg = 49,
111 MRMSrcReg4VOp3 = 50,
112 MRMSrcRegOp4 = 51,
113 MRMXr = 55,
114 MRM0r = 56, MRM1r = 57, MRM2r = 58, MRM3r = 59,
115 MRM4r = 60, MRM5r = 61, MRM6r = 62, MRM7r = 63,
116 #define MAP(from, to) MRM_##from = to,
117 MRM_MAPPING
118 #undef MAP
119 };
120
121 enum {
122 OB = 0, TB = 1, T8 = 2, TA = 3, XOP8 = 4, XOP9 = 5, XOPA = 6
123 };
124
125 enum {
126 PS = 1, PD = 2, XS = 3, XD = 4
127 };
128
129 enum {
130 VEX = 1, XOP = 2, EVEX = 3
131 };
132
133 enum {
134 OpSize16 = 1, OpSize32 = 2
135 };
136
137 enum {
138 AdSize16 = 1, AdSize32 = 2, AdSize64 = 3
139 };
140
141 enum {
142 VEX_W0 = 0, VEX_W1 = 1, VEX_WIG = 2
143 };
144 }
145
14623 using namespace X86Disassembler;
14724
14825 /// byteFromBitsInit - Extracts a value at most 8 bits in width from a BitsInit.
889766 case X86Local::MRM6m: case X86Local::MRM7m:
890767 filter = new ExtendedFilter(false, Form - X86Local::MRM0m);
891768 break;
892 MRM_MAPPING
769 X86_INSTR_MRM_MAPPING
893770 filter = new ExactFilter(0xC0 + Form - X86Local::MRM_C0); \
894771 break;
895772 } // switch (Form)
2222 #include "llvm/TableGen/Record.h"
2323
2424 namespace llvm {
25
26 #define X86_INSTR_MRM_MAPPING \
27 MAP(C0, 64) \
28 MAP(C1, 65) \
29 MAP(C2, 66) \
30 MAP(C3, 67) \
31 MAP(C4, 68) \
32 MAP(C5, 69) \
33 MAP(C6, 70) \
34 MAP(C7, 71) \
35 MAP(C8, 72) \
36 MAP(C9, 73) \
37 MAP(CA, 74) \
38 MAP(CB, 75) \
39 MAP(CC, 76) \
40 MAP(CD, 77) \
41 MAP(CE, 78) \
42 MAP(CF, 79) \
43 MAP(D0, 80) \
44 MAP(D1, 81) \
45 MAP(D2, 82) \
46 MAP(D3, 83) \
47 MAP(D4, 84) \
48 MAP(D5, 85) \
49 MAP(D6, 86) \
50 MAP(D7, 87) \
51 MAP(D8, 88) \
52 MAP(D9, 89) \
53 MAP(DA, 90) \
54 MAP(DB, 91) \
55 MAP(DC, 92) \
56 MAP(DD, 93) \
57 MAP(DE, 94) \
58 MAP(DF, 95) \
59 MAP(E0, 96) \
60 MAP(E1, 97) \
61 MAP(E2, 98) \
62 MAP(E3, 99) \
63 MAP(E4, 100) \
64 MAP(E5, 101) \
65 MAP(E6, 102) \
66 MAP(E7, 103) \
67 MAP(E8, 104) \
68 MAP(E9, 105) \
69 MAP(EA, 106) \
70 MAP(EB, 107) \
71 MAP(EC, 108) \
72 MAP(ED, 109) \
73 MAP(EE, 110) \
74 MAP(EF, 111) \
75 MAP(F0, 112) \
76 MAP(F1, 113) \
77 MAP(F2, 114) \
78 MAP(F3, 115) \
79 MAP(F4, 116) \
80 MAP(F5, 117) \
81 MAP(F6, 118) \
82 MAP(F7, 119) \
83 MAP(F8, 120) \
84 MAP(F9, 121) \
85 MAP(FA, 122) \
86 MAP(FB, 123) \
87 MAP(FC, 124) \
88 MAP(FD, 125) \
89 MAP(FE, 126) \
90 MAP(FF, 127)
91
92 // A clone of X86 since we can't depend on something that is generated.
93 namespace X86Local {
94 enum {
95 Pseudo = 0,
96 RawFrm = 1,
97 AddRegFrm = 2,
98 RawFrmMemOffs = 3,
99 RawFrmSrc = 4,
100 RawFrmDst = 5,
101 RawFrmDstSrc = 6,
102 RawFrmImm8 = 7,
103 RawFrmImm16 = 8,
104 MRMDestMem = 32,
105 MRMSrcMem = 33,
106 MRMSrcMem4VOp3 = 34,
107 MRMSrcMemOp4 = 35,
108 MRMXm = 39,
109 MRM0m = 40, MRM1m = 41, MRM2m = 42, MRM3m = 43,
110 MRM4m = 44, MRM5m = 45, MRM6m = 46, MRM7m = 47,
111 MRMDestReg = 48,
112 MRMSrcReg = 49,
113 MRMSrcReg4VOp3 = 50,
114 MRMSrcRegOp4 = 51,
115 MRMXr = 55,
116 MRM0r = 56, MRM1r = 57, MRM2r = 58, MRM3r = 59,
117 MRM4r = 60, MRM5r = 61, MRM6r = 62, MRM7r = 63,
118 #define MAP(from, to) MRM_##from = to,
119 X86_INSTR_MRM_MAPPING
120 #undef MAP
121 };
122
123 enum {
124 OB = 0, TB = 1, T8 = 2, TA = 3, XOP8 = 4, XOP9 = 5, XOPA = 6
125 };
126
127 enum {
128 PS = 1, PD = 2, XS = 3, XD = 4
129 };
130
131 enum {
132 VEX = 1, XOP = 2, EVEX = 3
133 };
134
135 enum {
136 OpSize16 = 1, OpSize32 = 2
137 };
138
139 enum {
140 AdSize16 = 1, AdSize32 = 2, AdSize64 = 3
141 };
142
143 enum {
144 VEX_W0 = 0, VEX_W1 = 1, VEX_WIG = 2
145 };
146 }
25147
26148 namespace X86Disassembler {
27149