Emit debug info for byval parameters.
[oota-llvm.git] / include / llvm / CodeGen / ISDOpcodes.h
1 //===-- llvm/CodeGen/ISDOpcodes.h - CodeGen 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 declares codegen opcodes and related utilities.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_CODEGEN_ISDOPCODES_H
15 #define LLVM_CODEGEN_ISDOPCODES_H
16
17 namespace llvm {
18
19 /// ISD namespace - This namespace contains an enum which represents all of the
20 /// SelectionDAG node types and value types.
21 ///
22 namespace ISD {
23
24   //===--------------------------------------------------------------------===//
25   /// ISD::NodeType enum - This enum defines the target-independent operators
26   /// for a SelectionDAG.
27   ///
28   /// Targets may also define target-dependent operator codes for SDNodes. For
29   /// example, on x86, these are the enum values in the X86ISD namespace.
30   /// Targets should aim to use target-independent operators to model their
31   /// instruction sets as much as possible, and only use target-dependent
32   /// operators when they have special requirements.
33   ///
34   /// Finally, during and after selection proper, SNodes may use special
35   /// operator codes that correspond directly with MachineInstr opcodes. These
36   /// are used to represent selected instructions. See the isMachineOpcode()
37   /// and getMachineOpcode() member functions of SDNode.
38   ///
39   enum NodeType {
40     // DELETED_NODE - This is an illegal value that is used to catch
41     // errors.  This opcode is not a legal opcode for any node.
42     DELETED_NODE,
43
44     // EntryToken - This is the marker used to indicate the start of the region.
45     EntryToken,
46
47     // TokenFactor - This node takes multiple tokens as input and produces a
48     // single token result.  This is used to represent the fact that the operand
49     // operators are independent of each other.
50     TokenFactor,
51
52     // AssertSext, AssertZext - These nodes record if a register contains a
53     // value that has already been zero or sign extended from a narrower type.
54     // These nodes take two operands.  The first is the node that has already
55     // been extended, and the second is a value type node indicating the width
56     // of the extension
57     AssertSext, AssertZext,
58
59     // Various leaf nodes.
60     BasicBlock, VALUETYPE, CONDCODE, Register,
61     Constant, ConstantFP,
62     GlobalAddress, GlobalTLSAddress, FrameIndex,
63     JumpTable, ConstantPool, ExternalSymbol, BlockAddress,
64
65     // The address of the GOT
66     GLOBAL_OFFSET_TABLE,
67
68     // FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and
69     // llvm.returnaddress on the DAG.  These nodes take one operand, the index
70     // of the frame or return address to return.  An index of zero corresponds
71     // to the current function's frame or return address, an index of one to the
72     // parent's frame or return address, and so on.
73     FRAMEADDR, RETURNADDR,
74
75     // FRAME_TO_ARGS_OFFSET - This node represents offset from frame pointer to
76     // first (possible) on-stack argument. This is needed for correct stack
77     // adjustment during unwind.
78     FRAME_TO_ARGS_OFFSET,
79
80     // RESULT, OUTCHAIN = EXCEPTIONADDR(INCHAIN) - This node represents the
81     // address of the exception block on entry to an landing pad block.
82     EXCEPTIONADDR,
83
84     // RESULT, OUTCHAIN = LSDAADDR(INCHAIN) - This node represents the
85     // address of the Language Specific Data Area for the enclosing function.
86     LSDAADDR,
87
88     // RESULT, OUTCHAIN = EHSELECTION(INCHAIN, EXCEPTION) - This node represents
89     // the selection index of the exception thrown.
90     EHSELECTION,
91
92     // OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents
93     // 'eh_return' gcc dwarf builtin, which is used to return from
94     // exception. The general meaning is: adjust stack by OFFSET and pass
95     // execution to HANDLER. Many platform-related details also :)
96     EH_RETURN,
97
98     // TargetConstant* - Like Constant*, but the DAG does not do any folding or
99     // simplification of the constant.
100     TargetConstant,
101     TargetConstantFP,
102
103     // TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or
104     // anything else with this node, and this is valid in the target-specific
105     // dag, turning into a GlobalAddress operand.
106     TargetGlobalAddress,
107     TargetGlobalTLSAddress,
108     TargetFrameIndex,
109     TargetJumpTable,
110     TargetConstantPool,
111     TargetExternalSymbol,
112     TargetBlockAddress,
113
114     /// RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...)
115     /// This node represents a target intrinsic function with no side effects.
116     /// The first operand is the ID number of the intrinsic from the
117     /// llvm::Intrinsic namespace.  The operands to the intrinsic follow.  The
118     /// node has returns the result of the intrinsic.
119     INTRINSIC_WO_CHAIN,
120
121     /// RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...)
122     /// This node represents a target intrinsic function with side effects that
123     /// returns a result.  The first operand is a chain pointer.  The second is
124     /// the ID number of the intrinsic from the llvm::Intrinsic namespace.  The
125     /// operands to the intrinsic follow.  The node has two results, the result
126     /// of the intrinsic and an output chain.
127     INTRINSIC_W_CHAIN,
128
129     /// OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...)
130     /// This node represents a target intrinsic function with side effects that
131     /// does not return a result.  The first operand is a chain pointer.  The
132     /// second is the ID number of the intrinsic from the llvm::Intrinsic
133     /// namespace.  The operands to the intrinsic follow.
134     INTRINSIC_VOID,
135
136     // CopyToReg - This node has three operands: a chain, a register number to
137     // set to this value, and a value.
138     CopyToReg,
139
140     // CopyFromReg - This node indicates that the input value is a virtual or
141     // physical register that is defined outside of the scope of this
142     // SelectionDAG.  The register is available from the RegisterSDNode object.
143     CopyFromReg,
144
145     // UNDEF - An undefined node
146     UNDEF,
147
148     // EXTRACT_ELEMENT - This is used to get the lower or upper (determined by
149     // a Constant, which is required to be operand #1) half of the integer or
150     // float value specified as operand #0.  This is only for use before
151     // legalization, for values that will be broken into multiple registers.
152     EXTRACT_ELEMENT,
153
154     // BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.  Given
155     // two values of the same integer value type, this produces a value twice as
156     // big.  Like EXTRACT_ELEMENT, this can only be used before legalization.
157     BUILD_PAIR,
158
159     // MERGE_VALUES - This node takes multiple discrete operands and returns
160     // them all as its individual results.  This nodes has exactly the same
161     // number of inputs and outputs. This node is useful for some pieces of the
162     // code generator that want to think about a single node with multiple
163     // results, not multiple nodes.
164     MERGE_VALUES,
165
166     // Simple integer binary arithmetic operators.
167     ADD, SUB, MUL, SDIV, UDIV, SREM, UREM,
168
169     // SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing
170     // a signed/unsigned value of type i[2*N], and return the full value as
171     // two results, each of type iN.
172     SMUL_LOHI, UMUL_LOHI,
173
174     // SDIVREM/UDIVREM - Divide two integers and produce both a quotient and
175     // remainder result.
176     SDIVREM, UDIVREM,
177
178     // CARRY_FALSE - This node is used when folding other nodes,
179     // like ADDC/SUBC, which indicate the carry result is always false.
180     CARRY_FALSE,
181
182     // Carry-setting nodes for multiple precision addition and subtraction.
183     // These nodes take two operands of the same value type, and produce two
184     // results.  The first result is the normal add or sub result, the second
185     // result is the carry flag result.
186     ADDC, SUBC,
187
188     // Carry-using nodes for multiple precision addition and subtraction.  These
189     // nodes take three operands: The first two are the normal lhs and rhs to
190     // the add or sub, and the third is the input carry flag.  These nodes
191     // produce two results; the normal result of the add or sub, and the output
192     // carry flag.  These nodes both read and write a carry flag to allow them
193     // to them to be chained together for add and sub of arbitrarily large
194     // values.
195     ADDE, SUBE,
196
197     // RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
198     // These nodes take two operands: the normal LHS and RHS to the add. They
199     // produce two results: the normal result of the add, and a boolean that
200     // indicates if an overflow occured (*not* a flag, because it may be stored
201     // to memory, etc.).  If the type of the boolean is not i1 then the high
202     // bits conform to getBooleanContents.
203     // These nodes are generated from the llvm.[su]add.with.overflow intrinsics.
204     SADDO, UADDO,
205
206     // Same for subtraction
207     SSUBO, USUBO,
208
209     // Same for multiplication
210     SMULO, UMULO,
211
212     // Simple binary floating point operators.
213     FADD, FSUB, FMUL, FDIV, FREM,
214
215     // FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.  NOTE: This
216     // DAG node does not require that X and Y have the same type, just that they
217     // are both floating point.  X and the result must have the same type.
218     // FCOPYSIGN(f32, f64) is allowed.
219     FCOPYSIGN,
220
221     // INT = FGETSIGN(FP) - Return the sign bit of the specified floating point
222     // value as an integer 0/1 value.
223     FGETSIGN,
224
225     /// BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the
226     /// specified, possibly variable, elements.  The number of elements is
227     /// required to be a power of two.  The types of the operands must all be
228     /// the same and must match the vector element type, except that integer
229     /// types are allowed to be larger than the element type, in which case
230     /// the operands are implicitly truncated.
231     BUILD_VECTOR,
232
233     /// INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element
234     /// at IDX replaced with VAL.  If the type of VAL is larger than the vector
235     /// element type then VAL is truncated before replacement.
236     INSERT_VECTOR_ELT,
237
238     /// EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR
239     /// identified by the (potentially variable) element number IDX.  If the
240     /// return type is an integer type larger than the element type of the
241     /// vector, the result is extended to the width of the return type.
242     EXTRACT_VECTOR_ELT,
243
244     /// CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of
245     /// vector type with the same length and element type, this produces a
246     /// concatenated vector result value, with length equal to the sum of the
247     /// lengths of the input vectors.
248     CONCAT_VECTORS,
249
250     /// EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an
251     /// vector value) starting with the (potentially variable) element number
252     /// IDX, which must be a multiple of the result vector length.
253     EXTRACT_SUBVECTOR,
254
255     /// VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as 
256     /// VEC1/VEC2.  A VECTOR_SHUFFLE node also contains an array of constant int
257     /// values that indicate which value (or undef) each result element will
258     /// get.  These constant ints are accessible through the 
259     /// ShuffleVectorSDNode class.  This is quite similar to the Altivec 
260     /// 'vperm' instruction, except that the indices must be constants and are
261     /// in terms of the element size of VEC1/VEC2, not in terms of bytes.
262     VECTOR_SHUFFLE,
263
264     /// SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a
265     /// scalar value into element 0 of the resultant vector type.  The top
266     /// elements 1 to N-1 of the N-element vector are undefined.  The type
267     /// of the operand must match the vector element type, except when they
268     /// are integer types.  In this case the operand is allowed to be wider
269     /// than the vector element type, and is implicitly truncated to it.
270     SCALAR_TO_VECTOR,
271
272     // MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing
273     // an unsigned/signed value of type i[2*N], then return the top part.
274     MULHU, MULHS,
275
276     // Bitwise operators - logical and, logical or, logical xor, shift left,
277     // shift right algebraic (shift in sign bits), shift right logical (shift in
278     // zeroes), rotate left, rotate right, and byteswap.
279     AND, OR, XOR, SHL, SRA, SRL, ROTL, ROTR, BSWAP,
280
281     // Counting operators
282     CTTZ, CTLZ, CTPOP,
283
284     // Select(COND, TRUEVAL, FALSEVAL).  If the type of the boolean COND is not
285     // i1 then the high bits must conform to getBooleanContents.
286     SELECT,
287
288     // Select with condition operator - This selects between a true value and
289     // a false value (ops #2 and #3) based on the boolean result of comparing
290     // the lhs and rhs (ops #0 and #1) of a conditional expression with the
291     // condition code in op #4, a CondCodeSDNode.
292     SELECT_CC,
293
294     // SetCC operator - This evaluates to a true value iff the condition is
295     // true.  If the result value type is not i1 then the high bits conform
296     // to getBooleanContents.  The operands to this are the left and right
297     // operands to compare (ops #0, and #1) and the condition code to compare
298     // them with (op #2) as a CondCodeSDNode.
299     SETCC,
300
301     // RESULT = VSETCC(LHS, RHS, COND) operator - This evaluates to a vector of
302     // integer elements with all bits of the result elements set to true if the
303     // comparison is true or all cleared if the comparison is false.  The
304     // operands to this are the left and right operands to compare (LHS/RHS) and
305     // the condition code to compare them with (COND) as a CondCodeSDNode.
306     VSETCC,
307
308     // SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded
309     // integer shift operations, just like ADD/SUB_PARTS.  The operation
310     // ordering is:
311     //       [Lo,Hi] = op [LoLHS,HiLHS], Amt
312     SHL_PARTS, SRA_PARTS, SRL_PARTS,
313
314     // Conversion operators.  These are all single input single output
315     // operations.  For all of these, the result type must be strictly
316     // wider or narrower (depending on the operation) than the source
317     // type.
318
319     // SIGN_EXTEND - Used for integer types, replicating the sign bit
320     // into new bits.
321     SIGN_EXTEND,
322
323     // ZERO_EXTEND - Used for integer types, zeroing the new bits.
324     ZERO_EXTEND,
325
326     // ANY_EXTEND - Used for integer types.  The high bits are undefined.
327     ANY_EXTEND,
328
329     // TRUNCATE - Completely drop the high bits.
330     TRUNCATE,
331
332     // [SU]INT_TO_FP - These operators convert integers (whose interpreted sign
333     // depends on the first letter) to floating point.
334     SINT_TO_FP,
335     UINT_TO_FP,
336
337     // SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to
338     // sign extend a small value in a large integer register (e.g. sign
339     // extending the low 8 bits of a 32-bit register to fill the top 24 bits
340     // with the 7th bit).  The size of the smaller type is indicated by the 1th
341     // operand, a ValueType node.
342     SIGN_EXTEND_INREG,
343
344     /// FP_TO_[US]INT - Convert a floating point value to a signed or unsigned
345     /// integer.
346     FP_TO_SINT,
347     FP_TO_UINT,
348
349     /// X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type
350     /// down to the precision of the destination VT.  TRUNC is a flag, which is
351     /// always an integer that is zero or one.  If TRUNC is 0, this is a
352     /// normal rounding, if it is 1, this FP_ROUND is known to not change the
353     /// value of Y.
354     ///
355     /// The TRUNC = 1 case is used in cases where we know that the value will
356     /// not be modified by the node, because Y is not using any of the extra
357     /// precision of source type.  This allows certain transformations like
358     /// FP_EXTEND(FP_ROUND(X,1)) -> X which are not safe for
359     /// FP_EXTEND(FP_ROUND(X,0)) because the extra bits aren't removed.
360     FP_ROUND,
361
362     // FLT_ROUNDS_ - Returns current rounding mode:
363     // -1 Undefined
364     //  0 Round to 0
365     //  1 Round to nearest
366     //  2 Round to +inf
367     //  3 Round to -inf
368     FLT_ROUNDS_,
369
370     /// X = FP_ROUND_INREG(Y, VT) - This operator takes an FP register, and
371     /// rounds it to a floating point value.  It then promotes it and returns it
372     /// in a register of the same size.  This operation effectively just
373     /// discards excess precision.  The type to round down to is specified by
374     /// the VT operand, a VTSDNode.
375     FP_ROUND_INREG,
376
377     /// X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
378     FP_EXTEND,
379
380     // BIT_CONVERT - This operator converts between integer, vector and FP
381     // values, as if the value was stored to memory with one type and loaded
382     // from the same address with the other type (or equivalently for vector
383     // format conversions, etc).  The source and result are required to have
384     // the same bit size (e.g.  f32 <-> i32).  This can also be used for
385     // int-to-int or fp-to-fp conversions, but that is a noop, deleted by
386     // getNode().
387     BIT_CONVERT,
388
389     // CONVERT_RNDSAT - This operator is used to support various conversions
390     // between various types (float, signed, unsigned and vectors of those
391     // types) with rounding and saturation. NOTE: Avoid using this operator as
392     // most target don't support it and the operator might be removed in the
393     // future. It takes the following arguments:
394     //   0) value
395     //   1) dest type (type to convert to)
396     //   2) src type (type to convert from)
397     //   3) rounding imm
398     //   4) saturation imm
399     //   5) ISD::CvtCode indicating the type of conversion to do
400     CONVERT_RNDSAT,
401
402     // FP16_TO_FP32, FP32_TO_FP16 - These operators are used to perform
403     // promotions and truncation for half-precision (16 bit) floating
404     // numbers. We need special nodes since FP16 is a storage-only type with
405     // special semantics of operations.
406     FP16_TO_FP32, FP32_TO_FP16,
407
408     // FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW,
409     // FLOG, FLOG2, FLOG10, FEXP, FEXP2,
410     // FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR - Perform various unary floating
411     // point operations. These are inspired by libm.
412     FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW,
413     FLOG, FLOG2, FLOG10, FEXP, FEXP2,
414     FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR,
415
416     // LOAD and STORE have token chains as their first operand, then the same
417     // operands as an LLVM load/store instruction, then an offset node that
418     // is added / subtracted from the base pointer to form the address (for
419     // indexed memory ops).
420     LOAD, STORE,
421
422     // DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned
423     // to a specified boundary.  This node always has two return values: a new
424     // stack pointer value and a chain. The first operand is the token chain,
425     // the second is the number of bytes to allocate, and the third is the
426     // alignment boundary.  The size is guaranteed to be a multiple of the stack
427     // alignment, and the alignment is guaranteed to be bigger than the stack
428     // alignment (if required) or 0 to get standard stack alignment.
429     DYNAMIC_STACKALLOC,
430
431     // Control flow instructions.  These all have token chains.
432
433     // BR - Unconditional branch.  The first operand is the chain
434     // operand, the second is the MBB to branch to.
435     BR,
436
437     // BRIND - Indirect branch.  The first operand is the chain, the second
438     // is the value to branch to, which must be of the same type as the target's
439     // pointer type.
440     BRIND,
441
442     // BR_JT - Jumptable branch. The first operand is the chain, the second
443     // is the jumptable index, the last one is the jumptable entry index.
444     BR_JT,
445
446     // BRCOND - Conditional branch.  The first operand is the chain, the
447     // second is the condition, the third is the block to branch to if the
448     // condition is true.  If the type of the condition is not i1, then the
449     // high bits must conform to getBooleanContents.
450     BRCOND,
451
452     // BR_CC - Conditional branch.  The behavior is like that of SELECT_CC, in
453     // that the condition is represented as condition code, and two nodes to
454     // compare, rather than as a combined SetCC node.  The operands in order are
455     // chain, cc, lhs, rhs, block to branch to if condition is true.
456     BR_CC,
457
458     // INLINEASM - Represents an inline asm block.  This node always has two
459     // return values: a chain and a flag result.  The inputs are as follows:
460     //   Operand #0   : Input chain.
461     //   Operand #1   : a ExternalSymbolSDNode with a pointer to the asm string.
462     //   Operand #2   : a MDNodeSDNode with the !srcloc metadata.
463     //   After this, it is followed by a list of operands with this format:
464     //     ConstantSDNode: Flags that encode whether it is a mem or not, the
465     //                     of operands that follow, etc.  See InlineAsm.h.
466     //     ... however many operands ...
467     //   Operand #last: Optional, an incoming flag.
468     //
469     // The variable width operands are required to represent target addressing
470     // modes as a single "operand", even though they may have multiple
471     // SDOperands.
472     INLINEASM,
473
474     // EH_LABEL - Represents a label in mid basic block used to track
475     // locations needed for debug and exception handling tables.  These nodes
476     // take a chain as input and return a chain.
477     EH_LABEL,
478
479     // STACKSAVE - STACKSAVE has one operand, an input chain.  It produces a
480     // value, the same type as the pointer type for the system, and an output
481     // chain.
482     STACKSAVE,
483
484     // STACKRESTORE has two operands, an input chain and a pointer to restore to
485     // it returns an output chain.
486     STACKRESTORE,
487
488     // CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end of
489     // a call sequence, and carry arbitrary information that target might want
490     // to know.  The first operand is a chain, the rest are specified by the
491     // target and not touched by the DAG optimizers.
492     // CALLSEQ_START..CALLSEQ_END pairs may not be nested.
493     CALLSEQ_START,  // Beginning of a call sequence
494     CALLSEQ_END,    // End of a call sequence
495
496     // VAARG - VAARG has three operands: an input chain, a pointer, and a
497     // SRCVALUE.  It returns a pair of values: the vaarg value and a new chain.
498     VAARG,
499
500     // VACOPY - VACOPY has five operands: an input chain, a destination pointer,
501     // a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the
502     // source.
503     VACOPY,
504
505     // VAEND, VASTART - VAEND and VASTART have three operands: an input chain, a
506     // pointer, and a SRCVALUE.
507     VAEND, VASTART,
508
509     // SRCVALUE - This is a node type that holds a Value* that is used to
510     // make reference to a value in the LLVM IR.
511     SRCVALUE,
512     
513     // MDNODE_SDNODE - This is a node that holdes an MDNode*, which is used to
514     // reference metadata in the IR.
515     MDNODE_SDNODE,
516
517     // PCMARKER - This corresponds to the pcmarker intrinsic.
518     PCMARKER,
519
520     // READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
521     // The only operand is a chain and a value and a chain are produced.  The
522     // value is the contents of the architecture specific cycle counter like
523     // register (or other high accuracy low latency clock source)
524     READCYCLECOUNTER,
525
526     // HANDLENODE node - Used as a handle for various purposes.
527     HANDLENODE,
528
529     // TRAMPOLINE - This corresponds to the init_trampoline intrinsic.
530     // It takes as input a token chain, the pointer to the trampoline,
531     // the pointer to the nested function, the pointer to pass for the
532     // 'nest' parameter, a SRCVALUE for the trampoline and another for
533     // the nested function (allowing targets to access the original
534     // Function*).  It produces the result of the intrinsic and a token
535     // chain as output.
536     TRAMPOLINE,
537
538     // TRAP - Trapping instruction
539     TRAP,
540
541     // PREFETCH - This corresponds to a prefetch intrinsic. It takes chains are
542     // their first operand. The other operands are the address to prefetch,
543     // read / write specifier, and locality specifier.
544     PREFETCH,
545
546     // OUTCHAIN = MEMBARRIER(INCHAIN, load-load, load-store, store-load,
547     //                       store-store, device)
548     // This corresponds to the memory.barrier intrinsic.
549     // it takes an input chain, 4 operands to specify the type of barrier, an
550     // operand specifying if the barrier applies to device and uncached memory
551     // and produces an output chain.
552     MEMBARRIER,
553
554     // Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap)
555     // this corresponds to the atomic.lcs intrinsic.
556     // cmp is compared to *ptr, and if equal, swap is stored in *ptr.
557     // the return is always the original value in *ptr
558     ATOMIC_CMP_SWAP,
559
560     // Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt)
561     // this corresponds to the atomic.swap intrinsic.
562     // amt is stored to *ptr atomically.
563     // the return is always the original value in *ptr
564     ATOMIC_SWAP,
565
566     // Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt)
567     // this corresponds to the atomic.load.[OpName] intrinsic.
568     // op(*ptr, amt) is stored to *ptr atomically.
569     // the return is always the original value in *ptr
570     ATOMIC_LOAD_ADD,
571     ATOMIC_LOAD_SUB,
572     ATOMIC_LOAD_AND,
573     ATOMIC_LOAD_OR,
574     ATOMIC_LOAD_XOR,
575     ATOMIC_LOAD_NAND,
576     ATOMIC_LOAD_MIN,
577     ATOMIC_LOAD_MAX,
578     ATOMIC_LOAD_UMIN,
579     ATOMIC_LOAD_UMAX,
580
581     /// BUILTIN_OP_END - This must be the last enum value in this list.
582     /// The target-specific pre-isel opcode values start here.
583     BUILTIN_OP_END
584   };
585
586   /// FIRST_TARGET_MEMORY_OPCODE - Target-specific pre-isel operations
587   /// which do not reference a specific memory location should be less than
588   /// this value. Those that do must not be less than this value, and can
589   /// be used with SelectionDAG::getMemIntrinsicNode.
590   static const int FIRST_TARGET_MEMORY_OPCODE = BUILTIN_OP_END+100;
591
592   //===--------------------------------------------------------------------===//
593   /// MemIndexedMode enum - This enum defines the load / store indexed
594   /// addressing modes.
595   ///
596   /// UNINDEXED    "Normal" load / store. The effective address is already
597   ///              computed and is available in the base pointer. The offset
598   ///              operand is always undefined. In addition to producing a
599   ///              chain, an unindexed load produces one value (result of the
600   ///              load); an unindexed store does not produce a value.
601   ///
602   /// PRE_INC      Similar to the unindexed mode where the effective address is
603   /// PRE_DEC      the value of the base pointer add / subtract the offset.
604   ///              It considers the computation as being folded into the load /
605   ///              store operation (i.e. the load / store does the address
606   ///              computation as well as performing the memory transaction).
607   ///              The base operand is always undefined. In addition to
608   ///              producing a chain, pre-indexed load produces two values
609   ///              (result of the load and the result of the address
610   ///              computation); a pre-indexed store produces one value (result
611   ///              of the address computation).
612   ///
613   /// POST_INC     The effective address is the value of the base pointer. The
614   /// POST_DEC     value of the offset operand is then added to / subtracted
615   ///              from the base after memory transaction. In addition to
616   ///              producing a chain, post-indexed load produces two values
617   ///              (the result of the load and the result of the base +/- offset
618   ///              computation); a post-indexed store produces one value (the
619   ///              the result of the base +/- offset computation).
620   ///
621   enum MemIndexedMode {
622     UNINDEXED = 0,
623     PRE_INC,
624     PRE_DEC,
625     POST_INC,
626     POST_DEC,
627     LAST_INDEXED_MODE
628   };
629
630   //===--------------------------------------------------------------------===//
631   /// LoadExtType enum - This enum defines the three variants of LOADEXT
632   /// (load with extension).
633   ///
634   /// SEXTLOAD loads the integer operand and sign extends it to a larger
635   ///          integer result type.
636   /// ZEXTLOAD loads the integer operand and zero extends it to a larger
637   ///          integer result type.
638   /// EXTLOAD  is used for three things: floating point extending loads,
639   ///          integer extending loads [the top bits are undefined], and vector
640   ///          extending loads [load into low elt].
641   ///
642   enum LoadExtType {
643     NON_EXTLOAD = 0,
644     EXTLOAD,
645     SEXTLOAD,
646     ZEXTLOAD,
647     LAST_LOADEXT_TYPE
648   };
649
650   //===--------------------------------------------------------------------===//
651   /// ISD::CondCode enum - These are ordered carefully to make the bitfields
652   /// below work out, when considering SETFALSE (something that never exists
653   /// dynamically) as 0.  "U" -> Unsigned (for integer operands) or Unordered
654   /// (for floating point), "L" -> Less than, "G" -> Greater than, "E" -> Equal
655   /// to.  If the "N" column is 1, the result of the comparison is undefined if
656   /// the input is a NAN.
657   ///
658   /// All of these (except for the 'always folded ops') should be handled for
659   /// floating point.  For integer, only the SETEQ,SETNE,SETLT,SETLE,SETGT,
660   /// SETGE,SETULT,SETULE,SETUGT, and SETUGE opcodes are used.
661   ///
662   /// Note that these are laid out in a specific order to allow bit-twiddling
663   /// to transform conditions.
664   enum CondCode {
665     // Opcode          N U L G E       Intuitive operation
666     SETFALSE,      //    0 0 0 0       Always false (always folded)
667     SETOEQ,        //    0 0 0 1       True if ordered and equal
668     SETOGT,        //    0 0 1 0       True if ordered and greater than
669     SETOGE,        //    0 0 1 1       True if ordered and greater than or equal
670     SETOLT,        //    0 1 0 0       True if ordered and less than
671     SETOLE,        //    0 1 0 1       True if ordered and less than or equal
672     SETONE,        //    0 1 1 0       True if ordered and operands are unequal
673     SETO,          //    0 1 1 1       True if ordered (no nans)
674     SETUO,         //    1 0 0 0       True if unordered: isnan(X) | isnan(Y)
675     SETUEQ,        //    1 0 0 1       True if unordered or equal
676     SETUGT,        //    1 0 1 0       True if unordered or greater than
677     SETUGE,        //    1 0 1 1       True if unordered, greater than, or equal
678     SETULT,        //    1 1 0 0       True if unordered or less than
679     SETULE,        //    1 1 0 1       True if unordered, less than, or equal
680     SETUNE,        //    1 1 1 0       True if unordered or not equal
681     SETTRUE,       //    1 1 1 1       Always true (always folded)
682     // Don't care operations: undefined if the input is a nan.
683     SETFALSE2,     //  1 X 0 0 0       Always false (always folded)
684     SETEQ,         //  1 X 0 0 1       True if equal
685     SETGT,         //  1 X 0 1 0       True if greater than
686     SETGE,         //  1 X 0 1 1       True if greater than or equal
687     SETLT,         //  1 X 1 0 0       True if less than
688     SETLE,         //  1 X 1 0 1       True if less than or equal
689     SETNE,         //  1 X 1 1 0       True if not equal
690     SETTRUE2,      //  1 X 1 1 1       Always true (always folded)
691
692     SETCC_INVALID       // Marker value.
693   };
694
695   /// isSignedIntSetCC - Return true if this is a setcc instruction that
696   /// performs a signed comparison when used with integer operands.
697   inline bool isSignedIntSetCC(CondCode Code) {
698     return Code == SETGT || Code == SETGE || Code == SETLT || Code == SETLE;
699   }
700
701   /// isUnsignedIntSetCC - Return true if this is a setcc instruction that
702   /// performs an unsigned comparison when used with integer operands.
703   inline bool isUnsignedIntSetCC(CondCode Code) {
704     return Code == SETUGT || Code == SETUGE || Code == SETULT || Code == SETULE;
705   }
706
707   /// isTrueWhenEqual - Return true if the specified condition returns true if
708   /// the two operands to the condition are equal.  Note that if one of the two
709   /// operands is a NaN, this value is meaningless.
710   inline bool isTrueWhenEqual(CondCode Cond) {
711     return ((int)Cond & 1) != 0;
712   }
713
714   /// getUnorderedFlavor - This function returns 0 if the condition is always
715   /// false if an operand is a NaN, 1 if the condition is always true if the
716   /// operand is a NaN, and 2 if the condition is undefined if the operand is a
717   /// NaN.
718   inline unsigned getUnorderedFlavor(CondCode Cond) {
719     return ((int)Cond >> 3) & 3;
720   }
721
722   /// getSetCCInverse - Return the operation corresponding to !(X op Y), where
723   /// 'op' is a valid SetCC operation.
724   CondCode getSetCCInverse(CondCode Operation, bool isInteger);
725
726   /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X)
727   /// when given the operation for (X op Y).
728   CondCode getSetCCSwappedOperands(CondCode Operation);
729
730   /// getSetCCOrOperation - Return the result of a logical OR between different
731   /// comparisons of identical values: ((X op1 Y) | (X op2 Y)).  This
732   /// function returns SETCC_INVALID if it is not possible to represent the
733   /// resultant comparison.
734   CondCode getSetCCOrOperation(CondCode Op1, CondCode Op2, bool isInteger);
735
736   /// getSetCCAndOperation - Return the result of a logical AND between
737   /// different comparisons of identical values: ((X op1 Y) & (X op2 Y)).  This
738   /// function returns SETCC_INVALID if it is not possible to represent the
739   /// resultant comparison.
740   CondCode getSetCCAndOperation(CondCode Op1, CondCode Op2, bool isInteger);
741
742   //===--------------------------------------------------------------------===//
743   /// CvtCode enum - This enum defines the various converts CONVERT_RNDSAT
744   /// supports.
745   enum CvtCode {
746     CVT_FF,     // Float from Float
747     CVT_FS,     // Float from Signed
748     CVT_FU,     // Float from Unsigned
749     CVT_SF,     // Signed from Float
750     CVT_UF,     // Unsigned from Float
751     CVT_SS,     // Signed from Signed
752     CVT_SU,     // Signed from Unsigned
753     CVT_US,     // Unsigned from Signed
754     CVT_UU,     // Unsigned from Unsigned
755     CVT_INVALID // Marker - Invalid opcode
756   };
757
758 } // end llvm::ISD namespace
759
760 } // end llvm namespace
761
762 #endif