LLVM 19.0.0git
HexagonBaseInfo.h
Go to the documentation of this file.
1//===- HexagonBaseInfo.h - Top level definitions for Hexagon ----*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains small standalone helper functions and enum definitions for
10// the Hexagon target useful for the compiler back-end and the MC libraries.
11// As such, it deliberately does not include references to LLVM core
12// code gen types, passes, etc..
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
17#define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
18
19#include "HexagonDepITypes.h"
21#include "llvm/MC/MCInstrDesc.h"
22
23namespace llvm {
24
25/// HexagonII - This namespace holds all of the target specific flags that
26/// instruction info tracks.
27namespace HexagonII {
29 unsigned const TypeCVI_LAST = TypeCVI_ZW;
30
31 enum AddrMode {
32 NoAddrMode = 0, // No addressing mode
33 Absolute = 1, // Absolute addressing mode
34 AbsoluteSet = 2, // Absolute set addressing mode
35 BaseImmOffset = 3, // Indirect with offset
36 BaseLongOffset = 4, // Indirect with long offset
37 BaseRegOffset = 5, // Indirect with register offset
38 PostInc = 6 // Post increment addressing mode
39 };
40
48 };
49
50 // MCInstrDesc TSFlags
51 // *** Must match HexagonInstrFormat*.td ***
53 // This 7-bit field describes the insn type.
55 TypeMask = 0x7f,
56
57 // Solo instructions.
59 SoloMask = 0x1,
60 // Packed only with A or X-type instructions.
63 // Only A-type instruction in first slot or nothing.
66
67 // Predicated instructions.
76
77 // New-Value consumer instructions.
80 // New-Value producer instructions.
83 // Which operand consumes or produces a new value.
86 // Stores that can become new-value stores.
89 // New-value store instructions.
92 // Loads that can become current-value loads.
95 // Current-value load instructions.
98
99 // Extendable insns.
102 // Insns must be extended.
105 // Which operand may be extended.
108 // Signed or unsigned range.
111 // Number of bits of range before extending operand.
114 // Alignment power-of-two before extending operand.
117
124
127
128 // Addressing mode for load/store instructions.
131 // Access size for load/store instructions.
134
135 // Branch predicted taken.
138
139 // Floating-point instructions.
140 FPPos = 48,
141 FPMask = 0x1,
142
143 // New-Value producer-2 instructions.
146 // Which operand consumes or produces a new value.
149
150 // Accumulator instructions.
153
154 // Complex XU, prevent xu competition by preferring slot3
157
160
163
166
169
172
175 };
176
177 inline unsigned getTSFlags(const MCInstrDesc &MID, HexagonTSFlagsVal Pos,
178 unsigned Mask) {
179 return (MID.TSFlags >> Pos) & Mask;
180 }
181
182 // *** The code above must match HexagonInstrFormat*.td *** //
183
184 // Hexagon specific MO operand flag mask.
186 // Hexagon-specific MachineOperand target flags.
187 //
188 // When changing these, make sure to update
189 // getSerializableDirectMachineOperandTargetFlags and
190 // getSerializableBitmaskMachineOperandTargetFlags if needed.
192
193 /// MO_PCREL - On a symbol operand, indicates a PC-relative relocation
194 /// Used for computing a global address for PIC compilations
196
197 /// MO_GOT - Indicates a GOT-relative relocation
199
200 // Low or high part of a symbol.
203
204 // Offset from the base of the SDA.
206
207 // MO_GDGOT - indicates GOT relative relocation for TLS
208 // GeneralDynamic method
210
211 // MO_GDPLT - indicates PLT relative relocation for TLS
212 // GeneralDynamic method
214
215 // MO_IE - indicates non PIC relocation for TLS
216 // Initial Executable method
218
219 // MO_IEGOT - indicates PIC relocation for TLS
220 // Initial Executable method
222
223 // MO_TPREL - indicates relocation for TLS
224 // local Executable method
226
227 // HMOTF_ConstExtended
228 // Addendum to above, indicates a const extended op
229 // Can be used as a mask.
231
232 // Union of all bitmasks (currently only HMOTF_ConstExtended).
234 };
235
236 // Hexagon Sub-instruction classes.
245 };
246
247 // Hexagon Compound classes.
252 HCG_C
253 };
254
256 INST_PARSE_MASK = 0x0000c000,
259 INST_PARSE_NOT_END = 0x00004000,
260 INST_PARSE_DUPLEX = 0x00000000,
261 INST_PARSE_EXTENDER = 0x00000000
262 };
263
264 enum InstIClassBits : unsigned {
265 INST_ICLASS_MASK = 0xf0000000,
267 INST_ICLASS_J_1 = 0x10000000,
268 INST_ICLASS_J_2 = 0x20000000,
271 INST_ICLASS_J_3 = 0x50000000,
272 INST_ICLASS_CR = 0x60000000,
275 INST_ICLASS_LD = 0x90000000,
276 INST_ICLASS_ST = 0xa0000000,
281 INST_ICLASS_ALU32_3 = 0xf0000000
282 };
283
284 inline bool isCVI(const MCInstrDesc &MID) {
285 return getTSFlags(MID, isCVIPos, isCVIMask) != 0;
286 }
287
290 switch (S) {
291 case ByteAccess: return 1;
292 case HalfWordAccess: return 2;
293 case WordAccess: return 4;
294 case DoubleWordAccess: return 8;
295 default: return 0;
296 }
297 }
298} // end namespace HexagonII
299
300} // end namespace llvm
301
302#endif // LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
#define LLVM_ATTRIBUTE_UNUSED
Definition: Compiler.h:203
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:198
unsigned const TypeCVI_LAST
static LLVM_ATTRIBUTE_UNUSED unsigned getMemAccessSizeInBytes(MemAccessSize S)
unsigned const TypeCVI_FIRST
unsigned getTSFlags(const MCInstrDesc &MID, HexagonTSFlagsVal Pos, unsigned Mask)
@ MO_PCREL
MO_PCREL - On a symbol operand, indicates a PC-relative relocation Used for computing a global addres...
@ MO_GOT
MO_GOT - Indicates a GOT-relative relocation.
bool isCVI(const MCInstrDesc &MID)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18