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

          Line data    Source code
       1             : /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
       2             : |*                                                                            *|
       3             : |*  * AVR Disassembler                                                        *|
       4             : |*                                                                            *|
       5             : |* Automatically generated file, do not edit!                                 *|
       6             : |*                                                                            *|
       7             : \*===----------------------------------------------------------------------===*/
       8             : 
       9             : #include "llvm/MC/MCInst.h"
      10             : #include "llvm/Support/Debug.h"
      11             : #include "llvm/Support/DataTypes.h"
      12             : #include "llvm/Support/LEB128.h"
      13             : #include "llvm/Support/raw_ostream.h"
      14             : #include <assert.h>
      15             : 
      16             : namespace llvm {
      17             : 
      18             : // Helper function for extracting fields from encoded instructions.
      19             : template<typename InsnType>
      20             : #if defined(_MSC_VER) && !defined(__clang__)
      21             : __declspec(noinline)
      22             : #endif
      23             : static InsnType fieldFromInstruction(InsnType insn, unsigned startBit,
      24             :                                      unsigned numBits) {
      25             :     assert(startBit + numBits <= (sizeof(InsnType)*8) &&
      26             :            "Instruction field out of bounds!");
      27             :     InsnType fieldMask;
      28           0 :     if (numBits == sizeof(InsnType)*8)
      29             :       fieldMask = (InsnType)(-1LL);
      30             :     else
      31           0 :       fieldMask = (((InsnType)1 << numBits) - 1) << startBit;
      32           0 :     return (insn & fieldMask) >> startBit;
      33             : }
      34             : 
      35             : static const uint8_t DecoderTable16[] = {
      36             : /* 0 */       MCD::OPC_ExtractField, 14, 2,  // Inst{15-14} ...
      37             : /* 3 */       MCD::OPC_FilterValue, 0, 5, 1, 0, // Skip to: 269
      38             : /* 8 */       MCD::OPC_ExtractField, 12, 2,  // Inst{13-12} ...
      39             : /* 11 */      MCD::OPC_FilterValue, 0, 156, 0, 0, // Skip to: 172
      40             : /* 16 */      MCD::OPC_ExtractField, 10, 2,  // Inst{11-10} ...
      41             : /* 19 */      MCD::OPC_FilterValue, 0, 121, 0, 0, // Skip to: 145
      42             : /* 24 */      MCD::OPC_ExtractField, 8, 2,  // Inst{9-8} ...
      43             : /* 27 */      MCD::OPC_FilterValue, 0, 11, 0, 0, // Skip to: 43
      44             : /* 32 */      MCD::OPC_CheckField, 0, 8, 0, 48, 5, 0, // Skip to: 1367
      45             : /* 39 */      MCD::OPC_Decode, 146, 2, 0, // Opcode: NOP
      46             : /* 43 */      MCD::OPC_FilterValue, 1, 9, 0, 0, // Skip to: 57
      47             : /* 48 */      MCD::OPC_CheckPredicate, 0, 34, 5, 0, // Skip to: 1367
      48             : /* 53 */      MCD::OPC_Decode, 141, 2, 0, // Opcode: MOVWRdRr
      49             : /* 57 */      MCD::OPC_FilterValue, 2, 9, 0, 0, // Skip to: 71
      50             : /* 62 */      MCD::OPC_CheckPredicate, 1, 20, 5, 0, // Skip to: 1367
      51             : /* 67 */      MCD::OPC_Decode, 143, 2, 0, // Opcode: MULSRdRr
      52             : /* 71 */      MCD::OPC_FilterValue, 3, 11, 5, 0, // Skip to: 1367
      53             : /* 76 */      MCD::OPC_ExtractField, 3, 1,  // Inst{3} ...
      54             : /* 79 */      MCD::OPC_FilterValue, 0, 16, 0, 0, // Skip to: 100
      55             : /* 84 */      MCD::OPC_CheckPredicate, 1, 47, 0, 0, // Skip to: 136
      56             : /* 89 */      MCD::OPC_CheckField, 7, 1, 1, 40, 0, 0, // Skip to: 136
      57             : /* 96 */      MCD::OPC_Decode, 248, 1, 0, // Opcode: FMULS
      58             : /* 100 */     MCD::OPC_FilterValue, 1, 31, 0, 0, // Skip to: 136
      59             : /* 105 */     MCD::OPC_ExtractField, 7, 1,  // Inst{7} ...
      60             : /* 108 */     MCD::OPC_FilterValue, 0, 9, 0, 0, // Skip to: 122
      61             : /* 113 */     MCD::OPC_CheckPredicate, 1, 18, 0, 0, // Skip to: 136
      62             : /* 118 */     MCD::OPC_Decode, 247, 1, 0, // Opcode: FMUL
      63             : /* 122 */     MCD::OPC_FilterValue, 1, 9, 0, 0, // Skip to: 136
      64             : /* 127 */     MCD::OPC_CheckPredicate, 1, 4, 0, 0, // Skip to: 136
      65             : /* 132 */     MCD::OPC_Decode, 249, 1, 0, // Opcode: FMULSU
      66             : /* 136 */     MCD::OPC_CheckPredicate, 1, 202, 4, 0, // Skip to: 1367
      67             : /* 141 */     MCD::OPC_Decode, 144, 2, 0, // Opcode: MULSURdRr
      68             : /* 145 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 154
      69             : /* 150 */     MCD::OPC_Decode, 235, 1, 1, // Opcode: CPCRdRr
      70             : /* 154 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 163
      71             : /* 159 */     MCD::OPC_Decode, 158, 2, 2, // Opcode: SBCRdRr
      72             : /* 163 */     MCD::OPC_FilterValue, 3, 175, 4, 0, // Skip to: 1367
      73             : /* 168 */     MCD::OPC_Decode, 211, 1, 2, // Opcode: ADDRdRr
      74             : /* 172 */     MCD::OPC_FilterValue, 1, 39, 0, 0, // Skip to: 216
      75             : /* 177 */     MCD::OPC_ExtractField, 10, 2,  // Inst{11-10} ...
      76             : /* 180 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 189
      77             : /* 185 */     MCD::OPC_Decode, 238, 1, 1, // Opcode: CPSE
      78             : /* 189 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 198
      79             : /* 194 */     MCD::OPC_Decode, 237, 1, 1, // Opcode: CPRdRr
      80             : /* 198 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 207
      81             : /* 203 */     MCD::OPC_Decode, 174, 2, 2, // Opcode: SUBRdRr
      82             : /* 207 */     MCD::OPC_FilterValue, 3, 131, 4, 0, // Skip to: 1367
      83             : /* 212 */     MCD::OPC_Decode, 210, 1, 2, // Opcode: ADCRdRr
      84             : /* 216 */     MCD::OPC_FilterValue, 2, 39, 0, 0, // Skip to: 260
      85             : /* 221 */     MCD::OPC_ExtractField, 10, 2,  // Inst{11-10} ...
      86             : /* 224 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 233
      87             : /* 229 */     MCD::OPC_Decode, 214, 1, 2, // Opcode: ANDRdRr
      88             : /* 233 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 242
      89             : /* 238 */     MCD::OPC_Decode, 246, 1, 2, // Opcode: EORRdRr
      90             : /* 242 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 251
      91             : /* 247 */     MCD::OPC_Decode, 148, 2, 2, // Opcode: ORRdRr
      92             : /* 251 */     MCD::OPC_FilterValue, 3, 87, 4, 0, // Skip to: 1367
      93             : /* 256 */     MCD::OPC_Decode, 140, 2, 1, // Opcode: MOVRdRr
      94             : /* 260 */     MCD::OPC_FilterValue, 3, 78, 4, 0, // Skip to: 1367
      95             : /* 265 */     MCD::OPC_Decode, 236, 1, 3, // Opcode: CPIRdK
      96             : /* 269 */     MCD::OPC_FilterValue, 1, 35, 0, 0, // Skip to: 309
      97             : /* 274 */     MCD::OPC_ExtractField, 12, 2,  // Inst{13-12} ...
      98             : /* 277 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 286
      99             : /* 282 */     MCD::OPC_Decode, 157, 2, 4, // Opcode: SBCIRdK
     100             : /* 286 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 295
     101             : /* 291 */     MCD::OPC_Decode, 173, 2, 4, // Opcode: SUBIRdK
     102             : /* 295 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 304
     103             : /* 300 */     MCD::OPC_Decode, 147, 2, 4, // Opcode: ORIRdK
     104             : /* 304 */     MCD::OPC_FilterValue, 3, 34, 4, 0, // Skip to: 1367
     105             : /* 309 */     MCD::OPC_FilterValue, 2, 66, 3, 0, // Skip to: 1148
     106             : /* 314 */     MCD::OPC_ExtractField, 12, 1,  // Inst{12} ...
     107             : /* 317 */     MCD::OPC_FilterValue, 0, 205, 0, 0, // Skip to: 527
     108             : /* 322 */     MCD::OPC_ExtractField, 9, 1,  // Inst{9} ...
     109             : /* 325 */     MCD::OPC_FilterValue, 0, 96, 0, 0, // Skip to: 426
     110             : /* 330 */     MCD::OPC_ExtractField, 0, 2,  // Inst{1-0} ...
     111             : /* 333 */     MCD::OPC_FilterValue, 0, 23, 0, 0, // Skip to: 361
     112             : /* 338 */     MCD::OPC_CheckPredicate, 2, 74, 0, 0, // Skip to: 417
     113             : /* 343 */     MCD::OPC_CheckField, 13, 1, 0, 67, 0, 0, // Skip to: 417
     114             : /* 350 */     MCD::OPC_CheckField, 10, 2, 0, 60, 0, 0, // Skip to: 417
     115             : /* 357 */     MCD::OPC_Decode, 132, 2, 5, // Opcode: LDRdPtr
     116             : /* 361 */     MCD::OPC_FilterValue, 1, 23, 0, 0, // Skip to: 389
     117             : /* 366 */     MCD::OPC_CheckPredicate, 2, 46, 0, 0, // Skip to: 417
     118             : /* 371 */     MCD::OPC_CheckField, 13, 1, 0, 39, 0, 0, // Skip to: 417
     119             : /* 378 */     MCD::OPC_CheckField, 10, 2, 0, 32, 0, 0, // Skip to: 417
     120             : /* 385 */     MCD::OPC_Decode, 134, 2, 6, // Opcode: LDRdPtrPi
     121             : /* 389 */     MCD::OPC_FilterValue, 2, 23, 0, 0, // Skip to: 417
     122             : /* 394 */     MCD::OPC_CheckPredicate, 2, 18, 0, 0, // Skip to: 417
     123             : /* 399 */     MCD::OPC_CheckField, 13, 1, 0, 11, 0, 0, // Skip to: 417
     124             : /* 406 */     MCD::OPC_CheckField, 10, 2, 0, 4, 0, 0, // Skip to: 417
     125             : /* 413 */     MCD::OPC_Decode, 133, 2, 6, // Opcode: LDRdPtrPd
     126             : /* 417 */     MCD::OPC_CheckPredicate, 2, 177, 3, 0, // Skip to: 1367
     127             : /* 422 */     MCD::OPC_Decode, 130, 2, 7, // Opcode: LDDRdPtrQ
     128             : /* 426 */     MCD::OPC_FilterValue, 1, 168, 3, 0, // Skip to: 1367
     129             : /* 431 */     MCD::OPC_ExtractField, 0, 2,  // Inst{1-0} ...
     130             : /* 434 */     MCD::OPC_FilterValue, 0, 23, 0, 0, // Skip to: 462
     131             : /* 439 */     MCD::OPC_CheckPredicate, 2, 74, 0, 0, // Skip to: 518
     132             : /* 444 */     MCD::OPC_CheckField, 13, 1, 0, 67, 0, 0, // Skip to: 518
     133             : /* 451 */     MCD::OPC_CheckField, 10, 2, 0, 60, 0, 0, // Skip to: 518
     134             : /* 458 */     MCD::OPC_Decode, 171, 2, 8, // Opcode: STPtrRr
     135             : /* 462 */     MCD::OPC_FilterValue, 1, 23, 0, 0, // Skip to: 490
     136             : /* 467 */     MCD::OPC_CheckPredicate, 2, 46, 0, 0, // Skip to: 518
     137             : /* 472 */     MCD::OPC_CheckField, 13, 1, 0, 39, 0, 0, // Skip to: 518
     138             : /* 479 */     MCD::OPC_CheckField, 10, 2, 0, 32, 0, 0, // Skip to: 518
     139             : /* 486 */     MCD::OPC_Decode, 170, 2, 9, // Opcode: STPtrPiRr
     140             : /* 490 */     MCD::OPC_FilterValue, 2, 23, 0, 0, // Skip to: 518
     141             : /* 495 */     MCD::OPC_CheckPredicate, 2, 18, 0, 0, // Skip to: 518
     142             : /* 500 */     MCD::OPC_CheckField, 13, 1, 0, 11, 0, 0, // Skip to: 518
     143             : /* 507 */     MCD::OPC_CheckField, 10, 2, 0, 4, 0, 0, // Skip to: 518
     144             : /* 514 */     MCD::OPC_Decode, 169, 2, 9, // Opcode: STPtrPdRr
     145             : /* 518 */     MCD::OPC_CheckPredicate, 2, 76, 3, 0, // Skip to: 1367
     146             : /* 523 */     MCD::OPC_Decode, 168, 2, 10, // Opcode: STDPtrQRr
     147             : /* 527 */     MCD::OPC_FilterValue, 1, 67, 3, 0, // Skip to: 1367
     148             : /* 532 */     MCD::OPC_ExtractField, 11, 1,  // Inst{11} ...
     149             : /* 535 */     MCD::OPC_FilterValue, 0, 13, 2, 0, // Skip to: 1065
     150             : /* 540 */     MCD::OPC_ExtractField, 13, 1,  // Inst{13} ...
     151             : /* 543 */     MCD::OPC_FilterValue, 0, 252, 1, 0, // Skip to: 1056
     152             : /* 548 */     MCD::OPC_ExtractField, 9, 2,  // Inst{10-9} ...
     153             : /* 551 */     MCD::OPC_FilterValue, 0, 73, 0, 0, // Skip to: 629
     154             : /* 556 */     MCD::OPC_ExtractField, 0, 4,  // Inst{3-0} ...
     155             : /* 559 */     MCD::OPC_FilterValue, 4, 9, 0, 0, // Skip to: 573
     156             : /* 564 */     MCD::OPC_CheckPredicate, 3, 30, 3, 0, // Skip to: 1367
     157             : /* 569 */     MCD::OPC_Decode, 137, 2, 0, // Opcode: LPMRdZ
     158             : /* 573 */     MCD::OPC_FilterValue, 5, 9, 0, 0, // Skip to: 587
     159             : /* 578 */     MCD::OPC_CheckPredicate, 3, 16, 3, 0, // Skip to: 1367
     160             : /* 583 */     MCD::OPC_Decode, 138, 2, 0, // Opcode: LPMRdZPi
     161             : /* 587 */     MCD::OPC_FilterValue, 6, 9, 0, 0, // Skip to: 601
     162             : /* 592 */     MCD::OPC_CheckPredicate, 4, 2, 3, 0, // Skip to: 1367
     163             : /* 597 */     MCD::OPC_Decode, 244, 1, 0, // Opcode: ELPMRdZ
     164             : /* 601 */     MCD::OPC_FilterValue, 7, 9, 0, 0, // Skip to: 615
     165             : /* 606 */     MCD::OPC_CheckPredicate, 4, 244, 2, 0, // Skip to: 1367
     166             : /* 611 */     MCD::OPC_Decode, 245, 1, 0, // Opcode: ELPMRdZPi
     167             : /* 615 */     MCD::OPC_FilterValue, 15, 235, 2, 0, // Skip to: 1367
     168             : /* 620 */     MCD::OPC_CheckPredicate, 2, 230, 2, 0, // Skip to: 1367
     169             : /* 625 */     MCD::OPC_Decode, 150, 2, 0, // Opcode: POPRd
     170             : /* 629 */     MCD::OPC_FilterValue, 1, 73, 0, 0, // Skip to: 707
     171             : /* 634 */     MCD::OPC_ExtractField, 0, 4,  // Inst{3-0} ...
     172             : /* 637 */     MCD::OPC_FilterValue, 4, 9, 0, 0, // Skip to: 651
     173             : /* 642 */     MCD::OPC_CheckPredicate, 5, 208, 2, 0, // Skip to: 1367
     174             : /* 647 */     MCD::OPC_Decode, 177, 2, 11, // Opcode: XCHZRd
     175             : /* 651 */     MCD::OPC_FilterValue, 5, 9, 0, 0, // Skip to: 665
     176             : /* 656 */     MCD::OPC_CheckPredicate, 5, 194, 2, 0, // Skip to: 1367
     177             : /* 661 */     MCD::OPC_Decode, 128, 2, 11, // Opcode: LASZRd
     178             : /* 665 */     MCD::OPC_FilterValue, 6, 9, 0, 0, // Skip to: 679
     179             : /* 670 */     MCD::OPC_CheckPredicate, 5, 180, 2, 0, // Skip to: 1367
     180             : /* 675 */     MCD::OPC_Decode, 255, 1, 11, // Opcode: LACZRd
     181             : /* 679 */     MCD::OPC_FilterValue, 7, 9, 0, 0, // Skip to: 693
     182             : /* 684 */     MCD::OPC_CheckPredicate, 5, 166, 2, 0, // Skip to: 1367
     183             : /* 689 */     MCD::OPC_Decode, 129, 2, 11, // Opcode: LATZRd
     184             : /* 693 */     MCD::OPC_FilterValue, 15, 157, 2, 0, // Skip to: 1367
     185             : /* 698 */     MCD::OPC_CheckPredicate, 2, 152, 2, 0, // Skip to: 1367
     186             : /* 703 */     MCD::OPC_Decode, 151, 2, 0, // Opcode: PUSHRr
     187             : /* 707 */     MCD::OPC_FilterValue, 2, 52, 1, 0, // Skip to: 1020
     188             : /* 712 */     MCD::OPC_ExtractField, 0, 4,  // Inst{3-0} ...
     189             : /* 715 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 724
     190             : /* 720 */     MCD::OPC_Decode, 234, 1, 0, // Opcode: COMRd
     191             : /* 724 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 733
     192             : /* 729 */     MCD::OPC_Decode, 145, 2, 0, // Opcode: NEGRd
     193             : /* 733 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 742
     194             : /* 738 */     MCD::OPC_Decode, 175, 2, 0, // Opcode: SWAPRd
     195             : /* 742 */     MCD::OPC_FilterValue, 3, 4, 0, 0, // Skip to: 751
     196             : /* 747 */     MCD::OPC_Decode, 252, 1, 0, // Opcode: INCRd
     197             : /* 751 */     MCD::OPC_FilterValue, 5, 4, 0, 0, // Skip to: 760
     198             : /* 756 */     MCD::OPC_Decode, 215, 1, 0, // Opcode: ASRRd
     199             : /* 760 */     MCD::OPC_FilterValue, 6, 4, 0, 0, // Skip to: 769
     200             : /* 765 */     MCD::OPC_Decode, 139, 2, 0, // Opcode: LSRRd
     201             : /* 769 */     MCD::OPC_FilterValue, 7, 4, 0, 0, // Skip to: 778
     202             : /* 774 */     MCD::OPC_Decode, 156, 2, 0, // Opcode: RORRd
     203             : /* 778 */     MCD::OPC_FilterValue, 8, 143, 0, 0, // Skip to: 926
     204             : /* 783 */     MCD::OPC_ExtractField, 7, 2,  // Inst{8-7} ...
     205             : /* 786 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 795
     206             : /* 791 */     MCD::OPC_Decode, 229, 1, 12, // Opcode: BSETs
     207             : /* 795 */     MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 804
     208             : /* 800 */     MCD::OPC_Decode, 216, 1, 12, // Opcode: BCLRs
     209             : /* 804 */     MCD::OPC_FilterValue, 2, 21, 0, 0, // Skip to: 830
     210             : /* 809 */     MCD::OPC_ExtractField, 4, 3,  // Inst{6-4} ...
     211             : /* 812 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 821
     212             : /* 817 */     MCD::OPC_Decode, 153, 2, 0, // Opcode: RET
     213             : /* 821 */     MCD::OPC_FilterValue, 1, 29, 2, 0, // Skip to: 1367
     214             : /* 826 */     MCD::OPC_Decode, 154, 2, 0, // Opcode: RETI
     215             : /* 830 */     MCD::OPC_FilterValue, 3, 20, 2, 0, // Skip to: 1367
     216             : /* 835 */     MCD::OPC_ExtractField, 4, 3,  // Inst{6-4} ...
     217             : /* 838 */     MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 847
     218             : /* 843 */     MCD::OPC_Decode, 165, 2, 0, // Opcode: SLEEP
     219             : /* 847 */     MCD::OPC_FilterValue, 1, 9, 0, 0, // Skip to: 861
     220             : /* 852 */     MCD::OPC_CheckPredicate, 6, 254, 1, 0, // Skip to: 1367
     221             : /* 857 */     MCD::OPC_Decode, 220, 1, 0, // Opcode: BREAK
     222             : /* 861 */     MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 870
     223             : /* 866 */     MCD::OPC_Decode, 176, 2, 0, // Opcode: WDR
     224             : /* 870 */     MCD::OPC_FilterValue, 4, 9, 0, 0, // Skip to: 884
     225             : /* 875 */     MCD::OPC_CheckPredicate, 7, 231, 1, 0, // Skip to: 1367
     226             : /* 880 */     MCD::OPC_Decode, 136, 2, 0, // Opcode: LPM
     227             : /* 884 */     MCD::OPC_FilterValue, 5, 9, 0, 0, // Skip to: 898
     228             : /* 889 */     MCD::OPC_CheckPredicate, 8, 217, 1, 0, // Skip to: 1367
     229             : /* 894 */     MCD::OPC_Decode, 243, 1, 0, // Opcode: ELPM
     230             : /* 898 */     MCD::OPC_FilterValue, 6, 9, 0, 0, // Skip to: 912
     231             : /* 903 */     MCD::OPC_CheckPredicate, 9, 203, 1, 0, // Skip to: 1367
     232             : /* 908 */     MCD::OPC_Decode, 166, 2, 0, // Opcode: SPM
     233             : /* 912 */     MCD::OPC_FilterValue, 7, 194, 1, 0, // Skip to: 1367
     234             : /* 917 */     MCD::OPC_CheckPredicate, 10, 189, 1, 0, // Skip to: 1367
     235             : /* 922 */     MCD::OPC_Decode, 167, 2, 0, // Opcode: SPMZPi
     236             : /* 926 */     MCD::OPC_FilterValue, 9, 59, 0, 0, // Skip to: 990
     237             : /* 931 */     MCD::OPC_ExtractField, 4, 5,  // Inst{8-4} ...
     238             : /* 934 */     MCD::OPC_FilterValue, 0, 9, 0, 0, // Skip to: 948
     239             : /* 939 */     MCD::OPC_CheckPredicate, 11, 167, 1, 0, // Skip to: 1367
     240             : /* 944 */     MCD::OPC_Decode, 251, 1, 0, // Opcode: IJMP
     241             : /* 948 */     MCD::OPC_FilterValue, 1, 9, 0, 0, // Skip to: 962
     242             : /* 953 */     MCD::OPC_CheckPredicate, 12, 153, 1, 0, // Skip to: 1367
     243             : /* 958 */     MCD::OPC_Decode, 242, 1, 0, // Opcode: EIJMP
     244             : /* 962 */     MCD::OPC_FilterValue, 16, 9, 0, 0, // Skip to: 976
     245             : /* 967 */     MCD::OPC_CheckPredicate, 11, 139, 1, 0, // Skip to: 1367
     246             : /* 972 */     MCD::OPC_Decode, 250, 1, 0, // Opcode: ICALL
     247             : /* 976 */     MCD::OPC_FilterValue, 17, 130, 1, 0, // Skip to: 1367
     248             : /* 981 */     MCD::OPC_CheckPredicate, 12, 125, 1, 0, // Skip to: 1367
     249             : /* 986 */     MCD::OPC_Decode, 241, 1, 0, // Opcode: EICALL
     250             : /* 990 */     MCD::OPC_FilterValue, 10, 4, 0, 0, // Skip to: 999
     251             : /* 995 */     MCD::OPC_Decode, 239, 1, 0, // Opcode: DECRd
     252             : /* 999 */     MCD::OPC_FilterValue, 11, 107, 1, 0, // Skip to: 1367
     253             : /* 1004 */    MCD::OPC_CheckPredicate, 13, 102, 1, 0, // Skip to: 1367
     254             : /* 1009 */    MCD::OPC_CheckField, 8, 1, 0, 95, 1, 0, // Skip to: 1367
     255             : /* 1016 */    MCD::OPC_Decode, 240, 1, 13, // Opcode: DESK
     256             : /* 1020 */    MCD::OPC_FilterValue, 3, 86, 1, 0, // Skip to: 1367
     257             : /* 1025 */    MCD::OPC_ExtractField, 8, 1,  // Inst{8} ...
     258             : /* 1028 */    MCD::OPC_FilterValue, 0, 9, 0, 0, // Skip to: 1042
     259             : /* 1033 */    MCD::OPC_CheckPredicate, 14, 73, 1, 0, // Skip to: 1367
     260             : /* 1038 */    MCD::OPC_Decode, 212, 1, 14, // Opcode: ADIWRdK
     261             : /* 1042 */    MCD::OPC_FilterValue, 1, 64, 1, 0, // Skip to: 1367
     262             : /* 1047 */    MCD::OPC_CheckPredicate, 14, 59, 1, 0, // Skip to: 1367
     263             : /* 1052 */    MCD::OPC_Decode, 162, 2, 14, // Opcode: SBIWRdK
     264             : /* 1056 */    MCD::OPC_FilterValue, 1, 50, 1, 0, // Skip to: 1367
     265             : /* 1061 */    MCD::OPC_Decode, 253, 1, 0, // Opcode: INRdA
     266             : /* 1065 */    MCD::OPC_FilterValue, 1, 41, 1, 0, // Skip to: 1367
     267             : /* 1070 */    MCD::OPC_ExtractField, 13, 1,  // Inst{13} ...
     268             : /* 1073 */    MCD::OPC_FilterValue, 0, 61, 0, 0, // Skip to: 1139
     269             : /* 1078 */    MCD::OPC_ExtractField, 10, 1,  // Inst{10} ...
     270             : /* 1081 */    MCD::OPC_FilterValue, 0, 39, 0, 0, // Skip to: 1125
     271             : /* 1086 */    MCD::OPC_ExtractField, 8, 2,  // Inst{9-8} ...
     272             : /* 1089 */    MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 1098
     273             : /* 1094 */    MCD::OPC_Decode, 232, 1, 0, // Opcode: CBIAb
     274             : /* 1098 */    MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 1107
     275             : /* 1103 */    MCD::OPC_Decode, 160, 2, 15, // Opcode: SBICAb
     276             : /* 1107 */    MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 1116
     277             : /* 1112 */    MCD::OPC_Decode, 159, 2, 0, // Opcode: SBIAb
     278             : /* 1116 */    MCD::OPC_FilterValue, 3, 246, 0, 0, // Skip to: 1367
     279             : /* 1121 */    MCD::OPC_Decode, 161, 2, 15, // Opcode: SBISAb
     280             : /* 1125 */    MCD::OPC_FilterValue, 1, 237, 0, 0, // Skip to: 1367
     281             : /* 1130 */    MCD::OPC_CheckPredicate, 1, 232, 0, 0, // Skip to: 1367
     282             : /* 1135 */    MCD::OPC_Decode, 142, 2, 0, // Opcode: MULRdRr
     283             : /* 1139 */    MCD::OPC_FilterValue, 1, 223, 0, 0, // Skip to: 1367
     284             : /* 1144 */    MCD::OPC_Decode, 149, 2, 0, // Opcode: OUTARr
     285             : /* 1148 */    MCD::OPC_FilterValue, 3, 214, 0, 0, // Skip to: 1367
     286             : /* 1153 */    MCD::OPC_ExtractField, 12, 2,  // Inst{13-12} ...
     287             : /* 1156 */    MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 1165
     288             : /* 1161 */    MCD::OPC_Decode, 155, 2, 0, // Opcode: RJMPk
     289             : /* 1165 */    MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 1174
     290             : /* 1170 */    MCD::OPC_Decode, 152, 2, 0, // Opcode: RCALLk
     291             : /* 1174 */    MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 1183
     292             : /* 1179 */    MCD::OPC_Decode, 131, 2, 3, // Opcode: LDIRdK
     293             : /* 1183 */    MCD::OPC_FilterValue, 3, 179, 0, 0, // Skip to: 1367
     294             : /* 1188 */    MCD::OPC_ExtractField, 10, 2,  // Inst{11-10} ...
     295             : /* 1191 */    MCD::OPC_FilterValue, 0, 43, 0, 0, // Skip to: 1239
     296             : /* 1196 */    MCD::OPC_ExtractField, 0, 3,  // Inst{2-0} ...
     297             : /* 1199 */    MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 1208
     298             : /* 1204 */    MCD::OPC_Decode, 223, 1, 0, // Opcode: BRLOk
     299             : /* 1208 */    MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 1217
     300             : /* 1213 */    MCD::OPC_Decode, 221, 1, 0, // Opcode: BREQk
     301             : /* 1217 */    MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 1226
     302             : /* 1222 */    MCD::OPC_Decode, 225, 1, 0, // Opcode: BRMIk
     303             : /* 1226 */    MCD::OPC_FilterValue, 4, 4, 0, 0, // Skip to: 1235
     304             : /* 1231 */    MCD::OPC_Decode, 224, 1, 0, // Opcode: BRLTk
     305             : /* 1235 */    MCD::OPC_Decode, 219, 1, 16, // Opcode: BRBSsk
     306             : /* 1239 */    MCD::OPC_FilterValue, 1, 43, 0, 0, // Skip to: 1287
     307             : /* 1244 */    MCD::OPC_ExtractField, 0, 3,  // Inst{2-0} ...
     308             : /* 1247 */    MCD::OPC_FilterValue, 0, 4, 0, 0, // Skip to: 1256
     309             : /* 1252 */    MCD::OPC_Decode, 228, 1, 0, // Opcode: BRSHk
     310             : /* 1256 */    MCD::OPC_FilterValue, 1, 4, 0, 0, // Skip to: 1265
     311             : /* 1261 */    MCD::OPC_Decode, 226, 1, 0, // Opcode: BRNEk
     312             : /* 1265 */    MCD::OPC_FilterValue, 2, 4, 0, 0, // Skip to: 1274
     313             : /* 1270 */    MCD::OPC_Decode, 227, 1, 0, // Opcode: BRPLk
     314             : /* 1274 */    MCD::OPC_FilterValue, 4, 4, 0, 0, // Skip to: 1283
     315             : /* 1279 */    MCD::OPC_Decode, 222, 1, 0, // Opcode: BRGEk
     316             : /* 1283 */    MCD::OPC_Decode, 218, 1, 16, // Opcode: BRBCsk
     317             : /* 1287 */    MCD::OPC_FilterValue, 2, 35, 0, 0, // Skip to: 1327
     318             : /* 1292 */    MCD::OPC_ExtractField, 9, 1,  // Inst{9} ...
     319             : /* 1295 */    MCD::OPC_FilterValue, 0, 11, 0, 0, // Skip to: 1311
     320             : /* 1300 */    MCD::OPC_CheckField, 3, 1, 0, 60, 0, 0, // Skip to: 1367
     321             : /* 1307 */    MCD::OPC_Decode, 217, 1, 17, // Opcode: BLD
     322             : /* 1311 */    MCD::OPC_FilterValue, 1, 51, 0, 0, // Skip to: 1367
     323             : /* 1316 */    MCD::OPC_CheckField, 3, 1, 0, 44, 0, 0, // Skip to: 1367
     324             : /* 1323 */    MCD::OPC_Decode, 230, 1, 17, // Opcode: BST
     325             : /* 1327 */    MCD::OPC_FilterValue, 3, 35, 0, 0, // Skip to: 1367
     326             : /* 1332 */    MCD::OPC_ExtractField, 9, 1,  // Inst{9} ...
     327             : /* 1335 */    MCD::OPC_FilterValue, 0, 11, 0, 0, // Skip to: 1351
     328             : /* 1340 */    MCD::OPC_CheckField, 3, 1, 0, 20, 0, 0, // Skip to: 1367
     329             : /* 1347 */    MCD::OPC_Decode, 163, 2, 15, // Opcode: SBRCRrB
     330             : /* 1351 */    MCD::OPC_FilterValue, 1, 11, 0, 0, // Skip to: 1367
     331             : /* 1356 */    MCD::OPC_CheckField, 3, 1, 0, 4, 0, 0, // Skip to: 1367
     332             : /* 1363 */    MCD::OPC_Decode, 164, 2, 15, // Opcode: SBRSRrB
     333             : /* 1367 */    MCD::OPC_Fail,
     334             :   0
     335             : };
     336             : 
     337             : static const uint8_t DecoderTable32[] = {
     338             : /* 0 */       MCD::OPC_ExtractField, 17, 3,  // Inst{19-17} ...
     339             : /* 3 */       MCD::OPC_FilterValue, 0, 45, 0, 0, // Skip to: 53
     340             : /* 8 */       MCD::OPC_ExtractField, 25, 7,  // Inst{31-25} ...
     341             : /* 11 */      MCD::OPC_FilterValue, 72, 16, 0, 0, // Skip to: 32
     342             : /* 16 */      MCD::OPC_CheckPredicate, 2, 74, 0, 0, // Skip to: 95
     343             : /* 21 */      MCD::OPC_CheckField, 16, 1, 0, 67, 0, 0, // Skip to: 95
     344             : /* 28 */      MCD::OPC_Decode, 135, 2, 18, // Opcode: LDSRdK
     345             : /* 32 */      MCD::OPC_FilterValue, 73, 58, 0, 0, // Skip to: 95
     346             : /* 37 */      MCD::OPC_CheckPredicate, 2, 53, 0, 0, // Skip to: 95
     347             : /* 42 */      MCD::OPC_CheckField, 16, 1, 0, 46, 0, 0, // Skip to: 95
     348             : /* 49 */      MCD::OPC_Decode, 172, 2, 19, // Opcode: STSKRr
     349             : /* 53 */      MCD::OPC_FilterValue, 6, 16, 0, 0, // Skip to: 74
     350             : /* 58 */      MCD::OPC_CheckPredicate, 15, 32, 0, 0, // Skip to: 95
     351             : /* 63 */      MCD::OPC_CheckField, 25, 7, 74, 25, 0, 0, // Skip to: 95
     352             : /* 70 */      MCD::OPC_Decode, 254, 1, 20, // Opcode: JMPk
     353             : /* 74 */      MCD::OPC_FilterValue, 7, 16, 0, 0, // Skip to: 95
     354             : /* 79 */      MCD::OPC_CheckPredicate, 15, 11, 0, 0, // Skip to: 95
     355             : /* 84 */      MCD::OPC_CheckField, 25, 7, 74, 4, 0, 0, // Skip to: 95
     356             : /* 91 */      MCD::OPC_Decode, 231, 1, 20, // Opcode: CALLk
     357             : /* 95 */      MCD::OPC_Fail,
     358             :   0
     359             : };
     360             : 
     361           0 : static bool checkDecoderPredicate(unsigned Idx, const FeatureBitset& Bits) {
     362           0 :   switch (Idx) {
     363           0 :   default: llvm_unreachable("Invalid index!");
     364           0 :   case 0:
     365           0 :     return (Bits[AVR::FeatureMOVW]);
     366           0 :   case 1:
     367           0 :     return (Bits[AVR::FeatureMultiplication]);
     368           0 :   case 2:
     369           0 :     return (Bits[AVR::FeatureSRAM]);
     370           0 :   case 3:
     371           0 :     return (Bits[AVR::FeatureLPMX]);
     372           0 :   case 4:
     373           0 :     return (Bits[AVR::FeatureELPMX]);
     374           0 :   case 5:
     375           0 :     return (Bits[AVR::FeatureRMW]);
     376           0 :   case 6:
     377           0 :     return (Bits[AVR::FeatureBREAK]);
     378           0 :   case 7:
     379           0 :     return (Bits[AVR::FeatureLPM]);
     380           0 :   case 8:
     381           0 :     return (Bits[AVR::FeatureELPM]);
     382           0 :   case 9:
     383           0 :     return (Bits[AVR::FeatureSPM]);
     384           0 :   case 10:
     385           0 :     return (Bits[AVR::FeatureSPMX]);
     386           0 :   case 11:
     387           0 :     return (Bits[AVR::FeatureIJMPCALL]);
     388           0 :   case 12:
     389           0 :     return (Bits[AVR::FeatureEIJMPCALL]);
     390           0 :   case 13:
     391           0 :     return (Bits[AVR::FeatureDES]);
     392           0 :   case 14:
     393           0 :     return (Bits[AVR::FeatureADDSUBIW]);
     394           0 :   case 15:
     395           0 :     return (Bits[AVR::FeatureJMPCALL]);
     396             :   }
     397             : }
     398             : 
     399             : template<typename InsnType>
     400           0 : static DecodeStatus decodeToMCInst(DecodeStatus S, unsigned Idx, InsnType insn, MCInst &MI,
     401             :                                    uint64_t Address, const void *Decoder, bool &DecodeComplete) {
     402           0 :   DecodeComplete = true;
     403             :   InsnType tmp;
     404           0 :   switch (Idx) {
     405           0 :   default: llvm_unreachable("Invalid index!");
     406             :   case 0:
     407             :     return S;
     408             :   case 1:
     409             :     tmp = fieldFromInstruction(insn, 4, 5);
     410             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     411             :     tmp = 0;
     412             :     tmp |= fieldFromInstruction(insn, 0, 4) << 0;
     413             :     tmp |= fieldFromInstruction(insn, 9, 1) << 4;
     414             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     415             :     return S;
     416             :   case 2:
     417             :     tmp = fieldFromInstruction(insn, 4, 5);
     418             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     419             :     tmp = fieldFromInstruction(insn, 4, 5);
     420             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     421             :     tmp = 0;
     422             :     tmp |= fieldFromInstruction(insn, 0, 4) << 0;
     423             :     tmp |= fieldFromInstruction(insn, 9, 1) << 4;
     424             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     425             :     return S;
     426             :   case 3:
     427             :     tmp = fieldFromInstruction(insn, 4, 4);
     428             :     if (DecodeLD8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     429             :     tmp = 0;
     430             :     tmp |= fieldFromInstruction(insn, 0, 4) << 0;
     431           0 :     tmp |= fieldFromInstruction(insn, 8, 4) << 4;
     432           0 :     MI.addOperand(MCOperand::createImm(tmp));
     433           0 :     return S;
     434             :   case 4:
     435             :     tmp = fieldFromInstruction(insn, 4, 4);
     436             :     if (DecodeLD8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     437             :     tmp = fieldFromInstruction(insn, 4, 4);
     438             :     if (DecodeLD8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     439             :     tmp = 0;
     440             :     tmp |= fieldFromInstruction(insn, 0, 4) << 0;
     441           0 :     tmp |= fieldFromInstruction(insn, 8, 4) << 4;
     442           0 :     MI.addOperand(MCOperand::createImm(tmp));
     443           0 :     return S;
     444             :   case 5:
     445             :     tmp = fieldFromInstruction(insn, 4, 5);
     446             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     447             :     tmp = fieldFromInstruction(insn, 2, 2);
     448           0 :     MI.addOperand(MCOperand::createImm(tmp));
     449           0 :     return S;
     450             :   case 6:
     451             :     tmp = fieldFromInstruction(insn, 4, 5);
     452             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     453             :     tmp = fieldFromInstruction(insn, 2, 2);
     454             :     if (DecodePTRREGSRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     455             :     tmp = fieldFromInstruction(insn, 2, 2);
     456           0 :     MI.addOperand(MCOperand::createImm(tmp));
     457           0 :     return S;
     458             :   case 7:
     459             :     tmp = fieldFromInstruction(insn, 4, 5);
     460             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     461             :     tmp = 0;
     462             :     tmp |= fieldFromInstruction(insn, 0, 3) << 0;
     463           0 :     tmp |= fieldFromInstruction(insn, 3, 1) << 6;
     464           0 :     tmp |= fieldFromInstruction(insn, 10, 2) << 3;
     465           0 :     tmp |= fieldFromInstruction(insn, 13, 1) << 5;
     466           0 :     MI.addOperand(MCOperand::createImm(tmp));
     467           0 :     return S;
     468             :   case 8:
     469             :     tmp = fieldFromInstruction(insn, 2, 2);
     470           0 :     MI.addOperand(MCOperand::createImm(tmp));
     471             :     tmp = fieldFromInstruction(insn, 4, 5);
     472             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     473           0 :     return S;
     474             :   case 9:
     475             :     tmp = fieldFromInstruction(insn, 2, 2);
     476           0 :     MI.addOperand(MCOperand::createImm(tmp));
     477             :     tmp = fieldFromInstruction(insn, 2, 2);
     478           0 :     MI.addOperand(MCOperand::createImm(tmp));
     479             :     tmp = fieldFromInstruction(insn, 4, 5);
     480             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     481           0 :     return S;
     482           0 :   case 10:
     483             :     tmp = 0;
     484             :     tmp |= fieldFromInstruction(insn, 0, 3) << 0;
     485           0 :     tmp |= fieldFromInstruction(insn, 3, 1) << 6;
     486           0 :     tmp |= fieldFromInstruction(insn, 10, 2) << 3;
     487           0 :     tmp |= fieldFromInstruction(insn, 13, 1) << 5;
     488           0 :     MI.addOperand(MCOperand::createImm(tmp));
     489             :     tmp = fieldFromInstruction(insn, 4, 5);
     490             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     491           0 :     return S;
     492             :   case 11:
     493             :     tmp = fieldFromInstruction(insn, 4, 5);
     494             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     495             :     return S;
     496             :   case 12:
     497             :     tmp = fieldFromInstruction(insn, 4, 3);
     498           0 :     MI.addOperand(MCOperand::createImm(tmp));
     499           0 :     return S;
     500             :   case 13:
     501             :     tmp = fieldFromInstruction(insn, 4, 4);
     502           0 :     MI.addOperand(MCOperand::createImm(tmp));
     503           0 :     return S;
     504           0 :   case 14:
     505             :     tmp = 0;
     506             :     tmp |= fieldFromInstruction(insn, 0, 4) << 0;
     507           0 :     tmp |= fieldFromInstruction(insn, 6, 2) << 4;
     508           0 :     MI.addOperand(MCOperand::createImm(tmp));
     509           0 :     return S;
     510             :   case 15:
     511             :     tmp = fieldFromInstruction(insn, 0, 3);
     512           0 :     MI.addOperand(MCOperand::createImm(tmp));
     513           0 :     return S;
     514             :   case 16:
     515             :     tmp = fieldFromInstruction(insn, 0, 3);
     516           0 :     MI.addOperand(MCOperand::createImm(tmp));
     517             :     tmp = fieldFromInstruction(insn, 3, 7);
     518           0 :     MI.addOperand(MCOperand::createImm(tmp));
     519           0 :     return S;
     520             :   case 17:
     521             :     tmp = fieldFromInstruction(insn, 4, 5);
     522             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     523             :     tmp = fieldFromInstruction(insn, 0, 3);
     524           0 :     MI.addOperand(MCOperand::createImm(tmp));
     525           0 :     return S;
     526             :   case 18:
     527             :     tmp = fieldFromInstruction(insn, 20, 5);
     528             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     529             :     tmp = fieldFromInstruction(insn, 0, 16);
     530           0 :     MI.addOperand(MCOperand::createImm(tmp));
     531           0 :     return S;
     532             :   case 19:
     533             :     tmp = fieldFromInstruction(insn, 0, 16);
     534           0 :     MI.addOperand(MCOperand::createImm(tmp));
     535             :     tmp = fieldFromInstruction(insn, 20, 5);
     536             :     if (DecodeGPR8RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     537           0 :     return S;
     538           0 :   case 20:
     539             :     tmp = 0;
     540             :     tmp |= fieldFromInstruction(insn, 0, 17) << 0;
     541           0 :     tmp |= fieldFromInstruction(insn, 20, 5) << 17;
     542           0 :     MI.addOperand(MCOperand::createImm(tmp));
     543           0 :     return S;
     544             :   }
     545             : }
     546             : 
     547             : template<typename InsnType>
     548           0 : static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
     549             :                                       InsnType insn, uint64_t Address,
     550             :                                       const void *DisAsm,
     551             :                                       const MCSubtargetInfo &STI) {
     552             :   const FeatureBitset& Bits = STI.getFeatureBits();
     553             : 
     554             :   const uint8_t *Ptr = DecodeTable;
     555             :   uint32_t CurFieldValue = 0;
     556             :   DecodeStatus S = MCDisassembler::Success;
     557             :   while (true) {
     558           0 :     ptrdiff_t Loc = Ptr - DecodeTable;
     559           0 :     switch (*Ptr) {
     560           0 :     default:
     561           0 :       errs() << Loc << ": Unexpected decode table opcode!\n";
     562           0 :       return MCDisassembler::Fail;
     563           0 :     case MCD::OPC_ExtractField: {
     564           0 :       unsigned Start = *++Ptr;
     565           0 :       unsigned Len = *++Ptr;
     566           0 :       ++Ptr;
     567             :       CurFieldValue = fieldFromInstruction(insn, Start, Len);
     568             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_ExtractField(" << Start << ", "
     569             :                    << Len << "): " << CurFieldValue << "\n");
     570           0 :       break;
     571             :     }
     572           0 :     case MCD::OPC_FilterValue: {
     573             :       // Decode the field value.
     574             :       unsigned Len;
     575           0 :       InsnType Val = decodeULEB128(++Ptr, &Len);
     576           0 :       Ptr += Len;
     577             :       // NumToSkip is a plain 24-bit integer.
     578           0 :       unsigned NumToSkip = *Ptr++;
     579           0 :       NumToSkip |= (*Ptr++) << 8;
     580           0 :       NumToSkip |= (*Ptr++) << 16;
     581             : 
     582             :       // Perform the filter operation.
     583           0 :       if (Val != CurFieldValue)
     584           0 :         Ptr += NumToSkip;
     585             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_FilterValue(" << Val << ", " << NumToSkip
     586             :                    << "): " << ((Val != CurFieldValue) ? "FAIL:" : "PASS:")
     587             :                    << " continuing at " << (Ptr - DecodeTable) << "\n");
     588             : 
     589             :       break;
     590             :     }
     591           0 :     case MCD::OPC_CheckField: {
     592           0 :       unsigned Start = *++Ptr;
     593           0 :       unsigned Len = *++Ptr;
     594             :       InsnType FieldValue = fieldFromInstruction(insn, Start, Len);
     595             :       // Decode the field value.
     596           0 :       uint32_t ExpectedValue = decodeULEB128(++Ptr, &Len);
     597           0 :       Ptr += Len;
     598             :       // NumToSkip is a plain 24-bit integer.
     599           0 :       unsigned NumToSkip = *Ptr++;
     600           0 :       NumToSkip |= (*Ptr++) << 8;
     601           0 :       NumToSkip |= (*Ptr++) << 16;
     602             : 
     603             :       // If the actual and expected values don't match, skip.
     604           0 :       if (ExpectedValue != FieldValue)
     605           0 :         Ptr += NumToSkip;
     606             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_CheckField(" << Start << ", "
     607             :                    << Len << ", " << ExpectedValue << ", " << NumToSkip
     608             :                    << "): FieldValue = " << FieldValue << ", ExpectedValue = "
     609             :                    << ExpectedValue << ": "
     610             :                    << ((ExpectedValue == FieldValue) ? "PASS\n" : "FAIL\n"));
     611             :       break;
     612             :     }
     613           0 :     case MCD::OPC_CheckPredicate: {
     614             :       unsigned Len;
     615             :       // Decode the Predicate Index value.
     616           0 :       unsigned PIdx = decodeULEB128(++Ptr, &Len);
     617           0 :       Ptr += Len;
     618             :       // NumToSkip is a plain 24-bit integer.
     619           0 :       unsigned NumToSkip = *Ptr++;
     620           0 :       NumToSkip |= (*Ptr++) << 8;
     621           0 :       NumToSkip |= (*Ptr++) << 16;
     622             :       // Check the predicate.
     623             :       bool Pred;
     624           0 :       if (!(Pred = checkDecoderPredicate(PIdx, Bits)))
     625           0 :         Ptr += NumToSkip;
     626             :       (void)Pred;
     627             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_CheckPredicate(" << PIdx << "): "
     628             :             << (Pred ? "PASS\n" : "FAIL\n"));
     629             : 
     630             :       break;
     631             :     }
     632           0 :     case MCD::OPC_Decode: {
     633             :       unsigned Len;
     634             :       // Decode the Opcode value.
     635           0 :       unsigned Opc = decodeULEB128(++Ptr, &Len);
     636           0 :       Ptr += Len;
     637           0 :       unsigned DecodeIdx = decodeULEB128(Ptr, &Len);
     638             :       Ptr += Len;
     639             : 
     640             :       MI.clear();
     641             :       MI.setOpcode(Opc);
     642             :       bool DecodeComplete;
     643           0 :       S = decodeToMCInst(S, DecodeIdx, insn, MI, Address, DisAsm, DecodeComplete);
     644             :       assert(DecodeComplete);
     645             : 
     646             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_Decode: opcode " << Opc
     647             :                    << ", using decoder " << DecodeIdx << ": "
     648             :                    << (S != MCDisassembler::Fail ? "PASS" : "FAIL") << "\n");
     649             :       return S;
     650             :     }
     651           0 :     case MCD::OPC_TryDecode: {
     652             :       unsigned Len;
     653             :       // Decode the Opcode value.
     654           0 :       unsigned Opc = decodeULEB128(++Ptr, &Len);
     655           0 :       Ptr += Len;
     656           0 :       unsigned DecodeIdx = decodeULEB128(Ptr, &Len);
     657           0 :       Ptr += Len;
     658             :       // NumToSkip is a plain 24-bit integer.
     659           0 :       unsigned NumToSkip = *Ptr++;
     660           0 :       NumToSkip |= (*Ptr++) << 8;
     661           0 :       NumToSkip |= (*Ptr++) << 16;
     662             : 
     663             :       // Perform the decode operation.
     664             :       MCInst TmpMI;
     665             :       TmpMI.setOpcode(Opc);
     666             :       bool DecodeComplete;
     667           0 :       S = decodeToMCInst(S, DecodeIdx, insn, TmpMI, Address, DisAsm, DecodeComplete);
     668             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_TryDecode: opcode " << Opc
     669             :                    << ", using decoder " << DecodeIdx << ": ");
     670             : 
     671           0 :       if (DecodeComplete) {
     672             :         // Decoding complete.
     673             :         LLVM_DEBUG(dbgs() << (S != MCDisassembler::Fail ? "PASS" : "FAIL") << "\n");
     674             :         MI = TmpMI;
     675           0 :         return S;
     676             :       } else {
     677             :         assert(S == MCDisassembler::Fail);
     678             :         // If the decoding was incomplete, skip.
     679           0 :         Ptr += NumToSkip;
     680             :         LLVM_DEBUG(dbgs() << "FAIL: continuing at " << (Ptr - DecodeTable) << "\n");
     681             :         // Reset decode status. This also drops a SoftFail status that could be
     682             :         // set before the decode attempt.
     683             :         S = MCDisassembler::Success;
     684             :       }
     685             :       break;
     686             :     }
     687           0 :     case MCD::OPC_SoftFail: {
     688             :       // Decode the mask values.
     689             :       unsigned Len;
     690           0 :       InsnType PositiveMask = decodeULEB128(++Ptr, &Len);
     691           0 :       Ptr += Len;
     692           0 :       InsnType NegativeMask = decodeULEB128(Ptr, &Len);
     693           0 :       Ptr += Len;
     694           0 :       bool Fail = (insn & PositiveMask) || (~insn & NegativeMask);
     695             :       if (Fail)
     696             :         S = MCDisassembler::SoftFail;
     697             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_SoftFail: " << (Fail ? "FAIL\n":"PASS\n"));
     698             :       break;
     699             :     }
     700             :     case MCD::OPC_Fail: {
     701             :       LLVM_DEBUG(dbgs() << Loc << ": OPC_Fail\n");
     702             :       return MCDisassembler::Fail;
     703             :     }
     704             :     }
     705             :   }
     706             :   llvm_unreachable("bogosity detected in disassembler state machine!");
     707             : }
     708             : 
     709             : 
     710             : } // End llvm namespace

Generated by: LCOV version 1.13