Line data Source code
1 : /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2 : |* *|
3 : |* * Lanai Disassembler *|
4 : |* *|
5 : |* Automatically generated file, do not edit! *|
6 : |* *|
7 : \*===----------------------------------------------------------------------===*/
8 :
9 : #include "llvm/MC/MCInst.h"
10 : #include "llvm/Support/Debug.h"
11 : #include "llvm/Support/DataTypes.h"
12 : #include "llvm/Support/LEB128.h"
13 : #include "llvm/Support/raw_ostream.h"
14 : #include <assert.h>
15 :
16 : namespace llvm {
17 :
18 : // Helper function for extracting fields from encoded instructions.
19 : template<typename InsnType>
20 : #if defined(_MSC_VER) && !defined(__clang__)
21 : __declspec(noinline)
22 : #endif
23 : static InsnType fieldFromInstruction(InsnType insn, unsigned startBit,
24 : unsigned numBits) {
25 : assert(startBit + numBits <= (sizeof(InsnType)*8) &&
26 : "Instruction field out of bounds!");
27 : InsnType fieldMask;
28 0 : if (numBits == sizeof(InsnType)*8)
29 : fieldMask = (InsnType)(-1LL);
30 : else
31 0 : fieldMask = (((InsnType)1 << numBits) - 1) << startBit;
32 349 : return (insn & fieldMask) >> startBit;
33 : }
34 :
35 : static const uint8_t DecoderTableLanai32[] = {
36 : /* 0 */ MCD::OPC_ExtractField, 28, 4, // Inst{31-28} ...
37 : /* 3 */ MCD::OPC_FilterValue, 0, 138, 0, 0, // Skip to: 146
38 : /* 8 */ MCD::OPC_ExtractField, 16, 2, // Inst{17-16} ...
39 : /* 11 */ MCD::OPC_FilterValue, 0, 103, 0, 0, // Skip to: 119
40 : /* 16 */ MCD::OPC_ExtractField, 0, 16, // Inst{15-0} ...
41 : /* 19 */ MCD::OPC_FilterValue, 1, 11, 0, 0, // Skip to: 35
42 : /* 24 */ MCD::OPC_CheckField, 18, 10, 0, 84, 0, 0, // Skip to: 115
43 : /* 31 */ MCD::OPC_Decode, 185, 1, 0, // Opcode: NOP
44 : /* 35 */ MCD::OPC_FilterValue, 2, 11, 0, 0, // Skip to: 51
45 : /* 40 */ MCD::OPC_CheckField, 18, 10, 0, 68, 0, 0, // Skip to: 115
46 : /* 47 */ MCD::OPC_Decode, 179, 1, 0, // Opcode: LOG0
47 : /* 51 */ MCD::OPC_FilterValue, 3, 11, 0, 0, // Skip to: 67
48 : /* 56 */ MCD::OPC_CheckField, 18, 10, 0, 52, 0, 0, // Skip to: 115
49 : /* 63 */ MCD::OPC_Decode, 180, 1, 0, // Opcode: LOG1
50 : /* 67 */ MCD::OPC_FilterValue, 4, 11, 0, 0, // Skip to: 83
51 : /* 72 */ MCD::OPC_CheckField, 18, 10, 0, 36, 0, 0, // Skip to: 115
52 : /* 79 */ MCD::OPC_Decode, 181, 1, 0, // Opcode: LOG2
53 : /* 83 */ MCD::OPC_FilterValue, 5, 11, 0, 0, // Skip to: 99
54 : /* 88 */ MCD::OPC_CheckField, 18, 10, 0, 20, 0, 0, // Skip to: 115
55 : /* 95 */ MCD::OPC_Decode, 182, 1, 0, // Opcode: LOG3
56 : /* 99 */ MCD::OPC_FilterValue, 6, 11, 0, 0, // Skip to: 115
57 : /* 104 */ MCD::OPC_CheckField, 18, 10, 0, 4, 0, 0, // Skip to: 115
58 : /* 111 */ MCD::OPC_Decode, 183, 1, 0, // Opcode: LOG4
59 : /* 115 */ MCD::OPC_Decode, 152, 1, 1, // Opcode: ADD_I_LO
60 : /* 119 */ MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 128
61 : /* 124 */ MCD::OPC_Decode, 151, 1, 1, // Opcode: ADD_I_HI
62 : /* 128 */ MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 137
63 : /* 133 */ MCD::OPC_Decode, 149, 1, 1, // Opcode: ADD_F_I_LO
64 : /* 137 */ MCD::OPC_FilterValue, 3, 198, 3, 0, // Skip to: 1108
65 : /* 142 */ MCD::OPC_Decode, 148, 1, 1, // Opcode: ADD_F_I_HI
66 : /* 146 */ MCD::OPC_FilterValue, 1, 39, 0, 0, // Skip to: 190
67 : /* 151 */ MCD::OPC_ExtractField, 16, 2, // Inst{17-16} ...
68 : /* 154 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 163
69 : /* 159 */ MCD::OPC_Decode, 146, 1, 1, // Opcode: ADDC_I_LO
70 : /* 163 */ MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 172
71 : /* 168 */ MCD::OPC_Decode, 145, 1, 1, // Opcode: ADDC_I_HI
72 : /* 172 */ MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 181
73 : /* 177 */ MCD::OPC_Decode, 143, 1, 1, // Opcode: ADDC_F_I_LO
74 : /* 181 */ MCD::OPC_FilterValue, 3, 154, 3, 0, // Skip to: 1108
75 : /* 186 */ MCD::OPC_Decode, 142, 1, 1, // Opcode: ADDC_F_I_HI
76 : /* 190 */ MCD::OPC_FilterValue, 2, 39, 0, 0, // Skip to: 234
77 : /* 195 */ MCD::OPC_ExtractField, 16, 2, // Inst{17-16} ...
78 : /* 198 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 207
79 : /* 203 */ MCD::OPC_Decode, 225, 1, 1, // Opcode: SUB_I_LO
80 : /* 207 */ MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 216
81 : /* 212 */ MCD::OPC_Decode, 224, 1, 1, // Opcode: SUB_I_HI
82 : /* 216 */ MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 225
83 : /* 221 */ MCD::OPC_Decode, 222, 1, 1, // Opcode: SUB_F_I_LO
84 : /* 225 */ MCD::OPC_FilterValue, 3, 110, 3, 0, // Skip to: 1108
85 : /* 230 */ MCD::OPC_Decode, 221, 1, 1, // Opcode: SUB_F_I_HI
86 : /* 234 */ MCD::OPC_FilterValue, 3, 39, 0, 0, // Skip to: 278
87 : /* 239 */ MCD::OPC_ExtractField, 16, 2, // Inst{17-16} ...
88 : /* 242 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 251
89 : /* 247 */ MCD::OPC_Decode, 219, 1, 1, // Opcode: SUBB_I_LO
90 : /* 251 */ MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 260
91 : /* 256 */ MCD::OPC_Decode, 218, 1, 1, // Opcode: SUBB_I_HI
92 : /* 260 */ MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 269
93 : /* 265 */ MCD::OPC_Decode, 216, 1, 1, // Opcode: SUBB_F_I_LO
94 : /* 269 */ MCD::OPC_FilterValue, 3, 66, 3, 0, // Skip to: 1108
95 : /* 274 */ MCD::OPC_Decode, 215, 1, 1, // Opcode: SUBB_F_I_HI
96 : /* 278 */ MCD::OPC_FilterValue, 4, 39, 0, 0, // Skip to: 322
97 : /* 283 */ MCD::OPC_ExtractField, 16, 2, // Inst{17-16} ...
98 : /* 286 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 295
99 : /* 291 */ MCD::OPC_Decode, 158, 1, 1, // Opcode: AND_I_LO
100 : /* 295 */ MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 304
101 : /* 300 */ MCD::OPC_Decode, 157, 1, 1, // Opcode: AND_I_HI
102 : /* 304 */ MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 313
103 : /* 309 */ MCD::OPC_Decode, 155, 1, 1, // Opcode: AND_F_I_LO
104 : /* 313 */ MCD::OPC_FilterValue, 3, 22, 3, 0, // Skip to: 1108
105 : /* 318 */ MCD::OPC_Decode, 154, 1, 1, // Opcode: AND_F_I_HI
106 : /* 322 */ MCD::OPC_FilterValue, 5, 39, 0, 0, // Skip to: 366
107 : /* 327 */ MCD::OPC_ExtractField, 16, 2, // Inst{17-16} ...
108 : /* 330 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 339
109 : /* 335 */ MCD::OPC_Decode, 190, 1, 1, // Opcode: OR_I_LO
110 : /* 339 */ MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 348
111 : /* 344 */ MCD::OPC_Decode, 189, 1, 1, // Opcode: OR_I_HI
112 : /* 348 */ MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 357
113 : /* 353 */ MCD::OPC_Decode, 187, 1, 1, // Opcode: OR_F_I_LO
114 : /* 357 */ MCD::OPC_FilterValue, 3, 234, 2, 0, // Skip to: 1108
115 : /* 362 */ MCD::OPC_Decode, 186, 1, 1, // Opcode: OR_F_I_HI
116 : /* 366 */ MCD::OPC_FilterValue, 6, 39, 0, 0, // Skip to: 410
117 : /* 371 */ MCD::OPC_ExtractField, 16, 2, // Inst{17-16} ...
118 : /* 374 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 383
119 : /* 379 */ MCD::OPC_Decode, 234, 1, 1, // Opcode: XOR_I_LO
120 : /* 383 */ MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 392
121 : /* 388 */ MCD::OPC_Decode, 233, 1, 1, // Opcode: XOR_I_HI
122 : /* 392 */ MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 401
123 : /* 397 */ MCD::OPC_Decode, 231, 1, 1, // Opcode: XOR_F_I_LO
124 : /* 401 */ MCD::OPC_FilterValue, 3, 190, 2, 0, // Skip to: 1108
125 : /* 406 */ MCD::OPC_Decode, 230, 1, 1, // Opcode: XOR_F_I_HI
126 : /* 410 */ MCD::OPC_FilterValue, 7, 39, 0, 0, // Skip to: 454
127 : /* 415 */ MCD::OPC_ExtractField, 16, 2, // Inst{17-16} ...
128 : /* 418 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 427
129 : /* 423 */ MCD::OPC_Decode, 205, 1, 2, // Opcode: SL_I
130 : /* 427 */ MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 436
131 : /* 432 */ MCD::OPC_Decode, 195, 1, 2, // Opcode: SA_I
132 : /* 436 */ MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 445
133 : /* 441 */ MCD::OPC_Decode, 204, 1, 2, // Opcode: SL_F_I
134 : /* 445 */ MCD::OPC_FilterValue, 3, 146, 2, 0, // Skip to: 1108
135 : /* 450 */ MCD::OPC_Decode, 194, 1, 2, // Opcode: SA_F_I
136 : /* 454 */ MCD::OPC_FilterValue, 8, 18, 0, 0, // Skip to: 477
137 : /* 459 */ MCD::OPC_CheckField, 0, 28, 252, 255, 219, 8, 4, 0, 0, // Skip to: 473
138 : /* 469 */ MCD::OPC_Decode, 193, 1, 0, // Opcode: RET
139 : /* 473 */ MCD::OPC_Decode, 175, 1, 3, // Opcode: LDW_RI
140 : /* 477 */ MCD::OPC_FilterValue, 9, 4, 0, 0, // Skip to: 486
141 : /* 482 */ MCD::OPC_Decode, 227, 1, 3, // Opcode: SW_RI
142 : /* 486 */ MCD::OPC_FilterValue, 10, 57, 0, 0, // Skip to: 548
143 : /* 491 */ MCD::OPC_ExtractField, 0, 3, // Inst{2-0} ...
144 : /* 494 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 503
145 : /* 499 */ MCD::OPC_Decode, 172, 1, 4, // Opcode: LDHs_RR
146 : /* 503 */ MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 512
147 : /* 508 */ MCD::OPC_Decode, 174, 1, 4, // Opcode: LDHz_RR
148 : /* 512 */ MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 521
149 : /* 517 */ MCD::OPC_Decode, 176, 1, 4, // Opcode: LDW_RR
150 : /* 521 */ MCD::OPC_FilterValue, 3, 4, 0, 0, // Skip to: 530
151 : /* 526 */ MCD::OPC_Decode, 177, 1, 4, // Opcode: LDWz_RR
152 : /* 530 */ MCD::OPC_FilterValue, 4, 4, 0, 0, // Skip to: 539
153 : /* 535 */ MCD::OPC_Decode, 168, 1, 4, // Opcode: LDBs_RR
154 : /* 539 */ MCD::OPC_FilterValue, 5, 52, 2, 0, // Skip to: 1108
155 : /* 544 */ MCD::OPC_Decode, 170, 1, 4, // Opcode: LDBz_RR
156 : /* 548 */ MCD::OPC_FilterValue, 11, 30, 0, 0, // Skip to: 583
157 : /* 553 */ MCD::OPC_ExtractField, 0, 3, // Inst{2-0} ...
158 : /* 556 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 565
159 : /* 561 */ MCD::OPC_Decode, 214, 1, 4, // Opcode: STH_RR
160 : /* 565 */ MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 574
161 : /* 570 */ MCD::OPC_Decode, 228, 1, 4, // Opcode: SW_RR
162 : /* 574 */ MCD::OPC_FilterValue, 4, 17, 2, 0, // Skip to: 1108
163 : /* 579 */ MCD::OPC_Decode, 212, 1, 4, // Opcode: STB_RR
164 : /* 583 */ MCD::OPC_FilterValue, 12, 57, 1, 0, // Skip to: 901
165 : /* 588 */ MCD::OPC_ExtractField, 3, 8, // Inst{10-3} ...
166 : /* 591 */ MCD::OPC_FilterValue, 0, 21, 0, 0, // Skip to: 617
167 : /* 596 */ MCD::OPC_ExtractField, 17, 1, // Inst{17} ...
168 : /* 599 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 608
169 : /* 604 */ MCD::OPC_Decode, 153, 1, 5, // Opcode: ADD_R
170 : /* 608 */ MCD::OPC_FilterValue, 1, 239, 1, 0, // Skip to: 1108
171 : /* 613 */ MCD::OPC_Decode, 150, 1, 5, // Opcode: ADD_F_R
172 : /* 617 */ MCD::OPC_FilterValue, 32, 21, 0, 0, // Skip to: 643
173 : /* 622 */ MCD::OPC_ExtractField, 17, 1, // Inst{17} ...
174 : /* 625 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 634
175 : /* 630 */ MCD::OPC_Decode, 147, 1, 5, // Opcode: ADDC_R
176 : /* 634 */ MCD::OPC_FilterValue, 1, 213, 1, 0, // Skip to: 1108
177 : /* 639 */ MCD::OPC_Decode, 144, 1, 5, // Opcode: ADDC_F_R
178 : /* 643 */ MCD::OPC_FilterValue, 64, 21, 0, 0, // Skip to: 669
179 : /* 648 */ MCD::OPC_ExtractField, 17, 1, // Inst{17} ...
180 : /* 651 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 660
181 : /* 656 */ MCD::OPC_Decode, 226, 1, 5, // Opcode: SUB_R
182 : /* 660 */ MCD::OPC_FilterValue, 1, 187, 1, 0, // Skip to: 1108
183 : /* 665 */ MCD::OPC_Decode, 223, 1, 5, // Opcode: SUB_F_R
184 : /* 669 */ MCD::OPC_FilterValue, 96, 21, 0, 0, // Skip to: 695
185 : /* 674 */ MCD::OPC_ExtractField, 17, 1, // Inst{17} ...
186 : /* 677 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 686
187 : /* 682 */ MCD::OPC_Decode, 220, 1, 5, // Opcode: SUBB_R
188 : /* 686 */ MCD::OPC_FilterValue, 1, 161, 1, 0, // Skip to: 1108
189 : /* 691 */ MCD::OPC_Decode, 217, 1, 5, // Opcode: SUBB_F_R
190 : /* 695 */ MCD::OPC_FilterValue, 128, 1, 21, 0, 0, // Skip to: 722
191 : /* 701 */ MCD::OPC_ExtractField, 17, 1, // Inst{17} ...
192 : /* 704 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 713
193 : /* 709 */ MCD::OPC_Decode, 159, 1, 5, // Opcode: AND_R
194 : /* 713 */ MCD::OPC_FilterValue, 1, 134, 1, 0, // Skip to: 1108
195 : /* 718 */ MCD::OPC_Decode, 156, 1, 5, // Opcode: AND_F_R
196 : /* 722 */ MCD::OPC_FilterValue, 160, 1, 75, 0, 0, // Skip to: 803
197 : /* 728 */ MCD::OPC_ExtractField, 17, 1, // Inst{17} ...
198 : /* 731 */ MCD::OPC_FilterValue, 0, 58, 0, 0, // Skip to: 794
199 : /* 736 */ MCD::OPC_CheckField, 18, 10, 64, 18, 0, 0, // Skip to: 761
200 : /* 743 */ MCD::OPC_CheckField, 16, 1, 0, 11, 0, 0, // Skip to: 761
201 : /* 750 */ MCD::OPC_CheckField, 0, 3, 0, 4, 0, 0, // Skip to: 761
202 : /* 757 */ MCD::OPC_Decode, 165, 1, 6, // Opcode: JR
203 : /* 761 */ MCD::OPC_CheckField, 23, 5, 2, 11, 0, 0, // Skip to: 779
204 : /* 768 */ MCD::OPC_CheckField, 11, 5, 0, 4, 0, 0, // Skip to: 779
205 : /* 775 */ MCD::OPC_Decode, 161, 1, 7, // Opcode: BRIND_CC
206 : /* 779 */ MCD::OPC_CheckField, 23, 5, 2, 4, 0, 0, // Skip to: 790
207 : /* 786 */ MCD::OPC_Decode, 162, 1, 8, // Opcode: BRIND_CCA
208 : /* 790 */ MCD::OPC_Decode, 191, 1, 5, // Opcode: OR_R
209 : /* 794 */ MCD::OPC_FilterValue, 1, 53, 1, 0, // Skip to: 1108
210 : /* 799 */ MCD::OPC_Decode, 188, 1, 5, // Opcode: OR_F_R
211 : /* 803 */ MCD::OPC_FilterValue, 192, 1, 21, 0, 0, // Skip to: 830
212 : /* 809 */ MCD::OPC_ExtractField, 17, 1, // Inst{17} ...
213 : /* 812 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 821
214 : /* 817 */ MCD::OPC_Decode, 235, 1, 5, // Opcode: XOR_R
215 : /* 821 */ MCD::OPC_FilterValue, 1, 26, 1, 0, // Skip to: 1108
216 : /* 826 */ MCD::OPC_Decode, 232, 1, 5, // Opcode: XOR_F_R
217 : /* 830 */ MCD::OPC_FilterValue, 224, 1, 11, 0, 0, // Skip to: 847
218 : /* 836 */ MCD::OPC_CheckField, 17, 1, 0, 9, 1, 0, // Skip to: 1108
219 : /* 843 */ MCD::OPC_Decode, 197, 1, 9, // Opcode: SELECT
220 : /* 847 */ MCD::OPC_FilterValue, 240, 1, 21, 0, 0, // Skip to: 874
221 : /* 853 */ MCD::OPC_ExtractField, 17, 1, // Inst{17} ...
222 : /* 856 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 865
223 : /* 861 */ MCD::OPC_Decode, 202, 1, 5, // Opcode: SHL_R
224 : /* 865 */ MCD::OPC_FilterValue, 1, 238, 0, 0, // Skip to: 1108
225 : /* 870 */ MCD::OPC_Decode, 201, 1, 5, // Opcode: SHL_F_R
226 : /* 874 */ MCD::OPC_FilterValue, 248, 1, 228, 0, 0, // Skip to: 1108
227 : /* 880 */ MCD::OPC_ExtractField, 17, 1, // Inst{17} ...
228 : /* 883 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 892
229 : /* 888 */ MCD::OPC_Decode, 207, 1, 5, // Opcode: SRA_R
230 : /* 892 */ MCD::OPC_FilterValue, 1, 211, 0, 0, // Skip to: 1108
231 : /* 897 */ MCD::OPC_Decode, 206, 1, 5, // Opcode: SRA_F_R
232 : /* 901 */ MCD::OPC_FilterValue, 13, 30, 0, 0, // Skip to: 936
233 : /* 906 */ MCD::OPC_ExtractField, 0, 18, // Inst{17-0} ...
234 : /* 909 */ MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 918
235 : /* 914 */ MCD::OPC_Decode, 192, 1, 10, // Opcode: POPC
236 : /* 918 */ MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 927
237 : /* 923 */ MCD::OPC_Decode, 178, 1, 10, // Opcode: LEADZ
238 : /* 927 */ MCD::OPC_FilterValue, 3, 176, 0, 0, // Skip to: 1108
239 : /* 932 */ MCD::OPC_Decode, 229, 1, 10, // Opcode: TRAILZ
240 : /* 936 */ MCD::OPC_FilterValue, 14, 70, 0, 0, // Skip to: 1011
241 : /* 941 */ MCD::OPC_ExtractField, 1, 1, // Inst{1} ...
242 : /* 944 */ MCD::OPC_FilterValue, 0, 22, 0, 0, // Skip to: 971
243 : /* 949 */ MCD::OPC_CheckField, 25, 3, 0, 11, 0, 0, // Skip to: 967
244 : /* 956 */ MCD::OPC_CheckField, 0, 1, 0, 4, 0, 0, // Skip to: 967
245 : /* 963 */ MCD::OPC_Decode, 164, 1, 11, // Opcode: BT
246 : /* 967 */ MCD::OPC_Decode, 160, 1, 12, // Opcode: BRCC
247 : /* 971 */ MCD::OPC_FilterValue, 1, 132, 0, 0, // Skip to: 1108
248 : /* 976 */ MCD::OPC_ExtractField, 23, 2, // Inst{24-23} ...
249 : /* 979 */ MCD::OPC_FilterValue, 0, 11, 0, 0, // Skip to: 995
250 : /* 984 */ MCD::OPC_CheckField, 2, 16, 0, 117, 0, 0, // Skip to: 1108
251 : /* 991 */ MCD::OPC_Decode, 196, 1, 13, // Opcode: SCC
252 : /* 995 */ MCD::OPC_FilterValue, 2, 108, 0, 0, // Skip to: 1108
253 : /* 1000 */ MCD::OPC_CheckField, 16, 7, 0, 101, 0, 0, // Skip to: 1108
254 : /* 1007 */ MCD::OPC_Decode, 163, 1, 14, // Opcode: BRR
255 : /* 1011 */ MCD::OPC_FilterValue, 15, 92, 0, 0, // Skip to: 1108
256 : /* 1016 */ MCD::OPC_ExtractField, 16, 2, // Inst{17-16} ...
257 : /* 1019 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 1028
258 : /* 1024 */ MCD::OPC_Decode, 166, 1, 15, // Opcode: LDADDR
259 : /* 1028 */ MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 1037
260 : /* 1033 */ MCD::OPC_Decode, 210, 1, 15, // Opcode: STADDR
261 : /* 1037 */ MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 1046
262 : /* 1042 */ MCD::OPC_Decode, 203, 1, 15, // Opcode: SLI
263 : /* 1046 */ MCD::OPC_FilterValue, 3, 57, 0, 0, // Skip to: 1108
264 : /* 1051 */ MCD::OPC_ExtractField, 12, 4, // Inst{15-12} ...
265 : /* 1054 */ MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 1063
266 : /* 1059 */ MCD::OPC_Decode, 171, 1, 16, // Opcode: LDHs_RI
267 : /* 1063 */ MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 1072
268 : /* 1068 */ MCD::OPC_Decode, 173, 1, 16, // Opcode: LDHz_RI
269 : /* 1072 */ MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 1081
270 : /* 1077 */ MCD::OPC_Decode, 213, 1, 16, // Opcode: STH_RI
271 : /* 1081 */ MCD::OPC_FilterValue, 4, 4, 0, 0, // Skip to: 1090
272 : /* 1086 */ MCD::OPC_Decode, 167, 1, 16, // Opcode: LDBs_RI
273 : /* 1090 */ MCD::OPC_FilterValue, 5, 4, 0, 0, // Skip to: 1099
274 : /* 1095 */ MCD::OPC_Decode, 169, 1, 16, // Opcode: LDBz_RI
275 : /* 1099 */ MCD::OPC_FilterValue, 6, 4, 0, 0, // Skip to: 1108
276 : /* 1104 */ MCD::OPC_Decode, 211, 1, 16, // Opcode: STB_RI
277 : /* 1108 */ MCD::OPC_Fail,
278 : 0
279 : };
280 :
281 0 : static bool checkDecoderPredicate(unsigned Idx, const FeatureBitset& Bits) {
282 0 : llvm_unreachable("Invalid index!");
283 : }
284 :
285 : template<typename InsnType>
286 380 : static DecodeStatus decodeToMCInst(DecodeStatus S, unsigned Idx, InsnType insn, MCInst &MI,
287 : uint64_t Address, const void *Decoder, bool &DecodeComplete) {
288 380 : DecodeComplete = true;
289 : InsnType tmp;
290 380 : switch (Idx) {
291 0 : default: llvm_unreachable("Invalid index!");
292 : case 0:
293 : return S;
294 : case 1:
295 : tmp = fieldFromInstruction(insn, 23, 5);
296 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
297 : tmp = fieldFromInstruction(insn, 18, 5);
298 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
299 : tmp = fieldFromInstruction(insn, 0, 16);
300 46 : MI.addOperand(MCOperand::createImm(tmp));
301 46 : return S;
302 : case 2:
303 : tmp = fieldFromInstruction(insn, 23, 5);
304 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
305 : tmp = fieldFromInstruction(insn, 18, 5);
306 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
307 : tmp = fieldFromInstruction(insn, 0, 16);
308 : if (decodeShiftImm(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
309 16 : return S;
310 : case 3:
311 : tmp = fieldFromInstruction(insn, 23, 5);
312 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
313 : tmp = 0;
314 : tmp |= fieldFromInstruction(insn, 0, 16) << 0;
315 34 : tmp |= fieldFromInstruction(insn, 18, 5) << 18;
316 34 : if (decodeRiMemoryValue(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
317 : return S;
318 : case 4:
319 : tmp = fieldFromInstruction(insn, 23, 5);
320 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
321 : tmp = 0;
322 : tmp |= fieldFromInstruction(insn, 3, 8) << 0;
323 118 : tmp |= fieldFromInstruction(insn, 11, 5) << 10;
324 118 : tmp |= fieldFromInstruction(insn, 18, 5) << 15;
325 118 : if (decodeRrMemoryValue(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
326 : return S;
327 : case 5:
328 : tmp = fieldFromInstruction(insn, 23, 5);
329 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
330 : tmp = fieldFromInstruction(insn, 18, 5);
331 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
332 : tmp = fieldFromInstruction(insn, 11, 5);
333 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
334 : tmp = 0;
335 19 : tmp |= fieldFromInstruction(insn, 0, 3) << 1;
336 19 : tmp |= fieldFromInstruction(insn, 16, 1) << 0;
337 : if (decodePredicateOperand(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
338 : return S;
339 : case 6:
340 : tmp = fieldFromInstruction(insn, 11, 5);
341 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
342 : return S;
343 : case 7:
344 : tmp = fieldFromInstruction(insn, 18, 5);
345 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
346 : tmp = 0;
347 0 : tmp |= fieldFromInstruction(insn, 0, 3) << 1;
348 0 : tmp |= fieldFromInstruction(insn, 16, 1) << 0;
349 0 : MI.addOperand(MCOperand::createImm(tmp));
350 0 : return S;
351 : case 8:
352 : tmp = fieldFromInstruction(insn, 18, 5);
353 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
354 : tmp = fieldFromInstruction(insn, 11, 5);
355 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
356 : tmp = 0;
357 0 : tmp |= fieldFromInstruction(insn, 0, 3) << 1;
358 0 : tmp |= fieldFromInstruction(insn, 16, 1) << 0;
359 0 : MI.addOperand(MCOperand::createImm(tmp));
360 0 : return S;
361 : case 9:
362 : tmp = fieldFromInstruction(insn, 23, 5);
363 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
364 : tmp = fieldFromInstruction(insn, 18, 5);
365 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
366 : tmp = fieldFromInstruction(insn, 11, 5);
367 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
368 : tmp = 0;
369 0 : tmp |= fieldFromInstruction(insn, 0, 3) << 1;
370 0 : tmp |= fieldFromInstruction(insn, 16, 1) << 0;
371 0 : MI.addOperand(MCOperand::createImm(tmp));
372 0 : return S;
373 : case 10:
374 : tmp = fieldFromInstruction(insn, 23, 5);
375 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
376 : tmp = fieldFromInstruction(insn, 18, 5);
377 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
378 : return S;
379 : case 11:
380 1 : tmp = fieldFromInstruction(insn, 2, 23) << 2;
381 1 : if (decodeBranch(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
382 : return S;
383 : case 12:
384 14 : tmp = fieldFromInstruction(insn, 2, 23) << 2;
385 14 : if (decodeBranch(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
386 : tmp = 0;
387 : tmp |= fieldFromInstruction(insn, 0, 1) << 0;
388 14 : tmp |= fieldFromInstruction(insn, 25, 3) << 1;
389 14 : MI.addOperand(MCOperand::createImm(tmp));
390 14 : return S;
391 : case 13:
392 : tmp = fieldFromInstruction(insn, 18, 5);
393 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
394 : tmp = 0;
395 : tmp |= fieldFromInstruction(insn, 0, 1) << 0;
396 14 : tmp |= fieldFromInstruction(insn, 25, 3) << 1;
397 14 : MI.addOperand(MCOperand::createImm(tmp));
398 14 : return S;
399 : case 14:
400 15 : tmp = fieldFromInstruction(insn, 2, 14) << 2;
401 15 : MI.addOperand(MCOperand::createImm(tmp));
402 : tmp = 0;
403 : tmp |= fieldFromInstruction(insn, 0, 1) << 0;
404 15 : tmp |= fieldFromInstruction(insn, 25, 3) << 1;
405 15 : MI.addOperand(MCOperand::createImm(tmp));
406 15 : return S;
407 : case 15:
408 : tmp = fieldFromInstruction(insn, 23, 5);
409 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
410 : tmp = 0;
411 : tmp |= fieldFromInstruction(insn, 0, 16) << 0;
412 3 : tmp |= fieldFromInstruction(insn, 18, 5) << 16;
413 3 : MI.addOperand(MCOperand::createImm(tmp));
414 3 : return S;
415 : case 16:
416 : tmp = fieldFromInstruction(insn, 23, 5);
417 : if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
418 : tmp = 0;
419 : tmp |= fieldFromInstruction(insn, 0, 10) << 0;
420 96 : tmp |= fieldFromInstruction(insn, 18, 5) << 12;
421 96 : if (decodeSplsValue(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
422 : return S;
423 : }
424 : }
425 :
426 : template<typename InsnType>
427 0 : static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
428 : InsnType insn, uint64_t Address,
429 : const void *DisAsm,
430 : const MCSubtargetInfo &STI) {
431 : const FeatureBitset& Bits = STI.getFeatureBits();
432 :
433 : const uint8_t *Ptr = DecodeTable;
434 : uint32_t CurFieldValue = 0;
435 : DecodeStatus S = MCDisassembler::Success;
436 : while (true) {
437 0 : ptrdiff_t Loc = Ptr - DecodeTable;
438 0 : switch (*Ptr) {
439 0 : default:
440 0 : errs() << Loc << ": Unexpected decode table opcode!\n";
441 0 : return MCDisassembler::Fail;
442 0 : case MCD::OPC_ExtractField: {
443 0 : unsigned Start = *++Ptr;
444 0 : unsigned Len = *++Ptr;
445 0 : ++Ptr;
446 : CurFieldValue = fieldFromInstruction(insn, Start, Len);
447 : LLVM_DEBUG(dbgs() << Loc << ": OPC_ExtractField(" << Start << ", "
448 : << Len << "): " << CurFieldValue << "\n");
449 0 : break;
450 : }
451 0 : case MCD::OPC_FilterValue: {
452 : // Decode the field value.
453 : unsigned Len;
454 0 : InsnType Val = decodeULEB128(++Ptr, &Len);
455 0 : Ptr += Len;
456 : // NumToSkip is a plain 24-bit integer.
457 0 : unsigned NumToSkip = *Ptr++;
458 0 : NumToSkip |= (*Ptr++) << 8;
459 0 : NumToSkip |= (*Ptr++) << 16;
460 :
461 : // Perform the filter operation.
462 0 : if (Val != CurFieldValue)
463 0 : Ptr += NumToSkip;
464 : LLVM_DEBUG(dbgs() << Loc << ": OPC_FilterValue(" << Val << ", " << NumToSkip
465 : << "): " << ((Val != CurFieldValue) ? "FAIL:" : "PASS:")
466 : << " continuing at " << (Ptr - DecodeTable) << "\n");
467 :
468 : break;
469 : }
470 0 : case MCD::OPC_CheckField: {
471 0 : unsigned Start = *++Ptr;
472 0 : unsigned Len = *++Ptr;
473 : InsnType FieldValue = fieldFromInstruction(insn, Start, Len);
474 : // Decode the field value.
475 0 : uint32_t ExpectedValue = decodeULEB128(++Ptr, &Len);
476 0 : Ptr += Len;
477 : // NumToSkip is a plain 24-bit integer.
478 0 : unsigned NumToSkip = *Ptr++;
479 0 : NumToSkip |= (*Ptr++) << 8;
480 0 : NumToSkip |= (*Ptr++) << 16;
481 :
482 : // If the actual and expected values don't match, skip.
483 0 : if (ExpectedValue != FieldValue)
484 0 : Ptr += NumToSkip;
485 : LLVM_DEBUG(dbgs() << Loc << ": OPC_CheckField(" << Start << ", "
486 : << Len << ", " << ExpectedValue << ", " << NumToSkip
487 : << "): FieldValue = " << FieldValue << ", ExpectedValue = "
488 : << ExpectedValue << ": "
489 : << ((ExpectedValue == FieldValue) ? "PASS\n" : "FAIL\n"));
490 : break;
491 : }
492 0 : case MCD::OPC_CheckPredicate: {
493 : unsigned Len;
494 : // Decode the Predicate Index value.
495 0 : unsigned PIdx = decodeULEB128(++Ptr, &Len);
496 : Ptr += Len;
497 : // NumToSkip is a plain 24-bit integer.
498 : unsigned NumToSkip = *Ptr++;
499 : NumToSkip |= (*Ptr++) << 8;
500 : NumToSkip |= (*Ptr++) << 16;
501 : // Check the predicate.
502 : bool Pred;
503 : if (!(Pred = checkDecoderPredicate(PIdx, Bits)))
504 : Ptr += NumToSkip;
505 : (void)Pred;
506 : LLVM_DEBUG(dbgs() << Loc << ": OPC_CheckPredicate(" << PIdx << "): "
507 : << (Pred ? "PASS\n" : "FAIL\n"));
508 :
509 : break;
510 : }
511 0 : case MCD::OPC_Decode: {
512 : unsigned Len;
513 : // Decode the Opcode value.
514 0 : unsigned Opc = decodeULEB128(++Ptr, &Len);
515 0 : Ptr += Len;
516 0 : unsigned DecodeIdx = decodeULEB128(Ptr, &Len);
517 : Ptr += Len;
518 :
519 : MI.clear();
520 : MI.setOpcode(Opc);
521 : bool DecodeComplete;
522 0 : S = decodeToMCInst(S, DecodeIdx, insn, MI, Address, DisAsm, DecodeComplete);
523 : assert(DecodeComplete);
524 :
525 : LLVM_DEBUG(dbgs() << Loc << ": OPC_Decode: opcode " << Opc
526 : << ", using decoder " << DecodeIdx << ": "
527 : << (S != MCDisassembler::Fail ? "PASS" : "FAIL") << "\n");
528 : return S;
529 : }
530 0 : case MCD::OPC_TryDecode: {
531 : unsigned Len;
532 : // Decode the Opcode value.
533 0 : unsigned Opc = decodeULEB128(++Ptr, &Len);
534 0 : Ptr += Len;
535 0 : unsigned DecodeIdx = decodeULEB128(Ptr, &Len);
536 0 : Ptr += Len;
537 : // NumToSkip is a plain 24-bit integer.
538 0 : unsigned NumToSkip = *Ptr++;
539 0 : NumToSkip |= (*Ptr++) << 8;
540 0 : NumToSkip |= (*Ptr++) << 16;
541 :
542 : // Perform the decode operation.
543 : MCInst TmpMI;
544 : TmpMI.setOpcode(Opc);
545 : bool DecodeComplete;
546 0 : S = decodeToMCInst(S, DecodeIdx, insn, TmpMI, Address, DisAsm, DecodeComplete);
547 : LLVM_DEBUG(dbgs() << Loc << ": OPC_TryDecode: opcode " << Opc
548 : << ", using decoder " << DecodeIdx << ": ");
549 :
550 0 : if (DecodeComplete) {
551 : // Decoding complete.
552 : LLVM_DEBUG(dbgs() << (S != MCDisassembler::Fail ? "PASS" : "FAIL") << "\n");
553 : MI = TmpMI;
554 0 : return S;
555 : } else {
556 : assert(S == MCDisassembler::Fail);
557 : // If the decoding was incomplete, skip.
558 0 : Ptr += NumToSkip;
559 : LLVM_DEBUG(dbgs() << "FAIL: continuing at " << (Ptr - DecodeTable) << "\n");
560 : // Reset decode status. This also drops a SoftFail status that could be
561 : // set before the decode attempt.
562 : S = MCDisassembler::Success;
563 : }
564 : break;
565 : }
566 0 : case MCD::OPC_SoftFail: {
567 : // Decode the mask values.
568 : unsigned Len;
569 0 : InsnType PositiveMask = decodeULEB128(++Ptr, &Len);
570 0 : Ptr += Len;
571 0 : InsnType NegativeMask = decodeULEB128(Ptr, &Len);
572 0 : Ptr += Len;
573 0 : bool Fail = (insn & PositiveMask) || (~insn & NegativeMask);
574 : if (Fail)
575 : S = MCDisassembler::SoftFail;
576 : LLVM_DEBUG(dbgs() << Loc << ": OPC_SoftFail: " << (Fail ? "FAIL\n":"PASS\n"));
577 : break;
578 : }
579 : case MCD::OPC_Fail: {
580 : LLVM_DEBUG(dbgs() << Loc << ": OPC_Fail\n");
581 : return MCDisassembler::Fail;
582 : }
583 : }
584 : }
585 : llvm_unreachable("bogosity detected in disassembler state machine!");
586 : }
587 :
588 :
589 : } // End llvm namespace
|