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: 137 199 68.8 %
Date: 2017-09-14 15:23:50 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        2233 :       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, 118, 0, // Skip to: 125
      35             : /* 7 */       MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      36             : /* 10 */      MCD::OPC_FilterValue, 0, 90, 0, // Skip to: 104
      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, 152, 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, 146, 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, 147, 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, 148, 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, 149, 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, 150, 1, 0, // Opcode: LOG4
      56             : /* 101 */     MCD::OPC_Decode, 114, 1, // Opcode: ADD_I_LO
      57             : /* 104 */     MCD::OPC_FilterValue, 1, 3, 0, // Skip to: 111
      58             : /* 108 */     MCD::OPC_Decode, 113, 1, // Opcode: ADD_I_HI
      59             : /* 111 */     MCD::OPC_FilterValue, 2, 3, 0, // Skip to: 118
      60             : /* 115 */     MCD::OPC_Decode, 111, 1, // Opcode: ADD_F_I_LO
      61             : /* 118 */     MCD::OPC_FilterValue, 3, 71, 3, // Skip to: 961
      62             : /* 122 */     MCD::OPC_Decode, 110, 1, // Opcode: ADD_F_I_HI
      63             : /* 125 */     MCD::OPC_FilterValue, 1, 31, 0, // Skip to: 160
      64             : /* 129 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      65             : /* 132 */     MCD::OPC_FilterValue, 0, 3, 0, // Skip to: 139
      66             : /* 136 */     MCD::OPC_Decode, 108, 1, // Opcode: ADDC_I_LO
      67             : /* 139 */     MCD::OPC_FilterValue, 1, 3, 0, // Skip to: 146
      68             : /* 143 */     MCD::OPC_Decode, 107, 1, // Opcode: ADDC_I_HI
      69             : /* 146 */     MCD::OPC_FilterValue, 2, 3, 0, // Skip to: 153
      70             : /* 150 */     MCD::OPC_Decode, 105, 1, // Opcode: ADDC_F_I_LO
      71             : /* 153 */     MCD::OPC_FilterValue, 3, 36, 3, // Skip to: 961
      72             : /* 157 */     MCD::OPC_Decode, 104, 1, // Opcode: ADDC_F_I_HI
      73             : /* 160 */     MCD::OPC_FilterValue, 2, 35, 0, // Skip to: 199
      74             : /* 164 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      75             : /* 167 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 175
      76             : /* 171 */     MCD::OPC_Decode, 192, 1, 1, // Opcode: SUB_I_LO
      77             : /* 175 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 183
      78             : /* 179 */     MCD::OPC_Decode, 191, 1, 1, // Opcode: SUB_I_HI
      79             : /* 183 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 191
      80             : /* 187 */     MCD::OPC_Decode, 189, 1, 1, // Opcode: SUB_F_I_LO
      81             : /* 191 */     MCD::OPC_FilterValue, 3, 254, 2, // Skip to: 961
      82             : /* 195 */     MCD::OPC_Decode, 188, 1, 1, // Opcode: SUB_F_I_HI
      83             : /* 199 */     MCD::OPC_FilterValue, 3, 35, 0, // Skip to: 238
      84             : /* 203 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      85             : /* 206 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 214
      86             : /* 210 */     MCD::OPC_Decode, 186, 1, 1, // Opcode: SUBB_I_LO
      87             : /* 214 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 222
      88             : /* 218 */     MCD::OPC_Decode, 185, 1, 1, // Opcode: SUBB_I_HI
      89             : /* 222 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 230
      90             : /* 226 */     MCD::OPC_Decode, 183, 1, 1, // Opcode: SUBB_F_I_LO
      91             : /* 230 */     MCD::OPC_FilterValue, 3, 215, 2, // Skip to: 961
      92             : /* 234 */     MCD::OPC_Decode, 182, 1, 1, // Opcode: SUBB_F_I_HI
      93             : /* 238 */     MCD::OPC_FilterValue, 4, 31, 0, // Skip to: 273
      94             : /* 242 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      95             : /* 245 */     MCD::OPC_FilterValue, 0, 3, 0, // Skip to: 252
      96             : /* 249 */     MCD::OPC_Decode, 123, 1, // Opcode: AND_I_LO
      97             : /* 252 */     MCD::OPC_FilterValue, 1, 3, 0, // Skip to: 259
      98             : /* 256 */     MCD::OPC_Decode, 122, 1, // Opcode: AND_I_HI
      99             : /* 259 */     MCD::OPC_FilterValue, 2, 3, 0, // Skip to: 266
     100             : /* 263 */     MCD::OPC_Decode, 120, 1, // Opcode: AND_F_I_LO
     101             : /* 266 */     MCD::OPC_FilterValue, 3, 179, 2, // Skip to: 961
     102             : /* 270 */     MCD::OPC_Decode, 119, 1, // Opcode: AND_F_I_HI
     103             : /* 273 */     MCD::OPC_FilterValue, 5, 35, 0, // Skip to: 312
     104             : /* 277 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
     105             : /* 280 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 288
     106             : /* 284 */     MCD::OPC_Decode, 157, 1, 1, // Opcode: OR_I_LO
     107             : /* 288 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 296
     108             : /* 292 */     MCD::OPC_Decode, 156, 1, 1, // Opcode: OR_I_HI
     109             : /* 296 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 304
     110             : /* 300 */     MCD::OPC_Decode, 154, 1, 1, // Opcode: OR_F_I_LO
     111             : /* 304 */     MCD::OPC_FilterValue, 3, 141, 2, // Skip to: 961
     112             : /* 308 */     MCD::OPC_Decode, 153, 1, 1, // Opcode: OR_F_I_HI
     113             : /* 312 */     MCD::OPC_FilterValue, 6, 35, 0, // Skip to: 351
     114             : /* 316 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
     115             : /* 319 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 327
     116             : /* 323 */     MCD::OPC_Decode, 201, 1, 1, // Opcode: XOR_I_LO
     117             : /* 327 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 335
     118             : /* 331 */     MCD::OPC_Decode, 200, 1, 1, // Opcode: XOR_I_HI
     119             : /* 335 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 343
     120             : /* 339 */     MCD::OPC_Decode, 198, 1, 1, // Opcode: XOR_F_I_LO
     121             : /* 343 */     MCD::OPC_FilterValue, 3, 102, 2, // Skip to: 961
     122             : /* 347 */     MCD::OPC_Decode, 197, 1, 1, // Opcode: XOR_F_I_HI
     123             : /* 351 */     MCD::OPC_FilterValue, 7, 35, 0, // Skip to: 390
     124             : /* 355 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
     125             : /* 358 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 366
     126             : /* 362 */     MCD::OPC_Decode, 172, 1, 2, // Opcode: SL_I
     127             : /* 366 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 374
     128             : /* 370 */     MCD::OPC_Decode, 162, 1, 2, // Opcode: SA_I
     129             : /* 374 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 382
     130             : /* 378 */     MCD::OPC_Decode, 171, 1, 2, // Opcode: SL_F_I
     131             : /* 382 */     MCD::OPC_FilterValue, 3, 63, 2, // Skip to: 961
     132             : /* 386 */     MCD::OPC_Decode, 161, 1, 2, // Opcode: SA_F_I
     133             : /* 390 */     MCD::OPC_FilterValue, 8, 17, 0, // Skip to: 411
     134             : /* 394 */     MCD::OPC_CheckField, 0, 28, 252, 255, 219, 8, 4, 0, // Skip to: 407
     135             : /* 403 */     MCD::OPC_Decode, 160, 1, 0, // Opcode: RET
     136             : /* 407 */     MCD::OPC_Decode, 142, 1, 3, // Opcode: LDW_RI
     137             : /* 411 */     MCD::OPC_FilterValue, 9, 4, 0, // Skip to: 419
     138             : /* 415 */     MCD::OPC_Decode, 194, 1, 3, // Opcode: SW_RI
     139             : /* 419 */     MCD::OPC_FilterValue, 10, 51, 0, // Skip to: 474
     140             : /* 423 */     MCD::OPC_ExtractField, 0, 3,  // Inst{2-0} ...
     141             : /* 426 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 434
     142             : /* 430 */     MCD::OPC_Decode, 139, 1, 4, // Opcode: LDHs_RR
     143             : /* 434 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 442
     144             : /* 438 */     MCD::OPC_Decode, 141, 1, 4, // Opcode: LDHz_RR
     145             : /* 442 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 450
     146             : /* 446 */     MCD::OPC_Decode, 143, 1, 4, // Opcode: LDW_RR
     147             : /* 450 */     MCD::OPC_FilterValue, 3, 4, 0, // Skip to: 458
     148             : /* 454 */     MCD::OPC_Decode, 144, 1, 4, // Opcode: LDWz_RR
     149             : /* 458 */     MCD::OPC_FilterValue, 4, 4, 0, // Skip to: 466
     150             : /* 462 */     MCD::OPC_Decode, 135, 1, 4, // Opcode: LDBs_RR
     151             : /* 466 */     MCD::OPC_FilterValue, 5, 235, 1, // Skip to: 961
     152             : /* 470 */     MCD::OPC_Decode, 137, 1, 4, // Opcode: LDBz_RR
     153             : /* 474 */     MCD::OPC_FilterValue, 11, 27, 0, // Skip to: 505
     154             : /* 478 */     MCD::OPC_ExtractField, 0, 3,  // Inst{2-0} ...
     155             : /* 481 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 489
     156             : /* 485 */     MCD::OPC_Decode, 181, 1, 4, // Opcode: STH_RR
     157             : /* 489 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 497
     158             : /* 493 */     MCD::OPC_Decode, 195, 1, 4, // Opcode: SW_RR
     159             : /* 497 */     MCD::OPC_FilterValue, 4, 204, 1, // Skip to: 961
     160             : /* 501 */     MCD::OPC_Decode, 179, 1, 4, // Opcode: STB_RR
     161             : /* 505 */     MCD::OPC_FilterValue, 12, 14, 1, // Skip to: 779
     162             : /* 509 */     MCD::OPC_ExtractField, 3, 8,  // Inst{10-3} ...
     163             : /* 512 */     MCD::OPC_FilterValue, 0, 17, 0, // Skip to: 533
     164             : /* 516 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     165             : /* 519 */     MCD::OPC_FilterValue, 0, 3, 0, // Skip to: 526
     166             : /* 523 */     MCD::OPC_Decode, 115, 5, // Opcode: ADD_R
     167             : /* 526 */     MCD::OPC_FilterValue, 1, 175, 1, // Skip to: 961
     168             : /* 530 */     MCD::OPC_Decode, 112, 5, // Opcode: ADD_F_R
     169             : /* 533 */     MCD::OPC_FilterValue, 32, 17, 0, // Skip to: 554
     170             : /* 537 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     171             : /* 540 */     MCD::OPC_FilterValue, 0, 3, 0, // Skip to: 547
     172             : /* 544 */     MCD::OPC_Decode, 109, 5, // Opcode: ADDC_R
     173             : /* 547 */     MCD::OPC_FilterValue, 1, 154, 1, // Skip to: 961
     174             : /* 551 */     MCD::OPC_Decode, 106, 5, // Opcode: ADDC_F_R
     175             : /* 554 */     MCD::OPC_FilterValue, 64, 19, 0, // Skip to: 577
     176             : /* 558 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     177             : /* 561 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 569
     178             : /* 565 */     MCD::OPC_Decode, 193, 1, 5, // Opcode: SUB_R
     179             : /* 569 */     MCD::OPC_FilterValue, 1, 132, 1, // Skip to: 961
     180             : /* 573 */     MCD::OPC_Decode, 190, 1, 5, // Opcode: SUB_F_R
     181             : /* 577 */     MCD::OPC_FilterValue, 96, 19, 0, // Skip to: 600
     182             : /* 581 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     183             : /* 584 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 592
     184             : /* 588 */     MCD::OPC_Decode, 187, 1, 5, // Opcode: SUBB_R
     185             : /* 592 */     MCD::OPC_FilterValue, 1, 109, 1, // Skip to: 961
     186             : /* 596 */     MCD::OPC_Decode, 184, 1, 5, // Opcode: SUBB_F_R
     187             : /* 600 */     MCD::OPC_FilterValue, 128, 1, 17, 0, // Skip to: 622
     188             : /* 605 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     189             : /* 608 */     MCD::OPC_FilterValue, 0, 3, 0, // Skip to: 615
     190             : /* 612 */     MCD::OPC_Decode, 124, 5, // Opcode: AND_R
     191             : /* 615 */     MCD::OPC_FilterValue, 1, 86, 1, // Skip to: 961
     192             : /* 619 */     MCD::OPC_Decode, 121, 5, // Opcode: AND_F_R
     193             : /* 622 */     MCD::OPC_FilterValue, 160, 1, 65, 0, // Skip to: 692
     194             : /* 627 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     195             : /* 630 */     MCD::OPC_FilterValue, 0, 50, 0, // Skip to: 684
     196             : /* 634 */     MCD::OPC_CheckField, 18, 10, 64, 16, 0, // Skip to: 656
     197             : /* 640 */     MCD::OPC_CheckField, 16, 1, 0, 10, 0, // Skip to: 656
     198             : /* 646 */     MCD::OPC_CheckField, 0, 3, 0, 4, 0, // Skip to: 656
     199             : /* 652 */     MCD::OPC_Decode, 132, 1, 6, // Opcode: JR
     200             : /* 656 */     MCD::OPC_CheckField, 23, 5, 2, 9, 0, // Skip to: 671
     201             : /* 662 */     MCD::OPC_CheckField, 11, 5, 0, 3, 0, // Skip to: 671
     202             : /* 668 */     MCD::OPC_Decode, 126, 7, // Opcode: BRIND_CC
     203             : /* 671 */     MCD::OPC_CheckField, 23, 5, 2, 3, 0, // Skip to: 680
     204             : /* 677 */     MCD::OPC_Decode, 127, 8, // Opcode: BRIND_CCA
     205             : /* 680 */     MCD::OPC_Decode, 158, 1, 5, // Opcode: OR_R
     206             : /* 684 */     MCD::OPC_FilterValue, 1, 17, 1, // Skip to: 961
     207             : /* 688 */     MCD::OPC_Decode, 155, 1, 5, // Opcode: OR_F_R
     208             : /* 692 */     MCD::OPC_FilterValue, 192, 1, 19, 0, // Skip to: 716
     209             : /* 697 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     210             : /* 700 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 708
     211             : /* 704 */     MCD::OPC_Decode, 202, 1, 5, // Opcode: XOR_R
     212             : /* 708 */     MCD::OPC_FilterValue, 1, 249, 0, // Skip to: 961
     213             : /* 712 */     MCD::OPC_Decode, 199, 1, 5, // Opcode: XOR_F_R
     214             : /* 716 */     MCD::OPC_FilterValue, 224, 1, 10, 0, // Skip to: 731
     215             : /* 721 */     MCD::OPC_CheckField, 17, 1, 0, 234, 0, // Skip to: 961
     216             : /* 727 */     MCD::OPC_Decode, 164, 1, 9, // Opcode: SELECT
     217             : /* 731 */     MCD::OPC_FilterValue, 240, 1, 19, 0, // Skip to: 755
     218             : /* 736 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     219             : /* 739 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 747
     220             : /* 743 */     MCD::OPC_Decode, 169, 1, 5, // Opcode: SHL_R
     221             : /* 747 */     MCD::OPC_FilterValue, 1, 210, 0, // Skip to: 961
     222             : /* 751 */     MCD::OPC_Decode, 168, 1, 5, // Opcode: SHL_F_R
     223             : /* 755 */     MCD::OPC_FilterValue, 248, 1, 201, 0, // Skip to: 961
     224             : /* 760 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     225             : /* 763 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 771
     226             : /* 767 */     MCD::OPC_Decode, 174, 1, 5, // Opcode: SRA_R
     227             : /* 771 */     MCD::OPC_FilterValue, 1, 186, 0, // Skip to: 961
     228             : /* 775 */     MCD::OPC_Decode, 173, 1, 5, // Opcode: SRA_F_R
     229             : /* 779 */     MCD::OPC_FilterValue, 13, 27, 0, // Skip to: 810
     230             : /* 783 */     MCD::OPC_ExtractField, 0, 18,  // Inst{17-0} ...
     231             : /* 786 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 794
     232             : /* 790 */     MCD::OPC_Decode, 159, 1, 10, // Opcode: POPC
     233             : /* 794 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 802
     234             : /* 798 */     MCD::OPC_Decode, 145, 1, 10, // Opcode: LEADZ
     235             : /* 802 */     MCD::OPC_FilterValue, 3, 155, 0, // Skip to: 961
     236             : /* 806 */     MCD::OPC_Decode, 196, 1, 10, // Opcode: TRAILZ
     237             : /* 810 */     MCD::OPC_FilterValue, 14, 61, 0, // Skip to: 875
     238             : /* 814 */     MCD::OPC_ExtractField, 1, 1,  // Inst{1} ...
     239             : /* 817 */     MCD::OPC_FilterValue, 0, 19, 0, // Skip to: 840
     240             : /* 821 */     MCD::OPC_CheckField, 25, 3, 0, 10, 0, // Skip to: 837
     241             : /* 827 */     MCD::OPC_CheckField, 0, 1, 0, 4, 0, // Skip to: 837
     242             : /* 833 */     MCD::OPC_Decode, 129, 1, 11, // Opcode: BT
     243             : /* 837 */     MCD::OPC_Decode, 125, 12, // Opcode: BRCC
     244             : /* 840 */     MCD::OPC_FilterValue, 1, 117, 0, // Skip to: 961
     245             : /* 844 */     MCD::OPC_ExtractField, 23, 2,  // Inst{24-23} ...
     246             : /* 847 */     MCD::OPC_FilterValue, 0, 10, 0, // Skip to: 861
     247             : /* 851 */     MCD::OPC_CheckField, 2, 16, 0, 104, 0, // Skip to: 961
     248             : /* 857 */     MCD::OPC_Decode, 163, 1, 13, // Opcode: SCC
     249             : /* 861 */     MCD::OPC_FilterValue, 2, 96, 0, // Skip to: 961
     250             : /* 865 */     MCD::OPC_CheckField, 16, 7, 0, 90, 0, // Skip to: 961
     251             : /* 871 */     MCD::OPC_Decode, 128, 1, 14, // Opcode: BRR
     252             : /* 875 */     MCD::OPC_FilterValue, 15, 82, 0, // Skip to: 961
     253             : /* 879 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
     254             : /* 882 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 890
     255             : /* 886 */     MCD::OPC_Decode, 133, 1, 15, // Opcode: LDADDR
     256             : /* 890 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 898
     257             : /* 894 */     MCD::OPC_Decode, 177, 1, 15, // Opcode: STADDR
     258             : /* 898 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 906
     259             : /* 902 */     MCD::OPC_Decode, 170, 1, 15, // Opcode: SLI
     260             : /* 906 */     MCD::OPC_FilterValue, 3, 51, 0, // Skip to: 961
     261             : /* 910 */     MCD::OPC_ExtractField, 12, 4,  // Inst{15-12} ...
     262             : /* 913 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 921
     263             : /* 917 */     MCD::OPC_Decode, 138, 1, 16, // Opcode: LDHs_RI
     264             : /* 921 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 929
     265             : /* 925 */     MCD::OPC_Decode, 140, 1, 16, // Opcode: LDHz_RI
     266             : /* 929 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 937
     267             : /* 933 */     MCD::OPC_Decode, 180, 1, 16, // Opcode: STH_RI
     268             : /* 937 */     MCD::OPC_FilterValue, 4, 4, 0, // Skip to: 945
     269             : /* 941 */     MCD::OPC_Decode, 134, 1, 16, // Opcode: LDBs_RI
     270             : /* 945 */     MCD::OPC_FilterValue, 5, 4, 0, // Skip to: 953
     271             : /* 949 */     MCD::OPC_Decode, 136, 1, 16, // Opcode: LDBz_RI
     272             : /* 953 */     MCD::OPC_FilterValue, 6, 4, 0, // Skip to: 961
     273             : /* 957 */     MCD::OPC_Decode, 178, 1, 16, // Opcode: STB_RI
     274             : /* 961 */     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          46 :   case 1:
     292          46 :     tmp = fieldFromInstruction(insn, 23, 5);
     293          46 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     294          46 :     tmp = fieldFromInstruction(insn, 18, 5);
     295          46 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     296          46 :     tmp = fieldFromInstruction(insn, 0, 16);
     297         138 :     MI.addOperand(MCOperand::createImm(tmp));
     298          46 :     return S;
     299          16 :   case 2:
     300          16 :     tmp = fieldFromInstruction(insn, 23, 5);
     301          16 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     302          16 :     tmp = fieldFromInstruction(insn, 18, 5);
     303          16 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     304          16 :     tmp = fieldFromInstruction(insn, 0, 16);
     305          32 :     if (decodeShiftImm(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     306          16 :     return S;
     307          34 :   case 3:
     308          34 :     tmp = fieldFromInstruction(insn, 23, 5);
     309          34 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     310          34 :     tmp = 0;
     311          34 :     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         118 :   case 4:
     316         118 :     tmp = fieldFromInstruction(insn, 23, 5);
     317         118 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     318         118 :     tmp = 0;
     319         118 :     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          19 :   case 5:
     325          19 :     tmp = fieldFromInstruction(insn, 23, 5);
     326          19 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     327          19 :     tmp = fieldFromInstruction(insn, 18, 5);
     328          19 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     329          19 :     tmp = fieldFromInstruction(insn, 11, 5);
     330          19 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     331          19 :     tmp = 0;
     332          19 :     tmp |= fieldFromInstruction(insn, 0, 3) << 1;
     333          19 :     tmp |= fieldFromInstruction(insn, 16, 1) << 0;
     334          38 :     if (decodePredicateOperand(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     335             :     return S;
     336           1 :   case 6:
     337           1 :     tmp = fieldFromInstruction(insn, 11, 5);
     338           1 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     339           1 :     return S;
     340           0 :   case 7:
     341           0 :     tmp = fieldFromInstruction(insn, 18, 5);
     342           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     343           0 :     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           0 :   case 8:
     349           0 :     tmp = fieldFromInstruction(insn, 18, 5);
     350           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     351           0 :     tmp = fieldFromInstruction(insn, 11, 5);
     352           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     353           0 :     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           0 :   case 9:
     359           0 :     tmp = fieldFromInstruction(insn, 23, 5);
     360           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     361           0 :     tmp = fieldFromInstruction(insn, 18, 5);
     362           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     363           0 :     tmp = fieldFromInstruction(insn, 11, 5);
     364           0 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     365           0 :     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           2 :   case 10:
     371           2 :     tmp = fieldFromInstruction(insn, 23, 5);
     372           2 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     373           2 :     tmp = fieldFromInstruction(insn, 18, 5);
     374           2 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     375           2 :     return S;
     376           1 :   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          14 :   case 12:
     381          14 :     tmp = fieldFromInstruction(insn, 2, 23) << 2;
     382          14 :     if (decodeBranch(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     383          14 :     tmp = 0;
     384          14 :     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          14 :   case 13:
     389          14 :     tmp = fieldFromInstruction(insn, 18, 5);
     390          14 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     391          14 :     tmp = 0;
     392          14 :     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          15 :   case 14:
     397          15 :     tmp = fieldFromInstruction(insn, 2, 14) << 2;
     398          45 :     MI.addOperand(MCOperand::createImm(tmp));
     399          15 :     tmp = 0;
     400          15 :     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           3 :   case 15:
     405           3 :     tmp = fieldFromInstruction(insn, 23, 5);
     406           3 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     407           3 :     tmp = 0;
     408           3 :     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          96 :   case 16:
     413          96 :     tmp = fieldFromInstruction(insn, 23, 5);
     414          96 :     if (DecodeGPRRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     415          96 :     tmp = 0;
     416          96 :     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         876 :       CurFieldValue = fieldFromInstruction(insn, Start, Len);
     444             :       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             :       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         140 :       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             :       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           0 :       Ptr += Len;
     492             :       // NumToSkip is a plain 16-bit integer.
     493           0 :       unsigned NumToSkip = *Ptr++;
     494           0 :       NumToSkip |= (*Ptr++) << 8;
     495             :       // Check the predicate.
     496             :       bool Pred;
     497           0 :       if (!(Pred = checkDecoderPredicate(PIdx, Bits)))
     498             :         Ptr += NumToSkip;
     499             :       (void)Pred;
     500             :       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         380 :       Ptr += Len;
     512             : 
     513         380 :       MI.clear();
     514         760 :       MI.setOpcode(Opc);
     515             :       bool DecodeComplete;
     516         380 :       S = decodeToMCInst(S, DecodeIdx, insn, MI, Address, DisAsm, DecodeComplete);
     517             :       assert(DecodeComplete);
     518             : 
     519             :       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           0 :       MCInst TmpMI;
     537           0 :       TmpMI.setOpcode(Opc);
     538             :       bool DecodeComplete;
     539           0 :       S = decodeToMCInst(S, DecodeIdx, insn, TmpMI, Address, DisAsm, DecodeComplete);
     540             :       DEBUG(dbgs() << Loc << ": OPC_TryDecode: opcode " << Opc
     541             :                    << ", using decoder " << DecodeIdx << ": ");
     542             : 
     543           0 :       if (DecodeComplete) {
     544             :         // Decoding complete.
     545             :         DEBUG(dbgs() << (S != MCDisassembler::Fail ? "PASS" : "FAIL") << "\n");
     546           0 :         MI = TmpMI;
     547           0 :         return S;
     548             :       } else {
     549             :         assert(S == MCDisassembler::Fail);
     550             :         // If the decoding was incomplete, skip.
     551           0 :         Ptr += NumToSkip;
     552             :         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           0 :         S = MCDisassembler::Success;
     556             :       }
     557           0 :       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             :       DEBUG(dbgs() << Loc << ": OPC_SoftFail: " << (Fail ? "FAIL\n":"PASS\n"));
     570             :       break;
     571             :     }
     572             :     case MCD::OPC_Fail: {
     573             :       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