1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
2 | |* *| |
3 | |* Machine Code Emitter *| |
4 | |* *| |
5 | |* Automatically generated file, do not edit! *| |
6 | |* *| |
7 | \*===----------------------------------------------------------------------===*/ |
8 | |
9 | uint64_t BPFMCCodeEmitter::getBinaryCodeForInstr(const MCInst &MI, |
10 | SmallVectorImpl<MCFixup> &Fixups, |
11 | const MCSubtargetInfo &STI) const { |
12 | static const uint64_t InstBits[] = { |
13 | UINT64_C(0), |
14 | UINT64_C(0), |
15 | UINT64_C(0), |
16 | UINT64_C(0), |
17 | UINT64_C(0), |
18 | UINT64_C(0), |
19 | UINT64_C(0), |
20 | UINT64_C(0), |
21 | UINT64_C(0), |
22 | UINT64_C(0), |
23 | UINT64_C(0), |
24 | UINT64_C(0), |
25 | UINT64_C(0), |
26 | UINT64_C(0), |
27 | UINT64_C(0), |
28 | UINT64_C(0), |
29 | UINT64_C(0), |
30 | UINT64_C(0), |
31 | UINT64_C(0), |
32 | UINT64_C(0), |
33 | UINT64_C(0), |
34 | UINT64_C(0), |
35 | UINT64_C(0), |
36 | UINT64_C(0), |
37 | UINT64_C(0), |
38 | UINT64_C(0), |
39 | UINT64_C(0), |
40 | UINT64_C(0), |
41 | UINT64_C(0), |
42 | UINT64_C(0), |
43 | UINT64_C(0), |
44 | UINT64_C(0), |
45 | UINT64_C(0), |
46 | UINT64_C(0), |
47 | UINT64_C(0), |
48 | UINT64_C(0), |
49 | UINT64_C(0), |
50 | UINT64_C(0), |
51 | UINT64_C(0), |
52 | UINT64_C(0), |
53 | UINT64_C(0), |
54 | UINT64_C(0), |
55 | UINT64_C(0), |
56 | UINT64_C(0), |
57 | UINT64_C(0), |
58 | UINT64_C(0), |
59 | UINT64_C(0), |
60 | UINT64_C(0), |
61 | UINT64_C(0), |
62 | UINT64_C(0), |
63 | UINT64_C(0), |
64 | UINT64_C(0), |
65 | UINT64_C(0), |
66 | UINT64_C(0), |
67 | UINT64_C(0), |
68 | UINT64_C(0), |
69 | UINT64_C(0), |
70 | UINT64_C(0), |
71 | UINT64_C(0), |
72 | UINT64_C(0), |
73 | UINT64_C(0), |
74 | UINT64_C(0), |
75 | UINT64_C(0), |
76 | UINT64_C(0), |
77 | UINT64_C(0), |
78 | UINT64_C(0), |
79 | UINT64_C(0), |
80 | UINT64_C(0), |
81 | UINT64_C(0), |
82 | UINT64_C(0), |
83 | UINT64_C(0), |
84 | UINT64_C(0), |
85 | UINT64_C(0), |
86 | UINT64_C(0), |
87 | UINT64_C(0), |
88 | UINT64_C(0), |
89 | UINT64_C(0), |
90 | UINT64_C(0), |
91 | UINT64_C(0), |
92 | UINT64_C(0), |
93 | UINT64_C(0), |
94 | UINT64_C(0), |
95 | UINT64_C(0), |
96 | UINT64_C(0), |
97 | UINT64_C(0), |
98 | UINT64_C(0), |
99 | UINT64_C(0), |
100 | UINT64_C(0), |
101 | UINT64_C(0), |
102 | UINT64_C(0), |
103 | UINT64_C(0), |
104 | UINT64_C(0), |
105 | UINT64_C(0), |
106 | UINT64_C(0), |
107 | UINT64_C(0), |
108 | UINT64_C(0), |
109 | UINT64_C(0), |
110 | UINT64_C(0), |
111 | UINT64_C(0), |
112 | UINT64_C(0), |
113 | UINT64_C(0), |
114 | UINT64_C(0), |
115 | UINT64_C(0), |
116 | UINT64_C(0), |
117 | UINT64_C(0), |
118 | UINT64_C(0), |
119 | UINT64_C(0), |
120 | UINT64_C(0), |
121 | UINT64_C(0), |
122 | UINT64_C(0), |
123 | UINT64_C(0), |
124 | UINT64_C(0), |
125 | UINT64_C(0), |
126 | UINT64_C(0), |
127 | UINT64_C(0), |
128 | UINT64_C(0), |
129 | UINT64_C(0), |
130 | UINT64_C(0), |
131 | UINT64_C(0), |
132 | UINT64_C(0), |
133 | UINT64_C(0), |
134 | UINT64_C(0), |
135 | UINT64_C(0), |
136 | UINT64_C(0), |
137 | UINT64_C(0), |
138 | UINT64_C(0), |
139 | UINT64_C(0), |
140 | UINT64_C(0), |
141 | UINT64_C(0), |
142 | UINT64_C(0), |
143 | UINT64_C(0), |
144 | UINT64_C(0), |
145 | UINT64_C(0), |
146 | UINT64_C(0), |
147 | UINT64_C(0), |
148 | UINT64_C(0), |
149 | UINT64_C(0), |
150 | UINT64_C(0), |
151 | UINT64_C(0), |
152 | UINT64_C(0), |
153 | UINT64_C(0), |
154 | UINT64_C(0), |
155 | UINT64_C(0), |
156 | UINT64_C(0), |
157 | UINT64_C(0), |
158 | UINT64_C(0), |
159 | UINT64_C(0), |
160 | UINT64_C(0), |
161 | UINT64_C(0), |
162 | UINT64_C(0), |
163 | UINT64_C(0), |
164 | UINT64_C(0), |
165 | UINT64_C(0), |
166 | UINT64_C(0), |
167 | UINT64_C(0), |
168 | UINT64_C(0), |
169 | UINT64_C(0), |
170 | UINT64_C(0), |
171 | UINT64_C(0), |
172 | UINT64_C(0), |
173 | UINT64_C(0), |
174 | UINT64_C(0), |
175 | UINT64_C(0), |
176 | UINT64_C(0), |
177 | UINT64_C(0), |
178 | UINT64_C(0), |
179 | UINT64_C(0), |
180 | UINT64_C(0), |
181 | UINT64_C(0), |
182 | UINT64_C(0), |
183 | UINT64_C(0), |
184 | UINT64_C(0), |
185 | UINT64_C(0), |
186 | UINT64_C(0), |
187 | UINT64_C(0), |
188 | UINT64_C(0), |
189 | UINT64_C(0), |
190 | UINT64_C(0), |
191 | UINT64_C(0), |
192 | UINT64_C(0), |
193 | UINT64_C(0), |
194 | UINT64_C(0), |
195 | UINT64_C(0), |
196 | UINT64_C(0), |
197 | UINT64_C(0), |
198 | UINT64_C(0), |
199 | UINT64_C(0), |
200 | UINT64_C(0), |
201 | UINT64_C(0), |
202 | UINT64_C(0), |
203 | UINT64_C(0), |
204 | UINT64_C(0), |
205 | UINT64_C(0), |
206 | UINT64_C(0), |
207 | UINT64_C(0), |
208 | UINT64_C(0), |
209 | UINT64_C(0), |
210 | UINT64_C(0), |
211 | UINT64_C(0), |
212 | UINT64_C(0), |
213 | UINT64_C(0), |
214 | UINT64_C(0), |
215 | UINT64_C(0), |
216 | UINT64_C(0), |
217 | UINT64_C(0), |
218 | UINT64_C(0), |
219 | UINT64_C(0), |
220 | UINT64_C(0), |
221 | UINT64_C(0), |
222 | UINT64_C(0), |
223 | UINT64_C(0), |
224 | UINT64_C(0), |
225 | UINT64_C(0), |
226 | UINT64_C(0), |
227 | UINT64_C(0), |
228 | UINT64_C(0), |
229 | UINT64_C(0), |
230 | UINT64_C(0), |
231 | UINT64_C(0), |
232 | UINT64_C(0), |
233 | UINT64_C(0), |
234 | UINT64_C(0), |
235 | UINT64_C(0), |
236 | UINT64_C(0), |
237 | UINT64_C(0), |
238 | UINT64_C(0), |
239 | UINT64_C(0), |
240 | UINT64_C(0), |
241 | UINT64_C(0), |
242 | UINT64_C(0), |
243 | UINT64_C(0), |
244 | UINT64_C(0), |
245 | UINT64_C(0), |
246 | UINT64_C(0), |
247 | UINT64_C(0), |
248 | UINT64_C(0), |
249 | UINT64_C(0), |
250 | UINT64_C(0), |
251 | UINT64_C(0), |
252 | UINT64_C(0), |
253 | UINT64_C(0), |
254 | UINT64_C(0), |
255 | UINT64_C(0), |
256 | UINT64_C(0), |
257 | UINT64_C(0), |
258 | UINT64_C(0), |
259 | UINT64_C(0), |
260 | UINT64_C(0), |
261 | UINT64_C(0), |
262 | UINT64_C(0), |
263 | UINT64_C(0), |
264 | UINT64_C(0), |
265 | UINT64_C(0), |
266 | UINT64_C(0), |
267 | UINT64_C(0), |
268 | UINT64_C(0), |
269 | UINT64_C(0), |
270 | UINT64_C(0), |
271 | UINT64_C(0), |
272 | UINT64_C(0), |
273 | UINT64_C(0), |
274 | UINT64_C(0), |
275 | UINT64_C(0), |
276 | UINT64_C(0), |
277 | UINT64_C(0), |
278 | UINT64_C(0), |
279 | UINT64_C(0), |
280 | UINT64_C(0), |
281 | UINT64_C(0), |
282 | UINT64_C(0), |
283 | UINT64_C(0), |
284 | UINT64_C(0), |
285 | UINT64_C(0), |
286 | UINT64_C(0), |
287 | UINT64_C(0), |
288 | UINT64_C(0), |
289 | UINT64_C(0), |
290 | UINT64_C(0), |
291 | UINT64_C(0), |
292 | UINT64_C(0), |
293 | UINT64_C(0), |
294 | UINT64_C(0), |
295 | UINT64_C(0), |
296 | UINT64_C(0), |
297 | UINT64_C(0), |
298 | UINT64_C(0), |
299 | UINT64_C(0), |
300 | UINT64_C(0), |
301 | UINT64_C(0), |
302 | UINT64_C(0), |
303 | UINT64_C(0), |
304 | UINT64_C(0), |
305 | UINT64_C(0), |
306 | UINT64_C(0), |
307 | UINT64_C(0), |
308 | UINT64_C(0), |
309 | UINT64_C(0), |
310 | UINT64_C(0), |
311 | UINT64_C(0), |
312 | UINT64_C(0), |
313 | UINT64_C(0), |
314 | UINT64_C(0), |
315 | UINT64_C(0), |
316 | UINT64_C(0), |
317 | UINT64_C(0), |
318 | UINT64_C(0), |
319 | UINT64_C(0), |
320 | UINT64_C(13763000465539203072), // ADDR_SPACE_CAST |
321 | UINT64_C(504403158265495552), // ADD_ri |
322 | UINT64_C(288230376151711744), // ADD_ri_32 |
323 | UINT64_C(1080863910568919040), // ADD_rr |
324 | UINT64_C(864691128455135232), // ADD_rr_32 |
325 | UINT64_C(6269010681299730432), // AND_ri |
326 | UINT64_C(6052837899185946624), // AND_ri_32 |
327 | UINT64_C(6845471433603153920), // AND_rr |
328 | UINT64_C(6629298651489370112), // AND_rr_32 |
329 | UINT64_C(15852670688344145936), // BE16 |
330 | UINT64_C(15852670688344145952), // BE32 |
331 | UINT64_C(15852670688344145984), // BE64 |
332 | UINT64_C(15492382718154506256), // BSWAP16 |
333 | UINT64_C(15492382718154506272), // BSWAP32 |
334 | UINT64_C(15492382718154506304), // BSWAP64 |
335 | UINT64_C(15780613094306218225), // CMPXCHGD |
336 | UINT64_C(14051230837395947761), // CMPXCHGW32 |
337 | UINT64_C(6917529027641081856), // CORE_LD32 |
338 | UINT64_C(6917529027641081856), // CORE_LD64 |
339 | UINT64_C(7998392938210000896), // CORE_SHIFT |
340 | UINT64_C(6917529027641081856), // CORE_ST |
341 | UINT64_C(3963167672086036480), // DIV_ri |
342 | UINT64_C(3746994889972252672), // DIV_ri_32 |
343 | UINT64_C(4539628424389459968), // DIV_rr |
344 | UINT64_C(4323455642275676160), // DIV_rr_32 |
345 | UINT64_C(9583660007044415488), // JAL |
346 | UINT64_C(10160120759347838976), // JALX |
347 | UINT64_C(16501189034685497344), // JCOND |
348 | UINT64_C(1513209474796486656), // JEQ_ri |
349 | UINT64_C(1585267068834414592), // JEQ_ri_32 |
350 | UINT64_C(2089670227099910144), // JEQ_rr |
351 | UINT64_C(2161727821137838080), // JEQ_rr_32 |
352 | UINT64_C(360287970189639680), // JMP |
353 | UINT64_C(432345564227567616), // JMPL |
354 | UINT64_C(6124895493223874560), // JNE_ri |
355 | UINT64_C(6196953087261802496), // JNE_ri_32 |
356 | UINT64_C(6701356245527298048), // JNE_rr |
357 | UINT64_C(6773413839565225984), // JNE_rr_32 |
358 | UINT64_C(4971973988617027584), // JSET_ri |
359 | UINT64_C(5044031582654955520), // JSET_ri_32 |
360 | UINT64_C(5548434740920451072), // JSET_rr |
361 | UINT64_C(5620492334958379008), // JSET_rr_32 |
362 | UINT64_C(8430738502437568512), // JSGE_ri |
363 | UINT64_C(8502796096475496448), // JSGE_ri_32 |
364 | UINT64_C(9007199254740992000), // JSGE_rr |
365 | UINT64_C(9079256848778919936), // JSGE_rr_32 |
366 | UINT64_C(7277816997830721536), // JSGT_ri |
367 | UINT64_C(7349874591868649472), // JSGT_ri_32 |
368 | UINT64_C(7854277750134145024), // JSGT_rr |
369 | UINT64_C(7926335344172072960), // JSGT_rr_32 |
370 | UINT64_C(15348267530078650368), // JSLE_ri |
371 | UINT64_C(15420325124116578304), // JSLE_ri_32 |
372 | UINT64_C(15924728282382073856), // JSLE_rr |
373 | UINT64_C(15996785876420001792), // JSLE_rr_32 |
374 | UINT64_C(14195346025471803392), // JSLT_ri |
375 | UINT64_C(14267403619509731328), // JSLT_ri_32 |
376 | UINT64_C(14771806777775226880), // JSLT_rr |
377 | UINT64_C(14843864371813154816), // JSLT_rr_32 |
378 | UINT64_C(3819052484010180608), // JUGE_ri |
379 | UINT64_C(3891110078048108544), // JUGE_ri_32 |
380 | UINT64_C(4395513236313604096), // JUGE_rr |
381 | UINT64_C(4467570830351532032), // JUGE_rr_32 |
382 | UINT64_C(2666130979403333632), // JUGT_ri |
383 | UINT64_C(2738188573441261568), // JUGT_ri_32 |
384 | UINT64_C(3242591731706757120), // JUGT_rr |
385 | UINT64_C(3314649325744685056), // JUGT_rr_32 |
386 | UINT64_C(13042424520864956416), // JULE_ri |
387 | UINT64_C(13114482114902884352), // JULE_ri_32 |
388 | UINT64_C(13618885273168379904), // JULE_rr |
389 | UINT64_C(13690942867206307840), // JULE_rr_32 |
390 | UINT64_C(11889503016258109440), // JULT_ri |
391 | UINT64_C(11961560610296037376), // JULT_ri_32 |
392 | UINT64_C(12465963768561532928), // JULT_rr |
393 | UINT64_C(12538021362599460864), // JULT_rr_32 |
394 | UINT64_C(8142508126285856768), // LDB |
395 | UINT64_C(8142508126285856768), // LDB32 |
396 | UINT64_C(10448351135499550720), // LDBSX |
397 | UINT64_C(8718968878589280256), // LDD |
398 | UINT64_C(7566047373982433280), // LDH |
399 | UINT64_C(7566047373982433280), // LDH32 |
400 | UINT64_C(9871890383196127232), // LDHSX |
401 | UINT64_C(6989586621679009792), // LDW |
402 | UINT64_C(6989586621679009792), // LDW32 |
403 | UINT64_C(9295429630892703744), // LDWSX |
404 | UINT64_C(3458764513820540928), // LD_ABS_B |
405 | UINT64_C(2882303761517117440), // LD_ABS_H |
406 | UINT64_C(2305843009213693952), // LD_ABS_W |
407 | UINT64_C(5764607523034234880), // LD_IND_B |
408 | UINT64_C(5188146770730811392), // LD_IND_H |
409 | UINT64_C(4611686018427387904), // LD_IND_W |
410 | UINT64_C(1729382256910270464), // LD_imm64 |
411 | UINT64_C(1729382256910270464), // LD_pseudo |
412 | UINT64_C(15276209936040722448), // LE16 |
413 | UINT64_C(15276209936040722464), // LE32 |
414 | UINT64_C(15276209936040722496), // LE64 |
415 | UINT64_C(10880696699727118336), // MOD_ri |
416 | UINT64_C(10664523917613334528), // MOD_ri_32 |
417 | UINT64_C(11457157452030541824), // MOD_rr |
418 | UINT64_C(11240984669916758016), // MOD_rr_32 |
419 | UINT64_C(13763000529963712512), // MOVSX_rr_16 |
420 | UINT64_C(13763000598683189248), // MOVSX_rr_32 |
421 | UINT64_C(13546827747849928704), // MOVSX_rr_32_16 |
422 | UINT64_C(13546827713490190336), // MOVSX_rr_32_8 |
423 | UINT64_C(13763000495603974144), // MOVSX_rr_8 |
424 | UINT64_C(13546827679130451968), // MOV_32_64 |
425 | UINT64_C(13186539708940812288), // MOV_ri |
426 | UINT64_C(12970366926827028480), // MOV_ri_32 |
427 | UINT64_C(13763000461244235776), // MOV_rr |
428 | UINT64_C(13546827679130451968), // MOV_rr_32 |
429 | UINT64_C(2810246167479189504), // MUL_ri |
430 | UINT64_C(2594073385365405696), // MUL_ri_32 |
431 | UINT64_C(3386706919782612992), // MUL_rr |
432 | UINT64_C(3170534137668829184), // MUL_rr_32 |
433 | UINT64_C(9511602413006487552), // NEG_32 |
434 | UINT64_C(9727775195120271360), // NEG_64 |
435 | UINT64_C(13763000461244235776), // NOP |
436 | UINT64_C(5116089176692883456), // OR_ri |
437 | UINT64_C(4899916394579099648), // OR_ri_32 |
438 | UINT64_C(5692549928996306944), // OR_rr |
439 | UINT64_C(5476377146882523136), // OR_rr_32 |
440 | UINT64_C(10736581511651262464), // RET |
441 | UINT64_C(3963167676381003776), // SDIV_ri |
442 | UINT64_C(3746994894267219968), // SDIV_ri_32 |
443 | UINT64_C(4539628428684427264), // SDIV_rr |
444 | UINT64_C(4323455646570643456), // SDIV_rr_32 |
445 | UINT64_C(7421932185906577408), // SLL_ri |
446 | UINT64_C(7205759403792793600), // SLL_ri_32 |
447 | UINT64_C(7998392938210000896), // SLL_rr |
448 | UINT64_C(7782220156096217088), // SLL_rr_32 |
449 | UINT64_C(10880696704022085632), // SMOD_ri |
450 | UINT64_C(10664523921908301824), // SMOD_ri_32 |
451 | UINT64_C(11457157456325509120), // SMOD_rr |
452 | UINT64_C(11240984674211725312), // SMOD_rr_32 |
453 | UINT64_C(14339461213547659264), // SRA_ri |
454 | UINT64_C(14123288431433875456), // SRA_ri_32 |
455 | UINT64_C(14915921965851082752), // SRA_rr |
456 | UINT64_C(14699749183737298944), // SRA_rr_32 |
457 | UINT64_C(8574853690513424384), // SRL_ri |
458 | UINT64_C(8358680908399640576), // SRL_ri_32 |
459 | UINT64_C(9151314442816847872), // SRL_rr |
460 | UINT64_C(8935141660703064064), // SRL_rr_32 |
461 | UINT64_C(8286623314361712640), // STB |
462 | UINT64_C(8286623314361712640), // STB32 |
463 | UINT64_C(8214565720323784704), // STB_imm |
464 | UINT64_C(8863084066665136128), // STD |
465 | UINT64_C(8791026472627208192), // STD_imm |
466 | UINT64_C(7710162562058289152), // STH |
467 | UINT64_C(7710162562058289152), // STH32 |
468 | UINT64_C(7638104968020361216), // STH_imm |
469 | UINT64_C(7133701809754865664), // STW |
470 | UINT64_C(7133701809754865664), // STW32 |
471 | UINT64_C(7061644215716937728), // STW_imm |
472 | UINT64_C(1657324662872342528), // SUB_ri |
473 | UINT64_C(1441151880758558720), // SUB_ri_32 |
474 | UINT64_C(2233785415175766016), // SUB_rr |
475 | UINT64_C(2017612633061982208), // SUB_rr_32 |
476 | UINT64_C(15780613094306217984), // XADDD |
477 | UINT64_C(14051230837395947520), // XADDW |
478 | UINT64_C(14051230837395947520), // XADDW32 |
479 | UINT64_C(15780613094306218064), // XANDD |
480 | UINT64_C(14051230837395947600), // XANDW32 |
481 | UINT64_C(15780613094306218209), // XCHGD |
482 | UINT64_C(14051230837395947745), // XCHGW32 |
483 | UINT64_C(15780613094306217985), // XFADDD |
484 | UINT64_C(14051230837395947521), // XFADDW32 |
485 | UINT64_C(15780613094306218065), // XFANDD |
486 | UINT64_C(14051230837395947601), // XFANDW32 |
487 | UINT64_C(15780613094306218049), // XFORD |
488 | UINT64_C(14051230837395947585), // XFORW32 |
489 | UINT64_C(15780613094306218145), // XFXORD |
490 | UINT64_C(14051230837395947681), // XFXORW32 |
491 | UINT64_C(15780613094306218048), // XORD |
492 | UINT64_C(14051230837395947584), // XORW32 |
493 | UINT64_C(12033618204333965312), // XOR_ri |
494 | UINT64_C(11817445422220181504), // XOR_ri_32 |
495 | UINT64_C(12610078956637388800), // XOR_rr |
496 | UINT64_C(12393906174523604992), // XOR_rr_32 |
497 | UINT64_C(15780613094306218144), // XXORD |
498 | UINT64_C(14051230837395947680), // XXORW32 |
499 | UINT64_C(0) |
500 | }; |
501 | const unsigned opcode = MI.getOpcode(); |
502 | uint64_t Value = InstBits[opcode]; |
503 | uint64_t op = 0; |
504 | (void)op; // suppress warning |
505 | switch (opcode) { |
506 | case BPF::CORE_LD32: |
507 | case BPF::CORE_LD64: |
508 | case BPF::CORE_ST: |
509 | case BPF::NOP: |
510 | case BPF::RET: { |
511 | break; |
512 | } |
513 | case BPF::JALX: { |
514 | // op: BrDst |
515 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
516 | op &= UINT64_C(15); |
517 | op <<= 48; |
518 | Value |= op; |
519 | break; |
520 | } |
521 | case BPF::JAL: |
522 | case BPF::JMPL: { |
523 | // op: BrDst |
524 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
525 | op &= UINT64_C(4294967295); |
526 | Value |= op; |
527 | break; |
528 | } |
529 | case BPF::JCOND: |
530 | case BPF::JMP: { |
531 | // op: BrDst |
532 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
533 | op &= UINT64_C(65535); |
534 | op <<= 32; |
535 | Value |= op; |
536 | break; |
537 | } |
538 | case BPF::STB_imm: |
539 | case BPF::STD_imm: |
540 | case BPF::STH_imm: |
541 | case BPF::STW_imm: { |
542 | // op: addr |
543 | op = getMemoryOpValue(MI, Op: 1, Fixups, STI); |
544 | op &= UINT64_C(1048575); |
545 | op <<= 32; |
546 | Value |= op; |
547 | // op: imm |
548 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
549 | op &= UINT64_C(4294967295); |
550 | Value |= op; |
551 | break; |
552 | } |
553 | case BPF::BE16: |
554 | case BPF::BE32: |
555 | case BPF::BE64: |
556 | case BPF::BSWAP16: |
557 | case BPF::BSWAP32: |
558 | case BPF::BSWAP64: |
559 | case BPF::LE16: |
560 | case BPF::LE32: |
561 | case BPF::LE64: |
562 | case BPF::NEG_32: |
563 | case BPF::NEG_64: { |
564 | // op: dst |
565 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
566 | op &= UINT64_C(15); |
567 | op <<= 48; |
568 | Value |= op; |
569 | break; |
570 | } |
571 | case BPF::JEQ_ri: |
572 | case BPF::JEQ_ri_32: |
573 | case BPF::JNE_ri: |
574 | case BPF::JNE_ri_32: |
575 | case BPF::JSET_ri: |
576 | case BPF::JSET_ri_32: |
577 | case BPF::JSGE_ri: |
578 | case BPF::JSGE_ri_32: |
579 | case BPF::JSGT_ri: |
580 | case BPF::JSGT_ri_32: |
581 | case BPF::JSLE_ri: |
582 | case BPF::JSLE_ri_32: |
583 | case BPF::JSLT_ri: |
584 | case BPF::JSLT_ri_32: |
585 | case BPF::JUGE_ri: |
586 | case BPF::JUGE_ri_32: |
587 | case BPF::JUGT_ri: |
588 | case BPF::JUGT_ri_32: |
589 | case BPF::JULE_ri: |
590 | case BPF::JULE_ri_32: |
591 | case BPF::JULT_ri: |
592 | case BPF::JULT_ri_32: { |
593 | // op: dst |
594 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
595 | op &= UINT64_C(15); |
596 | op <<= 48; |
597 | Value |= op; |
598 | // op: BrDst |
599 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 2), Fixups, STI); |
600 | op &= UINT64_C(65535); |
601 | op <<= 32; |
602 | Value |= op; |
603 | // op: imm |
604 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 1), Fixups, STI); |
605 | op &= UINT64_C(4294967295); |
606 | Value |= op; |
607 | break; |
608 | } |
609 | case BPF::LDB: |
610 | case BPF::LDB32: |
611 | case BPF::LDBSX: |
612 | case BPF::LDD: |
613 | case BPF::LDH: |
614 | case BPF::LDH32: |
615 | case BPF::LDHSX: |
616 | case BPF::LDW: |
617 | case BPF::LDW32: |
618 | case BPF::LDWSX: { |
619 | // op: dst |
620 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
621 | op &= UINT64_C(15); |
622 | op <<= 48; |
623 | Value |= op; |
624 | // op: addr |
625 | op = getMemoryOpValue(MI, Op: 1, Fixups, STI); |
626 | Value |= (op & UINT64_C(983040)) << 36; |
627 | Value |= (op & UINT64_C(65535)) << 32; |
628 | break; |
629 | } |
630 | case BPF::LD_imm64: |
631 | case BPF::MOV_ri: |
632 | case BPF::MOV_ri_32: { |
633 | // op: dst |
634 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
635 | op &= UINT64_C(15); |
636 | op <<= 48; |
637 | Value |= op; |
638 | // op: imm |
639 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 1), Fixups, STI); |
640 | op &= UINT64_C(4294967295); |
641 | Value |= op; |
642 | break; |
643 | } |
644 | case BPF::ADD_ri: |
645 | case BPF::ADD_ri_32: |
646 | case BPF::AND_ri: |
647 | case BPF::AND_ri_32: |
648 | case BPF::DIV_ri: |
649 | case BPF::DIV_ri_32: |
650 | case BPF::MOD_ri: |
651 | case BPF::MOD_ri_32: |
652 | case BPF::MUL_ri: |
653 | case BPF::MUL_ri_32: |
654 | case BPF::OR_ri: |
655 | case BPF::OR_ri_32: |
656 | case BPF::SDIV_ri: |
657 | case BPF::SDIV_ri_32: |
658 | case BPF::SLL_ri: |
659 | case BPF::SLL_ri_32: |
660 | case BPF::SMOD_ri: |
661 | case BPF::SMOD_ri_32: |
662 | case BPF::SRA_ri: |
663 | case BPF::SRA_ri_32: |
664 | case BPF::SRL_ri: |
665 | case BPF::SRL_ri_32: |
666 | case BPF::SUB_ri: |
667 | case BPF::SUB_ri_32: |
668 | case BPF::XOR_ri: |
669 | case BPF::XOR_ri_32: { |
670 | // op: dst |
671 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
672 | op &= UINT64_C(15); |
673 | op <<= 48; |
674 | Value |= op; |
675 | // op: imm |
676 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 2), Fixups, STI); |
677 | op &= UINT64_C(4294967295); |
678 | Value |= op; |
679 | break; |
680 | } |
681 | case BPF::LD_pseudo: { |
682 | // op: dst |
683 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
684 | op &= UINT64_C(15); |
685 | op <<= 48; |
686 | Value |= op; |
687 | // op: imm |
688 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 2), Fixups, STI); |
689 | op &= UINT64_C(4294967295); |
690 | Value |= op; |
691 | // op: pseudo |
692 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 1), Fixups, STI); |
693 | op &= UINT64_C(15); |
694 | op <<= 52; |
695 | Value |= op; |
696 | break; |
697 | } |
698 | case BPF::MOVSX_rr_8: |
699 | case BPF::MOVSX_rr_16: |
700 | case BPF::MOVSX_rr_32: |
701 | case BPF::MOVSX_rr_32_8: |
702 | case BPF::MOVSX_rr_32_16: |
703 | case BPF::MOV_32_64: |
704 | case BPF::MOV_rr: |
705 | case BPF::MOV_rr_32: { |
706 | // op: dst |
707 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
708 | op &= UINT64_C(15); |
709 | op <<= 48; |
710 | Value |= op; |
711 | // op: src |
712 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 1), Fixups, STI); |
713 | op &= UINT64_C(15); |
714 | op <<= 52; |
715 | Value |= op; |
716 | break; |
717 | } |
718 | case BPF::JEQ_rr: |
719 | case BPF::JEQ_rr_32: |
720 | case BPF::JNE_rr: |
721 | case BPF::JNE_rr_32: |
722 | case BPF::JSET_rr: |
723 | case BPF::JSET_rr_32: |
724 | case BPF::JSGE_rr: |
725 | case BPF::JSGE_rr_32: |
726 | case BPF::JSGT_rr: |
727 | case BPF::JSGT_rr_32: |
728 | case BPF::JSLE_rr: |
729 | case BPF::JSLE_rr_32: |
730 | case BPF::JSLT_rr: |
731 | case BPF::JSLT_rr_32: |
732 | case BPF::JUGE_rr: |
733 | case BPF::JUGE_rr_32: |
734 | case BPF::JUGT_rr: |
735 | case BPF::JUGT_rr_32: |
736 | case BPF::JULE_rr: |
737 | case BPF::JULE_rr_32: |
738 | case BPF::JULT_rr: |
739 | case BPF::JULT_rr_32: { |
740 | // op: dst |
741 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
742 | op &= UINT64_C(15); |
743 | op <<= 48; |
744 | Value |= op; |
745 | // op: src |
746 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 1), Fixups, STI); |
747 | op &= UINT64_C(15); |
748 | op <<= 52; |
749 | Value |= op; |
750 | // op: BrDst |
751 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 2), Fixups, STI); |
752 | op &= UINT64_C(65535); |
753 | op <<= 32; |
754 | Value |= op; |
755 | break; |
756 | } |
757 | case BPF::ADDR_SPACE_CAST: { |
758 | // op: dst |
759 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
760 | op &= UINT64_C(15); |
761 | op <<= 48; |
762 | Value |= op; |
763 | // op: src |
764 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 1), Fixups, STI); |
765 | op &= UINT64_C(15); |
766 | op <<= 52; |
767 | Value |= op; |
768 | // op: dst_as |
769 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 2), Fixups, STI); |
770 | op &= UINT64_C(65535); |
771 | op <<= 16; |
772 | Value |= op; |
773 | // op: src_as |
774 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 3), Fixups, STI); |
775 | op &= UINT64_C(65535); |
776 | Value |= op; |
777 | break; |
778 | } |
779 | case BPF::ADD_rr: |
780 | case BPF::ADD_rr_32: |
781 | case BPF::AND_rr: |
782 | case BPF::AND_rr_32: |
783 | case BPF::CORE_SHIFT: |
784 | case BPF::DIV_rr: |
785 | case BPF::DIV_rr_32: |
786 | case BPF::MOD_rr: |
787 | case BPF::MOD_rr_32: |
788 | case BPF::MUL_rr: |
789 | case BPF::MUL_rr_32: |
790 | case BPF::OR_rr: |
791 | case BPF::OR_rr_32: |
792 | case BPF::SDIV_rr: |
793 | case BPF::SDIV_rr_32: |
794 | case BPF::SLL_rr: |
795 | case BPF::SLL_rr_32: |
796 | case BPF::SMOD_rr: |
797 | case BPF::SMOD_rr_32: |
798 | case BPF::SRA_rr: |
799 | case BPF::SRA_rr_32: |
800 | case BPF::SRL_rr: |
801 | case BPF::SRL_rr_32: |
802 | case BPF::SUB_rr: |
803 | case BPF::SUB_rr_32: |
804 | case BPF::XOR_rr: |
805 | case BPF::XOR_rr_32: { |
806 | // op: dst |
807 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
808 | op &= UINT64_C(15); |
809 | op <<= 48; |
810 | Value |= op; |
811 | // op: src |
812 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 2), Fixups, STI); |
813 | op &= UINT64_C(15); |
814 | op <<= 52; |
815 | Value |= op; |
816 | break; |
817 | } |
818 | case BPF::XADDD: |
819 | case BPF::XADDW: |
820 | case BPF::XADDW32: |
821 | case BPF::XANDD: |
822 | case BPF::XANDW32: |
823 | case BPF::XCHGD: |
824 | case BPF::XCHGW32: |
825 | case BPF::XFADDD: |
826 | case BPF::XFADDW32: |
827 | case BPF::XFANDD: |
828 | case BPF::XFANDW32: |
829 | case BPF::XFORD: |
830 | case BPF::XFORW32: |
831 | case BPF::XFXORD: |
832 | case BPF::XFXORW32: |
833 | case BPF::XORD: |
834 | case BPF::XORW32: |
835 | case BPF::XXORD: |
836 | case BPF::XXORW32: { |
837 | // op: dst |
838 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
839 | op &= UINT64_C(15); |
840 | op <<= 52; |
841 | Value |= op; |
842 | // op: addr |
843 | op = getMemoryOpValue(MI, Op: 1, Fixups, STI); |
844 | op &= UINT64_C(1048575); |
845 | op <<= 32; |
846 | Value |= op; |
847 | break; |
848 | } |
849 | case BPF::LD_ABS_B: |
850 | case BPF::LD_ABS_H: |
851 | case BPF::LD_ABS_W: { |
852 | // op: imm |
853 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 1), Fixups, STI); |
854 | op &= UINT64_C(4294967295); |
855 | Value |= op; |
856 | break; |
857 | } |
858 | case BPF::CMPXCHGD: |
859 | case BPF::CMPXCHGW32: { |
860 | // op: new |
861 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 2), Fixups, STI); |
862 | op &= UINT64_C(15); |
863 | op <<= 52; |
864 | Value |= op; |
865 | // op: addr |
866 | op = getMemoryOpValue(MI, Op: 0, Fixups, STI); |
867 | op &= UINT64_C(1048575); |
868 | op <<= 32; |
869 | Value |= op; |
870 | break; |
871 | } |
872 | case BPF::STB: |
873 | case BPF::STB32: |
874 | case BPF::STD: |
875 | case BPF::STH: |
876 | case BPF::STH32: |
877 | case BPF::STW: |
878 | case BPF::STW32: { |
879 | // op: src |
880 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 0), Fixups, STI); |
881 | op &= UINT64_C(15); |
882 | op <<= 52; |
883 | Value |= op; |
884 | // op: addr |
885 | op = getMemoryOpValue(MI, Op: 1, Fixups, STI); |
886 | op &= UINT64_C(1048575); |
887 | op <<= 32; |
888 | Value |= op; |
889 | break; |
890 | } |
891 | case BPF::LD_IND_B: |
892 | case BPF::LD_IND_H: |
893 | case BPF::LD_IND_W: { |
894 | // op: val |
895 | op = getMachineOpValue(MI, MO: MI.getOperand(i: 1), Fixups, STI); |
896 | op &= UINT64_C(15); |
897 | op <<= 52; |
898 | Value |= op; |
899 | break; |
900 | } |
901 | default: |
902 | std::string msg; |
903 | raw_string_ostream Msg(msg); |
904 | Msg << "Not supported instr: " << MI; |
905 | report_fatal_error(reason: Msg.str().c_str()); |
906 | } |
907 | return Value; |
908 | } |
909 | |
910 | #ifdef GET_OPERAND_BIT_OFFSET |
911 | #undef GET_OPERAND_BIT_OFFSET |
912 | |
913 | uint32_t BPFMCCodeEmitter::getOperandBitOffset(const MCInst &MI, |
914 | unsigned OpNum, |
915 | const MCSubtargetInfo &STI) const { |
916 | switch (MI.getOpcode()) { |
917 | case BPF::CORE_LD32: |
918 | case BPF::CORE_LD64: |
919 | case BPF::CORE_ST: |
920 | case BPF::NOP: |
921 | case BPF::RET: { |
922 | break; |
923 | } |
924 | case BPF::JAL: |
925 | case BPF::JMPL: { |
926 | switch (OpNum) { |
927 | case 0: |
928 | // op: BrDst |
929 | return 0; |
930 | } |
931 | break; |
932 | } |
933 | case BPF::JCOND: |
934 | case BPF::JMP: { |
935 | switch (OpNum) { |
936 | case 0: |
937 | // op: BrDst |
938 | return 32; |
939 | } |
940 | break; |
941 | } |
942 | case BPF::JALX: { |
943 | switch (OpNum) { |
944 | case 0: |
945 | // op: BrDst |
946 | return 48; |
947 | } |
948 | break; |
949 | } |
950 | case BPF::LDB: |
951 | case BPF::LDB32: |
952 | case BPF::LDBSX: |
953 | case BPF::LDD: |
954 | case BPF::LDH: |
955 | case BPF::LDH32: |
956 | case BPF::LDHSX: |
957 | case BPF::LDW: |
958 | case BPF::LDW32: |
959 | case BPF::LDWSX: { |
960 | switch (OpNum) { |
961 | case 0: |
962 | // op: dst |
963 | return 48; |
964 | case 1: |
965 | // op: addr |
966 | return 32; |
967 | } |
968 | break; |
969 | } |
970 | case BPF::LD_imm64: |
971 | case BPF::MOV_ri: |
972 | case BPF::MOV_ri_32: { |
973 | switch (OpNum) { |
974 | case 0: |
975 | // op: dst |
976 | return 48; |
977 | case 1: |
978 | // op: imm |
979 | return 0; |
980 | } |
981 | break; |
982 | } |
983 | case BPF::JEQ_rr: |
984 | case BPF::JEQ_rr_32: |
985 | case BPF::JNE_rr: |
986 | case BPF::JNE_rr_32: |
987 | case BPF::JSET_rr: |
988 | case BPF::JSET_rr_32: |
989 | case BPF::JSGE_rr: |
990 | case BPF::JSGE_rr_32: |
991 | case BPF::JSGT_rr: |
992 | case BPF::JSGT_rr_32: |
993 | case BPF::JSLE_rr: |
994 | case BPF::JSLE_rr_32: |
995 | case BPF::JSLT_rr: |
996 | case BPF::JSLT_rr_32: |
997 | case BPF::JUGE_rr: |
998 | case BPF::JUGE_rr_32: |
999 | case BPF::JUGT_rr: |
1000 | case BPF::JUGT_rr_32: |
1001 | case BPF::JULE_rr: |
1002 | case BPF::JULE_rr_32: |
1003 | case BPF::JULT_rr: |
1004 | case BPF::JULT_rr_32: { |
1005 | switch (OpNum) { |
1006 | case 0: |
1007 | // op: dst |
1008 | return 48; |
1009 | case 1: |
1010 | // op: src |
1011 | return 52; |
1012 | case 2: |
1013 | // op: BrDst |
1014 | return 32; |
1015 | } |
1016 | break; |
1017 | } |
1018 | case BPF::ADDR_SPACE_CAST: { |
1019 | switch (OpNum) { |
1020 | case 0: |
1021 | // op: dst |
1022 | return 48; |
1023 | case 1: |
1024 | // op: src |
1025 | return 52; |
1026 | case 2: |
1027 | // op: dst_as |
1028 | return 16; |
1029 | case 3: |
1030 | // op: src_as |
1031 | return 0; |
1032 | } |
1033 | break; |
1034 | } |
1035 | case BPF::MOVSX_rr_8: |
1036 | case BPF::MOVSX_rr_16: |
1037 | case BPF::MOVSX_rr_32: |
1038 | case BPF::MOVSX_rr_32_8: |
1039 | case BPF::MOVSX_rr_32_16: |
1040 | case BPF::MOV_32_64: |
1041 | case BPF::MOV_rr: |
1042 | case BPF::MOV_rr_32: { |
1043 | switch (OpNum) { |
1044 | case 0: |
1045 | // op: dst |
1046 | return 48; |
1047 | case 1: |
1048 | // op: src |
1049 | return 52; |
1050 | } |
1051 | break; |
1052 | } |
1053 | case BPF::JEQ_ri: |
1054 | case BPF::JEQ_ri_32: |
1055 | case BPF::JNE_ri: |
1056 | case BPF::JNE_ri_32: |
1057 | case BPF::JSET_ri: |
1058 | case BPF::JSET_ri_32: |
1059 | case BPF::JSGE_ri: |
1060 | case BPF::JSGE_ri_32: |
1061 | case BPF::JSGT_ri: |
1062 | case BPF::JSGT_ri_32: |
1063 | case BPF::JSLE_ri: |
1064 | case BPF::JSLE_ri_32: |
1065 | case BPF::JSLT_ri: |
1066 | case BPF::JSLT_ri_32: |
1067 | case BPF::JUGE_ri: |
1068 | case BPF::JUGE_ri_32: |
1069 | case BPF::JUGT_ri: |
1070 | case BPF::JUGT_ri_32: |
1071 | case BPF::JULE_ri: |
1072 | case BPF::JULE_ri_32: |
1073 | case BPF::JULT_ri: |
1074 | case BPF::JULT_ri_32: { |
1075 | switch (OpNum) { |
1076 | case 0: |
1077 | // op: dst |
1078 | return 48; |
1079 | case 2: |
1080 | // op: BrDst |
1081 | return 32; |
1082 | case 1: |
1083 | // op: imm |
1084 | return 0; |
1085 | } |
1086 | break; |
1087 | } |
1088 | case BPF::LD_pseudo: { |
1089 | switch (OpNum) { |
1090 | case 0: |
1091 | // op: dst |
1092 | return 48; |
1093 | case 2: |
1094 | // op: imm |
1095 | return 0; |
1096 | case 1: |
1097 | // op: pseudo |
1098 | return 52; |
1099 | } |
1100 | break; |
1101 | } |
1102 | case BPF::ADD_ri: |
1103 | case BPF::ADD_ri_32: |
1104 | case BPF::AND_ri: |
1105 | case BPF::AND_ri_32: |
1106 | case BPF::DIV_ri: |
1107 | case BPF::DIV_ri_32: |
1108 | case BPF::MOD_ri: |
1109 | case BPF::MOD_ri_32: |
1110 | case BPF::MUL_ri: |
1111 | case BPF::MUL_ri_32: |
1112 | case BPF::OR_ri: |
1113 | case BPF::OR_ri_32: |
1114 | case BPF::SDIV_ri: |
1115 | case BPF::SDIV_ri_32: |
1116 | case BPF::SLL_ri: |
1117 | case BPF::SLL_ri_32: |
1118 | case BPF::SMOD_ri: |
1119 | case BPF::SMOD_ri_32: |
1120 | case BPF::SRA_ri: |
1121 | case BPF::SRA_ri_32: |
1122 | case BPF::SRL_ri: |
1123 | case BPF::SRL_ri_32: |
1124 | case BPF::SUB_ri: |
1125 | case BPF::SUB_ri_32: |
1126 | case BPF::XOR_ri: |
1127 | case BPF::XOR_ri_32: { |
1128 | switch (OpNum) { |
1129 | case 0: |
1130 | // op: dst |
1131 | return 48; |
1132 | case 2: |
1133 | // op: imm |
1134 | return 0; |
1135 | } |
1136 | break; |
1137 | } |
1138 | case BPF::ADD_rr: |
1139 | case BPF::ADD_rr_32: |
1140 | case BPF::AND_rr: |
1141 | case BPF::AND_rr_32: |
1142 | case BPF::CORE_SHIFT: |
1143 | case BPF::DIV_rr: |
1144 | case BPF::DIV_rr_32: |
1145 | case BPF::MOD_rr: |
1146 | case BPF::MOD_rr_32: |
1147 | case BPF::MUL_rr: |
1148 | case BPF::MUL_rr_32: |
1149 | case BPF::OR_rr: |
1150 | case BPF::OR_rr_32: |
1151 | case BPF::SDIV_rr: |
1152 | case BPF::SDIV_rr_32: |
1153 | case BPF::SLL_rr: |
1154 | case BPF::SLL_rr_32: |
1155 | case BPF::SMOD_rr: |
1156 | case BPF::SMOD_rr_32: |
1157 | case BPF::SRA_rr: |
1158 | case BPF::SRA_rr_32: |
1159 | case BPF::SRL_rr: |
1160 | case BPF::SRL_rr_32: |
1161 | case BPF::SUB_rr: |
1162 | case BPF::SUB_rr_32: |
1163 | case BPF::XOR_rr: |
1164 | case BPF::XOR_rr_32: { |
1165 | switch (OpNum) { |
1166 | case 0: |
1167 | // op: dst |
1168 | return 48; |
1169 | case 2: |
1170 | // op: src |
1171 | return 52; |
1172 | } |
1173 | break; |
1174 | } |
1175 | case BPF::BE16: |
1176 | case BPF::BE32: |
1177 | case BPF::BE64: |
1178 | case BPF::BSWAP16: |
1179 | case BPF::BSWAP32: |
1180 | case BPF::BSWAP64: |
1181 | case BPF::LE16: |
1182 | case BPF::LE32: |
1183 | case BPF::LE64: |
1184 | case BPF::NEG_32: |
1185 | case BPF::NEG_64: { |
1186 | switch (OpNum) { |
1187 | case 0: |
1188 | // op: dst |
1189 | return 48; |
1190 | } |
1191 | break; |
1192 | } |
1193 | case BPF::XADDD: |
1194 | case BPF::XADDW: |
1195 | case BPF::XADDW32: |
1196 | case BPF::XANDD: |
1197 | case BPF::XANDW32: |
1198 | case BPF::XCHGD: |
1199 | case BPF::XCHGW32: |
1200 | case BPF::XFADDD: |
1201 | case BPF::XFADDW32: |
1202 | case BPF::XFANDD: |
1203 | case BPF::XFANDW32: |
1204 | case BPF::XFORD: |
1205 | case BPF::XFORW32: |
1206 | case BPF::XFXORD: |
1207 | case BPF::XFXORW32: |
1208 | case BPF::XORD: |
1209 | case BPF::XORW32: |
1210 | case BPF::XXORD: |
1211 | case BPF::XXORW32: { |
1212 | switch (OpNum) { |
1213 | case 0: |
1214 | // op: dst |
1215 | return 52; |
1216 | case 1: |
1217 | // op: addr |
1218 | return 32; |
1219 | } |
1220 | break; |
1221 | } |
1222 | case BPF::STB: |
1223 | case BPF::STB32: |
1224 | case BPF::STD: |
1225 | case BPF::STH: |
1226 | case BPF::STH32: |
1227 | case BPF::STW: |
1228 | case BPF::STW32: { |
1229 | switch (OpNum) { |
1230 | case 0: |
1231 | // op: src |
1232 | return 52; |
1233 | case 1: |
1234 | // op: addr |
1235 | return 32; |
1236 | } |
1237 | break; |
1238 | } |
1239 | case BPF::STB_imm: |
1240 | case BPF::STD_imm: |
1241 | case BPF::STH_imm: |
1242 | case BPF::STW_imm: { |
1243 | switch (OpNum) { |
1244 | case 1: |
1245 | // op: addr |
1246 | return 32; |
1247 | case 0: |
1248 | // op: imm |
1249 | return 0; |
1250 | } |
1251 | break; |
1252 | } |
1253 | case BPF::LD_ABS_B: |
1254 | case BPF::LD_ABS_H: |
1255 | case BPF::LD_ABS_W: { |
1256 | switch (OpNum) { |
1257 | case 1: |
1258 | // op: imm |
1259 | return 0; |
1260 | } |
1261 | break; |
1262 | } |
1263 | case BPF::LD_IND_B: |
1264 | case BPF::LD_IND_H: |
1265 | case BPF::LD_IND_W: { |
1266 | switch (OpNum) { |
1267 | case 1: |
1268 | // op: val |
1269 | return 52; |
1270 | } |
1271 | break; |
1272 | } |
1273 | case BPF::CMPXCHGD: |
1274 | case BPF::CMPXCHGW32: { |
1275 | switch (OpNum) { |
1276 | case 2: |
1277 | // op: new |
1278 | return 52; |
1279 | case 0: |
1280 | // op: addr |
1281 | return 32; |
1282 | } |
1283 | break; |
1284 | } |
1285 | } |
1286 | std::string msg; |
1287 | raw_string_ostream Msg(msg); |
1288 | Msg << "Not supported instr[opcode]: " << MI << "[" << OpNum << "]" ; |
1289 | report_fatal_error(Msg.str().c_str()); |
1290 | } |
1291 | |
1292 | #endif // GET_OPERAND_BIT_OFFSET |
1293 | |
1294 | |