]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/Target/TargetOpcodes.def
MFV r319950: 5220 L2ARC does not support devices that do not provide 512B access
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / Target / TargetOpcodes.def
1 //===-- llvm/Target/TargetOpcodes.def - Target Indep Opcodes ------*- 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 defines the target independent instruction opcodes.
11 //
12 //===----------------------------------------------------------------------===//
13
14 // NOTE: NO INCLUDE GUARD DESIRED!
15
16 /// HANDLE_TARGET_OPCODE defines an opcode and its associated enum value.
17 ///
18 #ifndef HANDLE_TARGET_OPCODE
19 #define HANDLE_TARGET_OPCODE(OPC, NUM)
20 #endif
21
22 /// HANDLE_TARGET_OPCODE_MARKER defines an alternative identifier for an opcode.
23 ///
24 #ifndef HANDLE_TARGET_OPCODE_MARKER
25 #define HANDLE_TARGET_OPCODE_MARKER(IDENT, OPC)
26 #endif
27
28 /// Every instruction defined here must also appear in Target.td.
29 ///
30 HANDLE_TARGET_OPCODE(PHI)
31 HANDLE_TARGET_OPCODE(INLINEASM)
32 HANDLE_TARGET_OPCODE(CFI_INSTRUCTION)
33 HANDLE_TARGET_OPCODE(EH_LABEL)
34 HANDLE_TARGET_OPCODE(GC_LABEL)
35
36 /// KILL - This instruction is a noop that is used only to adjust the
37 /// liveness of registers. This can be useful when dealing with
38 /// sub-registers.
39 HANDLE_TARGET_OPCODE(KILL)
40
41 /// EXTRACT_SUBREG - This instruction takes two operands: a register
42 /// that has subregisters, and a subregister index. It returns the
43 /// extracted subregister value. This is commonly used to implement
44 /// truncation operations on target architectures which support it.
45 HANDLE_TARGET_OPCODE(EXTRACT_SUBREG)
46
47 /// INSERT_SUBREG - This instruction takes three operands: a register that
48 /// has subregisters, a register providing an insert value, and a
49 /// subregister index. It returns the value of the first register with the
50 /// value of the second register inserted. The first register is often
51 /// defined by an IMPLICIT_DEF, because it is commonly used to implement
52 /// anyext operations on target architectures which support it.
53 HANDLE_TARGET_OPCODE(INSERT_SUBREG)
54
55 /// IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef.
56 HANDLE_TARGET_OPCODE(IMPLICIT_DEF)
57
58 /// SUBREG_TO_REG - Assert the value of bits in a super register.
59 /// The result of this instruction is the value of the second operand inserted
60 /// into the subregister specified by the third operand. All other bits are
61 /// assumed to be equal to the bits in the immediate integer constant in the
62 /// first operand. This instruction just communicates information; No code
63 /// should be generated.
64 /// This is typically used after an instruction where the write to a subregister
65 /// implicitly cleared the bits in the super registers.
66 HANDLE_TARGET_OPCODE(SUBREG_TO_REG)
67
68 /// COPY_TO_REGCLASS - This instruction is a placeholder for a plain
69 /// register-to-register copy into a specific register class. This is only
70 /// used between instruction selection and MachineInstr creation, before
71 /// virtual registers have been created for all the instructions, and it's
72 /// only needed in cases where the register classes implied by the
73 /// instructions are insufficient. It is emitted as a COPY MachineInstr.
74   HANDLE_TARGET_OPCODE(COPY_TO_REGCLASS)
75
76 /// DBG_VALUE - a mapping of the llvm.dbg.value intrinsic
77 HANDLE_TARGET_OPCODE(DBG_VALUE)
78
79 /// REG_SEQUENCE - This variadic instruction is used to form a register that
80 /// represents a consecutive sequence of sub-registers. It's used as a
81 /// register coalescing / allocation aid and must be eliminated before code
82 /// emission.
83 // In SDNode form, the first operand encodes the register class created by
84 // the REG_SEQUENCE, while each subsequent pair names a vreg + subreg index
85 // pair.  Once it has been lowered to a MachineInstr, the regclass operand
86 // is no longer present.
87 /// e.g. v1027 = REG_SEQUENCE v1024, 3, v1025, 4, v1026, 5
88 /// After register coalescing references of v1024 should be replace with
89 /// v1027:3, v1025 with v1027:4, etc.
90   HANDLE_TARGET_OPCODE(REG_SEQUENCE)
91
92 /// COPY - Target-independent register copy. This instruction can also be
93 /// used to copy between subregisters of virtual registers.
94   HANDLE_TARGET_OPCODE(COPY)
95
96 /// BUNDLE - This instruction represents an instruction bundle. Instructions
97 /// which immediately follow a BUNDLE instruction which are marked with
98 /// 'InsideBundle' flag are inside the bundle.
99 HANDLE_TARGET_OPCODE(BUNDLE)
100
101 /// Lifetime markers.
102 HANDLE_TARGET_OPCODE(LIFETIME_START)
103 HANDLE_TARGET_OPCODE(LIFETIME_END)
104
105 /// A Stackmap instruction captures the location of live variables at its
106 /// position in the instruction stream. It is followed by a shadow of bytes
107 /// that must lie within the function and not contain another stackmap.
108 HANDLE_TARGET_OPCODE(STACKMAP)
109
110 /// Patchable call instruction - this instruction represents a call to a
111 /// constant address, followed by a series of NOPs. It is intended to
112 /// support optimizations for dynamic languages (such as javascript) that
113 /// rewrite calls to runtimes with more efficient code sequences.
114 /// This also implies a stack map.
115 HANDLE_TARGET_OPCODE(PATCHPOINT)
116
117 /// This pseudo-instruction loads the stack guard value. Targets which need
118 /// to prevent the stack guard value or address from being spilled to the
119 /// stack should override TargetLowering::emitLoadStackGuardNode and
120 /// additionally expand this pseudo after register allocation.
121 HANDLE_TARGET_OPCODE(LOAD_STACK_GUARD)
122
123 /// Call instruction with associated vm state for deoptimization and list
124 /// of live pointers for relocation by the garbage collector.  It is
125 /// intended to support garbage collection with fully precise relocating
126 /// collectors and deoptimizations in either the callee or caller.
127 HANDLE_TARGET_OPCODE(STATEPOINT)
128
129 /// Instruction that records the offset of a local stack allocation passed to
130 /// llvm.localescape. It has two arguments: the symbol for the label and the
131 /// frame index of the local stack allocation.
132 HANDLE_TARGET_OPCODE(LOCAL_ESCAPE)
133
134 /// Loading instruction that may page fault, bundled with associated
135 /// information on how to handle such a page fault.  It is intended to support
136 /// "zero cost" null checks in managed languages by allowing LLVM to fold
137 /// comparisons into existing memory operations.
138 HANDLE_TARGET_OPCODE(FAULTING_LOAD_OP)
139
140 /// Wraps a machine instruction to add patchability constraints.  An
141 /// instruction wrapped in PATCHABLE_OP has to either have a minimum
142 /// size or be preceded with a nop of that size.  The first operand is
143 /// an immediate denoting the minimum size of the instruction, the
144 /// second operand is an immediate denoting the opcode of the original
145 /// instruction.  The rest of the operands are the operands of the
146 /// original instruction.
147 HANDLE_TARGET_OPCODE(PATCHABLE_OP)
148
149 /// This is a marker instruction which gets translated into a nop sled, useful
150 /// for inserting instrumentation instructions at runtime.
151 HANDLE_TARGET_OPCODE(PATCHABLE_FUNCTION_ENTER)
152
153 /// Wraps a return instruction and its operands to enable adding nop sleds
154 /// either before or after the return. The nop sleds are useful for inserting
155 /// instrumentation instructions at runtime.
156 /// The patch here replaces the return instruction.
157 HANDLE_TARGET_OPCODE(PATCHABLE_RET)
158
159 /// This is a marker instruction which gets translated into a nop sled, useful
160 /// for inserting instrumentation instructions at runtime.
161 /// The patch here prepends the return instruction.
162 /// The same thing as in x86_64 is not possible for ARM because it has multiple
163 /// return instructions. Furthermore, CPU allows parametrized and even
164 /// conditional return instructions. In the current ARM implementation we are
165 /// making use of the fact that currently LLVM doesn't seem to generate
166 /// conditional return instructions.
167 /// On ARM, the same instruction can be used for popping multiple registers
168 /// from the stack and returning (it just pops pc register too), and LLVM
169 /// generates it sometimes. So we can't insert the sled between this stack
170 /// adjustment and the return without splitting the original instruction into 2
171 /// instructions. So on ARM, rather than jumping into the exit trampoline, we
172 /// call it, it does the tracing, preserves the stack and returns.
173 HANDLE_TARGET_OPCODE(PATCHABLE_FUNCTION_EXIT)
174
175 /// Wraps a tail call instruction and its operands to enable adding nop sleds
176 /// either before or after the tail exit. We use this as a disambiguation from
177 /// PATCHABLE_RET which specifically only works for return instructions.
178 HANDLE_TARGET_OPCODE(PATCHABLE_TAIL_CALL)
179
180 /// The following generic opcodes are not supposed to appear after ISel.
181 /// This is something we might want to relax, but for now, this is convenient
182 /// to produce diagnostics.
183
184 /// Generic ADD instruction. This is an integer add.
185 HANDLE_TARGET_OPCODE(G_ADD)
186 HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPCODE_START, G_ADD)
187
188 /// Generic SUB instruction. This is an integer sub.
189 HANDLE_TARGET_OPCODE(G_SUB)
190
191 // Generic multiply instruction.
192 HANDLE_TARGET_OPCODE(G_MUL)
193
194 // Generic signed division instruction.
195 HANDLE_TARGET_OPCODE(G_SDIV)
196
197 // Generic unsigned division instruction.
198 HANDLE_TARGET_OPCODE(G_UDIV)
199
200 // Generic signed remainder instruction.
201 HANDLE_TARGET_OPCODE(G_SREM)
202
203 // Generic unsigned remainder instruction.
204 HANDLE_TARGET_OPCODE(G_UREM)
205
206 /// Generic bitwise and instruction.
207 HANDLE_TARGET_OPCODE(G_AND)
208
209 /// Generic bitwise or instruction.
210 HANDLE_TARGET_OPCODE(G_OR)
211
212 /// Generic bitwise exclusive-or instruction.
213 HANDLE_TARGET_OPCODE(G_XOR)
214
215
216 /// Generic instruction to materialize the address of an alloca or other
217 /// stack-based object.
218 HANDLE_TARGET_OPCODE(G_FRAME_INDEX)
219
220 /// Generic reference to global value.
221 HANDLE_TARGET_OPCODE(G_GLOBAL_VALUE)
222
223 /// Generic instruction to extract blocks of bits from the register given
224 /// (typically a sub-register COPY after instruction selection).
225 HANDLE_TARGET_OPCODE(G_EXTRACT)
226
227 /// Generic instruction to insert blocks of bits from the registers given into
228 /// the source.
229 HANDLE_TARGET_OPCODE(G_INSERT)
230
231 /// Generic instruction to paste a variable number of components together into a
232 /// larger register.
233 HANDLE_TARGET_OPCODE(G_SEQUENCE)
234
235 /// Generic pointer to int conversion.
236 HANDLE_TARGET_OPCODE(G_PTRTOINT)
237
238 /// Generic int to pointer conversion.
239 HANDLE_TARGET_OPCODE(G_INTTOPTR)
240
241 /// Generic bitcast. The source and destination types must be different, or a
242 /// COPY is the relevant instruction.
243 HANDLE_TARGET_OPCODE(G_BITCAST)
244
245 /// Generic load.
246 HANDLE_TARGET_OPCODE(G_LOAD)
247
248 /// Generic store.
249 HANDLE_TARGET_OPCODE(G_STORE)
250
251 /// Generic conditional branch instruction.
252 HANDLE_TARGET_OPCODE(G_BRCOND)
253
254 /// Generic intrinsic use (without side effects).
255 HANDLE_TARGET_OPCODE(G_INTRINSIC)
256
257 /// Generic intrinsic use (with side effects).
258 HANDLE_TARGET_OPCODE(G_INTRINSIC_W_SIDE_EFFECTS)
259
260 /// Generic extension allowing rubbish in high bits.
261 HANDLE_TARGET_OPCODE(G_ANYEXT)
262
263 /// Generic instruction to discard the high bits of a register. This differs
264 /// from (G_EXTRACT val, 0) on its action on vectors: G_TRUNC will truncate
265 /// each element individually, G_EXTRACT will typically discard the high
266 /// elements of the vector.
267 HANDLE_TARGET_OPCODE(G_TRUNC)
268
269 /// Generic integer constant.
270 HANDLE_TARGET_OPCODE(G_CONSTANT)
271
272 /// Generic floating constant.
273 HANDLE_TARGET_OPCODE(G_FCONSTANT)
274
275 // Generic sign extend
276 HANDLE_TARGET_OPCODE(G_SEXT)
277
278 // Generic zero extend
279 HANDLE_TARGET_OPCODE(G_ZEXT)
280
281 // Generic left-shift
282 HANDLE_TARGET_OPCODE(G_SHL)
283
284 // Generic logical right-shift
285 HANDLE_TARGET_OPCODE(G_LSHR)
286
287 // Generic arithmetic right-shift
288 HANDLE_TARGET_OPCODE(G_ASHR)
289
290 /// Generic integer-base comparison, also applicable to vectors of integers.
291 HANDLE_TARGET_OPCODE(G_ICMP)
292
293 /// Generic floating-point comparison, also applicable to vectors.
294 HANDLE_TARGET_OPCODE(G_FCMP)
295
296 /// Generic select.
297 HANDLE_TARGET_OPCODE(G_SELECT)
298
299 /// Generic unsigned add instruction, consuming the normal operands plus a carry
300 /// flag, and similarly producing the result and a carry flag.
301 HANDLE_TARGET_OPCODE(G_UADDE)
302
303 /// Generic unsigned subtract instruction, consuming the normal operands plus a
304 /// carry flag, and similarly producing the result and a carry flag.
305 HANDLE_TARGET_OPCODE(G_USUBE)
306
307 /// Generic signed add instruction, producing the result and a signed overflow
308 /// flag.
309 HANDLE_TARGET_OPCODE(G_SADDO)
310
311 /// Generic signed subtract instruction, producing the result and a signed
312 /// overflow flag.
313 HANDLE_TARGET_OPCODE(G_SSUBO)
314
315 /// Generic unsigned multiply instruction, producing the result and a signed
316 /// overflow flag.
317 HANDLE_TARGET_OPCODE(G_UMULO)
318
319 /// Generic signed multiply instruction, producing the result and a signed
320 /// overflow flag.
321 HANDLE_TARGET_OPCODE(G_SMULO)
322
323 /// Generic FP addition.
324 HANDLE_TARGET_OPCODE(G_FADD)
325
326 /// Generic FP subtraction.
327 HANDLE_TARGET_OPCODE(G_FSUB)
328
329 /// Generic FP multiplication.
330 HANDLE_TARGET_OPCODE(G_FMUL)
331
332 /// Generic FP division.
333 HANDLE_TARGET_OPCODE(G_FDIV)
334
335 /// Generic FP remainder.
336 HANDLE_TARGET_OPCODE(G_FREM)
337
338 /// Generic float to signed-int conversion
339 HANDLE_TARGET_OPCODE(G_FPEXT)
340
341 /// Generic float to signed-int conversion
342 HANDLE_TARGET_OPCODE(G_FPTRUNC)
343
344 /// Generic float to signed-int conversion
345 HANDLE_TARGET_OPCODE(G_FPTOSI)
346
347 /// Generic float to unsigned-int conversion
348 HANDLE_TARGET_OPCODE(G_FPTOUI)
349
350 /// Generic signed-int to float conversion
351 HANDLE_TARGET_OPCODE(G_SITOFP)
352
353 /// Generic unsigned-int to float conversion
354 HANDLE_TARGET_OPCODE(G_UITOFP)
355
356 /// Generic unsigned-int to float conversion
357 HANDLE_TARGET_OPCODE(G_GEP)
358
359 /// Generic BRANCH instruction. This is an unconditional branch.
360 HANDLE_TARGET_OPCODE(G_BR)
361
362 // TODO: Add more generic opcodes as we move along.
363
364 /// Marker for the end of the generic opcode.
365 /// This is used to check if an opcode is in the range of the
366 /// generic opcodes.
367 HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPCODE_END, G_BR)
368
369 /// BUILTIN_OP_END - This must be the last enum value in this list.
370 /// The target-specific post-isel opcode values start here.
371 HANDLE_TARGET_OPCODE_MARKER(GENERIC_OP_END, PRE_ISEL_GENERIC_OPCODE_END)