LLVM  6.0.0svn
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"
22 
23 namespace llvm {
24 
25 /// HexagonII - This namespace holds all of the target specific flags that
26 /// instruction info tracks.
27 namespace HexagonII {
28  unsigned const TypeCVI_FIRST = TypeCVI_HIST;
29  unsigned const TypeCVI_LAST = TypeCVI_VX_LATE;
30 
31  enum SubTarget {
32  HasV4SubT = 0x3f,
33  HasV5SubT = 0x3e,
34  HasV55SubT = 0x3c,
35  HasV60SubT = 0x38,
36  };
37 
38  enum AddrMode {
39  NoAddrMode = 0, // No addressing mode
40  Absolute = 1, // Absolute addressing mode
41  AbsoluteSet = 2, // Absolute set addressing mode
42  BaseImmOffset = 3, // Indirect with offset
43  BaseLongOffset = 4, // Indirect with long offset
44  BaseRegOffset = 5, // Indirect with register offset
45  PostInc = 6 // Post increment addressing mode
46  };
47 
55  };
56 
57  // MCInstrDesc TSFlags
58  // *** Must match HexagonInstrFormat*.td ***
59  enum {
60  // This 5-bit field describes the insn type.
61  TypePos = 0,
62  TypeMask = 0x3f,
63 
64  // Solo instructions.
65  SoloPos = 6,
66  SoloMask = 0x1,
67  // Packed only with A or X-type instructions.
68  SoloAXPos = 7,
69  SoloAXMask = 0x1,
70  // Only A-type instruction in first slot or nothing.
72  SoloAin1Mask = 0x1,
73 
74  // Predicated instructions.
83 
84  // New-Value consumer instructions.
86  NewValueMask = 0x1,
87  // New-Value producer instructions.
90  // Which operand consumes or produces a new value.
93  // Stores that can become new-value stores.
96  // New-value store instructions.
97  NVStorePos = 19,
98  NVStoreMask = 0x1,
99  // Loads that can become current-value loads.
102  // Current-value load instructions.
103  CVLoadPos = 21,
104  CVLoadMask = 0x1,
105 
106  // Extendable insns.
109  // Insns must be extended.
112  // Which operand may be extended.
115  // Signed or unsigned range.
118  // Number of bits of range before extending operand.
121  // Alignment power-of-two before extending operand.
124 
125  // Addressing mode for load/store instructions.
128  // Access size for load/store instructions.
131 
132  // Branch predicted taken.
133  TakenPos = 48,
134  TakenMask = 0x1,
135 
136  // Floating-point instructions.
137  FPPos = 49,
138  FPMask = 0x1,
139 
140  // New-Value producer-2 instructions.
143  // Which operand consumes or produces a new value.
146 
147  // Accumulator instructions.
150 
151  // Complex XU, prevent xu competition by preferring slot3
154 
156  CofMax1Mask = 0x1,
157 
158  CVINewPos = 61,
160  };
161 
162  // *** The code above must match HexagonInstrFormat*.td *** //
163 
164  // Hexagon specific MO operand flag mask.
166  // Hexagon-specific MachineOperand target flags.
167  //
168  // When chaning these, make sure to update
169  // getSerializableDirectMachineOperandTargetFlags and
170  // getSerializableBitmaskMachineOperandTargetFlags if needed.
172 
173  /// MO_PCREL - On a symbol operand, indicates a PC-relative relocation
174  /// Used for computing a global address for PIC compilations
176 
177  /// MO_GOT - Indicates a GOT-relative relocation
179 
180  // Low or high part of a symbol.
182 
183  // Offset from the base of the SDA.
185 
186  // MO_GDGOT - indicates GOT relative relocation for TLS
187  // GeneralDynamic method
189 
190  // MO_GDPLT - indicates PLT relative relocation for TLS
191  // GeneralDynamic method
193 
194  // MO_IE - indicates non PIC relocation for TLS
195  // Initial Executable method
197 
198  // MO_IEGOT - indicates PIC relocation for TLS
199  // Initial Executable method
201 
202  // MO_TPREL - indicates relocation for TLS
203  // local Executable method
205 
206  // HMOTF_ConstExtended
207  // Addendum to above, indicates a const extended op
208  // Can be used as a mask.
210 
211  // Union of all bitmasks (currently only HMOTF_ConstExtended).
213  };
214 
215  // Hexagon Sub-instruction classes.
224  };
225 
226  // Hexagon Compound classes.
228  HCG_None = 0,
232  };
233 
235  INST_PARSE_MASK = 0x0000c000,
236  INST_PARSE_PACKET_END = 0x0000c000,
237  INST_PARSE_LOOP_END = 0x00008000,
238  INST_PARSE_NOT_END = 0x00004000,
239  INST_PARSE_DUPLEX = 0x00000000,
240  INST_PARSE_EXTENDER = 0x00000000
241  };
242 
243  enum InstIClassBits : unsigned {
244  INST_ICLASS_MASK = 0xf0000000,
245  INST_ICLASS_EXTENDER = 0x00000000,
246  INST_ICLASS_J_1 = 0x10000000,
247  INST_ICLASS_J_2 = 0x20000000,
248  INST_ICLASS_LD_ST_1 = 0x30000000,
249  INST_ICLASS_LD_ST_2 = 0x40000000,
250  INST_ICLASS_J_3 = 0x50000000,
251  INST_ICLASS_CR = 0x60000000,
252  INST_ICLASS_ALU32_1 = 0x70000000,
253  INST_ICLASS_XTYPE_1 = 0x80000000,
254  INST_ICLASS_LD = 0x90000000,
255  INST_ICLASS_ST = 0xa0000000,
256  INST_ICLASS_ALU32_2 = 0xb0000000,
257  INST_ICLASS_XTYPE_2 = 0xc0000000,
258  INST_ICLASS_XTYPE_3 = 0xd0000000,
259  INST_ICLASS_XTYPE_4 = 0xe0000000,
260  INST_ICLASS_ALU32_3 = 0xf0000000
261  };
262 
265  switch (S) {
266  case ByteAccess: return 1;
267  case HalfWordAccess: return 2;
268  case WordAccess: return 4;
269  case DoubleWordAccess: return 8;
270  default: return 0;
271  }
272  }
273 } // end namespace HexagonII
274 
275 } // end namespace llvm
276 
277 #endif // LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
#define LLVM_ATTRIBUTE_UNUSED
Definition: Compiler.h:144
MO_PCREL - On a symbol operand, indicates a PC-relative relocation Used for computing a global addres...
unsigned const TypeCVI_FIRST
static LLVM_ATTRIBUTE_UNUSED unsigned getMemAccessSizeInBytes(MemAccessSize S)
unsigned const TypeCVI_LAST
MO_GOT - Indicates a GOT-relative relocation.