LCOV - code coverage report
Current view: top level - build-llvm/lib/Target/Lanai - LanaiGenDisassemblerTables.inc (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 85 125 68.0 %
Date: 2018-05-20 00:06:23 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.13