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-02-21 06:32:55 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, 119, 0, // Skip to: 126
      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, 166, 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, 160, 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, 161, 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, 162, 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, 163, 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, 164, 1, 0, // Opcode: LOG4
      56             : /* 101 */     MCD::OPC_Decode, 128, 1, 1, // Opcode: ADD_I_LO
      57             : /* 105 */     MCD::OPC_FilterValue, 1, 3, 0, // Skip to: 112
      58             : /* 109 */     MCD::OPC_Decode, 127, 1, // Opcode: ADD_I_HI
      59             : /* 112 */     MCD::OPC_FilterValue, 2, 3, 0, // Skip to: 119
      60             : /* 116 */     MCD::OPC_Decode, 125, 1, // Opcode: ADD_F_I_LO
      61             : /* 119 */     MCD::OPC_FilterValue, 3, 81, 3, // Skip to: 972
      62             : /* 123 */     MCD::OPC_Decode, 124, 1, // Opcode: ADD_F_I_HI
      63             : /* 126 */     MCD::OPC_FilterValue, 1, 31, 0, // Skip to: 161
      64             : /* 130 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      65             : /* 133 */     MCD::OPC_FilterValue, 0, 3, 0, // Skip to: 140
      66             : /* 137 */     MCD::OPC_Decode, 122, 1, // Opcode: ADDC_I_LO
      67             : /* 140 */     MCD::OPC_FilterValue, 1, 3, 0, // Skip to: 147
      68             : /* 144 */     MCD::OPC_Decode, 121, 1, // Opcode: ADDC_I_HI
      69             : /* 147 */     MCD::OPC_FilterValue, 2, 3, 0, // Skip to: 154
      70             : /* 151 */     MCD::OPC_Decode, 119, 1, // Opcode: ADDC_F_I_LO
      71             : /* 154 */     MCD::OPC_FilterValue, 3, 46, 3, // Skip to: 972
      72             : /* 158 */     MCD::OPC_Decode, 118, 1, // Opcode: ADDC_F_I_HI
      73             : /* 161 */     MCD::OPC_FilterValue, 2, 35, 0, // Skip to: 200
      74             : /* 165 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      75             : /* 168 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 176
      76             : /* 172 */     MCD::OPC_Decode, 206, 1, 1, // Opcode: SUB_I_LO
      77             : /* 176 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 184
      78             : /* 180 */     MCD::OPC_Decode, 205, 1, 1, // Opcode: SUB_I_HI
      79             : /* 184 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 192
      80             : /* 188 */     MCD::OPC_Decode, 203, 1, 1, // Opcode: SUB_F_I_LO
      81             : /* 192 */     MCD::OPC_FilterValue, 3, 8, 3, // Skip to: 972
      82             : /* 196 */     MCD::OPC_Decode, 202, 1, 1, // Opcode: SUB_F_I_HI
      83             : /* 200 */     MCD::OPC_FilterValue, 3, 35, 0, // Skip to: 239
      84             : /* 204 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      85             : /* 207 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 215
      86             : /* 211 */     MCD::OPC_Decode, 200, 1, 1, // Opcode: SUBB_I_LO
      87             : /* 215 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 223
      88             : /* 219 */     MCD::OPC_Decode, 199, 1, 1, // Opcode: SUBB_I_HI
      89             : /* 223 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 231
      90             : /* 227 */     MCD::OPC_Decode, 197, 1, 1, // Opcode: SUBB_F_I_LO
      91             : /* 231 */     MCD::OPC_FilterValue, 3, 225, 2, // Skip to: 972
      92             : /* 235 */     MCD::OPC_Decode, 196, 1, 1, // Opcode: SUBB_F_I_HI
      93             : /* 239 */     MCD::OPC_FilterValue, 4, 35, 0, // Skip to: 278
      94             : /* 243 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
      95             : /* 246 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 254
      96             : /* 250 */     MCD::OPC_Decode, 137, 1, 1, // Opcode: AND_I_LO
      97             : /* 254 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 262
      98             : /* 258 */     MCD::OPC_Decode, 136, 1, 1, // Opcode: AND_I_HI
      99             : /* 262 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 270
     100             : /* 266 */     MCD::OPC_Decode, 134, 1, 1, // Opcode: AND_F_I_LO
     101             : /* 270 */     MCD::OPC_FilterValue, 3, 186, 2, // Skip to: 972
     102             : /* 274 */     MCD::OPC_Decode, 133, 1, 1, // Opcode: AND_F_I_HI
     103             : /* 278 */     MCD::OPC_FilterValue, 5, 35, 0, // Skip to: 317
     104             : /* 282 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
     105             : /* 285 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 293
     106             : /* 289 */     MCD::OPC_Decode, 171, 1, 1, // Opcode: OR_I_LO
     107             : /* 293 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 301
     108             : /* 297 */     MCD::OPC_Decode, 170, 1, 1, // Opcode: OR_I_HI
     109             : /* 301 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 309
     110             : /* 305 */     MCD::OPC_Decode, 168, 1, 1, // Opcode: OR_F_I_LO
     111             : /* 309 */     MCD::OPC_FilterValue, 3, 147, 2, // Skip to: 972
     112             : /* 313 */     MCD::OPC_Decode, 167, 1, 1, // Opcode: OR_F_I_HI
     113             : /* 317 */     MCD::OPC_FilterValue, 6, 35, 0, // Skip to: 356
     114             : /* 321 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
     115             : /* 324 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 332
     116             : /* 328 */     MCD::OPC_Decode, 215, 1, 1, // Opcode: XOR_I_LO
     117             : /* 332 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 340
     118             : /* 336 */     MCD::OPC_Decode, 214, 1, 1, // Opcode: XOR_I_HI
     119             : /* 340 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 348
     120             : /* 344 */     MCD::OPC_Decode, 212, 1, 1, // Opcode: XOR_F_I_LO
     121             : /* 348 */     MCD::OPC_FilterValue, 3, 108, 2, // Skip to: 972
     122             : /* 352 */     MCD::OPC_Decode, 211, 1, 1, // Opcode: XOR_F_I_HI
     123             : /* 356 */     MCD::OPC_FilterValue, 7, 35, 0, // Skip to: 395
     124             : /* 360 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
     125             : /* 363 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 371
     126             : /* 367 */     MCD::OPC_Decode, 186, 1, 2, // Opcode: SL_I
     127             : /* 371 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 379
     128             : /* 375 */     MCD::OPC_Decode, 176, 1, 2, // Opcode: SA_I
     129             : /* 379 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 387
     130             : /* 383 */     MCD::OPC_Decode, 185, 1, 2, // Opcode: SL_F_I
     131             : /* 387 */     MCD::OPC_FilterValue, 3, 69, 2, // Skip to: 972
     132             : /* 391 */     MCD::OPC_Decode, 175, 1, 2, // Opcode: SA_F_I
     133             : /* 395 */     MCD::OPC_FilterValue, 8, 17, 0, // Skip to: 416
     134             : /* 399 */     MCD::OPC_CheckField, 0, 28, 252, 255, 219, 8, 4, 0, // Skip to: 412
     135             : /* 408 */     MCD::OPC_Decode, 174, 1, 0, // Opcode: RET
     136             : /* 412 */     MCD::OPC_Decode, 156, 1, 3, // Opcode: LDW_RI
     137             : /* 416 */     MCD::OPC_FilterValue, 9, 4, 0, // Skip to: 424
     138             : /* 420 */     MCD::OPC_Decode, 208, 1, 3, // Opcode: SW_RI
     139             : /* 424 */     MCD::OPC_FilterValue, 10, 51, 0, // Skip to: 479
     140             : /* 428 */     MCD::OPC_ExtractField, 0, 3,  // Inst{2-0} ...
     141             : /* 431 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 439
     142             : /* 435 */     MCD::OPC_Decode, 153, 1, 4, // Opcode: LDHs_RR
     143             : /* 439 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 447
     144             : /* 443 */     MCD::OPC_Decode, 155, 1, 4, // Opcode: LDHz_RR
     145             : /* 447 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 455
     146             : /* 451 */     MCD::OPC_Decode, 157, 1, 4, // Opcode: LDW_RR
     147             : /* 455 */     MCD::OPC_FilterValue, 3, 4, 0, // Skip to: 463
     148             : /* 459 */     MCD::OPC_Decode, 158, 1, 4, // Opcode: LDWz_RR
     149             : /* 463 */     MCD::OPC_FilterValue, 4, 4, 0, // Skip to: 471
     150             : /* 467 */     MCD::OPC_Decode, 149, 1, 4, // Opcode: LDBs_RR
     151             : /* 471 */     MCD::OPC_FilterValue, 5, 241, 1, // Skip to: 972
     152             : /* 475 */     MCD::OPC_Decode, 151, 1, 4, // Opcode: LDBz_RR
     153             : /* 479 */     MCD::OPC_FilterValue, 11, 27, 0, // Skip to: 510
     154             : /* 483 */     MCD::OPC_ExtractField, 0, 3,  // Inst{2-0} ...
     155             : /* 486 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 494
     156             : /* 490 */     MCD::OPC_Decode, 195, 1, 4, // Opcode: STH_RR
     157             : /* 494 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 502
     158             : /* 498 */     MCD::OPC_Decode, 209, 1, 4, // Opcode: SW_RR
     159             : /* 502 */     MCD::OPC_FilterValue, 4, 210, 1, // Skip to: 972
     160             : /* 506 */     MCD::OPC_Decode, 193, 1, 4, // Opcode: STB_RR
     161             : /* 510 */     MCD::OPC_FilterValue, 12, 19, 1, // Skip to: 789
     162             : /* 514 */     MCD::OPC_ExtractField, 3, 8,  // Inst{10-3} ...
     163             : /* 517 */     MCD::OPC_FilterValue, 0, 18, 0, // Skip to: 539
     164             : /* 521 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     165             : /* 524 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 532
     166             : /* 528 */     MCD::OPC_Decode, 129, 1, 5, // Opcode: ADD_R
     167             : /* 532 */     MCD::OPC_FilterValue, 1, 180, 1, // Skip to: 972
     168             : /* 536 */     MCD::OPC_Decode, 126, 5, // Opcode: ADD_F_R
     169             : /* 539 */     MCD::OPC_FilterValue, 32, 17, 0, // Skip to: 560
     170             : /* 543 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     171             : /* 546 */     MCD::OPC_FilterValue, 0, 3, 0, // Skip to: 553
     172             : /* 550 */     MCD::OPC_Decode, 123, 5, // Opcode: ADDC_R
     173             : /* 553 */     MCD::OPC_FilterValue, 1, 159, 1, // Skip to: 972
     174             : /* 557 */     MCD::OPC_Decode, 120, 5, // Opcode: ADDC_F_R
     175             : /* 560 */     MCD::OPC_FilterValue, 64, 19, 0, // Skip to: 583
     176             : /* 564 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     177             : /* 567 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 575
     178             : /* 571 */     MCD::OPC_Decode, 207, 1, 5, // Opcode: SUB_R
     179             : /* 575 */     MCD::OPC_FilterValue, 1, 137, 1, // Skip to: 972
     180             : /* 579 */     MCD::OPC_Decode, 204, 1, 5, // Opcode: SUB_F_R
     181             : /* 583 */     MCD::OPC_FilterValue, 96, 19, 0, // Skip to: 606
     182             : /* 587 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     183             : /* 590 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 598
     184             : /* 594 */     MCD::OPC_Decode, 201, 1, 5, // Opcode: SUBB_R
     185             : /* 598 */     MCD::OPC_FilterValue, 1, 114, 1, // Skip to: 972
     186             : /* 602 */     MCD::OPC_Decode, 198, 1, 5, // Opcode: SUBB_F_R
     187             : /* 606 */     MCD::OPC_FilterValue, 128, 1, 19, 0, // Skip to: 630
     188             : /* 611 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     189             : /* 614 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 622
     190             : /* 618 */     MCD::OPC_Decode, 138, 1, 5, // Opcode: AND_R
     191             : /* 622 */     MCD::OPC_FilterValue, 1, 90, 1, // Skip to: 972
     192             : /* 626 */     MCD::OPC_Decode, 135, 1, 5, // Opcode: AND_F_R
     193             : /* 630 */     MCD::OPC_FilterValue, 160, 1, 67, 0, // Skip to: 702
     194             : /* 635 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     195             : /* 638 */     MCD::OPC_FilterValue, 0, 52, 0, // Skip to: 694
     196             : /* 642 */     MCD::OPC_CheckField, 18, 10, 64, 16, 0, // Skip to: 664
     197             : /* 648 */     MCD::OPC_CheckField, 16, 1, 0, 10, 0, // Skip to: 664
     198             : /* 654 */     MCD::OPC_CheckField, 0, 3, 0, 4, 0, // Skip to: 664
     199             : /* 660 */     MCD::OPC_Decode, 146, 1, 6, // Opcode: JR
     200             : /* 664 */     MCD::OPC_CheckField, 23, 5, 2, 10, 0, // Skip to: 680
     201             : /* 670 */     MCD::OPC_CheckField, 11, 5, 0, 4, 0, // Skip to: 680
     202             : /* 676 */     MCD::OPC_Decode, 140, 1, 7, // Opcode: BRIND_CC
     203             : /* 680 */     MCD::OPC_CheckField, 23, 5, 2, 4, 0, // Skip to: 690
     204             : /* 686 */     MCD::OPC_Decode, 141, 1, 8, // Opcode: BRIND_CCA
     205             : /* 690 */     MCD::OPC_Decode, 172, 1, 5, // Opcode: OR_R
     206             : /* 694 */     MCD::OPC_FilterValue, 1, 18, 1, // Skip to: 972
     207             : /* 698 */     MCD::OPC_Decode, 169, 1, 5, // Opcode: OR_F_R
     208             : /* 702 */     MCD::OPC_FilterValue, 192, 1, 19, 0, // Skip to: 726
     209             : /* 707 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     210             : /* 710 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 718
     211             : /* 714 */     MCD::OPC_Decode, 216, 1, 5, // Opcode: XOR_R
     212             : /* 718 */     MCD::OPC_FilterValue, 1, 250, 0, // Skip to: 972
     213             : /* 722 */     MCD::OPC_Decode, 213, 1, 5, // Opcode: XOR_F_R
     214             : /* 726 */     MCD::OPC_FilterValue, 224, 1, 10, 0, // Skip to: 741
     215             : /* 731 */     MCD::OPC_CheckField, 17, 1, 0, 235, 0, // Skip to: 972
     216             : /* 737 */     MCD::OPC_Decode, 178, 1, 9, // Opcode: SELECT
     217             : /* 741 */     MCD::OPC_FilterValue, 240, 1, 19, 0, // Skip to: 765
     218             : /* 746 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     219             : /* 749 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 757
     220             : /* 753 */     MCD::OPC_Decode, 183, 1, 5, // Opcode: SHL_R
     221             : /* 757 */     MCD::OPC_FilterValue, 1, 211, 0, // Skip to: 972
     222             : /* 761 */     MCD::OPC_Decode, 182, 1, 5, // Opcode: SHL_F_R
     223             : /* 765 */     MCD::OPC_FilterValue, 248, 1, 202, 0, // Skip to: 972
     224             : /* 770 */     MCD::OPC_ExtractField, 17, 1,  // Inst{17} ...
     225             : /* 773 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 781
     226             : /* 777 */     MCD::OPC_Decode, 188, 1, 5, // Opcode: SRA_R
     227             : /* 781 */     MCD::OPC_FilterValue, 1, 187, 0, // Skip to: 972
     228             : /* 785 */     MCD::OPC_Decode, 187, 1, 5, // Opcode: SRA_F_R
     229             : /* 789 */     MCD::OPC_FilterValue, 13, 27, 0, // Skip to: 820
     230             : /* 793 */     MCD::OPC_ExtractField, 0, 18,  // Inst{17-0} ...
     231             : /* 796 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 804
     232             : /* 800 */     MCD::OPC_Decode, 173, 1, 10, // Opcode: POPC
     233             : /* 804 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 812
     234             : /* 808 */     MCD::OPC_Decode, 159, 1, 10, // Opcode: LEADZ
     235             : /* 812 */     MCD::OPC_FilterValue, 3, 156, 0, // Skip to: 972
     236             : /* 816 */     MCD::OPC_Decode, 210, 1, 10, // Opcode: TRAILZ
     237             : /* 820 */     MCD::OPC_FilterValue, 14, 62, 0, // Skip to: 886
     238             : /* 824 */     MCD::OPC_ExtractField, 1, 1,  // Inst{1} ...
     239             : /* 827 */     MCD::OPC_FilterValue, 0, 20, 0, // Skip to: 851
     240             : /* 831 */     MCD::OPC_CheckField, 25, 3, 0, 10, 0, // Skip to: 847
     241             : /* 837 */     MCD::OPC_CheckField, 0, 1, 0, 4, 0, // Skip to: 847
     242             : /* 843 */     MCD::OPC_Decode, 143, 1, 11, // Opcode: BT
     243             : /* 847 */     MCD::OPC_Decode, 139, 1, 12, // Opcode: BRCC
     244             : /* 851 */     MCD::OPC_FilterValue, 1, 117, 0, // Skip to: 972
     245             : /* 855 */     MCD::OPC_ExtractField, 23, 2,  // Inst{24-23} ...
     246             : /* 858 */     MCD::OPC_FilterValue, 0, 10, 0, // Skip to: 872
     247             : /* 862 */     MCD::OPC_CheckField, 2, 16, 0, 104, 0, // Skip to: 972
     248             : /* 868 */     MCD::OPC_Decode, 177, 1, 13, // Opcode: SCC
     249             : /* 872 */     MCD::OPC_FilterValue, 2, 96, 0, // Skip to: 972
     250             : /* 876 */     MCD::OPC_CheckField, 16, 7, 0, 90, 0, // Skip to: 972
     251             : /* 882 */     MCD::OPC_Decode, 142, 1, 14, // Opcode: BRR
     252             : /* 886 */     MCD::OPC_FilterValue, 15, 82, 0, // Skip to: 972
     253             : /* 890 */     MCD::OPC_ExtractField, 16, 2,  // Inst{17-16} ...
     254             : /* 893 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 901
     255             : /* 897 */     MCD::OPC_Decode, 147, 1, 15, // Opcode: LDADDR
     256             : /* 901 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 909
     257             : /* 905 */     MCD::OPC_Decode, 191, 1, 15, // Opcode: STADDR
     258             : /* 909 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 917
     259             : /* 913 */     MCD::OPC_Decode, 184, 1, 15, // Opcode: SLI
     260             : /* 917 */     MCD::OPC_FilterValue, 3, 51, 0, // Skip to: 972
     261             : /* 921 */     MCD::OPC_ExtractField, 12, 4,  // Inst{15-12} ...
     262             : /* 924 */     MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 932
     263             : /* 928 */     MCD::OPC_Decode, 152, 1, 16, // Opcode: LDHs_RI
     264             : /* 932 */     MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 940
     265             : /* 936 */     MCD::OPC_Decode, 154, 1, 16, // Opcode: LDHz_RI
     266             : /* 940 */     MCD::OPC_FilterValue, 2, 4, 0, // Skip to: 948
     267             : /* 944 */     MCD::OPC_Decode, 194, 1, 16, // Opcode: STH_RI
     268             : /* 948 */     MCD::OPC_FilterValue, 4, 4, 0, // Skip to: 956
     269             : /* 952 */     MCD::OPC_Decode, 148, 1, 16, // Opcode: LDBs_RI
     270             : /* 956 */     MCD::OPC_FilterValue, 5, 4, 0, // Skip to: 964
     271             : /* 960 */     MCD::OPC_Decode, 150, 1, 16, // Opcode: LDBz_RI
     272             : /* 964 */     MCD::OPC_FilterValue, 6, 4, 0, // Skip to: 972
     273             : /* 968 */     MCD::OPC_Decode, 192, 1, 16, // Opcode: STB_RI
     274             : /* 972 */     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             :       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             :       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             :       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             :       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             :       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             :       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             :         MI = TmpMI;
     547             :         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             :         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             :       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