[Hexagon] Moving more functions off of HexagonMCInst and in to HexagonMCInstrInfo.
[oota-llvm.git] / lib / Target / Hexagon / MCTargetDesc / HexagonMCInstrInfo.h
1 //===- HexagonMCInstrInfo.cpp - 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 // Utility functions for Hexagon specific MCInst queries
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCINSTRINFO_H
15 #define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCINSTRINFO_H
16
17 namespace llvm {
18 class MCInstrDesc;
19 class MCInstrInfo;
20 class MCInst;
21 class MCOperand;
22 namespace HexagonMCInstrInfo {
23 // Return number of bits in the constant extended operand.
24 unsigned getBitCount(MCInstrInfo const &MCII, MCInst const &MCI);
25
26 // Return constant extended operand number.
27 unsigned short getCExtOpNum(MCInstrInfo const &MCII, MCInst const &MCI);
28
29 MCInstrDesc const &getDesc(MCInstrInfo const &MCII, MCInst const &MCI);
30
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);
34
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);
38
39 // Return the operand that consumes or produces a new value.
40 MCOperand const &getNewValue(MCInstrInfo const &MCII, MCInst const &MCI);
41
42 // Return the Hexagon ISA class for the insn.
43 unsigned getType(MCInstrInfo const &MCII, MCInst const &MCI);
44
45 // Return whether the instruction is a legal new-value producer.
46 bool hasNewValue(MCInstrInfo const &MCII, MCInst const &MCI);
47   
48 // Return whether the insn is an actual insn.
49 bool isCanon(MCInstrInfo const &MCII, MCInst const &MCI);
50
51 // Return whether the instruction needs to be constant extended.
52 bool isConstExtended(MCInstrInfo const &MCII, MCInst const &MCI);
53
54 // Return true if the insn may be extended based on the operand value.
55 bool isExtendable(MCInstrInfo const &MCII, MCInst const &MCI);
56
57 // Return whether the instruction must be always extended.
58 bool isExtended(MCInstrInfo const &MCII, MCInst const &MCI);
59
60 // Return whether the insn is a new-value consumer.
61 bool isNewValue(MCInstrInfo const &MCII, MCInst const &MCI);
62
63 // Return true if the operand can be constant extended.
64 bool isOperandExtended(MCInstrInfo const &MCII, MCInst const &MCI,
65                        unsigned short OperandNum);
66
67 // Return whether the insn is a prefix.
68 bool isPrefix(MCInstrInfo const &MCII, MCInst const &MCI);
69
70 // Return whether the insn is solo, i.e., cannot be in a packet.
71 bool isSolo(MCInstrInfo const &MCII, MCInst const &MCI);
72 }
73 }
74
75 #endif // LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCINSTRINFO_H