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 "HexagonDepITypes.h"
21 #include "HexagonMCTargetDesc.h"
22 #include "llvm/Support/ErrorHandling.h"
27 /// HexagonII - This namespace holds all of the target specific flags that
28 /// instruction info tracks.
31 unsigned const TypeCVI_FIRST = TypeCVI_HIST;
32 unsigned const TypeCVI_LAST = TypeCVI_VX_LATE;
42 NoAddrMode = 0, // No addressing mode
43 Absolute = 1, // Absolute addressing mode
44 AbsoluteSet = 2, // Absolute set addressing mode
45 BaseImmOffset = 3, // Indirect with offset
46 BaseLongOffset = 4, // Indirect with long offset
47 BaseRegOffset = 5, // Indirect with register offset
48 PostInc = 6 // Post increment addressing mode
51 // MemAccessSize is represented as 1+log2(N) where N is size in bits.
52 enum class MemAccessSize {
53 NoMemAccess = 0, // Not a memory access instruction.
54 ByteAccess = 1, // Byte access instruction (memb).
55 HalfWordAccess = 2, // Half word access instruction (memh).
56 WordAccess = 3, // Word access instruction (memw).
57 DoubleWordAccess = 4, // Double word access instruction (memd)
58 // 5, // We do not have a 16 byte vector access.
59 Vector64Access = 7, // 64 Byte vector access instruction (vmem).
60 Vector128Access = 8 // 128 Byte vector access instruction (vmem).
63 // MCInstrDesc TSFlags
64 // *** Must match HexagonInstrFormat*.td ***
66 // This 5-bit field describes the insn type.
73 // Packed only with A or X-type instructions.
76 // Only A-type instruction in first slot or nothing.
80 // Predicated instructions.
83 PredicatedFalsePos = 10,
84 PredicatedFalseMask = 0x1,
85 PredicatedNewPos = 11,
86 PredicatedNewMask = 0x1,
87 PredicateLatePos = 12,
88 PredicateLateMask = 0x1,
90 // New-Value consumer instructions.
93 // New-Value producer instructions.
95 hasNewValueMask = 0x1,
96 // Which operand consumes or produces a new value.
99 // Stores that can become new-value stores.
101 mayNVStoreMask = 0x1,
102 // New-value store instructions.
105 // Loads that can become current-value loads.
108 // Current-value load instructions.
114 ExtendableMask = 0x1,
115 // Insns must be extended.
118 // Which operand may be extended.
119 ExtendableOpPos = 24,
120 ExtendableOpMask = 0x7,
121 // Signed or unsigned range.
122 ExtentSignedPos = 27,
123 ExtentSignedMask = 0x1,
124 // Number of bits of range before extending operand.
126 ExtentBitsMask = 0x1f,
127 // Alignment power-of-two before extending operand.
129 ExtentAlignMask = 0x3,
131 // Addressing mode for load/store instructions.
134 // Access size for load/store instructions.
135 MemAccessSizePos = 44,
136 MemAccesSizeMask = 0xf,
138 // Branch predicted taken.
142 // Floating-point instructions.
146 // New-Value producer-2 instructions.
147 hasNewValuePos2 = 51,
148 hasNewValueMask2 = 0x1,
149 // Which operand consumes or produces a new value.
151 NewValueOpMask2 = 0x7,
153 // Accumulator instructions.
155 AccumulatorMask = 0x1,
157 // Complex XU, prevent xu competition by preferring slot3
158 PrefersSlot3Pos = 56,
159 PrefersSlot3Mask = 0x1,
168 // *** The code above must match HexagonInstrFormat*.td *** //
170 // Hexagon specific MO operand flag mask.
171 enum HexagonMOTargetFlagVal {
172 //===------------------------------------------------------------------===//
173 // Hexagon Specific MachineOperand flags.
176 /// MO_PCREL - On a symbol operand, indicates a PC-relative relocation
177 /// Used for computing a global address for PIC compilations
180 /// MO_GOT - Indicates a GOT-relative relocation
183 // Low or high part of a symbol.
186 // Offset from the base of the SDA.
189 // MO_GDGOT - indicates GOT relative relocation for TLS
190 // GeneralDynamic method
193 // MO_GDPLT - indicates PLT relative relocation for TLS
194 // GeneralDynamic method
197 // MO_IE - indicates non PIC relocation for TLS
198 // Initial Executable method
201 // MO_IEGOT - indicates PIC relocation for TLS
202 // Initial Executable method
205 // MO_TPREL - indicates relocation for TLS
206 // local Executable method
209 // HMOTF_ConstExtended
210 // Addendum to abovem, indicates a const extended op
211 // Can be used as a mask.
212 HMOTF_ConstExtended = 0x80
216 // Hexagon Sub-instruction classes.
217 enum SubInstructionGroup {
227 // Hexagon Compound classes.
236 INST_PARSE_MASK = 0x0000c000,
237 INST_PARSE_PACKET_END = 0x0000c000,
238 INST_PARSE_LOOP_END = 0x00008000,
239 INST_PARSE_NOT_END = 0x00004000,
240 INST_PARSE_DUPLEX = 0x00000000,
241 INST_PARSE_EXTENDER = 0x00000000
244 enum InstIClassBits : unsigned {
245 INST_ICLASS_MASK = 0xf0000000,
246 INST_ICLASS_EXTENDER = 0x00000000,
247 INST_ICLASS_J_1 = 0x10000000,
248 INST_ICLASS_J_2 = 0x20000000,
249 INST_ICLASS_LD_ST_1 = 0x30000000,
250 INST_ICLASS_LD_ST_2 = 0x40000000,
251 INST_ICLASS_J_3 = 0x50000000,
252 INST_ICLASS_CR = 0x60000000,
253 INST_ICLASS_ALU32_1 = 0x70000000,
254 INST_ICLASS_XTYPE_1 = 0x80000000,
255 INST_ICLASS_LD = 0x90000000,
256 INST_ICLASS_ST = 0xa0000000,
257 INST_ICLASS_ALU32_2 = 0xb0000000,
258 INST_ICLASS_XTYPE_2 = 0xc0000000,
259 INST_ICLASS_XTYPE_3 = 0xd0000000,
260 INST_ICLASS_XTYPE_4 = 0xe0000000,
261 INST_ICLASS_ALU32_3 = 0xf0000000
264 } // End namespace HexagonII.
266 } // End namespace llvm.