e456aefcefb3728dddcf70166d657ddd98f78f16
[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 "llvm/MC/MCInst.h"
18
19 namespace llvm {
20 class MCInstrDesc;
21 class MCOperand;
22 class HexagonTargetMachine;
23
24 class HexagonMCInst : public MCInst {
25 public:
26   explicit HexagonMCInst(unsigned op);
27
28   /// 10.6 Instruction Packets
29   bool isPacketBegin() const;
30   /// \brief Is this marked as last in packet.
31   bool isPacketEnd() const;
32   void setPacketBegin(bool Y);
33   /// \brief Mark this as last in packet.
34   void setPacketEnd(bool Y);
35   /// \brief Return the slots used.
36   unsigned getUnits(HexagonTargetMachine const &TM) const;
37   bool isConstExtended() const;
38   /// \brief Return constant extended operand number.
39   unsigned short getCExtOpNum(void) const;
40   /// \brief Return whether this is a new-value consumer.
41   bool isNewValue() const;
42   /// \brief Return whether this is a legal new-value producer.
43   bool hasNewValue() const;
44   /// \brief Return the operand that consumes or produces a new value.
45   MCOperand const &getNewValue() const;
46   /// \brief Return number of bits in the constant extended operand.
47   unsigned getBitCount(void) const;
48
49 private:
50   /// \brief Return whether this must be always extended.
51   bool isExtended() const;
52   /// \brief Return true if this may be extended based on the operand value.
53   bool isExtendable() const;
54   ///  \brief Return if the operand can be constant extended.
55   bool isOperandExtended(unsigned short const OperandNum) const;
56   /// \brief Return the min value that a constant extendable operand can have
57   /// without being extended.
58   int getMinValue() const;
59   /// \brief Return the max value that a constant extendable operand can have
60   /// without being extended.
61   int getMaxValue() const;
62   bool packetBegin;
63   bool packetEnd;
64   MCInstrDesc const &MCID;
65 };
66 }
67
68 #endif