LLVM  5.0.0
HexagonBaseInfo.h
Go to the documentation of this file.
1 //===-- HexagonBaseInfo.h - Top level definitions for Hexagon --*- C++ -*--===//
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 // 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..
14 //
15 //===----------------------------------------------------------------------===//
16 
17 #ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
18 #define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
19 
20 #include "HexagonDepITypes.h"
21 #include "HexagonMCTargetDesc.h"
23 #include <stdint.h>
24 
25 namespace llvm {
26 
27 /// HexagonII - This namespace holds all of the target specific flags that
28 /// instruction info tracks.
29 ///
30 namespace HexagonII {
31  unsigned const TypeCVI_FIRST = TypeCVI_HIST;
32  unsigned const TypeCVI_LAST = TypeCVI_VX_LATE;
33 
34  enum SubTarget {
35  HasV4SubT = 0x3f,
36  HasV5SubT = 0x3e,
37  HasV55SubT = 0x3c,
38  HasV60SubT = 0x38,
39  };
40 
41  enum AddrMode {
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
49  };
50 
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).
61  };
62 
63  // MCInstrDesc TSFlags
64  // *** Must match HexagonInstrFormat*.td ***
65  enum {
66  // This 5-bit field describes the insn type.
67  TypePos = 0,
68  TypeMask = 0x3f,
69 
70  // Solo instructions.
71  SoloPos = 6,
72  SoloMask = 0x1,
73  // Packed only with A or X-type instructions.
74  SoloAXPos = 7,
75  SoloAXMask = 0x1,
76  // Only A-type instruction in first slot or nothing.
78  SoloAin1Mask = 0x1,
79 
80  // Predicated instructions.
89 
90  // New-Value consumer instructions.
92  NewValueMask = 0x1,
93  // New-Value producer instructions.
96  // Which operand consumes or produces a new value.
99  // Stores that can become new-value stores.
102  // New-value store instructions.
104  NVStoreMask = 0x1,
105  // Loads that can become current-value loads.
108  // Current-value load instructions.
109  CVLoadPos = 21,
110  CVLoadMask = 0x1,
111 
112  // Extendable insns.
115  // Insns must be extended.
118  // Which operand may be extended.
121  // Signed or unsigned range.
124  // Number of bits of range before extending operand.
127  // Alignment power-of-two before extending operand.
130 
131  // Addressing mode for load/store instructions.
134  // Access size for load/store instructions.
137 
138  // Branch predicted taken.
139  TakenPos = 48,
140  TakenMask = 0x1,
141 
142  // Floating-point instructions.
143  FPPos = 49,
144  FPMask = 0x1,
145 
146  // New-Value producer-2 instructions.
149  // Which operand consumes or produces a new value.
152 
153  // Accumulator instructions.
156 
157  // Complex XU, prevent xu competition by preferring slot3
160 
162  CofMax1Mask = 0x1,
163 
164  CVINewPos = 61,
166  };
167 
168  // *** The code above must match HexagonInstrFormat*.td *** //
169 
170  // Hexagon specific MO operand flag mask.
172  // Hexagon-specific MachineOperand target flags.
173  //
174  // When chaning these, make sure to update
175  // getSerializableDirectMachineOperandTargetFlags and
176  // getSerializableBitmaskMachineOperandTargetFlags if needed.
178 
179  /// MO_PCREL - On a symbol operand, indicates a PC-relative relocation
180  /// Used for computing a global address for PIC compilations
182 
183  /// MO_GOT - Indicates a GOT-relative relocation
185 
186  // Low or high part of a symbol.
188 
189  // Offset from the base of the SDA.
191 
192  // MO_GDGOT - indicates GOT relative relocation for TLS
193  // GeneralDynamic method
195 
196  // MO_GDPLT - indicates PLT relative relocation for TLS
197  // GeneralDynamic method
199 
200  // MO_IE - indicates non PIC relocation for TLS
201  // Initial Executable method
203 
204  // MO_IEGOT - indicates PIC relocation for TLS
205  // Initial Executable method
207 
208  // MO_TPREL - indicates relocation for TLS
209  // local Executable method
211 
212  // HMOTF_ConstExtended
213  // Addendum to above, indicates a const extended op
214  // Can be used as a mask.
216 
217  // Union of all bitmasks (currently only HMOTF_ConstExtended).
219  };
220 
221  // Hexagon Sub-instruction classes.
230  };
231 
232  // Hexagon Compound classes.
234  HCG_None = 0,
238  };
239 
241  INST_PARSE_MASK = 0x0000c000,
242  INST_PARSE_PACKET_END = 0x0000c000,
243  INST_PARSE_LOOP_END = 0x00008000,
244  INST_PARSE_NOT_END = 0x00004000,
245  INST_PARSE_DUPLEX = 0x00000000,
246  INST_PARSE_EXTENDER = 0x00000000
247  };
248 
249  enum InstIClassBits : unsigned {
250  INST_ICLASS_MASK = 0xf0000000,
251  INST_ICLASS_EXTENDER = 0x00000000,
252  INST_ICLASS_J_1 = 0x10000000,
253  INST_ICLASS_J_2 = 0x20000000,
254  INST_ICLASS_LD_ST_1 = 0x30000000,
255  INST_ICLASS_LD_ST_2 = 0x40000000,
256  INST_ICLASS_J_3 = 0x50000000,
257  INST_ICLASS_CR = 0x60000000,
258  INST_ICLASS_ALU32_1 = 0x70000000,
259  INST_ICLASS_XTYPE_1 = 0x80000000,
260  INST_ICLASS_LD = 0x90000000,
261  INST_ICLASS_ST = 0xa0000000,
262  INST_ICLASS_ALU32_2 = 0xb0000000,
263  INST_ICLASS_XTYPE_2 = 0xc0000000,
264  INST_ICLASS_XTYPE_3 = 0xd0000000,
265  INST_ICLASS_XTYPE_4 = 0xe0000000,
266  INST_ICLASS_ALU32_3 = 0xf0000000
267  };
268 
269 } // End namespace HexagonII.
270 
271 } // End namespace llvm.
272 
273 #endif
MO_PCREL - On a symbol operand, indicates a PC-relative relocation Used for computing a global addres...
unsigned const TypeCVI_FIRST
unsigned const TypeCVI_LAST
MO_GOT - Indicates a GOT-relative relocation.