LCOV - code coverage report
Current view: top level - build-llvm/lib/Target/BPF - BPFGenDisassemblerTables.inc (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 0 115 0.0 %
Date: 2018-10-20 13:21:21 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
       2             : |*                                                                            *|
       3             : |*  * BPF 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           0 :     return (insn & fieldMask) >> startBit;
      33             : }
      34             : 
      35             : static const uint8_t DecoderTableBPF64[] = {
      36             : /* 0 */       MCD::OPC_ExtractField, 56, 8,  // Inst{63-56} ...
      37             : /* 3 */       MCD::OPC_FilterValue, 4, 4, 0, 0, // Skip to: 12
      38             : /* 8 */       MCD::OPC_Decode, 149, 1, 0, // Opcode: ADD_ri_32
      39             : /* 12 */      MCD::OPC_FilterValue, 5, 4, 0, 0, // Skip to: 21
      40             : /* 17 */      MCD::OPC_Decode, 168, 1, 1, // Opcode: JMP
      41             : /* 21 */      MCD::OPC_FilterValue, 7, 4, 0, 0, // Skip to: 30
      42             : /* 26 */      MCD::OPC_Decode, 148, 1, 2, // Opcode: ADD_ri
      43             : /* 30 */      MCD::OPC_FilterValue, 12, 4, 0, 0, // Skip to: 39
      44             : /* 35 */      MCD::OPC_Decode, 151, 1, 3, // Opcode: ADD_rr_32
      45             : /* 39 */      MCD::OPC_FilterValue, 15, 4, 0, 0, // Skip to: 48
      46             : /* 44 */      MCD::OPC_Decode, 150, 1, 4, // Opcode: ADD_rr
      47             : /* 48 */      MCD::OPC_FilterValue, 20, 4, 0, 0, // Skip to: 57
      48             : /* 53 */      MCD::OPC_Decode, 242, 1, 0, // Opcode: SUB_ri_32
      49             : /* 57 */      MCD::OPC_FilterValue, 21, 4, 0, 0, // Skip to: 66
      50             : /* 62 */      MCD::OPC_Decode, 166, 1, 5, // Opcode: JEQ_ri
      51             : /* 66 */      MCD::OPC_FilterValue, 23, 4, 0, 0, // Skip to: 75
      52             : /* 71 */      MCD::OPC_Decode, 241, 1, 2, // Opcode: SUB_ri
      53             : /* 75 */      MCD::OPC_FilterValue, 24, 41, 0, 0, // Skip to: 121
      54             : /* 80 */      MCD::OPC_ExtractField, 32, 16,  // Inst{47-32} ...
      55             : /* 83 */      MCD::OPC_FilterValue, 0, 84, 3, 0, // Skip to: 940
      56             : /* 88 */      MCD::OPC_CheckField, 48, 8, 32, 11, 0, 0, // Skip to: 106
      57             : /* 95 */      MCD::OPC_CheckField, 0, 32, 0, 4, 0, 0, // Skip to: 106
      58             : /* 102 */     MCD::OPC_Decode, 163, 1, 6, // Opcode: FI_ri
      59             : /* 106 */     MCD::OPC_CheckField, 52, 4, 0, 4, 0, 0, // Skip to: 117
      60             : /* 113 */     MCD::OPC_Decode, 200, 1, 7, // Opcode: LD_imm64
      61             : /* 117 */     MCD::OPC_Decode, 201, 1, 8, // Opcode: LD_pseudo
      62             : /* 121 */     MCD::OPC_FilterValue, 28, 4, 0, 0, // Skip to: 130
      63             : /* 126 */     MCD::OPC_Decode, 244, 1, 3, // Opcode: SUB_rr_32
      64             : /* 130 */     MCD::OPC_FilterValue, 29, 4, 0, 0, // Skip to: 139
      65             : /* 135 */     MCD::OPC_Decode, 167, 1, 9, // Opcode: JEQ_rr
      66             : /* 139 */     MCD::OPC_FilterValue, 31, 4, 0, 0, // Skip to: 148
      67             : /* 144 */     MCD::OPC_Decode, 243, 1, 4, // Opcode: SUB_rr
      68             : /* 148 */     MCD::OPC_FilterValue, 32, 4, 0, 0, // Skip to: 157
      69             : /* 153 */     MCD::OPC_Decode, 196, 1, 10, // Opcode: LD_ABS_W
      70             : /* 157 */     MCD::OPC_FilterValue, 36, 4, 0, 0, // Skip to: 166
      71             : /* 162 */     MCD::OPC_Decode, 211, 1, 0, // Opcode: MUL_ri_32
      72             : /* 166 */     MCD::OPC_FilterValue, 37, 4, 0, 0, // Skip to: 175
      73             : /* 171 */     MCD::OPC_Decode, 181, 1, 5, // Opcode: JUGT_ri
      74             : /* 175 */     MCD::OPC_FilterValue, 39, 4, 0, 0, // Skip to: 184
      75             : /* 180 */     MCD::OPC_Decode, 210, 1, 2, // Opcode: MUL_ri
      76             : /* 184 */     MCD::OPC_FilterValue, 40, 4, 0, 0, // Skip to: 193
      77             : /* 189 */     MCD::OPC_Decode, 195, 1, 10, // Opcode: LD_ABS_H
      78             : /* 193 */     MCD::OPC_FilterValue, 44, 4, 0, 0, // Skip to: 202
      79             : /* 198 */     MCD::OPC_Decode, 213, 1, 3, // Opcode: MUL_rr_32
      80             : /* 202 */     MCD::OPC_FilterValue, 45, 4, 0, 0, // Skip to: 211
      81             : /* 207 */     MCD::OPC_Decode, 182, 1, 9, // Opcode: JUGT_rr
      82             : /* 211 */     MCD::OPC_FilterValue, 47, 4, 0, 0, // Skip to: 220
      83             : /* 216 */     MCD::OPC_Decode, 212, 1, 4, // Opcode: MUL_rr
      84             : /* 220 */     MCD::OPC_FilterValue, 48, 4, 0, 0, // Skip to: 229
      85             : /* 225 */     MCD::OPC_Decode, 194, 1, 10, // Opcode: LD_ABS_B
      86             : /* 229 */     MCD::OPC_FilterValue, 52, 4, 0, 0, // Skip to: 238
      87             : /* 234 */     MCD::OPC_Decode, 160, 1, 0, // Opcode: DIV_ri_32
      88             : /* 238 */     MCD::OPC_FilterValue, 53, 4, 0, 0, // Skip to: 247
      89             : /* 243 */     MCD::OPC_Decode, 179, 1, 5, // Opcode: JUGE_ri
      90             : /* 247 */     MCD::OPC_FilterValue, 55, 4, 0, 0, // Skip to: 256
      91             : /* 252 */     MCD::OPC_Decode, 159, 1, 2, // Opcode: DIV_ri
      92             : /* 256 */     MCD::OPC_FilterValue, 60, 4, 0, 0, // Skip to: 265
      93             : /* 261 */     MCD::OPC_Decode, 162, 1, 3, // Opcode: DIV_rr_32
      94             : /* 265 */     MCD::OPC_FilterValue, 61, 4, 0, 0, // Skip to: 274
      95             : /* 270 */     MCD::OPC_Decode, 180, 1, 9, // Opcode: JUGE_rr
      96             : /* 274 */     MCD::OPC_FilterValue, 63, 4, 0, 0, // Skip to: 283
      97             : /* 279 */     MCD::OPC_Decode, 161, 1, 4, // Opcode: DIV_rr
      98             : /* 283 */     MCD::OPC_FilterValue, 64, 4, 0, 0, // Skip to: 292
      99             : /* 288 */     MCD::OPC_Decode, 199, 1, 11, // Opcode: LD_IND_W
     100             : /* 292 */     MCD::OPC_FilterValue, 68, 4, 0, 0, // Skip to: 301
     101             : /* 297 */     MCD::OPC_Decode, 218, 1, 0, // Opcode: OR_ri_32
     102             : /* 301 */     MCD::OPC_FilterValue, 71, 4, 0, 0, // Skip to: 310
     103             : /* 306 */     MCD::OPC_Decode, 217, 1, 2, // Opcode: OR_ri
     104             : /* 310 */     MCD::OPC_FilterValue, 72, 4, 0, 0, // Skip to: 319
     105             : /* 315 */     MCD::OPC_Decode, 198, 1, 11, // Opcode: LD_IND_H
     106             : /* 319 */     MCD::OPC_FilterValue, 76, 4, 0, 0, // Skip to: 328
     107             : /* 324 */     MCD::OPC_Decode, 220, 1, 3, // Opcode: OR_rr_32
     108             : /* 328 */     MCD::OPC_FilterValue, 79, 4, 0, 0, // Skip to: 337
     109             : /* 333 */     MCD::OPC_Decode, 219, 1, 4, // Opcode: OR_rr
     110             : /* 337 */     MCD::OPC_FilterValue, 80, 4, 0, 0, // Skip to: 346
     111             : /* 342 */     MCD::OPC_Decode, 197, 1, 11, // Opcode: LD_IND_B
     112             : /* 346 */     MCD::OPC_FilterValue, 84, 4, 0, 0, // Skip to: 355
     113             : /* 351 */     MCD::OPC_Decode, 153, 1, 0, // Opcode: AND_ri_32
     114             : /* 355 */     MCD::OPC_FilterValue, 85, 4, 0, 0, // Skip to: 364
     115             : /* 360 */     MCD::OPC_Decode, 169, 1, 5, // Opcode: JNE_ri
     116             : /* 364 */     MCD::OPC_FilterValue, 87, 4, 0, 0, // Skip to: 373
     117             : /* 369 */     MCD::OPC_Decode, 152, 1, 2, // Opcode: AND_ri
     118             : /* 373 */     MCD::OPC_FilterValue, 92, 4, 0, 0, // Skip to: 382
     119             : /* 378 */     MCD::OPC_Decode, 155, 1, 3, // Opcode: AND_rr_32
     120             : /* 382 */     MCD::OPC_FilterValue, 93, 4, 0, 0, // Skip to: 391
     121             : /* 387 */     MCD::OPC_Decode, 170, 1, 9, // Opcode: JNE_rr
     122             : /* 391 */     MCD::OPC_FilterValue, 95, 4, 0, 0, // Skip to: 400
     123             : /* 396 */     MCD::OPC_Decode, 154, 1, 4, // Opcode: AND_rr
     124             : /* 400 */     MCD::OPC_FilterValue, 97, 4, 0, 0, // Skip to: 409
     125             : /* 405 */     MCD::OPC_Decode, 192, 1, 12, // Opcode: LDW
     126             : /* 409 */     MCD::OPC_FilterValue, 99, 4, 0, 0, // Skip to: 418
     127             : /* 414 */     MCD::OPC_Decode, 239, 1, 13, // Opcode: STW
     128             : /* 418 */     MCD::OPC_FilterValue, 100, 4, 0, 0, // Skip to: 427
     129             : /* 423 */     MCD::OPC_Decode, 223, 1, 0, // Opcode: SLL_ri_32
     130             : /* 427 */     MCD::OPC_FilterValue, 101, 4, 0, 0, // Skip to: 436
     131             : /* 432 */     MCD::OPC_Decode, 173, 1, 5, // Opcode: JSGT_ri
     132             : /* 436 */     MCD::OPC_FilterValue, 103, 4, 0, 0, // Skip to: 445
     133             : /* 441 */     MCD::OPC_Decode, 222, 1, 2, // Opcode: SLL_ri
     134             : /* 445 */     MCD::OPC_FilterValue, 105, 4, 0, 0, // Skip to: 454
     135             : /* 450 */     MCD::OPC_Decode, 190, 1, 12, // Opcode: LDH
     136             : /* 454 */     MCD::OPC_FilterValue, 107, 4, 0, 0, // Skip to: 463
     137             : /* 459 */     MCD::OPC_Decode, 237, 1, 13, // Opcode: STH
     138             : /* 463 */     MCD::OPC_FilterValue, 108, 4, 0, 0, // Skip to: 472
     139             : /* 468 */     MCD::OPC_Decode, 225, 1, 3, // Opcode: SLL_rr_32
     140             : /* 472 */     MCD::OPC_FilterValue, 109, 4, 0, 0, // Skip to: 481
     141             : /* 477 */     MCD::OPC_Decode, 174, 1, 9, // Opcode: JSGT_rr
     142             : /* 481 */     MCD::OPC_FilterValue, 111, 4, 0, 0, // Skip to: 490
     143             : /* 486 */     MCD::OPC_Decode, 224, 1, 4, // Opcode: SLL_rr
     144             : /* 490 */     MCD::OPC_FilterValue, 113, 4, 0, 0, // Skip to: 499
     145             : /* 495 */     MCD::OPC_Decode, 187, 1, 12, // Opcode: LDB
     146             : /* 499 */     MCD::OPC_FilterValue, 115, 4, 0, 0, // Skip to: 508
     147             : /* 504 */     MCD::OPC_Decode, 234, 1, 13, // Opcode: STB
     148             : /* 508 */     MCD::OPC_FilterValue, 116, 4, 0, 0, // Skip to: 517
     149             : /* 513 */     MCD::OPC_Decode, 231, 1, 0, // Opcode: SRL_ri_32
     150             : /* 517 */     MCD::OPC_FilterValue, 117, 4, 0, 0, // Skip to: 526
     151             : /* 522 */     MCD::OPC_Decode, 171, 1, 5, // Opcode: JSGE_ri
     152             : /* 526 */     MCD::OPC_FilterValue, 119, 4, 0, 0, // Skip to: 535
     153             : /* 531 */     MCD::OPC_Decode, 230, 1, 2, // Opcode: SRL_ri
     154             : /* 535 */     MCD::OPC_FilterValue, 121, 4, 0, 0, // Skip to: 544
     155             : /* 540 */     MCD::OPC_Decode, 189, 1, 12, // Opcode: LDD
     156             : /* 544 */     MCD::OPC_FilterValue, 123, 4, 0, 0, // Skip to: 553
     157             : /* 549 */     MCD::OPC_Decode, 236, 1, 13, // Opcode: STD
     158             : /* 553 */     MCD::OPC_FilterValue, 124, 4, 0, 0, // Skip to: 562
     159             : /* 558 */     MCD::OPC_Decode, 233, 1, 3, // Opcode: SRL_rr_32
     160             : /* 562 */     MCD::OPC_FilterValue, 125, 4, 0, 0, // Skip to: 571
     161             : /* 567 */     MCD::OPC_Decode, 172, 1, 9, // Opcode: JSGE_rr
     162             : /* 571 */     MCD::OPC_FilterValue, 127, 4, 0, 0, // Skip to: 580
     163             : /* 576 */     MCD::OPC_Decode, 232, 1, 4, // Opcode: SRL_rr
     164             : /* 580 */     MCD::OPC_FilterValue, 132, 1, 4, 0, 0, // Skip to: 590
     165             : /* 586 */     MCD::OPC_Decode, 214, 1, 14, // Opcode: NEG_32
     166             : /* 590 */     MCD::OPC_FilterValue, 133, 1, 4, 0, 0, // Skip to: 600
     167             : /* 596 */     MCD::OPC_Decode, 164, 1, 10, // Opcode: JAL
     168             : /* 600 */     MCD::OPC_FilterValue, 135, 1, 4, 0, 0, // Skip to: 610
     169             : /* 606 */     MCD::OPC_Decode, 215, 1, 15, // Opcode: NEG_64
     170             : /* 610 */     MCD::OPC_FilterValue, 141, 1, 4, 0, 0, // Skip to: 620
     171             : /* 616 */     MCD::OPC_Decode, 165, 1, 10, // Opcode: JALX
     172             : /* 620 */     MCD::OPC_FilterValue, 149, 1, 11, 0, 0, // Skip to: 637
     173             : /* 626 */     MCD::OPC_CheckField, 0, 32, 0, 51, 1, 0, // Skip to: 940
     174             : /* 633 */     MCD::OPC_Decode, 221, 1, 6, // Opcode: RET
     175             : /* 637 */     MCD::OPC_FilterValue, 164, 1, 4, 0, 0, // Skip to: 647
     176             : /* 643 */     MCD::OPC_Decode, 248, 1, 0, // Opcode: XOR_ri_32
     177             : /* 647 */     MCD::OPC_FilterValue, 165, 1, 4, 0, 0, // Skip to: 657
     178             : /* 653 */     MCD::OPC_Decode, 185, 1, 5, // Opcode: JULT_ri
     179             : /* 657 */     MCD::OPC_FilterValue, 167, 1, 4, 0, 0, // Skip to: 667
     180             : /* 663 */     MCD::OPC_Decode, 247, 1, 2, // Opcode: XOR_ri
     181             : /* 667 */     MCD::OPC_FilterValue, 172, 1, 4, 0, 0, // Skip to: 677
     182             : /* 673 */     MCD::OPC_Decode, 250, 1, 3, // Opcode: XOR_rr_32
     183             : /* 677 */     MCD::OPC_FilterValue, 173, 1, 4, 0, 0, // Skip to: 687
     184             : /* 683 */     MCD::OPC_Decode, 186, 1, 9, // Opcode: JULT_rr
     185             : /* 687 */     MCD::OPC_FilterValue, 175, 1, 4, 0, 0, // Skip to: 697
     186             : /* 693 */     MCD::OPC_Decode, 249, 1, 4, // Opcode: XOR_rr
     187             : /* 697 */     MCD::OPC_FilterValue, 180, 1, 4, 0, 0, // Skip to: 707
     188             : /* 703 */     MCD::OPC_Decode, 207, 1, 16, // Opcode: MOV_ri_32
     189             : /* 707 */     MCD::OPC_FilterValue, 181, 1, 4, 0, 0, // Skip to: 717
     190             : /* 713 */     MCD::OPC_Decode, 183, 1, 5, // Opcode: JULE_ri
     191             : /* 717 */     MCD::OPC_FilterValue, 183, 1, 4, 0, 0, // Skip to: 727
     192             : /* 723 */     MCD::OPC_Decode, 206, 1, 7, // Opcode: MOV_ri
     193             : /* 727 */     MCD::OPC_FilterValue, 188, 1, 4, 0, 0, // Skip to: 737
     194             : /* 733 */     MCD::OPC_Decode, 209, 1, 17, // Opcode: MOV_rr_32
     195             : /* 737 */     MCD::OPC_FilterValue, 189, 1, 4, 0, 0, // Skip to: 747
     196             : /* 743 */     MCD::OPC_Decode, 184, 1, 9, // Opcode: JULE_rr
     197             : /* 747 */     MCD::OPC_FilterValue, 191, 1, 15, 0, 0, // Skip to: 768
     198             : /* 753 */     MCD::OPC_CheckField, 48, 8, 0, 4, 0, 0, // Skip to: 764
     199             : /* 760 */     MCD::OPC_Decode, 216, 1, 6, // Opcode: NOP
     200             : /* 764 */     MCD::OPC_Decode, 208, 1, 18, // Opcode: MOV_rr
     201             : /* 768 */     MCD::OPC_FilterValue, 195, 1, 4, 0, 0, // Skip to: 778
     202             : /* 774 */     MCD::OPC_Decode, 245, 1, 19, // Opcode: XADD32
     203             : /* 778 */     MCD::OPC_FilterValue, 196, 1, 4, 0, 0, // Skip to: 788
     204             : /* 784 */     MCD::OPC_Decode, 227, 1, 0, // Opcode: SRA_ri_32
     205             : /* 788 */     MCD::OPC_FilterValue, 197, 1, 4, 0, 0, // Skip to: 798
     206             : /* 794 */     MCD::OPC_Decode, 177, 1, 5, // Opcode: JSLT_ri
     207             : /* 798 */     MCD::OPC_FilterValue, 199, 1, 4, 0, 0, // Skip to: 808
     208             : /* 804 */     MCD::OPC_Decode, 226, 1, 2, // Opcode: SRA_ri
     209             : /* 808 */     MCD::OPC_FilterValue, 204, 1, 4, 0, 0, // Skip to: 818
     210             : /* 814 */     MCD::OPC_Decode, 229, 1, 3, // Opcode: SRA_rr_32
     211             : /* 818 */     MCD::OPC_FilterValue, 205, 1, 4, 0, 0, // Skip to: 828
     212             : /* 824 */     MCD::OPC_Decode, 178, 1, 9, // Opcode: JSLT_rr
     213             : /* 828 */     MCD::OPC_FilterValue, 207, 1, 4, 0, 0, // Skip to: 838
     214             : /* 834 */     MCD::OPC_Decode, 228, 1, 4, // Opcode: SRA_rr
     215             : /* 838 */     MCD::OPC_FilterValue, 212, 1, 30, 0, 0, // Skip to: 874
     216             : /* 844 */     MCD::OPC_ExtractField, 0, 32,  // Inst{31-0} ...
     217             : /* 847 */     MCD::OPC_FilterValue, 16, 4, 0, 0, // Skip to: 856
     218             : /* 852 */     MCD::OPC_Decode, 202, 1, 15, // Opcode: LE16
     219             : /* 856 */     MCD::OPC_FilterValue, 32, 4, 0, 0, // Skip to: 865
     220             : /* 861 */     MCD::OPC_Decode, 203, 1, 15, // Opcode: LE32
     221             : /* 865 */     MCD::OPC_FilterValue, 64, 70, 0, 0, // Skip to: 940
     222             : /* 870 */     MCD::OPC_Decode, 204, 1, 15, // Opcode: LE64
     223             : /* 874 */     MCD::OPC_FilterValue, 213, 1, 4, 0, 0, // Skip to: 884
     224             : /* 880 */     MCD::OPC_Decode, 175, 1, 5, // Opcode: JSLE_ri
     225             : /* 884 */     MCD::OPC_FilterValue, 219, 1, 4, 0, 0, // Skip to: 894
     226             : /* 890 */     MCD::OPC_Decode, 246, 1, 19, // Opcode: XADD64
     227             : /* 894 */     MCD::OPC_FilterValue, 220, 1, 30, 0, 0, // Skip to: 930
     228             : /* 900 */     MCD::OPC_ExtractField, 0, 32,  // Inst{31-0} ...
     229             : /* 903 */     MCD::OPC_FilterValue, 16, 4, 0, 0, // Skip to: 912
     230             : /* 908 */     MCD::OPC_Decode, 156, 1, 15, // Opcode: BE16
     231             : /* 912 */     MCD::OPC_FilterValue, 32, 4, 0, 0, // Skip to: 921
     232             : /* 917 */     MCD::OPC_Decode, 157, 1, 15, // Opcode: BE32
     233             : /* 921 */     MCD::OPC_FilterValue, 64, 14, 0, 0, // Skip to: 940
     234             : /* 926 */     MCD::OPC_Decode, 158, 1, 15, // Opcode: BE64
     235             : /* 930 */     MCD::OPC_FilterValue, 221, 1, 4, 0, 0, // Skip to: 940
     236             : /* 936 */     MCD::OPC_Decode, 176, 1, 9, // Opcode: JSLE_rr
     237             : /* 940 */     MCD::OPC_Fail,
     238             :   0
     239             : };
     240             : 
     241             : static const uint8_t DecoderTableBPFALU3264[] = {
     242             : /* 0 */       MCD::OPC_ExtractField, 56, 8,  // Inst{63-56} ...
     243             : /* 3 */       MCD::OPC_FilterValue, 97, 4, 0, 0, // Skip to: 12
     244             : /* 8 */       MCD::OPC_Decode, 193, 1, 20, // Opcode: LDW32
     245             : /* 12 */      MCD::OPC_FilterValue, 99, 4, 0, 0, // Skip to: 21
     246             : /* 17 */      MCD::OPC_Decode, 240, 1, 21, // Opcode: STW32
     247             : /* 21 */      MCD::OPC_FilterValue, 105, 4, 0, 0, // Skip to: 30
     248             : /* 26 */      MCD::OPC_Decode, 191, 1, 20, // Opcode: LDH32
     249             : /* 30 */      MCD::OPC_FilterValue, 107, 4, 0, 0, // Skip to: 39
     250             : /* 35 */      MCD::OPC_Decode, 238, 1, 21, // Opcode: STH32
     251             : /* 39 */      MCD::OPC_FilterValue, 113, 4, 0, 0, // Skip to: 48
     252             : /* 44 */      MCD::OPC_Decode, 188, 1, 20, // Opcode: LDB32
     253             : /* 48 */      MCD::OPC_FilterValue, 115, 4, 0, 0, // Skip to: 57
     254             : /* 53 */      MCD::OPC_Decode, 235, 1, 21, // Opcode: STB32
     255             : /* 57 */      MCD::OPC_Fail,
     256             :   0
     257             : };
     258             : 
     259           0 : static bool checkDecoderPredicate(unsigned Idx, const FeatureBitset& Bits) {
     260           0 :   llvm_unreachable("Invalid index!");
     261             : }
     262             : 
     263             : template<typename InsnType>
     264           0 : static DecodeStatus decodeToMCInst(DecodeStatus S, unsigned Idx, InsnType insn, MCInst &MI,
     265             :                                    uint64_t Address, const void *Decoder, bool &DecodeComplete) {
     266           0 :   DecodeComplete = true;
     267             :   InsnType tmp;
     268           0 :   switch (Idx) {
     269           0 :   default: llvm_unreachable("Invalid index!");
     270             :   case 0:
     271             :     tmp = fieldFromInstruction(insn, 48, 4);
     272           0 :     if (DecodeGPR32RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     273             :     tmp = fieldFromInstruction(insn, 48, 4);
     274             :     if (DecodeGPR32RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     275             :     tmp = fieldFromInstruction(insn, 0, 32);
     276           0 :     MI.addOperand(MCOperand::createImm(tmp));
     277           0 :     return S;
     278             :   case 1:
     279             :     tmp = fieldFromInstruction(insn, 32, 16);
     280           0 :     MI.addOperand(MCOperand::createImm(tmp));
     281           0 :     return S;
     282             :   case 2:
     283             :     tmp = fieldFromInstruction(insn, 48, 4);
     284           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     285             :     tmp = fieldFromInstruction(insn, 48, 4);
     286             :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     287             :     tmp = fieldFromInstruction(insn, 0, 32);
     288           0 :     MI.addOperand(MCOperand::createImm(tmp));
     289           0 :     return S;
     290             :   case 3:
     291             :     tmp = fieldFromInstruction(insn, 48, 4);
     292           0 :     if (DecodeGPR32RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     293             :     tmp = fieldFromInstruction(insn, 48, 4);
     294             :     if (DecodeGPR32RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     295             :     tmp = fieldFromInstruction(insn, 52, 4);
     296           0 :     if (DecodeGPR32RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     297             :     return S;
     298             :   case 4:
     299             :     tmp = fieldFromInstruction(insn, 48, 4);
     300           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     301             :     tmp = fieldFromInstruction(insn, 48, 4);
     302             :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     303             :     tmp = fieldFromInstruction(insn, 52, 4);
     304           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     305             :     return S;
     306             :   case 5:
     307             :     tmp = fieldFromInstruction(insn, 48, 4);
     308           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     309             :     tmp = fieldFromInstruction(insn, 0, 32);
     310           0 :     MI.addOperand(MCOperand::createImm(tmp));
     311             :     tmp = fieldFromInstruction(insn, 32, 16);
     312           0 :     MI.addOperand(MCOperand::createImm(tmp));
     313           0 :     return S;
     314             :   case 6:
     315             :     return S;
     316             :   case 7:
     317             :     tmp = fieldFromInstruction(insn, 48, 4);
     318           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     319             :     tmp = fieldFromInstruction(insn, 0, 32);
     320           0 :     MI.addOperand(MCOperand::createImm(tmp));
     321           0 :     return S;
     322             :   case 8:
     323             :     tmp = fieldFromInstruction(insn, 48, 4);
     324           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     325             :     tmp = fieldFromInstruction(insn, 52, 4);
     326           0 :     MI.addOperand(MCOperand::createImm(tmp));
     327             :     tmp = fieldFromInstruction(insn, 0, 32);
     328           0 :     MI.addOperand(MCOperand::createImm(tmp));
     329           0 :     return S;
     330             :   case 9:
     331             :     tmp = fieldFromInstruction(insn, 48, 4);
     332           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     333             :     tmp = fieldFromInstruction(insn, 52, 4);
     334           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     335             :     tmp = fieldFromInstruction(insn, 32, 16);
     336           0 :     MI.addOperand(MCOperand::createImm(tmp));
     337           0 :     return S;
     338             :   case 10:
     339             :     tmp = fieldFromInstruction(insn, 0, 32);
     340           0 :     MI.addOperand(MCOperand::createImm(tmp));
     341           0 :     return S;
     342             :   case 11:
     343             :     tmp = fieldFromInstruction(insn, 52, 4);
     344           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     345             :     return S;
     346             :   case 12:
     347             :     tmp = fieldFromInstruction(insn, 48, 4);
     348           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     349             :     tmp = 0;
     350             :     tmp |= fieldFromInstruction(insn, 32, 16) << 0;
     351           0 :     tmp |= fieldFromInstruction(insn, 52, 4) << 16;
     352           0 :     if (decodeMemoryOpValue(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     353             :     return S;
     354             :   case 13:
     355             :     tmp = fieldFromInstruction(insn, 52, 4);
     356           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     357             :     tmp = fieldFromInstruction(insn, 32, 20);
     358           0 :     if (decodeMemoryOpValue(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     359             :     return S;
     360             :   case 14:
     361             :     tmp = fieldFromInstruction(insn, 48, 4);
     362           0 :     if (DecodeGPR32RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     363             :     tmp = fieldFromInstruction(insn, 48, 4);
     364             :     if (DecodeGPR32RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     365             :     return S;
     366             :   case 15:
     367             :     tmp = fieldFromInstruction(insn, 48, 4);
     368           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     369             :     tmp = fieldFromInstruction(insn, 48, 4);
     370             :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     371             :     return S;
     372             :   case 16:
     373             :     tmp = fieldFromInstruction(insn, 48, 4);
     374           0 :     if (DecodeGPR32RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     375             :     tmp = fieldFromInstruction(insn, 0, 32);
     376           0 :     MI.addOperand(MCOperand::createImm(tmp));
     377           0 :     return S;
     378             :   case 17:
     379             :     tmp = fieldFromInstruction(insn, 48, 4);
     380           0 :     if (DecodeGPR32RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     381             :     tmp = fieldFromInstruction(insn, 52, 4);
     382           0 :     if (DecodeGPR32RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     383             :     return S;
     384             :   case 18:
     385             :     tmp = fieldFromInstruction(insn, 48, 4);
     386           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     387             :     tmp = fieldFromInstruction(insn, 52, 4);
     388           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     389             :     return S;
     390             :   case 19:
     391             :     tmp = fieldFromInstruction(insn, 52, 4);
     392           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     393             :     tmp = fieldFromInstruction(insn, 32, 20);
     394           0 :     if (decodeMemoryOpValue(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     395             :     tmp = fieldFromInstruction(insn, 52, 4);
     396             :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     397             :     return S;
     398             :   case 20:
     399             :     tmp = fieldFromInstruction(insn, 48, 4);
     400           0 :     if (DecodeGPR32RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     401             :     tmp = 0;
     402             :     tmp |= fieldFromInstruction(insn, 32, 16) << 0;
     403           0 :     tmp |= fieldFromInstruction(insn, 52, 4) << 16;
     404           0 :     if (decodeMemoryOpValue(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     405             :     return S;
     406             :   case 21:
     407             :     tmp = fieldFromInstruction(insn, 52, 4);
     408           0 :     if (DecodeGPR32RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     409             :     tmp = fieldFromInstruction(insn, 32, 20);
     410           0 :     if (decodeMemoryOpValue(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     411             :     return S;
     412             :   }
     413             : }
     414             : 
     415             : template<typename InsnType>
     416           0 : static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
     417             :                                       InsnType insn, uint64_t Address,
     418             :                                       const void *DisAsm,
     419             :                                       const MCSubtargetInfo &STI) {
     420             :   const FeatureBitset& Bits = STI.getFeatureBits();
     421             : 
     422             :   const uint8_t *Ptr = DecodeTable;
     423             :   uint32_t CurFieldValue = 0;
     424             :   DecodeStatus S = MCDisassembler::Success;
     425             :   while (true) {
     426           0 :     ptrdiff_t Loc = Ptr - DecodeTable;
     427           0 :     switch (*Ptr) {
     428           0 :     default:
     429           0 :       errs() << Loc << ": Unexpected decode table opcode!\n";
     430           0 :       return MCDisassembler::Fail;
     431           0 :     case MCD::OPC_ExtractField: {
     432           0 :       unsigned Start = *++Ptr;
     433           0 :       unsigned Len = *++Ptr;
     434           0 :       ++Ptr;
     435           0 :       CurFieldValue = fieldFromInstruction(insn, Start, Len);
     436             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_ExtractField(" << Start << ", "
     437             :                    << Len << "): " << CurFieldValue << "\n");
     438           0 :       break;
     439             :     }
     440           0 :     case MCD::OPC_FilterValue: {
     441             :       // Decode the field value.
     442             :       unsigned Len;
     443           0 :       InsnType Val = decodeULEB128(++Ptr, &Len);
     444           0 :       Ptr += Len;
     445             :       // NumToSkip is a plain 24-bit integer.
     446           0 :       unsigned NumToSkip = *Ptr++;
     447           0 :       NumToSkip |= (*Ptr++) << 8;
     448           0 :       NumToSkip |= (*Ptr++) << 16;
     449             : 
     450             :       // Perform the filter operation.
     451           0 :       if (Val != CurFieldValue)
     452           0 :         Ptr += NumToSkip;
     453             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_FilterValue(" << Val << ", " << NumToSkip
     454             :                    << "): " << ((Val != CurFieldValue) ? "FAIL:" : "PASS:")
     455             :                    << " continuing at " << (Ptr - DecodeTable) << "\n");
     456             : 
     457             :       break;
     458             :     }
     459           0 :     case MCD::OPC_CheckField: {
     460           0 :       unsigned Start = *++Ptr;
     461           0 :       unsigned Len = *++Ptr;
     462             :       InsnType FieldValue = fieldFromInstruction(insn, Start, Len);
     463             :       // Decode the field value.
     464           0 :       uint32_t ExpectedValue = decodeULEB128(++Ptr, &Len);
     465           0 :       Ptr += Len;
     466             :       // NumToSkip is a plain 24-bit integer.
     467           0 :       unsigned NumToSkip = *Ptr++;
     468           0 :       NumToSkip |= (*Ptr++) << 8;
     469           0 :       NumToSkip |= (*Ptr++) << 16;
     470             : 
     471             :       // If the actual and expected values don't match, skip.
     472           0 :       if (ExpectedValue != FieldValue)
     473           0 :         Ptr += NumToSkip;
     474             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_CheckField(" << Start << ", "
     475             :                    << Len << ", " << ExpectedValue << ", " << NumToSkip
     476             :                    << "): FieldValue = " << FieldValue << ", ExpectedValue = "
     477             :                    << ExpectedValue << ": "
     478             :                    << ((ExpectedValue == FieldValue) ? "PASS\n" : "FAIL\n"));
     479             :       break;
     480             :     }
     481           0 :     case MCD::OPC_CheckPredicate: {
     482             :       unsigned Len;
     483             :       // Decode the Predicate Index value.
     484           0 :       unsigned PIdx = decodeULEB128(++Ptr, &Len);
     485             :       Ptr += Len;
     486             :       // NumToSkip is a plain 24-bit integer.
     487             :       unsigned NumToSkip = *Ptr++;
     488             :       NumToSkip |= (*Ptr++) << 8;
     489             :       NumToSkip |= (*Ptr++) << 16;
     490             :       // Check the predicate.
     491             :       bool Pred;
     492             :       if (!(Pred = checkDecoderPredicate(PIdx, Bits)))
     493             :         Ptr += NumToSkip;
     494             :       (void)Pred;
     495             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_CheckPredicate(" << PIdx << "): "
     496             :             << (Pred ? "PASS\n" : "FAIL\n"));
     497             : 
     498             :       break;
     499             :     }
     500           0 :     case MCD::OPC_Decode: {
     501             :       unsigned Len;
     502             :       // Decode the Opcode value.
     503           0 :       unsigned Opc = decodeULEB128(++Ptr, &Len);
     504           0 :       Ptr += Len;
     505           0 :       unsigned DecodeIdx = decodeULEB128(Ptr, &Len);
     506             :       Ptr += Len;
     507             : 
     508             :       MI.clear();
     509             :       MI.setOpcode(Opc);
     510             :       bool DecodeComplete;
     511           0 :       S = decodeToMCInst(S, DecodeIdx, insn, MI, Address, DisAsm, DecodeComplete);
     512             :       assert(DecodeComplete);
     513             : 
     514             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_Decode: opcode " << Opc
     515             :                    << ", using decoder " << DecodeIdx << ": "
     516             :                    << (S != MCDisassembler::Fail ? "PASS" : "FAIL") << "\n");
     517             :       return S;
     518             :     }
     519           0 :     case MCD::OPC_TryDecode: {
     520             :       unsigned Len;
     521             :       // Decode the Opcode value.
     522           0 :       unsigned Opc = decodeULEB128(++Ptr, &Len);
     523           0 :       Ptr += Len;
     524           0 :       unsigned DecodeIdx = decodeULEB128(Ptr, &Len);
     525           0 :       Ptr += Len;
     526             :       // NumToSkip is a plain 24-bit integer.
     527           0 :       unsigned NumToSkip = *Ptr++;
     528           0 :       NumToSkip |= (*Ptr++) << 8;
     529           0 :       NumToSkip |= (*Ptr++) << 16;
     530             : 
     531             :       // Perform the decode operation.
     532             :       MCInst TmpMI;
     533             :       TmpMI.setOpcode(Opc);
     534             :       bool DecodeComplete;
     535           0 :       S = decodeToMCInst(S, DecodeIdx, insn, TmpMI, Address, DisAsm, DecodeComplete);
     536             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_TryDecode: opcode " << Opc
     537             :                    << ", using decoder " << DecodeIdx << ": ");
     538             : 
     539           0 :       if (DecodeComplete) {
     540             :         // Decoding complete.
     541             :         LLVM_DEBUG(dbgs() << (S != MCDisassembler::Fail ? "PASS" : "FAIL") << "\n");
     542             :         MI = TmpMI;
     543           0 :         return S;
     544             :       } else {
     545             :         assert(S == MCDisassembler::Fail);
     546             :         // If the decoding was incomplete, skip.
     547           0 :         Ptr += NumToSkip;
     548             :         LLVM_DEBUG(dbgs() << "FAIL: continuing at " << (Ptr - DecodeTable) << "\n");
     549             :         // Reset decode status. This also drops a SoftFail status that could be
     550             :         // set before the decode attempt.
     551             :         S = MCDisassembler::Success;
     552             :       }
     553             :       break;
     554             :     }
     555           0 :     case MCD::OPC_SoftFail: {
     556             :       // Decode the mask values.
     557             :       unsigned Len;
     558           0 :       InsnType PositiveMask = decodeULEB128(++Ptr, &Len);
     559           0 :       Ptr += Len;
     560           0 :       InsnType NegativeMask = decodeULEB128(Ptr, &Len);
     561           0 :       Ptr += Len;
     562           0 :       bool Fail = (insn & PositiveMask) || (~insn & NegativeMask);
     563             :       if (Fail)
     564             :         S = MCDisassembler::SoftFail;
     565             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_SoftFail: " << (Fail ? "FAIL\n":"PASS\n"));
     566             :       break;
     567             :     }
     568             :     case MCD::OPC_Fail: {
     569             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_Fail\n");
     570             :       return MCDisassembler::Fail;
     571             :     }
     572             :     }
     573             :   }
     574             :   llvm_unreachable("bogosity detected in disassembler state machine!");
     575             : }
     576             : 
     577             : 
     578             : } // End llvm namespace

Generated by: LCOV version 1.13