1 //===- HexagonMCInstrInfo.cpp - Hexagon sub-class of MCInst ---------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Utility functions for Hexagon specific MCInst queries
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCINSTRINFO_H
15 #define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCINSTRINFO_H
22 namespace HexagonMCInstrInfo {
23 // Return number of bits in the constant extended operand.
24 unsigned getBitCount(MCInstrInfo const &MCII, MCInst const &MCI);
26 // Return constant extended operand number.
27 unsigned short getCExtOpNum(MCInstrInfo const &MCII, MCInst const &MCI);
29 MCInstrDesc const &getDesc(MCInstrInfo const &MCII, MCInst const &MCI);
31 // Return the max value that a constant extendable operand can have
32 // without being extended.
33 int getMaxValue(MCInstrInfo const &MCII, MCInst const &MCI);
35 // Return the min value that a constant extendable operand can have
36 // without being extended.
37 int getMinValue(MCInstrInfo const &MCII, MCInst const &MCI);
39 // Return the operand that consumes or produces a new value.
40 MCOperand const &getNewValue(MCInstrInfo const &MCII, MCInst const &MCI);
42 // Return the Hexagon ISA class for the insn.
43 unsigned getType(MCInstrInfo const &MCII, MCInst const &MCI);
45 // Return whether the instruction is a legal new-value producer.
46 bool hasNewValue(MCInstrInfo const &MCII, MCInst const &MCI);
48 // Return whether the insn is an actual insn.
49 bool isCanon(MCInstrInfo const &MCII, MCInst const &MCI);
51 // Return whether the instruction needs to be constant extended.
52 bool isConstExtended(MCInstrInfo const &MCII, MCInst const &MCI);
54 // Return true if the insn may be extended based on the operand value.
55 bool isExtendable(MCInstrInfo const &MCII, MCInst const &MCI);
57 // Return whether the instruction must be always extended.
58 bool isExtended(MCInstrInfo const &MCII, MCInst const &MCI);
60 // Return whether the insn is a new-value consumer.
61 bool isNewValue(MCInstrInfo const &MCII, MCInst const &MCI);
63 // Return true if the operand can be constant extended.
64 bool isOperandExtended(MCInstrInfo const &MCII, MCInst const &MCI,
65 unsigned short OperandNum);
67 // Return whether the insn is a prefix.
68 bool isPrefix(MCInstrInfo const &MCII, MCInst const &MCI);
70 // Return whether the insn is solo, i.e., cannot be in a packet.
71 bool isSolo(MCInstrInfo const &MCII, MCInst const &MCI);
75 #endif // LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCINSTRINFO_H