summaryrefslogtreecommitdiff
path: root/lib/Target/Hexagon/MCTargetDesc/HexagonMCInst.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-01-18 16:17:27 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-01-18 16:17:27 +0000
commit67c32a98315f785a9ec9d531c1f571a0196c7463 (patch)
tree4abb9cbeecc7901726dd0b4a37369596c852e9ef /lib/Target/Hexagon/MCTargetDesc/HexagonMCInst.h
parent9f61947910e6ab40de38e6b4034751ef1513200f (diff)
downloadsrc-test2-67c32a98315f785a9ec9d531c1f571a0196c7463.tar.gz
src-test2-67c32a98315f785a9ec9d531c1f571a0196c7463.zip
Notes
Diffstat (limited to 'lib/Target/Hexagon/MCTargetDesc/HexagonMCInst.h')
-rw-r--r--lib/Target/Hexagon/MCTargetDesc/HexagonMCInst.h124
1 files changed, 66 insertions, 58 deletions
diff --git a/lib/Target/Hexagon/MCTargetDesc/HexagonMCInst.h b/lib/Target/Hexagon/MCTargetDesc/HexagonMCInst.h
index 3c52d4563f8c..ce9a8db5ac44 100644
--- a/lib/Target/Hexagon/MCTargetDesc/HexagonMCInst.h
+++ b/lib/Target/Hexagon/MCTargetDesc/HexagonMCInst.h
@@ -11,90 +11,98 @@
//
//===----------------------------------------------------------------------===//
-#ifndef HEXAGONMCINST_H
-#define HEXAGONMCINST_H
+#ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCINST_H
+#define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCINST_H
#include "HexagonTargetMachine.h"
#include "llvm/MC/MCInst.h"
+#include <memory>
+extern "C" void LLVMInitializeHexagonTargetMC();
namespace llvm {
- class MCOperand;
+class MCOperand;
- class HexagonMCInst: public MCInst {
- // MCID is set during instruction lowering.
- // It is needed in order to access TSFlags for
- // use in checking MC instruction properties.
- const MCInstrDesc *MCID;
+class HexagonMCInst : public MCInst {
+ friend void ::LLVMInitializeHexagonTargetMC();
+ // Used to access TSFlags
+ static std::unique_ptr <MCInstrInfo const> MCII;
- // Packet start and end markers
- unsigned packetStart: 1, packetEnd: 1;
+public:
+ explicit HexagonMCInst();
+ HexagonMCInst(const MCInstrDesc &mcid);
- public:
- explicit HexagonMCInst():
- MCInst(), MCID(nullptr), packetStart(0), packetEnd(0) {};
- HexagonMCInst(const MCInstrDesc& mcid):
- MCInst(), MCID(&mcid), packetStart(0), packetEnd(0) {};
+ static void AppendImplicitOperands(MCInst &MCI);
+ static std::bitset<16> GetImplicitBits(MCInst const &MCI);
+ static void SetImplicitBits(MCInst &MCI, std::bitset<16> Bits);
+ static void SanityCheckImplicitOperands(MCInst const &MCI) {
+ assert(MCI.getNumOperands() >= 2 && "At least the two implicit operands");
+ assert(MCI.getOperand(MCI.getNumOperands() - 1).isInst() &&
+ "Implicit bits and flags");
+ assert(MCI.getOperand(MCI.getNumOperands() - 2).isImm() &&
+ "Parent pointer");
+ }
- bool isPacketStart() const { return (packetStart); };
- bool isPacketEnd() const { return (packetEnd); };
- void setPacketStart(bool Y) { packetStart = Y; };
- void setPacketEnd(bool Y) { packetEnd = Y; };
- void resetPacket() { setPacketStart(false); setPacketEnd(false); };
+ void setPacketBegin(bool Y);
+ bool isPacketBegin() const;
+ static const size_t packetBeginIndex = 0;
+ void setPacketEnd(bool Y);
+ bool isPacketEnd() const;
+ static const size_t packetEndIndex = 1;
+ void resetPacket();
- // Return the slots used by the insn.
- unsigned getUnits(const HexagonTargetMachine* TM) const;
+ // Return the slots used by the insn.
+ unsigned getUnits(const HexagonTargetMachine *TM) const;
- // Return the Hexagon ISA class for the insn.
- unsigned getType() const;
+ // Return the Hexagon ISA class for the insn.
+ unsigned getType() const;
- void setDesc(const MCInstrDesc& mcid) { MCID = &mcid; };
- const MCInstrDesc& getDesc(void) const { return *MCID; };
+ MCInstrDesc const &getDesc() const;
- // Return whether the insn is an actual insn.
- bool isCanon() const;
+ // Return whether the insn is an actual insn.
+ bool isCanon() const;
- // Return whether the insn is a prefix.
- bool isPrefix() const;
+ // Return whether the insn is a prefix.
+ bool isPrefix() const;
- // Return whether the insn is solo, i.e., cannot be in a packet.
- bool isSolo() const;
+ // Return whether the insn is solo, i.e., cannot be in a packet.
+ bool isSolo() const;
- // Return whether the instruction needs to be constant extended.
- bool isConstExtended() const;
+ // Return whether the instruction needs to be constant extended.
+ bool isConstExtended() const;
- // Return constant extended operand number.
- unsigned short getCExtOpNum(void) const;
+ // Return constant extended operand number.
+ unsigned short getCExtOpNum(void) const;
- // Return whether the insn is a new-value consumer.
- bool isNewValue() const;
+ // Return whether the insn is a new-value consumer.
+ bool isNewValue() const;
- // Return whether the instruction is a legal new-value producer.
- bool hasNewValue() const;
+ // Return whether the instruction is a legal new-value producer.
+ bool hasNewValue() const;
- // Return the operand that consumes or produces a new value.
- const MCOperand& getNewValue() const;
+ // Return the operand that consumes or produces a new value.
+ const MCOperand &getNewValue() const;
- // Return number of bits in the constant extended operand.
- unsigned getBitCount(void) const;
+ // Return number of bits in the constant extended operand.
+ unsigned getBitCount(void) const;
- private:
- // Return whether the instruction must be always extended.
- bool isExtended() const;
+private:
+ // Return whether the instruction must be always extended.
+ bool isExtended() const;
- // Return true if the insn may be extended based on the operand value.
- bool isExtendable() const;
+ // Return true if the insn may be extended based on the operand value.
+ bool isExtendable() const;
- // Return true if the operand can be constant extended.
- bool isOperandExtended(const unsigned short OperandNum) const;
+ // Return true if the operand can be constant extended.
+ bool isOperandExtended(const unsigned short OperandNum) const;
- // Return the min value that a constant extendable operand can have
- // without being extended.
- int getMinValue() const;
+ // Return the min value that a constant extendable operand can have
+ // without being extended.
+ int getMinValue() const;
- // Return the max value that a constant extendable operand can have
- // without being extended.
- int getMaxValue() const;
- };
+ // Return the max value that a constant extendable operand can have
+ // without being extended.
+ int getMaxValue() const;
+};
}
#endif