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 enum class MemAccessSize {
94 NoMemAccess = 0, // Not a memory acces instruction.
95 ByteAccess = 1, // Byte access instruction (memb).
96 HalfWordAccess = 2, // Half word access instruction (memh).
97 WordAccess = 3, // Word access instruction (memw).
98 DoubleWordAccess = 4 // Double word access instruction (memd)
101 // MCInstrDesc TSFlags
102 // *** Must match HexagonInstrFormat*.td ***
104 // This 5-bit field describes the insn type.
108 // Solo instructions.
111 // Packed only with A or X-type instructions.
114 // Only A-type instruction in first slot or nothing.
118 // Predicated instructions.
120 PredicatedMask = 0x1,
121 PredicatedFalsePos = 9,
122 PredicatedFalseMask = 0x1,
123 PredicatedNewPos = 10,
124 PredicatedNewMask = 0x1,
125 PredicateLatePos = 11,
126 PredicateLateMask = 0x1,
128 // New-Value consumer instructions.
131 // New-Value producer instructions.
133 hasNewValueMask = 0x1,
134 // Which operand consumes or produces a new value.
136 NewValueOpMask = 0x7,
137 // Stores that can become new-value stores.
139 mayNVStoreMask = 0x1,
140 // New-value store instructions.
143 // Loads that can become current-value loads.
146 // Current-value load instructions.
152 ExtendableMask = 0x1,
153 // Insns must be extended.
156 // Which operand may be extended.
157 ExtendableOpPos = 23,
158 ExtendableOpMask = 0x7,
159 // Signed or unsigned range.
160 ExtentSignedPos = 26,
161 ExtentSignedMask = 0x1,
162 // Number of bits of range before extending operand.
164 ExtentBitsMask = 0x1f,
165 // Alignment power-of-two before extending operand.
167 ExtentAlignMask = 0x3,
170 validSubTargetPos = 34,
171 validSubTargetMask = 0xf,
173 // Addressing mode for load/store instructions.
176 // Access size for load/store instructions.
177 MemAccessSizePos = 43,
178 MemAccesSizeMask = 0x7,
180 // Branch predicted taken.
184 // Floating-point instructions.
188 // New-Value producer-2 instructions.
189 hasNewValuePos2 = 50,
190 hasNewValueMask2 = 0x1,
192 // Which operand consumes or produces a new value.
194 NewValueOpMask2 = 0x7,
196 // Accumulator instructions.
198 AccumulatorMask = 0x1,
200 // Complex XU, prevent xu competition by prefering slot3
201 PrefersSlot3Pos = 55,
202 PrefersSlot3Mask = 0x1,
205 // *** The code above must match HexagonInstrFormat*.td *** //
207 // Hexagon specific MO operand flag mask.
208 enum HexagonMOTargetFlagVal {
209 //===------------------------------------------------------------------===//
210 // Hexagon Specific MachineOperand flags.
213 HMOTF_ConstExtended = 1,
215 /// MO_PCREL - On a symbol operand, indicates a PC-relative relocation
216 /// Used for computing a global address for PIC compilations
219 /// MO_GOT - Indicates a GOT-relative relocation
222 // Low or high part of a symbol.
225 // Offset from the base of the SDA.
229 // Hexagon Sub-instruction classes.
230 enum SubInstructionGroup {
240 // Hexagon Compound classes.
249 INST_PARSE_MASK = 0x0000c000,
250 INST_PARSE_PACKET_END = 0x0000c000,
251 INST_PARSE_LOOP_END = 0x00008000,
252 INST_PARSE_NOT_END = 0x00004000,
253 INST_PARSE_DUPLEX = 0x00000000,
254 INST_PARSE_EXTENDER = 0x00000000
257 enum InstIClassBits : unsigned {
258 INST_ICLASS_MASK = 0xf0000000,
259 INST_ICLASS_EXTENDER = 0x00000000,
260 INST_ICLASS_J_1 = 0x10000000,
261 INST_ICLASS_J_2 = 0x20000000,
262 INST_ICLASS_LD_ST_1 = 0x30000000,
263 INST_ICLASS_LD_ST_2 = 0x40000000,
264 INST_ICLASS_J_3 = 0x50000000,
265 INST_ICLASS_CR = 0x60000000,
266 INST_ICLASS_ALU32_1 = 0x70000000,
267 INST_ICLASS_XTYPE_1 = 0x80000000,
268 INST_ICLASS_LD = 0x90000000,
269 INST_ICLASS_ST = 0xa0000000,
270 INST_ICLASS_ALU32_2 = 0xb0000000,
271 INST_ICLASS_XTYPE_2 = 0xc0000000,
272 INST_ICLASS_XTYPE_3 = 0xd0000000,
273 INST_ICLASS_XTYPE_4 = 0xe0000000,
274 INST_ICLASS_ALU32_3 = 0xf0000000
277 } // End namespace HexagonII.
279 } // End namespace llvm.