1 //===-- HexagonBaseInfo.h - Top level definitions for Hexagon --*- C++ -*--===//
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 // This file contains small standalone helper functions and enum definitions for
11 // the Hexagon target useful for the compiler back-end and the MC libraries.
12 // As such, it deliberately does not include references to LLVM core
13 // code gen types, passes, etc..
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
18 #define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
20 #include "HexagonMCTargetDesc.h"
21 #include "llvm/Support/ErrorHandling.h"
26 /// HexagonII - This namespace holds all of the target specific flags that
27 /// instruction info tracks.
30 // *** The code below must match HexagonInstrFormat*.td *** //
33 // *** Must match HexagonInstrFormat*.td ***
49 TypeCVI_VA = TypeCVI_FIRST,
56 TypeCVI_VINLANESAT= 20,
58 TypeCVI_VM_TMP_LD = 22,
59 TypeCVI_VM_CUR_LD = 23,
60 TypeCVI_VM_VP_LDU = 24,
62 TypeCVI_VM_NEW_ST = 26,
65 TypeCVI_LAST = TypeCVI_HIST,
66 TypePREFIX = 30, // Such as extenders.
67 TypeENDLOOP = 31 // Such as end of a HW loop.
84 NoAddrMode = 0, // No addressing mode
85 Absolute = 1, // Absolute addressing mode
86 AbsoluteSet = 2, // Absolute set addressing mode
87 BaseImmOffset = 3, // Indirect with offset
88 BaseLongOffset = 4, // Indirect with long offset
89 BaseRegOffset = 5, // Indirect with register offset
90 PostInc = 6 // Post increment addressing mode
93 // MemAccessSize is represented as 1+log2(N) where N is size in bits.
94 enum class MemAccessSize {
95 NoMemAccess = 0, // Not a memory acces instruction.
96 ByteAccess = 1, // Byte access instruction (memb).
97 HalfWordAccess = 2, // Half word access instruction (memh).
98 WordAccess = 3, // Word access instruction (memw).
99 DoubleWordAccess = 4, // Double word access instruction (memd)
100 // 5, // We do not have a 16 byte vector access.
101 Vector64Access = 7, // 64 Byte vector access instruction (vmem).
102 Vector128Access = 8 // 128 Byte vector access instruction (vmem).
105 // MCInstrDesc TSFlags
106 // *** Must match HexagonInstrFormat*.td ***
108 // This 5-bit field describes the insn type.
112 // Solo instructions.
115 // Packed only with A or X-type instructions.
118 // Only A-type instruction in first slot or nothing.
122 // Predicated instructions.
124 PredicatedMask = 0x1,
125 PredicatedFalsePos = 9,
126 PredicatedFalseMask = 0x1,
127 PredicatedNewPos = 10,
128 PredicatedNewMask = 0x1,
129 PredicateLatePos = 11,
130 PredicateLateMask = 0x1,
132 // New-Value consumer instructions.
135 // New-Value producer instructions.
137 hasNewValueMask = 0x1,
138 // Which operand consumes or produces a new value.
140 NewValueOpMask = 0x7,
141 // Stores that can become new-value stores.
143 mayNVStoreMask = 0x1,
144 // New-value store instructions.
147 // Loads that can become current-value loads.
150 // Current-value load instructions.
156 ExtendableMask = 0x1,
157 // Insns must be extended.
160 // Which operand may be extended.
161 ExtendableOpPos = 23,
162 ExtendableOpMask = 0x7,
163 // Signed or unsigned range.
164 ExtentSignedPos = 26,
165 ExtentSignedMask = 0x1,
166 // Number of bits of range before extending operand.
168 ExtentBitsMask = 0x1f,
169 // Alignment power-of-two before extending operand.
171 ExtentAlignMask = 0x3,
174 validSubTargetPos = 34,
175 validSubTargetMask = 0xf,
177 // Addressing mode for load/store instructions.
180 // Access size for load/store instructions.
181 MemAccessSizePos = 43,
182 MemAccesSizeMask = 0xf,
184 // Branch predicted taken.
188 // Floating-point instructions.
192 // New-Value producer-2 instructions.
193 hasNewValuePos2 = 50,
194 hasNewValueMask2 = 0x1,
196 // Which operand consumes or produces a new value.
198 NewValueOpMask2 = 0x7,
200 // Accumulator instructions.
202 AccumulatorMask = 0x1,
204 // Complex XU, prevent xu competition by prefering slot3
205 PrefersSlot3Pos = 55,
206 PrefersSlot3Mask = 0x1,
209 // *** The code above must match HexagonInstrFormat*.td *** //
211 // Hexagon specific MO operand flag mask.
212 enum HexagonMOTargetFlagVal {
213 //===------------------------------------------------------------------===//
214 // Hexagon Specific MachineOperand flags.
217 HMOTF_ConstExtended = 1,
219 /// MO_PCREL - On a symbol operand, indicates a PC-relative relocation
220 /// Used for computing a global address for PIC compilations
223 /// MO_GOT - Indicates a GOT-relative relocation
226 // Low or high part of a symbol.
229 // Offset from the base of the SDA.
233 // Hexagon Sub-instruction classes.
234 enum SubInstructionGroup {
244 // Hexagon Compound classes.
253 INST_PARSE_MASK = 0x0000c000,
254 INST_PARSE_PACKET_END = 0x0000c000,
255 INST_PARSE_LOOP_END = 0x00008000,
256 INST_PARSE_NOT_END = 0x00004000,
257 INST_PARSE_DUPLEX = 0x00000000,
258 INST_PARSE_EXTENDER = 0x00000000
261 enum InstIClassBits : unsigned {
262 INST_ICLASS_MASK = 0xf0000000,
263 INST_ICLASS_EXTENDER = 0x00000000,
264 INST_ICLASS_J_1 = 0x10000000,
265 INST_ICLASS_J_2 = 0x20000000,
266 INST_ICLASS_LD_ST_1 = 0x30000000,
267 INST_ICLASS_LD_ST_2 = 0x40000000,
268 INST_ICLASS_J_3 = 0x50000000,
269 INST_ICLASS_CR = 0x60000000,
270 INST_ICLASS_ALU32_1 = 0x70000000,
271 INST_ICLASS_XTYPE_1 = 0x80000000,
272 INST_ICLASS_LD = 0x90000000,
273 INST_ICLASS_ST = 0xa0000000,
274 INST_ICLASS_ALU32_2 = 0xb0000000,
275 INST_ICLASS_XTYPE_2 = 0xc0000000,
276 INST_ICLASS_XTYPE_3 = 0xd0000000,
277 INST_ICLASS_XTYPE_4 = 0xe0000000,
278 INST_ICLASS_ALU32_3 = 0xf0000000
281 } // End namespace HexagonII.
283 } // End namespace llvm.