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: 87 128 68.0 %
Date: 2018-07-13 00:08:38 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, 138, 0, 0, // Skip to: 146
      35             : /* 8 */       MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      36             : /* 11 */      MCD::OPC_FilterValue, 0, 103, 0, 0, // Skip to: 119
      37             : /* 16 */      MCD::OPC_ExtractField, 0, 16,  // Inst{15-0} ...
      38             : /* 19 */      MCD::OPC_FilterValue, 1, 11, 0, 0, // Skip to: 35
      39             : /* 24 */      MCD::OPC_CheckField, 18, 10, 0, 84, 0, 0, // Skip to: 115
      40             : /* 31 */      MCD::OPC_Decode, 173, 1, 0, // Opcode: NOP
      41             : /* 35 */      MCD::OPC_FilterValue, 2, 11, 0, 0, // Skip to: 51
      42             : /* 40 */      MCD::OPC_CheckField, 18, 10, 0, 68, 0, 0, // Skip to: 115
      43             : /* 47 */      MCD::OPC_Decode, 167, 1, 0, // Opcode: LOG0
      44             : /* 51 */      MCD::OPC_FilterValue, 3, 11, 0, 0, // Skip to: 67
      45             : /* 56 */      MCD::OPC_CheckField, 18, 10, 0, 52, 0, 0, // Skip to: 115
      46             : /* 63 */      MCD::OPC_Decode, 168, 1, 0, // Opcode: LOG1
      47             : /* 67 */      MCD::OPC_FilterValue, 4, 11, 0, 0, // Skip to: 83
      48             : /* 72 */      MCD::OPC_CheckField, 18, 10, 0, 36, 0, 0, // Skip to: 115
      49             : /* 79 */      MCD::OPC_Decode, 169, 1, 0, // Opcode: LOG2
      50             : /* 83 */      MCD::OPC_FilterValue, 5, 11, 0, 0, // Skip to: 99
      51             : /* 88 */      MCD::OPC_CheckField, 18, 10, 0, 20, 0, 0, // Skip to: 115
      52             : /* 95 */      MCD::OPC_Decode, 170, 1, 0, // Opcode: LOG3
      53             : /* 99 */      MCD::OPC_FilterValue, 6, 11, 0, 0, // Skip to: 115
      54             : /* 104 */     MCD::OPC_CheckField, 18, 10, 0, 4, 0, 0, // Skip to: 115
      55             : /* 111 */     MCD::OPC_Decode, 171, 1, 0, // Opcode: LOG4
      56             : /* 115 */     MCD::OPC_Decode, 140, 1, 1, // Opcode: ADD_I_LO
      57             : /* 119 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 128
      58             : /* 124 */     MCD::OPC_Decode, 139, 1, 1, // Opcode: ADD_I_HI
      59             : /* 128 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 137
      60             : /* 133 */     MCD::OPC_Decode, 137, 1, 1, // Opcode: ADD_F_I_LO
      61             : /* 137 */     MCD::OPC_FilterValue, 3, 198, 3, 0, // Skip to: 1108
      62             : /* 142 */     MCD::OPC_Decode, 136, 1, 1, // Opcode: ADD_F_I_HI
      63             : /* 146 */     MCD::OPC_FilterValue, 1, 39, 0, 0, // Skip to: 190
      64             : /* 151 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      65             : /* 154 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 163
      66             : /* 159 */     MCD::OPC_Decode, 134, 1, 1, // Opcode: ADDC_I_LO
      67             : /* 163 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 172
      68             : /* 168 */     MCD::OPC_Decode, 133, 1, 1, // Opcode: ADDC_I_HI
      69             : /* 172 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 181
      70             : /* 177 */     MCD::OPC_Decode, 131, 1, 1, // Opcode: ADDC_F_I_LO
      71             : /* 181 */     MCD::OPC_FilterValue, 3, 154, 3, 0, // Skip to: 1108
      72             : /* 186 */     MCD::OPC_Decode, 130, 1, 1, // Opcode: ADDC_F_I_HI
      73             : /* 190 */     MCD::OPC_FilterValue, 2, 39, 0, 0, // Skip to: 234
      74             : /* 195 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      75             : /* 198 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 207
      76             : /* 203 */     MCD::OPC_Decode, 213, 1, 1, // Opcode: SUB_I_LO
      77             : /* 207 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 216
      78             : /* 212 */     MCD::OPC_Decode, 212, 1, 1, // Opcode: SUB_I_HI
      79             : /* 216 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 225
      80             : /* 221 */     MCD::OPC_Decode, 210, 1, 1, // Opcode: SUB_F_I_LO
      81             : /* 225 */     MCD::OPC_FilterValue, 3, 110, 3, 0, // Skip to: 1108
      82             : /* 230 */     MCD::OPC_Decode, 209, 1, 1, // Opcode: SUB_F_I_HI
      83             : /* 234 */     MCD::OPC_FilterValue, 3, 39, 0, 0, // Skip to: 278
      84             : /* 239 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      85             : /* 242 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 251
      86             : /* 247 */     MCD::OPC_Decode, 207, 1, 1, // Opcode: SUBB_I_LO
      87             : /* 251 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 260
      88             : /* 256 */     MCD::OPC_Decode, 206, 1, 1, // Opcode: SUBB_I_HI
      89             : /* 260 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 269
      90             : /* 265 */     MCD::OPC_Decode, 204, 1, 1, // Opcode: SUBB_F_I_LO
      91             : /* 269 */     MCD::OPC_FilterValue, 3, 66, 3, 0, // Skip to: 1108
      92             : /* 274 */     MCD::OPC_Decode, 203, 1, 1, // Opcode: SUBB_F_I_HI
      93             : /* 278 */     MCD::OPC_FilterValue, 4, 39, 0, 0, // Skip to: 322
      94             : /* 283 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      95             : /* 286 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 295
      96             : /* 291 */     MCD::OPC_Decode, 146, 1, 1, // Opcode: AND_I_LO
      97             : /* 295 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 304
      98             : /* 300 */     MCD::OPC_Decode, 145, 1, 1, // Opcode: AND_I_HI
      99             : /* 304 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 313
     100             : /* 309 */     MCD::OPC_Decode, 143, 1, 1, // Opcode: AND_F_I_LO
     101             : /* 313 */     MCD::OPC_FilterValue, 3, 22, 3, 0, // Skip to: 1108
     102             : /* 318 */     MCD::OPC_Decode, 142, 1, 1, // Opcode: AND_F_I_HI
     103             : /* 322 */     MCD::OPC_FilterValue, 5, 39, 0, 0, // Skip to: 366
     104             : /* 327 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
     105             : /* 330 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 339
     106             : /* 335 */     MCD::OPC_Decode, 178, 1, 1, // Opcode: OR_I_LO
     107             : /* 339 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 348
     108             : /* 344 */     MCD::OPC_Decode, 177, 1, 1, // Opcode: OR_I_HI
     109             : /* 348 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 357
     110             : /* 353 */     MCD::OPC_Decode, 175, 1, 1, // Opcode: OR_F_I_LO
     111             : /* 357 */     MCD::OPC_FilterValue, 3, 234, 2, 0, // Skip to: 1108
     112             : /* 362 */     MCD::OPC_Decode, 174, 1, 1, // Opcode: OR_F_I_HI
     113             : /* 366 */     MCD::OPC_FilterValue, 6, 39, 0, 0, // Skip to: 410
     114             : /* 371 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
     115             : /* 374 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 383
     116             : /* 379 */     MCD::OPC_Decode, 222, 1, 1, // Opcode: XOR_I_LO
     117             : /* 383 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 392
     118             : /* 388 */     MCD::OPC_Decode, 221, 1, 1, // Opcode: XOR_I_HI
     119             : /* 392 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 401
     120             : /* 397 */     MCD::OPC_Decode, 219, 1, 1, // Opcode: XOR_F_I_LO
     121             : /* 401 */     MCD::OPC_FilterValue, 3, 190, 2, 0, // Skip to: 1108
     122             : /* 406 */     MCD::OPC_Decode, 218, 1, 1, // Opcode: XOR_F_I_HI
     123             : /* 410 */     MCD::OPC_FilterValue, 7, 39, 0, 0, // Skip to: 454
     124             : /* 415 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
     125             : /* 418 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 427
     126             : /* 423 */     MCD::OPC_Decode, 193, 1, 2, // Opcode: SL_I
     127             : /* 427 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 436
     128             : /* 432 */     MCD::OPC_Decode, 183, 1, 2, // Opcode: SA_I
     129             : /* 436 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 445
     130             : /* 441 */     MCD::OPC_Decode, 192, 1, 2, // Opcode: SL_F_I
     131             : /* 445 */     MCD::OPC_FilterValue, 3, 146, 2, 0, // Skip to: 1108
     132             : /* 450 */     MCD::OPC_Decode, 182, 1, 2, // Opcode: SA_F_I
     133             : /* 454 */     MCD::OPC_FilterValue, 8, 18, 0, 0, // Skip to: 477
     134             : /* 459 */     MCD::OPC_CheckField, 0, 28, 252, 255, 219, 8, 4, 0, 0, // Skip to: 473
     135             : /* 469 */     MCD::OPC_Decode, 181, 1, 0, // Opcode: RET
     136             : /* 473 */     MCD::OPC_Decode, 163, 1, 3, // Opcode: LDW_RI
     137             : /* 477 */     MCD::OPC_FilterValue, 9, 4, 0, 0, // Skip to: 486
     138             : /* 482 */     MCD::OPC_Decode, 215, 1, 3, // Opcode: SW_RI
     139             : /* 486 */     MCD::OPC_FilterValue, 10, 57, 0, 0, // Skip to: 548
     140             : /* 491 */     MCD::OPC_ExtractField, 0, 3,  // Inst{2-0} ...
     141             : /* 494 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 503
     142             : /* 499 */     MCD::OPC_Decode, 160, 1, 4, // Opcode: LDHs_RR
     143             : /* 503 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 512
     144             : /* 508 */     MCD::OPC_Decode, 162, 1, 4, // Opcode: LDHz_RR
     145             : /* 512 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 521
     146             : /* 517 */     MCD::OPC_Decode, 164, 1, 4, // Opcode: LDW_RR
     147             : /* 521 */     MCD::OPC_FilterValue, 3, 4, 0, 0, // Skip to: 530
     148             : /* 526 */     MCD::OPC_Decode, 165, 1, 4, // Opcode: LDWz_RR
     149             : /* 530 */     MCD::OPC_FilterValue, 4, 4, 0, 0, // Skip to: 539
     150             : /* 535 */     MCD::OPC_Decode, 156, 1, 4, // Opcode: LDBs_RR
     151             : /* 539 */     MCD::OPC_FilterValue, 5, 52, 2, 0, // Skip to: 1108
     152             : /* 544 */     MCD::OPC_Decode, 158, 1, 4, // Opcode: LDBz_RR
     153             : /* 548 */     MCD::OPC_FilterValue, 11, 30, 0, 0, // Skip to: 583
     154             : /* 553 */     MCD::OPC_ExtractField, 0, 3,  // Inst{2-0} ...
     155             : /* 556 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 565
     156             : /* 561 */     MCD::OPC_Decode, 202, 1, 4, // Opcode: STH_RR
     157             : /* 565 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 574
     158             : /* 570 */     MCD::OPC_Decode, 216, 1, 4, // Opcode: SW_RR
     159             : /* 574 */     MCD::OPC_FilterValue, 4, 17, 2, 0, // Skip to: 1108
     160             : /* 579 */     MCD::OPC_Decode, 200, 1, 4, // Opcode: STB_RR
     161             : /* 583 */     MCD::OPC_FilterValue, 12, 57, 1, 0, // Skip to: 901
     162             : /* 588 */     MCD::OPC_ExtractField, 3, 8,  // Inst{10-3} ...
     163             : /* 591 */     MCD::OPC_FilterValue, 0, 21, 0, 0, // Skip to: 617
     164             : /* 596 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     165             : /* 599 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 608
     166             : /* 604 */     MCD::OPC_Decode, 141, 1, 5, // Opcode: ADD_R
     167             : /* 608 */     MCD::OPC_FilterValue, 1, 239, 1, 0, // Skip to: 1108
     168             : /* 613 */     MCD::OPC_Decode, 138, 1, 5, // Opcode: ADD_F_R
     169             : /* 617 */     MCD::OPC_FilterValue, 32, 21, 0, 0, // Skip to: 643
     170             : /* 622 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     171             : /* 625 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 634
     172             : /* 630 */     MCD::OPC_Decode, 135, 1, 5, // Opcode: ADDC_R
     173             : /* 634 */     MCD::OPC_FilterValue, 1, 213, 1, 0, // Skip to: 1108
     174             : /* 639 */     MCD::OPC_Decode, 132, 1, 5, // Opcode: ADDC_F_R
     175             : /* 643 */     MCD::OPC_FilterValue, 64, 21, 0, 0, // Skip to: 669
     176             : /* 648 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     177             : /* 651 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 660
     178             : /* 656 */     MCD::OPC_Decode, 214, 1, 5, // Opcode: SUB_R
     179             : /* 660 */     MCD::OPC_FilterValue, 1, 187, 1, 0, // Skip to: 1108
     180             : /* 665 */     MCD::OPC_Decode, 211, 1, 5, // Opcode: SUB_F_R
     181             : /* 669 */     MCD::OPC_FilterValue, 96, 21, 0, 0, // Skip to: 695
     182             : /* 674 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     183             : /* 677 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 686
     184             : /* 682 */     MCD::OPC_Decode, 208, 1, 5, // Opcode: SUBB_R
     185             : /* 686 */     MCD::OPC_FilterValue, 1, 161, 1, 0, // Skip to: 1108
     186             : /* 691 */     MCD::OPC_Decode, 205, 1, 5, // Opcode: SUBB_F_R
     187             : /* 695 */     MCD::OPC_FilterValue, 128, 1, 21, 0, 0, // Skip to: 722
     188             : /* 701 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     189             : /* 704 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 713
     190             : /* 709 */     MCD::OPC_Decode, 147, 1, 5, // Opcode: AND_R
     191             : /* 713 */     MCD::OPC_FilterValue, 1, 134, 1, 0, // Skip to: 1108
     192             : /* 718 */     MCD::OPC_Decode, 144, 1, 5, // Opcode: AND_F_R
     193             : /* 722 */     MCD::OPC_FilterValue, 160, 1, 75, 0, 0, // Skip to: 803
     194             : /* 728 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     195             : /* 731 */     MCD::OPC_FilterValue, 0, 58, 0, 0, // Skip to: 794
     196             : /* 736 */     MCD::OPC_CheckField, 18, 10, 64, 18, 0, 0, // Skip to: 761
     197             : /* 743 */     MCD::OPC_CheckField, 16, 1, 0, 11, 0, 0, // Skip to: 761
     198             : /* 750 */     MCD::OPC_CheckField, 0, 3, 0, 4, 0, 0, // Skip to: 761
     199             : /* 757 */     MCD::OPC_Decode, 153, 1, 6, // Opcode: JR
     200             : /* 761 */     MCD::OPC_CheckField, 23, 5, 2, 11, 0, 0, // Skip to: 779
     201             : /* 768 */     MCD::OPC_CheckField, 11, 5, 0, 4, 0, 0, // Skip to: 779
     202             : /* 775 */     MCD::OPC_Decode, 149, 1, 7, // Opcode: BRIND_CC
     203             : /* 779 */     MCD::OPC_CheckField, 23, 5, 2, 4, 0, 0, // Skip to: 790
     204             : /* 786 */     MCD::OPC_Decode, 150, 1, 8, // Opcode: BRIND_CCA
     205             : /* 790 */     MCD::OPC_Decode, 179, 1, 5, // Opcode: OR_R
     206             : /* 794 */     MCD::OPC_FilterValue, 1, 53, 1, 0, // Skip to: 1108
     207             : /* 799 */     MCD::OPC_Decode, 176, 1, 5, // Opcode: OR_F_R
     208             : /* 803 */     MCD::OPC_FilterValue, 192, 1, 21, 0, 0, // Skip to: 830
     209             : /* 809 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     210             : /* 812 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 821
     211             : /* 817 */     MCD::OPC_Decode, 223, 1, 5, // Opcode: XOR_R
     212             : /* 821 */     MCD::OPC_FilterValue, 1, 26, 1, 0, // Skip to: 1108
     213             : /* 826 */     MCD::OPC_Decode, 220, 1, 5, // Opcode: XOR_F_R
     214             : /* 830 */     MCD::OPC_FilterValue, 224, 1, 11, 0, 0, // Skip to: 847
     215             : /* 836 */     MCD::OPC_CheckField, 17, 1, 0, 9, 1, 0, // Skip to: 1108
     216             : /* 843 */     MCD::OPC_Decode, 185, 1, 9, // Opcode: SELECT
     217             : /* 847 */     MCD::OPC_FilterValue, 240, 1, 21, 0, 0, // Skip to: 874
     218             : /* 853 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     219             : /* 856 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 865
     220             : /* 861 */     MCD::OPC_Decode, 190, 1, 5, // Opcode: SHL_R
     221             : /* 865 */     MCD::OPC_FilterValue, 1, 238, 0, 0, // Skip to: 1108
     222             : /* 870 */     MCD::OPC_Decode, 189, 1, 5, // Opcode: SHL_F_R
     223             : /* 874 */     MCD::OPC_FilterValue, 248, 1, 228, 0, 0, // Skip to: 1108
     224             : /* 880 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     225             : /* 883 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 892
     226             : /* 888 */     MCD::OPC_Decode, 195, 1, 5, // Opcode: SRA_R
     227             : /* 892 */     MCD::OPC_FilterValue, 1, 211, 0, 0, // Skip to: 1108
     228             : /* 897 */     MCD::OPC_Decode, 194, 1, 5, // Opcode: SRA_F_R
     229             : /* 901 */     MCD::OPC_FilterValue, 13, 30, 0, 0, // Skip to: 936
     230             : /* 906 */     MCD::OPC_ExtractField, 0, 18,  // Inst{17-0} ...
     231             : /* 909 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 918
     232             : /* 914 */     MCD::OPC_Decode, 180, 1, 10, // Opcode: POPC
     233             : /* 918 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 927
     234             : /* 923 */     MCD::OPC_Decode, 166, 1, 10, // Opcode: LEADZ
     235             : /* 927 */     MCD::OPC_FilterValue, 3, 176, 0, 0, // Skip to: 1108
     236             : /* 932 */     MCD::OPC_Decode, 217, 1, 10, // Opcode: TRAILZ
     237             : /* 936 */     MCD::OPC_FilterValue, 14, 70, 0, 0, // Skip to: 1011
     238             : /* 941 */     MCD::OPC_ExtractField, 1, 1,  // Inst{1} ...
     239             : /* 944 */     MCD::OPC_FilterValue, 0, 22, 0, 0, // Skip to: 971
     240             : /* 949 */     MCD::OPC_CheckField, 25, 3, 0, 11, 0, 0, // Skip to: 967
     241             : /* 956 */     MCD::OPC_CheckField, 0, 1, 0, 4, 0, 0, // Skip to: 967
     242             : /* 963 */     MCD::OPC_Decode, 152, 1, 11, // Opcode: BT
     243             : /* 967 */     MCD::OPC_Decode, 148, 1, 12, // Opcode: BRCC
     244             : /* 971 */     MCD::OPC_FilterValue, 1, 132, 0, 0, // Skip to: 1108
     245             : /* 976 */     MCD::OPC_ExtractField, 23, 2,  // Inst{24-23} ...
     246             : /* 979 */     MCD::OPC_FilterValue, 0, 11, 0, 0, // Skip to: 995
     247             : /* 984 */     MCD::OPC_CheckField, 2, 16, 0, 117, 0, 0, // Skip to: 1108
     248             : /* 991 */     MCD::OPC_Decode, 184, 1, 13, // Opcode: SCC
     249             : /* 995 */     MCD::OPC_FilterValue, 2, 108, 0, 0, // Skip to: 1108
     250             : /* 1000 */    MCD::OPC_CheckField, 16, 7, 0, 101, 0, 0, // Skip to: 1108
     251             : /* 1007 */    MCD::OPC_Decode, 151, 1, 14, // Opcode: BRR
     252             : /* 1011 */    MCD::OPC_FilterValue, 15, 92, 0, 0, // Skip to: 1108
     253             : /* 1016 */    MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
     254             : /* 1019 */    MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 1028
     255             : /* 1024 */    MCD::OPC_Decode, 154, 1, 15, // Opcode: LDADDR
     256             : /* 1028 */    MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 1037
     257             : /* 1033 */    MCD::OPC_Decode, 198, 1, 15, // Opcode: STADDR
     258             : /* 1037 */    MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 1046
     259             : /* 1042 */    MCD::OPC_Decode, 191, 1, 15, // Opcode: SLI
     260             : /* 1046 */    MCD::OPC_FilterValue, 3, 57, 0, 0, // Skip to: 1108
     261             : /* 1051 */    MCD::OPC_ExtractField, 12, 4,  // Inst{15-12} ...
     262             : /* 1054 */    MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 1063
     263             : /* 1059 */    MCD::OPC_Decode, 159, 1, 16, // Opcode: LDHs_RI
     264             : /* 1063 */    MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 1072
     265             : /* 1068 */    MCD::OPC_Decode, 161, 1, 16, // Opcode: LDHz_RI
     266             : /* 1072 */    MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 1081
     267             : /* 1077 */    MCD::OPC_Decode, 201, 1, 16, // Opcode: STH_RI
     268             : /* 1081 */    MCD::OPC_FilterValue, 4, 4, 0, 0, // Skip to: 1090
     269             : /* 1086 */    MCD::OPC_Decode, 155, 1, 16, // Opcode: LDBs_RI
     270             : /* 1090 */    MCD::OPC_FilterValue, 5, 4, 0, 0, // Skip to: 1099
     271             : /* 1095 */    MCD::OPC_Decode, 157, 1, 16, // Opcode: LDBz_RI
     272             : /* 1099 */    MCD::OPC_FilterValue, 6, 4, 0, 0, // Skip to: 1108
     273             : /* 1104 */    MCD::OPC_Decode, 199, 1, 16, // Opcode: STB_RI
     274             : /* 1108 */    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 24-bit integer.
     454        5954 :       unsigned NumToSkip = *Ptr++;
     455        5954 :       NumToSkip |= (*Ptr++) << 8;
     456        5954 :       NumToSkip |= (*Ptr++) << 16;
     457             : 
     458             :       // Perform the filter operation.
     459        5954 :       if (Val != CurFieldValue)
     460        5082 :         Ptr += NumToSkip;
     461             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_FilterValue(" << Val << ", " << NumToSkip
     462             :                    << "): " << ((Val != CurFieldValue) ? "FAIL:" : "PASS:")
     463             :                    << " continuing at " << (Ptr - DecodeTable) << "\n");
     464             : 
     465             :       break;
     466             :     }
     467          70 :     case MCD::OPC_CheckField: {
     468          70 :       unsigned Start = *++Ptr;
     469          70 :       unsigned Len = *++Ptr;
     470             :       InsnType FieldValue = fieldFromInstruction(insn, Start, Len);
     471             :       // Decode the field value.
     472          70 :       uint32_t ExpectedValue = decodeULEB128(++Ptr, &Len);
     473          70 :       Ptr += Len;
     474             :       // NumToSkip is a plain 24-bit integer.
     475          70 :       unsigned NumToSkip = *Ptr++;
     476          70 :       NumToSkip |= (*Ptr++) << 8;
     477          70 :       NumToSkip |= (*Ptr++) << 16;
     478             : 
     479             :       // If the actual and expected values don't match, skip.
     480          70 :       if (ExpectedValue != FieldValue)
     481          34 :         Ptr += NumToSkip;
     482             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_CheckField(" << Start << ", "
     483             :                    << Len << ", " << ExpectedValue << ", " << NumToSkip
     484             :                    << "): FieldValue = " << FieldValue << ", ExpectedValue = "
     485             :                    << ExpectedValue << ": "
     486             :                    << ((ExpectedValue == FieldValue) ? "PASS\n" : "FAIL\n"));
     487             :       break;
     488             :     }
     489           0 :     case MCD::OPC_CheckPredicate: {
     490             :       unsigned Len;
     491             :       // Decode the Predicate Index value.
     492           0 :       unsigned PIdx = decodeULEB128(++Ptr, &Len);
     493             :       Ptr += Len;
     494             :       // NumToSkip is a plain 24-bit integer.
     495             :       unsigned NumToSkip = *Ptr++;
     496             :       NumToSkip |= (*Ptr++) << 8;
     497             :       NumToSkip |= (*Ptr++) << 16;
     498             :       // Check the predicate.
     499             :       bool Pred;
     500             :       if (!(Pred = checkDecoderPredicate(PIdx, Bits)))
     501             :         Ptr += NumToSkip;
     502             :       (void)Pred;
     503             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_CheckPredicate(" << PIdx << "): "
     504             :             << (Pred ? "PASS\n" : "FAIL\n"));
     505             : 
     506             :       break;
     507             :     }
     508         380 :     case MCD::OPC_Decode: {
     509             :       unsigned Len;
     510             :       // Decode the Opcode value.
     511         380 :       unsigned Opc = decodeULEB128(++Ptr, &Len);
     512         380 :       Ptr += Len;
     513         380 :       unsigned DecodeIdx = decodeULEB128(Ptr, &Len);
     514             :       Ptr += Len;
     515             : 
     516             :       MI.clear();
     517             :       MI.setOpcode(Opc);
     518             :       bool DecodeComplete;
     519         380 :       S = decodeToMCInst(S, DecodeIdx, insn, MI, Address, DisAsm, DecodeComplete);
     520             :       assert(DecodeComplete);
     521             : 
     522             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_Decode: opcode " << Opc
     523             :                    << ", using decoder " << DecodeIdx << ": "
     524             :                    << (S != MCDisassembler::Fail ? "PASS" : "FAIL") << "\n");
     525             :       return S;
     526             :     }
     527           0 :     case MCD::OPC_TryDecode: {
     528             :       unsigned Len;
     529             :       // Decode the Opcode value.
     530           0 :       unsigned Opc = decodeULEB128(++Ptr, &Len);
     531           0 :       Ptr += Len;
     532           0 :       unsigned DecodeIdx = decodeULEB128(Ptr, &Len);
     533           0 :       Ptr += Len;
     534             :       // NumToSkip is a plain 24-bit integer.
     535           0 :       unsigned NumToSkip = *Ptr++;
     536           0 :       NumToSkip |= (*Ptr++) << 8;
     537           0 :       NumToSkip |= (*Ptr++) << 16;
     538             : 
     539             :       // Perform the decode operation.
     540             :       MCInst TmpMI;
     541             :       TmpMI.setOpcode(Opc);
     542             :       bool DecodeComplete;
     543           0 :       S = decodeToMCInst(S, DecodeIdx, insn, TmpMI, Address, DisAsm, DecodeComplete);
     544             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_TryDecode: opcode " << Opc
     545             :                    << ", using decoder " << DecodeIdx << ": ");
     546             : 
     547           0 :       if (DecodeComplete) {
     548             :         // Decoding complete.
     549             :         LLVM_DEBUG(dbgs() << (S != MCDisassembler::Fail ? "PASS" : "FAIL") << "\n");
     550             :         MI = TmpMI;
     551             :         return S;
     552             :       } else {
     553             :         assert(S == MCDisassembler::Fail);
     554             :         // If the decoding was incomplete, skip.
     555           0 :         Ptr += NumToSkip;
     556             :         LLVM_DEBUG(dbgs() << "FAIL: continuing at " << (Ptr - DecodeTable) << "\n");
     557             :         // Reset decode status. This also drops a SoftFail status that could be
     558             :         // set before the decode attempt.
     559             :         S = MCDisassembler::Success;
     560             :       }
     561             :       break;
     562             :     }
     563           0 :     case MCD::OPC_SoftFail: {
     564             :       // Decode the mask values.
     565             :       unsigned Len;
     566           0 :       InsnType PositiveMask = decodeULEB128(++Ptr, &Len);
     567           0 :       Ptr += Len;
     568           0 :       InsnType NegativeMask = decodeULEB128(Ptr, &Len);
     569           0 :       Ptr += Len;
     570           0 :       bool Fail = (insn & PositiveMask) || (~insn & NegativeMask);
     571             :       if (Fail)
     572             :         S = MCDisassembler::SoftFail;
     573             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_SoftFail: " << (Fail ? "FAIL\n":"PASS\n"));
     574             :       break;
     575             :     }
     576             :     case MCD::OPC_Fail: {
     577             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_Fail\n");
     578             :       return MCDisassembler::Fail;
     579             :     }
     580             :     }
     581             :   }
     582             :   llvm_unreachable("bogosity detected in disassembler state machine!");
     583             : }
     584             : 
     585             : 
     586             : } // End llvm namespace

Generated by: LCOV version 1.13