]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonBaseInfo.h
Merge ^/head r317971 through r318379.
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / Hexagon / MCTargetDesc / HexagonBaseInfo.h
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"
22 #include "llvm/Support/ErrorHandling.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.
77     SoloAin1Pos  = 8,
78     SoloAin1Mask = 0x1,
79
80     // Predicated instructions.
81     PredicatedPos  = 9,
82     PredicatedMask = 0x1,
83     PredicatedFalsePos  = 10,
84     PredicatedFalseMask = 0x1,
85     PredicatedNewPos  = 11,
86     PredicatedNewMask = 0x1,
87     PredicateLatePos  = 12,
88     PredicateLateMask = 0x1,
89
90     // New-Value consumer instructions.
91     NewValuePos  = 13,
92     NewValueMask = 0x1,
93     // New-Value producer instructions.
94     hasNewValuePos  = 14,
95     hasNewValueMask = 0x1,
96     // Which operand consumes or produces a new value.
97     NewValueOpPos  = 15,
98     NewValueOpMask = 0x7,
99     // Stores that can become new-value stores.
100     mayNVStorePos  = 18,
101     mayNVStoreMask = 0x1,
102     // New-value store instructions.
103     NVStorePos  = 19,
104     NVStoreMask = 0x1,
105     // Loads that can become current-value loads.
106     mayCVLoadPos  = 20,
107     mayCVLoadMask = 0x1,
108     // Current-value load instructions.
109     CVLoadPos  = 21,
110     CVLoadMask = 0x1,
111
112     // Extendable insns.
113     ExtendablePos  = 22,
114     ExtendableMask = 0x1,
115     // Insns must be extended.
116     ExtendedPos  = 23,
117     ExtendedMask = 0x1,
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.
125     ExtentBitsPos  = 28,
126     ExtentBitsMask = 0x1f,
127     // Alignment power-of-two before extending operand.
128     ExtentAlignPos  = 33,
129     ExtentAlignMask = 0x3,
130
131     // Addressing mode for load/store instructions.
132     AddrModePos  = 41,
133     AddrModeMask = 0x7,
134     // Access size for load/store instructions.
135     MemAccessSizePos = 44,
136     MemAccesSizeMask = 0xf,
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.
147     hasNewValuePos2  = 51,
148     hasNewValueMask2 = 0x1,
149     // Which operand consumes or produces a new value.
150     NewValueOpPos2  = 52,
151     NewValueOpMask2 = 0x7,
152
153     // Accumulator instructions.
154     AccumulatorPos = 55,
155     AccumulatorMask = 0x1,
156
157     // Complex XU, prevent xu competition by preferring slot3
158     PrefersSlot3Pos = 56,
159     PrefersSlot3Mask = 0x1,
160
161     CofMax1Pos = 60,
162     CofMax1Mask = 0x1,
163
164     CVINewPos = 61,
165     CVINewMask = 0x1
166   };
167
168   // *** The code above must match HexagonInstrFormat*.td *** //
169
170   // Hexagon specific MO operand flag mask.
171   enum HexagonMOTargetFlagVal {
172     //===------------------------------------------------------------------===//
173     // Hexagon Specific MachineOperand flags.
174     MO_NO_FLAG,
175
176     /// MO_PCREL - On a symbol operand, indicates a PC-relative relocation
177     /// Used for computing a global address for PIC compilations
178     MO_PCREL,
179
180     /// MO_GOT - Indicates a GOT-relative relocation
181     MO_GOT,
182
183     // Low or high part of a symbol.
184     MO_LO16, MO_HI16,
185
186     // Offset from the base of the SDA.
187     MO_GPREL,
188
189     // MO_GDGOT - indicates GOT relative relocation for TLS
190     // GeneralDynamic method
191     MO_GDGOT,
192
193     // MO_GDPLT - indicates PLT relative relocation for TLS
194     // GeneralDynamic method
195     MO_GDPLT,
196
197     // MO_IE - indicates non PIC relocation for TLS
198     // Initial Executable method
199     MO_IE,
200
201     // MO_IEGOT - indicates PIC relocation for TLS
202     // Initial Executable method
203     MO_IEGOT,
204
205     // MO_TPREL - indicates relocation for TLS
206     // local Executable method
207     MO_TPREL,
208
209     // HMOTF_ConstExtended
210     // Addendum to abovem, indicates a const extended op
211     // Can be used as a mask.
212     HMOTF_ConstExtended = 0x80
213
214   };
215
216   // Hexagon Sub-instruction classes.
217   enum SubInstructionGroup {
218     HSIG_None = 0,
219     HSIG_L1,
220     HSIG_L2,
221     HSIG_S1,
222     HSIG_S2,
223     HSIG_A,
224     HSIG_Compound
225   };
226
227   // Hexagon Compound classes.
228   enum CompoundGroup {
229     HCG_None = 0,
230     HCG_A,
231     HCG_B,
232     HCG_C
233   };
234
235   enum InstParseBits {
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
242   };
243
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
262   };
263
264 } // End namespace HexagonII.
265
266 } // End namespace llvm.
267
268 #endif