[Hexagon] Moving more functions off of HexagonMCInst and in to HexagonMCInstrInfo.
[oota-llvm.git] / lib / Target / Hexagon / MCTargetDesc / HexagonMCInst.h
1 //===- HexagonMCInst.h - Hexagon sub-class of MCInst ----------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This class extends MCInst to allow some VLIW annotations.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCINST_H
15 #define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCINST_H
16
17 #include "HexagonTargetMachine.h"
18 #include "llvm/MC/MCInst.h"
19 #include <memory>
20
21 extern "C" void LLVMInitializeHexagonTargetMC();
22 namespace llvm {
23 class MCOperand;
24
25 class HexagonMCInst : public MCInst {
26   // Used to access TSFlags
27   std::unique_ptr <MCInstrInfo const> MCII;
28
29 public:
30   explicit HexagonMCInst();
31   HexagonMCInst(const MCInstrDesc &mcid);
32
33   static void AppendImplicitOperands(MCInst &MCI);
34   static std::bitset<16> GetImplicitBits(MCInst const &MCI);
35   static void SetImplicitBits(MCInst &MCI, std::bitset<16> Bits);
36   static void SanityCheckImplicitOperands(MCInst const &MCI) {
37     assert(MCI.getNumOperands() >= 2 && "At least the two implicit operands");
38     assert(MCI.getOperand(MCI.getNumOperands() - 1).isInst() &&
39            "Implicit bits and flags");
40     assert(MCI.getOperand(MCI.getNumOperands() - 2).isImm() &&
41            "Parent pointer");
42   }
43
44   void setPacketBegin(bool Y);
45   bool isPacketBegin() const;
46   static const size_t packetBeginIndex = 0;
47   void setPacketEnd(bool Y);
48   bool isPacketEnd() const;
49   static const size_t packetEndIndex = 1;
50   void resetPacket();
51 };
52 }
53
54 #endif