1 //===-- llvm/CodeGen/SelectionDAGNodes.h - SelectionDAG Nodes ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the SDNode class and derived classes, which are used to
11 // represent the nodes and operations present in a SelectionDAG. These nodes
12 // and operations are machine code level operations, with some similarities to
13 // the GCC RTL representation.
15 // Clients should include the SelectionDAG.h file instead of this file directly.
17 //===----------------------------------------------------------------------===//
19 #ifndef LLVM_CODEGEN_SELECTIONDAGNODES_H
20 #define LLVM_CODEGEN_SELECTIONDAGNODES_H
22 #include "llvm/Constants.h"
23 #include "llvm/ADT/FoldingSet.h"
24 #include "llvm/ADT/GraphTraits.h"
25 #include "llvm/ADT/ilist_node.h"
26 #include "llvm/ADT/SmallVector.h"
27 #include "llvm/ADT/STLExtras.h"
28 #include "llvm/CodeGen/ValueTypes.h"
29 #include "llvm/CodeGen/MachineMemOperand.h"
30 #include "llvm/Support/MathExtras.h"
31 #include "llvm/System/DataTypes.h"
32 #include "llvm/Support/DebugLoc.h"
39 class MachineBasicBlock;
40 class MachineConstantPoolValue;
44 template <typename T> struct DenseMapInfo;
45 template <typename T> struct simplify_type;
46 template <typename T> struct ilist_traits;
48 void checkForCycles(const SDNode *N);
50 /// SDVTList - This represents a list of ValueType's that has been intern'd by
51 /// a SelectionDAG. Instances of this simple value class are returned by
52 /// SelectionDAG::getVTList(...).
59 /// ISD namespace - This namespace contains an enum which represents all of the
60 /// SelectionDAG node types and value types.
64 //===--------------------------------------------------------------------===//
65 /// ISD::NodeType enum - This enum defines the target-independent operators
66 /// for a SelectionDAG.
68 /// Targets may also define target-dependent operator codes for SDNodes. For
69 /// example, on x86, these are the enum values in the X86ISD namespace.
70 /// Targets should aim to use target-independent operators to model their
71 /// instruction sets as much as possible, and only use target-dependent
72 /// operators when they have special requirements.
74 /// Finally, during and after selection proper, SNodes may use special
75 /// operator codes that correspond directly with MachineInstr opcodes. These
76 /// are used to represent selected instructions. See the isMachineOpcode()
77 /// and getMachineOpcode() member functions of SDNode.
80 // DELETED_NODE - This is an illegal value that is used to catch
81 // errors. This opcode is not a legal opcode for any node.
84 // EntryToken - This is the marker used to indicate the start of the region.
87 // TokenFactor - This node takes multiple tokens as input and produces a
88 // single token result. This is used to represent the fact that the operand
89 // operators are independent of each other.
92 // AssertSext, AssertZext - These nodes record if a register contains a
93 // value that has already been zero or sign extended from a narrower type.
94 // These nodes take two operands. The first is the node that has already
95 // been extended, and the second is a value type node indicating the width
97 AssertSext, AssertZext,
99 // Various leaf nodes.
100 BasicBlock, VALUETYPE, CONDCODE, Register,
101 Constant, ConstantFP,
102 GlobalAddress, GlobalTLSAddress, FrameIndex,
103 JumpTable, ConstantPool, ExternalSymbol, BlockAddress,
105 // The address of the GOT
108 // FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and
109 // llvm.returnaddress on the DAG. These nodes take one operand, the index
110 // of the frame or return address to return. An index of zero corresponds
111 // to the current function's frame or return address, an index of one to the
112 // parent's frame or return address, and so on.
113 FRAMEADDR, RETURNADDR,
115 // FRAME_TO_ARGS_OFFSET - This node represents offset from frame pointer to
116 // first (possible) on-stack argument. This is needed for correct stack
117 // adjustment during unwind.
118 FRAME_TO_ARGS_OFFSET,
120 // RESULT, OUTCHAIN = EXCEPTIONADDR(INCHAIN) - This node represents the
121 // address of the exception block on entry to an landing pad block.
124 // RESULT, OUTCHAIN = LSDAADDR(INCHAIN) - This node represents the
125 // address of the Language Specific Data Area for the enclosing function.
128 // RESULT, OUTCHAIN = EHSELECTION(INCHAIN, EXCEPTION) - This node represents
129 // the selection index of the exception thrown.
132 // OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents
133 // 'eh_return' gcc dwarf builtin, which is used to return from
134 // exception. The general meaning is: adjust stack by OFFSET and pass
135 // execution to HANDLER. Many platform-related details also :)
138 // TargetConstant* - Like Constant*, but the DAG does not do any folding or
139 // simplification of the constant.
143 // TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or
144 // anything else with this node, and this is valid in the target-specific
145 // dag, turning into a GlobalAddress operand.
147 TargetGlobalTLSAddress,
151 TargetExternalSymbol,
154 /// RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...)
155 /// This node represents a target intrinsic function with no side effects.
156 /// The first operand is the ID number of the intrinsic from the
157 /// llvm::Intrinsic namespace. The operands to the intrinsic follow. The
158 /// node has returns the result of the intrinsic.
161 /// RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...)
162 /// This node represents a target intrinsic function with side effects that
163 /// returns a result. The first operand is a chain pointer. The second is
164 /// the ID number of the intrinsic from the llvm::Intrinsic namespace. The
165 /// operands to the intrinsic follow. The node has two results, the result
166 /// of the intrinsic and an output chain.
169 /// OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...)
170 /// This node represents a target intrinsic function with side effects that
171 /// does not return a result. The first operand is a chain pointer. The
172 /// second is the ID number of the intrinsic from the llvm::Intrinsic
173 /// namespace. The operands to the intrinsic follow.
176 // CopyToReg - This node has three operands: a chain, a register number to
177 // set to this value, and a value.
180 // CopyFromReg - This node indicates that the input value is a virtual or
181 // physical register that is defined outside of the scope of this
182 // SelectionDAG. The register is available from the RegisterSDNode object.
185 // UNDEF - An undefined node
188 // EXTRACT_ELEMENT - This is used to get the lower or upper (determined by
189 // a Constant, which is required to be operand #1) half of the integer or
190 // float value specified as operand #0. This is only for use before
191 // legalization, for values that will be broken into multiple registers.
194 // BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways. Given
195 // two values of the same integer value type, this produces a value twice as
196 // big. Like EXTRACT_ELEMENT, this can only be used before legalization.
199 // MERGE_VALUES - This node takes multiple discrete operands and returns
200 // them all as its individual results. This nodes has exactly the same
201 // number of inputs and outputs. This node is useful for some pieces of the
202 // code generator that want to think about a single node with multiple
203 // results, not multiple nodes.
206 // Simple integer binary arithmetic operators.
207 ADD, SUB, MUL, SDIV, UDIV, SREM, UREM,
209 // SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing
210 // a signed/unsigned value of type i[2*N], and return the full value as
211 // two results, each of type iN.
212 SMUL_LOHI, UMUL_LOHI,
214 // SDIVREM/UDIVREM - Divide two integers and produce both a quotient and
218 // CARRY_FALSE - This node is used when folding other nodes,
219 // like ADDC/SUBC, which indicate the carry result is always false.
222 // Carry-setting nodes for multiple precision addition and subtraction.
223 // These nodes take two operands of the same value type, and produce two
224 // results. The first result is the normal add or sub result, the second
225 // result is the carry flag result.
228 // Carry-using nodes for multiple precision addition and subtraction. These
229 // nodes take three operands: The first two are the normal lhs and rhs to
230 // the add or sub, and the third is the input carry flag. These nodes
231 // produce two results; the normal result of the add or sub, and the output
232 // carry flag. These nodes both read and write a carry flag to allow them
233 // to them to be chained together for add and sub of arbitrarily large
237 // RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
238 // These nodes take two operands: the normal LHS and RHS to the add. They
239 // produce two results: the normal result of the add, and a boolean that
240 // indicates if an overflow occured (*not* a flag, because it may be stored
241 // to memory, etc.). If the type of the boolean is not i1 then the high
242 // bits conform to getBooleanContents.
243 // These nodes are generated from the llvm.[su]add.with.overflow intrinsics.
246 // Same for subtraction
249 // Same for multiplication
252 // Simple binary floating point operators.
253 FADD, FSUB, FMUL, FDIV, FREM,
255 // FCOPYSIGN(X, Y) - Return the value of X with the sign of Y. NOTE: This
256 // DAG node does not require that X and Y have the same type, just that they
257 // are both floating point. X and the result must have the same type.
258 // FCOPYSIGN(f32, f64) is allowed.
261 // INT = FGETSIGN(FP) - Return the sign bit of the specified floating point
262 // value as an integer 0/1 value.
265 /// BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the
266 /// specified, possibly variable, elements. The number of elements is
267 /// required to be a power of two. The types of the operands must all be
268 /// the same and must match the vector element type, except that integer
269 /// types are allowed to be larger than the element type, in which case
270 /// the operands are implicitly truncated.
273 /// INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element
274 /// at IDX replaced with VAL. If the type of VAL is larger than the vector
275 /// element type then VAL is truncated before replacement.
278 /// EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR
279 /// identified by the (potentially variable) element number IDX. If the
280 /// return type is an integer type larger than the element type of the
281 /// vector, the result is extended to the width of the return type.
284 /// CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of
285 /// vector type with the same length and element type, this produces a
286 /// concatenated vector result value, with length equal to the sum of the
287 /// lengths of the input vectors.
290 /// EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an
291 /// vector value) starting with the (potentially variable) element number
292 /// IDX, which must be a multiple of the result vector length.
295 /// VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as
296 /// VEC1/VEC2. A VECTOR_SHUFFLE node also contains an array of constant int
297 /// values that indicate which value (or undef) each result element will
298 /// get. These constant ints are accessible through the
299 /// ShuffleVectorSDNode class. This is quite similar to the Altivec
300 /// 'vperm' instruction, except that the indices must be constants and are
301 /// in terms of the element size of VEC1/VEC2, not in terms of bytes.
304 /// SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a
305 /// scalar value into element 0 of the resultant vector type. The top
306 /// elements 1 to N-1 of the N-element vector are undefined. The type
307 /// of the operand must match the vector element type, except when they
308 /// are integer types. In this case the operand is allowed to be wider
309 /// than the vector element type, and is implicitly truncated to it.
312 // MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing
313 // an unsigned/signed value of type i[2*N], then return the top part.
316 // Bitwise operators - logical and, logical or, logical xor, shift left,
317 // shift right algebraic (shift in sign bits), shift right logical (shift in
318 // zeroes), rotate left, rotate right, and byteswap.
319 AND, OR, XOR, SHL, SRA, SRL, ROTL, ROTR, BSWAP,
321 // Counting operators
324 // Select(COND, TRUEVAL, FALSEVAL). If the type of the boolean COND is not
325 // i1 then the high bits must conform to getBooleanContents.
328 // Select with condition operator - This selects between a true value and
329 // a false value (ops #2 and #3) based on the boolean result of comparing
330 // the lhs and rhs (ops #0 and #1) of a conditional expression with the
331 // condition code in op #4, a CondCodeSDNode.
334 // SetCC operator - This evaluates to a true value iff the condition is
335 // true. If the result value type is not i1 then the high bits conform
336 // to getBooleanContents. The operands to this are the left and right
337 // operands to compare (ops #0, and #1) and the condition code to compare
338 // them with (op #2) as a CondCodeSDNode.
341 // RESULT = VSETCC(LHS, RHS, COND) operator - This evaluates to a vector of
342 // integer elements with all bits of the result elements set to true if the
343 // comparison is true or all cleared if the comparison is false. The
344 // operands to this are the left and right operands to compare (LHS/RHS) and
345 // the condition code to compare them with (COND) as a CondCodeSDNode.
348 // SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded
349 // integer shift operations, just like ADD/SUB_PARTS. The operation
351 // [Lo,Hi] = op [LoLHS,HiLHS], Amt
352 SHL_PARTS, SRA_PARTS, SRL_PARTS,
354 // Conversion operators. These are all single input single output
355 // operations. For all of these, the result type must be strictly
356 // wider or narrower (depending on the operation) than the source
359 // SIGN_EXTEND - Used for integer types, replicating the sign bit
363 // ZERO_EXTEND - Used for integer types, zeroing the new bits.
366 // ANY_EXTEND - Used for integer types. The high bits are undefined.
369 // TRUNCATE - Completely drop the high bits.
372 // [SU]INT_TO_FP - These operators convert integers (whose interpreted sign
373 // depends on the first letter) to floating point.
377 // SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to
378 // sign extend a small value in a large integer register (e.g. sign
379 // extending the low 8 bits of a 32-bit register to fill the top 24 bits
380 // with the 7th bit). The size of the smaller type is indicated by the 1th
381 // operand, a ValueType node.
384 /// FP_TO_[US]INT - Convert a floating point value to a signed or unsigned
389 /// X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type
390 /// down to the precision of the destination VT. TRUNC is a flag, which is
391 /// always an integer that is zero or one. If TRUNC is 0, this is a
392 /// normal rounding, if it is 1, this FP_ROUND is known to not change the
395 /// The TRUNC = 1 case is used in cases where we know that the value will
396 /// not be modified by the node, because Y is not using any of the extra
397 /// precision of source type. This allows certain transformations like
398 /// FP_EXTEND(FP_ROUND(X,1)) -> X which are not safe for
399 /// FP_EXTEND(FP_ROUND(X,0)) because the extra bits aren't removed.
402 // FLT_ROUNDS_ - Returns current rounding mode:
405 // 1 Round to nearest
410 /// X = FP_ROUND_INREG(Y, VT) - This operator takes an FP register, and
411 /// rounds it to a floating point value. It then promotes it and returns it
412 /// in a register of the same size. This operation effectively just
413 /// discards excess precision. The type to round down to is specified by
414 /// the VT operand, a VTSDNode.
417 /// X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
420 // BIT_CONVERT - This operator converts between integer, vector and FP
421 // values, as if the value was stored to memory with one type and loaded
422 // from the same address with the other type (or equivalently for vector
423 // format conversions, etc). The source and result are required to have
424 // the same bit size (e.g. f32 <-> i32). This can also be used for
425 // int-to-int or fp-to-fp conversions, but that is a noop, deleted by
429 // CONVERT_RNDSAT - This operator is used to support various conversions
430 // between various types (float, signed, unsigned and vectors of those
431 // types) with rounding and saturation. NOTE: Avoid using this operator as
432 // most target don't support it and the operator might be removed in the
433 // future. It takes the following arguments:
435 // 1) dest type (type to convert to)
436 // 2) src type (type to convert from)
439 // 5) ISD::CvtCode indicating the type of conversion to do
442 // FP16_TO_FP32, FP32_TO_FP16 - These operators are used to perform
443 // promotions and truncation for half-precision (16 bit) floating
444 // numbers. We need special nodes since FP16 is a storage-only type with
445 // special semantics of operations.
446 FP16_TO_FP32, FP32_TO_FP16,
448 // FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW,
449 // FLOG, FLOG2, FLOG10, FEXP, FEXP2,
450 // FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR - Perform various unary floating
451 // point operations. These are inspired by libm.
452 FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW,
453 FLOG, FLOG2, FLOG10, FEXP, FEXP2,
454 FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR,
456 // LOAD and STORE have token chains as their first operand, then the same
457 // operands as an LLVM load/store instruction, then an offset node that
458 // is added / subtracted from the base pointer to form the address (for
459 // indexed memory ops).
462 // DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned
463 // to a specified boundary. This node always has two return values: a new
464 // stack pointer value and a chain. The first operand is the token chain,
465 // the second is the number of bytes to allocate, and the third is the
466 // alignment boundary. The size is guaranteed to be a multiple of the stack
467 // alignment, and the alignment is guaranteed to be bigger than the stack
468 // alignment (if required) or 0 to get standard stack alignment.
471 // Control flow instructions. These all have token chains.
473 // BR - Unconditional branch. The first operand is the chain
474 // operand, the second is the MBB to branch to.
477 // BRIND - Indirect branch. The first operand is the chain, the second
478 // is the value to branch to, which must be of the same type as the target's
482 // BR_JT - Jumptable branch. The first operand is the chain, the second
483 // is the jumptable index, the last one is the jumptable entry index.
486 // BRCOND - Conditional branch. The first operand is the chain, the
487 // second is the condition, the third is the block to branch to if the
488 // condition is true. If the type of the condition is not i1, then the
489 // high bits must conform to getBooleanContents.
492 // BR_CC - Conditional branch. The behavior is like that of SELECT_CC, in
493 // that the condition is represented as condition code, and two nodes to
494 // compare, rather than as a combined SetCC node. The operands in order are
495 // chain, cc, lhs, rhs, block to branch to if condition is true.
498 // INLINEASM - Represents an inline asm block. This node always has two
499 // return values: a chain and a flag result. The inputs are as follows:
500 // Operand #0 : Input chain.
501 // Operand #1 : a ExternalSymbolSDNode with a pointer to the asm string.
502 // Operand #2 : a MDNodeSDNode with the !srcloc metadata.
503 // After this, it is followed by a list of operands with this format:
504 // ConstantSDNode: Flags that encode whether it is a mem or not, the
505 // of operands that follow, etc. See InlineAsm.h.
506 // ... however many operands ...
507 // Operand #last: Optional, an incoming flag.
509 // The variable width operands are required to represent target addressing
510 // modes as a single "operand", even though they may have multiple
514 // EH_LABEL - Represents a label in mid basic block used to track
515 // locations needed for debug and exception handling tables. These nodes
516 // take a chain as input and return a chain.
519 // STACKSAVE - STACKSAVE has one operand, an input chain. It produces a
520 // value, the same type as the pointer type for the system, and an output
524 // STACKRESTORE has two operands, an input chain and a pointer to restore to
525 // it returns an output chain.
528 // CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end of
529 // a call sequence, and carry arbitrary information that target might want
530 // to know. The first operand is a chain, the rest are specified by the
531 // target and not touched by the DAG optimizers.
532 // CALLSEQ_START..CALLSEQ_END pairs may not be nested.
533 CALLSEQ_START, // Beginning of a call sequence
534 CALLSEQ_END, // End of a call sequence
536 // VAARG - VAARG has three operands: an input chain, a pointer, and a
537 // SRCVALUE. It returns a pair of values: the vaarg value and a new chain.
540 // VACOPY - VACOPY has five operands: an input chain, a destination pointer,
541 // a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the
545 // VAEND, VASTART - VAEND and VASTART have three operands: an input chain, a
546 // pointer, and a SRCVALUE.
549 // SRCVALUE - This is a node type that holds a Value* that is used to
550 // make reference to a value in the LLVM IR.
553 // MDNODE_SDNODE - This is a node that holdes an MDNode*, which is used to
554 // reference metadata in the IR.
557 // PCMARKER - This corresponds to the pcmarker intrinsic.
560 // READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
561 // The only operand is a chain and a value and a chain are produced. The
562 // value is the contents of the architecture specific cycle counter like
563 // register (or other high accuracy low latency clock source)
566 // HANDLENODE node - Used as a handle for various purposes.
569 // TRAMPOLINE - This corresponds to the init_trampoline intrinsic.
570 // It takes as input a token chain, the pointer to the trampoline,
571 // the pointer to the nested function, the pointer to pass for the
572 // 'nest' parameter, a SRCVALUE for the trampoline and another for
573 // the nested function (allowing targets to access the original
574 // Function*). It produces the result of the intrinsic and a token
578 // TRAP - Trapping instruction
581 // PREFETCH - This corresponds to a prefetch intrinsic. It takes chains are
582 // their first operand. The other operands are the address to prefetch,
583 // read / write specifier, and locality specifier.
586 // OUTCHAIN = MEMBARRIER(INCHAIN, load-load, load-store, store-load,
587 // store-store, device)
588 // This corresponds to the memory.barrier intrinsic.
589 // it takes an input chain, 4 operands to specify the type of barrier, an
590 // operand specifying if the barrier applies to device and uncached memory
591 // and produces an output chain.
594 // Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap)
595 // this corresponds to the atomic.lcs intrinsic.
596 // cmp is compared to *ptr, and if equal, swap is stored in *ptr.
597 // the return is always the original value in *ptr
600 // Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt)
601 // this corresponds to the atomic.swap intrinsic.
602 // amt is stored to *ptr atomically.
603 // the return is always the original value in *ptr
606 // Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt)
607 // this corresponds to the atomic.load.[OpName] intrinsic.
608 // op(*ptr, amt) is stored to *ptr atomically.
609 // the return is always the original value in *ptr
621 /// BUILTIN_OP_END - This must be the last enum value in this list.
622 /// The target-specific pre-isel opcode values start here.
626 /// FIRST_TARGET_MEMORY_OPCODE - Target-specific pre-isel operations
627 /// which do not reference a specific memory location should be less than
628 /// this value. Those that do must not be less than this value, and can
629 /// be used with SelectionDAG::getMemIntrinsicNode.
630 static const int FIRST_TARGET_MEMORY_OPCODE = BUILTIN_OP_END+100;
634 /// isBuildVectorAllOnes - Return true if the specified node is a
635 /// BUILD_VECTOR where all of the elements are ~0 or undef.
636 bool isBuildVectorAllOnes(const SDNode *N);
638 /// isBuildVectorAllZeros - Return true if the specified node is a
639 /// BUILD_VECTOR where all of the elements are 0 or undef.
640 bool isBuildVectorAllZeros(const SDNode *N);
642 /// isScalarToVector - Return true if the specified node is a
643 /// ISD::SCALAR_TO_VECTOR node or a BUILD_VECTOR node where only the low
644 /// element is not an undef.
645 bool isScalarToVector(const SDNode *N);
647 //===--------------------------------------------------------------------===//
648 /// MemIndexedMode enum - This enum defines the load / store indexed
649 /// addressing modes.
651 /// UNINDEXED "Normal" load / store. The effective address is already
652 /// computed and is available in the base pointer. The offset
653 /// operand is always undefined. In addition to producing a
654 /// chain, an unindexed load produces one value (result of the
655 /// load); an unindexed store does not produce a value.
657 /// PRE_INC Similar to the unindexed mode where the effective address is
658 /// PRE_DEC the value of the base pointer add / subtract the offset.
659 /// It considers the computation as being folded into the load /
660 /// store operation (i.e. the load / store does the address
661 /// computation as well as performing the memory transaction).
662 /// The base operand is always undefined. In addition to
663 /// producing a chain, pre-indexed load produces two values
664 /// (result of the load and the result of the address
665 /// computation); a pre-indexed store produces one value (result
666 /// of the address computation).
668 /// POST_INC The effective address is the value of the base pointer. The
669 /// POST_DEC value of the offset operand is then added to / subtracted
670 /// from the base after memory transaction. In addition to
671 /// producing a chain, post-indexed load produces two values
672 /// (the result of the load and the result of the base +/- offset
673 /// computation); a post-indexed store produces one value (the
674 /// the result of the base +/- offset computation).
676 enum MemIndexedMode {
685 //===--------------------------------------------------------------------===//
686 /// LoadExtType enum - This enum defines the three variants of LOADEXT
687 /// (load with extension).
689 /// SEXTLOAD loads the integer operand and sign extends it to a larger
690 /// integer result type.
691 /// ZEXTLOAD loads the integer operand and zero extends it to a larger
692 /// integer result type.
693 /// EXTLOAD is used for three things: floating point extending loads,
694 /// integer extending loads [the top bits are undefined], and vector
695 /// extending loads [load into low elt].
705 //===--------------------------------------------------------------------===//
706 /// ISD::CondCode enum - These are ordered carefully to make the bitfields
707 /// below work out, when considering SETFALSE (something that never exists
708 /// dynamically) as 0. "U" -> Unsigned (for integer operands) or Unordered
709 /// (for floating point), "L" -> Less than, "G" -> Greater than, "E" -> Equal
710 /// to. If the "N" column is 1, the result of the comparison is undefined if
711 /// the input is a NAN.
713 /// All of these (except for the 'always folded ops') should be handled for
714 /// floating point. For integer, only the SETEQ,SETNE,SETLT,SETLE,SETGT,
715 /// SETGE,SETULT,SETULE,SETUGT, and SETUGE opcodes are used.
717 /// Note that these are laid out in a specific order to allow bit-twiddling
718 /// to transform conditions.
720 // Opcode N U L G E Intuitive operation
721 SETFALSE, // 0 0 0 0 Always false (always folded)
722 SETOEQ, // 0 0 0 1 True if ordered and equal
723 SETOGT, // 0 0 1 0 True if ordered and greater than
724 SETOGE, // 0 0 1 1 True if ordered and greater than or equal
725 SETOLT, // 0 1 0 0 True if ordered and less than
726 SETOLE, // 0 1 0 1 True if ordered and less than or equal
727 SETONE, // 0 1 1 0 True if ordered and operands are unequal
728 SETO, // 0 1 1 1 True if ordered (no nans)
729 SETUO, // 1 0 0 0 True if unordered: isnan(X) | isnan(Y)
730 SETUEQ, // 1 0 0 1 True if unordered or equal
731 SETUGT, // 1 0 1 0 True if unordered or greater than
732 SETUGE, // 1 0 1 1 True if unordered, greater than, or equal
733 SETULT, // 1 1 0 0 True if unordered or less than
734 SETULE, // 1 1 0 1 True if unordered, less than, or equal
735 SETUNE, // 1 1 1 0 True if unordered or not equal
736 SETTRUE, // 1 1 1 1 Always true (always folded)
737 // Don't care operations: undefined if the input is a nan.
738 SETFALSE2, // 1 X 0 0 0 Always false (always folded)
739 SETEQ, // 1 X 0 0 1 True if equal
740 SETGT, // 1 X 0 1 0 True if greater than
741 SETGE, // 1 X 0 1 1 True if greater than or equal
742 SETLT, // 1 X 1 0 0 True if less than
743 SETLE, // 1 X 1 0 1 True if less than or equal
744 SETNE, // 1 X 1 1 0 True if not equal
745 SETTRUE2, // 1 X 1 1 1 Always true (always folded)
747 SETCC_INVALID // Marker value.
750 /// isSignedIntSetCC - Return true if this is a setcc instruction that
751 /// performs a signed comparison when used with integer operands.
752 inline bool isSignedIntSetCC(CondCode Code) {
753 return Code == SETGT || Code == SETGE || Code == SETLT || Code == SETLE;
756 /// isUnsignedIntSetCC - Return true if this is a setcc instruction that
757 /// performs an unsigned comparison when used with integer operands.
758 inline bool isUnsignedIntSetCC(CondCode Code) {
759 return Code == SETUGT || Code == SETUGE || Code == SETULT || Code == SETULE;
762 /// isTrueWhenEqual - Return true if the specified condition returns true if
763 /// the two operands to the condition are equal. Note that if one of the two
764 /// operands is a NaN, this value is meaningless.
765 inline bool isTrueWhenEqual(CondCode Cond) {
766 return ((int)Cond & 1) != 0;
769 /// getUnorderedFlavor - This function returns 0 if the condition is always
770 /// false if an operand is a NaN, 1 if the condition is always true if the
771 /// operand is a NaN, and 2 if the condition is undefined if the operand is a
773 inline unsigned getUnorderedFlavor(CondCode Cond) {
774 return ((int)Cond >> 3) & 3;
777 /// getSetCCInverse - Return the operation corresponding to !(X op Y), where
778 /// 'op' is a valid SetCC operation.
779 CondCode getSetCCInverse(CondCode Operation, bool isInteger);
781 /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X)
782 /// when given the operation for (X op Y).
783 CondCode getSetCCSwappedOperands(CondCode Operation);
785 /// getSetCCOrOperation - Return the result of a logical OR between different
786 /// comparisons of identical values: ((X op1 Y) | (X op2 Y)). This
787 /// function returns SETCC_INVALID if it is not possible to represent the
788 /// resultant comparison.
789 CondCode getSetCCOrOperation(CondCode Op1, CondCode Op2, bool isInteger);
791 /// getSetCCAndOperation - Return the result of a logical AND between
792 /// different comparisons of identical values: ((X op1 Y) & (X op2 Y)). This
793 /// function returns SETCC_INVALID if it is not possible to represent the
794 /// resultant comparison.
795 CondCode getSetCCAndOperation(CondCode Op1, CondCode Op2, bool isInteger);
797 //===--------------------------------------------------------------------===//
798 /// CvtCode enum - This enum defines the various converts CONVERT_RNDSAT
801 CVT_FF, // Float from Float
802 CVT_FS, // Float from Signed
803 CVT_FU, // Float from Unsigned
804 CVT_SF, // Signed from Float
805 CVT_UF, // Unsigned from Float
806 CVT_SS, // Signed from Signed
807 CVT_SU, // Signed from Unsigned
808 CVT_US, // Unsigned from Signed
809 CVT_UU, // Unsigned from Unsigned
810 CVT_INVALID // Marker - Invalid opcode
812 } // end llvm::ISD namespace
815 //===----------------------------------------------------------------------===//
816 /// SDValue - Unlike LLVM values, Selection DAG nodes may return multiple
817 /// values as the result of a computation. Many nodes return multiple values,
818 /// from loads (which define a token and a return value) to ADDC (which returns
819 /// a result and a carry value), to calls (which may return an arbitrary number
822 /// As such, each use of a SelectionDAG computation must indicate the node that
823 /// computes it as well as which return value to use from that node. This pair
824 /// of information is represented with the SDValue value type.
827 SDNode *Node; // The node defining the value we are using.
828 unsigned ResNo; // Which return value of the node we are using.
830 SDValue() : Node(0), ResNo(0) {}
831 SDValue(SDNode *node, unsigned resno) : Node(node), ResNo(resno) {}
833 /// get the index which selects a specific result in the SDNode
834 unsigned getResNo() const { return ResNo; }
836 /// get the SDNode which holds the desired result
837 SDNode *getNode() const { return Node; }
840 void setNode(SDNode *N) { Node = N; }
842 inline SDNode *operator->() const { return Node; }
844 bool operator==(const SDValue &O) const {
845 return Node == O.Node && ResNo == O.ResNo;
847 bool operator!=(const SDValue &O) const {
848 return !operator==(O);
850 bool operator<(const SDValue &O) const {
851 return Node < O.Node || (Node == O.Node && ResNo < O.ResNo);
854 SDValue getValue(unsigned R) const {
855 return SDValue(Node, R);
858 // isOperandOf - Return true if this node is an operand of N.
859 bool isOperandOf(SDNode *N) const;
861 /// getValueType - Return the ValueType of the referenced return value.
863 inline EVT getValueType() const;
865 /// getValueSizeInBits - Returns the size of the value in bits.
867 unsigned getValueSizeInBits() const {
868 return getValueType().getSizeInBits();
871 // Forwarding methods - These forward to the corresponding methods in SDNode.
872 inline unsigned getOpcode() const;
873 inline unsigned getNumOperands() const;
874 inline const SDValue &getOperand(unsigned i) const;
875 inline uint64_t getConstantOperandVal(unsigned i) const;
876 inline bool isTargetMemoryOpcode() const;
877 inline bool isTargetOpcode() const;
878 inline bool isMachineOpcode() const;
879 inline unsigned getMachineOpcode() const;
880 inline const DebugLoc getDebugLoc() const;
883 /// reachesChainWithoutSideEffects - Return true if this operand (which must
884 /// be a chain) reaches the specified operand without crossing any
885 /// side-effecting instructions. In practice, this looks through token
886 /// factors and non-volatile loads. In order to remain efficient, this only
887 /// looks a couple of nodes in, it does not do an exhaustive search.
888 bool reachesChainWithoutSideEffects(SDValue Dest,
889 unsigned Depth = 2) const;
891 /// use_empty - Return true if there are no nodes using value ResNo
894 inline bool use_empty() const;
896 /// hasOneUse - Return true if there is exactly one node using value
899 inline bool hasOneUse() const;
903 template<> struct DenseMapInfo<SDValue> {
904 static inline SDValue getEmptyKey() {
905 return SDValue((SDNode*)-1, -1U);
907 static inline SDValue getTombstoneKey() {
908 return SDValue((SDNode*)-1, 0);
910 static unsigned getHashValue(const SDValue &Val) {
911 return ((unsigned)((uintptr_t)Val.getNode() >> 4) ^
912 (unsigned)((uintptr_t)Val.getNode() >> 9)) + Val.getResNo();
914 static bool isEqual(const SDValue &LHS, const SDValue &RHS) {
918 template <> struct isPodLike<SDValue> { static const bool value = true; };
921 /// simplify_type specializations - Allow casting operators to work directly on
922 /// SDValues as if they were SDNode*'s.
923 template<> struct simplify_type<SDValue> {
924 typedef SDNode* SimpleType;
925 static SimpleType getSimplifiedValue(const SDValue &Val) {
926 return static_cast<SimpleType>(Val.getNode());
929 template<> struct simplify_type<const SDValue> {
930 typedef SDNode* SimpleType;
931 static SimpleType getSimplifiedValue(const SDValue &Val) {
932 return static_cast<SimpleType>(Val.getNode());
936 /// SDUse - Represents a use of a SDNode. This class holds an SDValue,
937 /// which records the SDNode being used and the result number, a
938 /// pointer to the SDNode using the value, and Next and Prev pointers,
939 /// which link together all the uses of an SDNode.
942 /// Val - The value being used.
944 /// User - The user of this value.
946 /// Prev, Next - Pointers to the uses list of the SDNode referred by
950 SDUse(const SDUse &U); // Do not implement
951 void operator=(const SDUse &U); // Do not implement
954 SDUse() : Val(), User(NULL), Prev(NULL), Next(NULL) {}
956 /// Normally SDUse will just implicitly convert to an SDValue that it holds.
957 operator const SDValue&() const { return Val; }
959 /// If implicit conversion to SDValue doesn't work, the get() method returns
961 const SDValue &get() const { return Val; }
963 /// getUser - This returns the SDNode that contains this Use.
964 SDNode *getUser() { return User; }
966 /// getNext - Get the next SDUse in the use list.
967 SDUse *getNext() const { return Next; }
969 /// getNode - Convenience function for get().getNode().
970 SDNode *getNode() const { return Val.getNode(); }
971 /// getResNo - Convenience function for get().getResNo().
972 unsigned getResNo() const { return Val.getResNo(); }
973 /// getValueType - Convenience function for get().getValueType().
974 EVT getValueType() const { return Val.getValueType(); }
976 /// operator== - Convenience function for get().operator==
977 bool operator==(const SDValue &V) const {
981 /// operator!= - Convenience function for get().operator!=
982 bool operator!=(const SDValue &V) const {
986 /// operator< - Convenience function for get().operator<
987 bool operator<(const SDValue &V) const {
992 friend class SelectionDAG;
995 void setUser(SDNode *p) { User = p; }
997 /// set - Remove this use from its existing use list, assign it the
998 /// given value, and add it to the new value's node's use list.
999 inline void set(const SDValue &V);
1000 /// setInitial - like set, but only supports initializing a newly-allocated
1001 /// SDUse with a non-null value.
1002 inline void setInitial(const SDValue &V);
1003 /// setNode - like set, but only sets the Node portion of the value,
1004 /// leaving the ResNo portion unmodified.
1005 inline void setNode(SDNode *N);
1007 void addToList(SDUse **List) {
1009 if (Next) Next->Prev = &Next;
1014 void removeFromList() {
1016 if (Next) Next->Prev = Prev;
1020 /// simplify_type specializations - Allow casting operators to work directly on
1021 /// SDValues as if they were SDNode*'s.
1022 template<> struct simplify_type<SDUse> {
1023 typedef SDNode* SimpleType;
1024 static SimpleType getSimplifiedValue(const SDUse &Val) {
1025 return static_cast<SimpleType>(Val.getNode());
1028 template<> struct simplify_type<const SDUse> {
1029 typedef SDNode* SimpleType;
1030 static SimpleType getSimplifiedValue(const SDUse &Val) {
1031 return static_cast<SimpleType>(Val.getNode());
1036 /// SDNode - Represents one node in the SelectionDAG.
1038 class SDNode : public FoldingSetNode, public ilist_node<SDNode> {
1040 /// NodeType - The operation that this node performs.
1044 /// OperandsNeedDelete - This is true if OperandList was new[]'d. If true,
1045 /// then they will be delete[]'d when the node is destroyed.
1046 uint16_t OperandsNeedDelete : 1;
1048 /// HasDebugValue - This tracks whether this node has one or more dbg_value
1049 /// nodes corresponding to it.
1050 uint16_t HasDebugValue : 1;
1053 /// SubclassData - This member is defined by this class, but is not used for
1054 /// anything. Subclasses can use it to hold whatever state they find useful.
1055 /// This field is initialized to zero by the ctor.
1056 uint16_t SubclassData : 14;
1059 /// NodeId - Unique id per SDNode in the DAG.
1062 /// OperandList - The values that are used by this operation.
1066 /// ValueList - The types of the values this node defines. SDNode's may
1067 /// define multiple values simultaneously.
1068 const EVT *ValueList;
1070 /// UseList - List of uses for this SDNode.
1073 /// NumOperands/NumValues - The number of entries in the Operand/Value list.
1074 unsigned short NumOperands, NumValues;
1076 /// debugLoc - source line information.
1079 /// getValueTypeList - Return a pointer to the specified value type.
1080 static const EVT *getValueTypeList(EVT VT);
1082 friend class SelectionDAG;
1083 friend struct ilist_traits<SDNode>;
1086 //===--------------------------------------------------------------------===//
1090 /// getOpcode - Return the SelectionDAG opcode value for this node. For
1091 /// pre-isel nodes (those for which isMachineOpcode returns false), these
1092 /// are the opcode values in the ISD and <target>ISD namespaces. For
1093 /// post-isel opcodes, see getMachineOpcode.
1094 unsigned getOpcode() const { return (unsigned short)NodeType; }
1096 /// isTargetOpcode - Test if this node has a target-specific opcode (in the
1097 /// \<target\>ISD namespace).
1098 bool isTargetOpcode() const { return NodeType >= ISD::BUILTIN_OP_END; }
1100 /// isTargetMemoryOpcode - Test if this node has a target-specific
1101 /// memory-referencing opcode (in the \<target\>ISD namespace and
1102 /// greater than FIRST_TARGET_MEMORY_OPCODE).
1103 bool isTargetMemoryOpcode() const {
1104 return NodeType >= ISD::FIRST_TARGET_MEMORY_OPCODE;
1107 /// isMachineOpcode - Test if this node has a post-isel opcode, directly
1108 /// corresponding to a MachineInstr opcode.
1109 bool isMachineOpcode() const { return NodeType < 0; }
1111 /// getMachineOpcode - This may only be called if isMachineOpcode returns
1112 /// true. It returns the MachineInstr opcode value that the node's opcode
1114 unsigned getMachineOpcode() const {
1115 assert(isMachineOpcode() && "Not a MachineInstr opcode!");
1119 /// getHasDebugValue - get this bit.
1120 bool getHasDebugValue() const { return HasDebugValue; }
1122 /// setHasDebugValue - set this bit.
1123 void setHasDebugValue(bool b) { HasDebugValue = b; }
1125 /// use_empty - Return true if there are no uses of this node.
1127 bool use_empty() const { return UseList == NULL; }
1129 /// hasOneUse - Return true if there is exactly one use of this node.
1131 bool hasOneUse() const {
1132 return !use_empty() && llvm::next(use_begin()) == use_end();
1135 /// use_size - Return the number of uses of this node. This method takes
1136 /// time proportional to the number of uses.
1138 size_t use_size() const { return std::distance(use_begin(), use_end()); }
1140 /// getNodeId - Return the unique node id.
1142 int getNodeId() const { return NodeId; }
1144 /// setNodeId - Set unique node id.
1145 void setNodeId(int Id) { NodeId = Id; }
1147 /// getDebugLoc - Return the source location info.
1148 const DebugLoc getDebugLoc() const { return debugLoc; }
1150 /// setDebugLoc - Set source location info. Try to avoid this, putting
1151 /// it in the constructor is preferable.
1152 void setDebugLoc(const DebugLoc dl) { debugLoc = dl; }
1154 /// use_iterator - This class provides iterator support for SDUse
1155 /// operands that use a specific SDNode.
1157 : public std::iterator<std::forward_iterator_tag, SDUse, ptrdiff_t> {
1159 explicit use_iterator(SDUse *op) : Op(op) {
1161 friend class SDNode;
1163 typedef std::iterator<std::forward_iterator_tag,
1164 SDUse, ptrdiff_t>::reference reference;
1165 typedef std::iterator<std::forward_iterator_tag,
1166 SDUse, ptrdiff_t>::pointer pointer;
1168 use_iterator(const use_iterator &I) : Op(I.Op) {}
1169 use_iterator() : Op(0) {}
1171 bool operator==(const use_iterator &x) const {
1174 bool operator!=(const use_iterator &x) const {
1175 return !operator==(x);
1178 /// atEnd - return true if this iterator is at the end of uses list.
1179 bool atEnd() const { return Op == 0; }
1181 // Iterator traversal: forward iteration only.
1182 use_iterator &operator++() { // Preincrement
1183 assert(Op && "Cannot increment end iterator!");
1188 use_iterator operator++(int) { // Postincrement
1189 use_iterator tmp = *this; ++*this; return tmp;
1192 /// Retrieve a pointer to the current user node.
1193 SDNode *operator*() const {
1194 assert(Op && "Cannot dereference end iterator!");
1195 return Op->getUser();
1198 SDNode *operator->() const { return operator*(); }
1200 SDUse &getUse() const { return *Op; }
1202 /// getOperandNo - Retrieve the operand # of this use in its user.
1204 unsigned getOperandNo() const {
1205 assert(Op && "Cannot dereference end iterator!");
1206 return (unsigned)(Op - Op->getUser()->OperandList);
1210 /// use_begin/use_end - Provide iteration support to walk over all uses
1213 use_iterator use_begin() const {
1214 return use_iterator(UseList);
1217 static use_iterator use_end() { return use_iterator(0); }
1220 /// hasNUsesOfValue - Return true if there are exactly NUSES uses of the
1221 /// indicated value. This method ignores uses of other values defined by this
1223 bool hasNUsesOfValue(unsigned NUses, unsigned Value) const;
1225 /// hasAnyUseOfValue - Return true if there are any use of the indicated
1226 /// value. This method ignores uses of other values defined by this operation.
1227 bool hasAnyUseOfValue(unsigned Value) const;
1229 /// isOnlyUserOf - Return true if this node is the only use of N.
1231 bool isOnlyUserOf(SDNode *N) const;
1233 /// isOperandOf - Return true if this node is an operand of N.
1235 bool isOperandOf(SDNode *N) const;
1237 /// isPredecessorOf - Return true if this node is a predecessor of N. This
1238 /// node is either an operand of N or it can be reached by recursively
1239 /// traversing up the operands.
1240 /// NOTE: this is an expensive method. Use it carefully.
1241 bool isPredecessorOf(SDNode *N) const;
1243 /// getNumOperands - Return the number of values used by this operation.
1245 unsigned getNumOperands() const { return NumOperands; }
1247 /// getConstantOperandVal - Helper method returns the integer value of a
1248 /// ConstantSDNode operand.
1249 uint64_t getConstantOperandVal(unsigned Num) const;
1251 const SDValue &getOperand(unsigned Num) const {
1252 assert(Num < NumOperands && "Invalid child # of SDNode!");
1253 return OperandList[Num];
1256 typedef SDUse* op_iterator;
1257 op_iterator op_begin() const { return OperandList; }
1258 op_iterator op_end() const { return OperandList+NumOperands; }
1260 SDVTList getVTList() const {
1261 SDVTList X = { ValueList, NumValues };
1265 /// getFlaggedNode - If this node has a flag operand, return the node
1266 /// to which the flag operand points. Otherwise return NULL.
1267 SDNode *getFlaggedNode() const {
1268 if (getNumOperands() != 0 &&
1269 getOperand(getNumOperands()-1).getValueType().getSimpleVT() == MVT::Flag)
1270 return getOperand(getNumOperands()-1).getNode();
1274 // If this is a pseudo op, like copyfromreg, look to see if there is a
1275 // real target node flagged to it. If so, return the target node.
1276 const SDNode *getFlaggedMachineNode() const {
1277 const SDNode *FoundNode = this;
1279 // Climb up flag edges until a machine-opcode node is found, or the
1280 // end of the chain is reached.
1281 while (!FoundNode->isMachineOpcode()) {
1282 const SDNode *N = FoundNode->getFlaggedNode();
1290 /// getNumValues - Return the number of values defined/returned by this
1293 unsigned getNumValues() const { return NumValues; }
1295 /// getValueType - Return the type of a specified result.
1297 EVT getValueType(unsigned ResNo) const {
1298 assert(ResNo < NumValues && "Illegal result number!");
1299 return ValueList[ResNo];
1302 /// getValueSizeInBits - Returns MVT::getSizeInBits(getValueType(ResNo)).
1304 unsigned getValueSizeInBits(unsigned ResNo) const {
1305 return getValueType(ResNo).getSizeInBits();
1308 typedef const EVT* value_iterator;
1309 value_iterator value_begin() const { return ValueList; }
1310 value_iterator value_end() const { return ValueList+NumValues; }
1312 /// getOperationName - Return the opcode of this operation for printing.
1314 std::string getOperationName(const SelectionDAG *G = 0) const;
1315 static const char* getIndexedModeName(ISD::MemIndexedMode AM);
1316 void print_types(raw_ostream &OS, const SelectionDAG *G) const;
1317 void print_details(raw_ostream &OS, const SelectionDAG *G) const;
1318 void print(raw_ostream &OS, const SelectionDAG *G = 0) const;
1319 void printr(raw_ostream &OS, const SelectionDAG *G = 0) const;
1321 /// printrFull - Print a SelectionDAG node and all children down to
1322 /// the leaves. The given SelectionDAG allows target-specific nodes
1323 /// to be printed in human-readable form. Unlike printr, this will
1324 /// print the whole DAG, including children that appear multiple
1327 void printrFull(raw_ostream &O, const SelectionDAG *G = 0) const;
1329 /// printrWithDepth - Print a SelectionDAG node and children up to
1330 /// depth "depth." The given SelectionDAG allows target-specific
1331 /// nodes to be printed in human-readable form. Unlike printr, this
1332 /// will print children that appear multiple times wherever they are
1335 void printrWithDepth(raw_ostream &O, const SelectionDAG *G = 0,
1336 unsigned depth = 100) const;
1339 /// dump - Dump this node, for debugging.
1342 /// dumpr - Dump (recursively) this node and its use-def subgraph.
1345 /// dump - Dump this node, for debugging.
1346 /// The given SelectionDAG allows target-specific nodes to be printed
1347 /// in human-readable form.
1348 void dump(const SelectionDAG *G) const;
1350 /// dumpr - Dump (recursively) this node and its use-def subgraph.
1351 /// The given SelectionDAG allows target-specific nodes to be printed
1352 /// in human-readable form.
1353 void dumpr(const SelectionDAG *G) const;
1355 /// dumprFull - printrFull to dbgs(). The given SelectionDAG allows
1356 /// target-specific nodes to be printed in human-readable form.
1357 /// Unlike dumpr, this will print the whole DAG, including children
1358 /// that appear multiple times.
1360 void dumprFull(const SelectionDAG *G = 0) const;
1362 /// dumprWithDepth - printrWithDepth to dbgs(). The given
1363 /// SelectionDAG allows target-specific nodes to be printed in
1364 /// human-readable form. Unlike dumpr, this will print children
1365 /// that appear multiple times wherever they are used.
1367 void dumprWithDepth(const SelectionDAG *G = 0, unsigned depth = 100) const;
1370 static bool classof(const SDNode *) { return true; }
1372 /// Profile - Gather unique data for the node.
1374 void Profile(FoldingSetNodeID &ID) const;
1376 /// addUse - This method should only be used by the SDUse class.
1378 void addUse(SDUse &U) { U.addToList(&UseList); }
1381 static SDVTList getSDVTList(EVT VT) {
1382 SDVTList Ret = { getValueTypeList(VT), 1 };
1386 SDNode(unsigned Opc, const DebugLoc dl, SDVTList VTs, const SDValue *Ops,
1388 : NodeType(Opc), OperandsNeedDelete(true), HasDebugValue(false),
1389 SubclassData(0), NodeId(-1),
1390 OperandList(NumOps ? new SDUse[NumOps] : 0),
1391 ValueList(VTs.VTs), UseList(NULL),
1392 NumOperands(NumOps), NumValues(VTs.NumVTs),
1394 for (unsigned i = 0; i != NumOps; ++i) {
1395 OperandList[i].setUser(this);
1396 OperandList[i].setInitial(Ops[i]);
1398 checkForCycles(this);
1401 /// This constructor adds no operands itself; operands can be
1402 /// set later with InitOperands.
1403 SDNode(unsigned Opc, const DebugLoc dl, SDVTList VTs)
1404 : NodeType(Opc), OperandsNeedDelete(false), HasDebugValue(false),
1405 SubclassData(0), NodeId(-1), OperandList(0), ValueList(VTs.VTs),
1406 UseList(NULL), NumOperands(0), NumValues(VTs.NumVTs),
1409 /// InitOperands - Initialize the operands list of this with 1 operand.
1410 void InitOperands(SDUse *Ops, const SDValue &Op0) {
1411 Ops[0].setUser(this);
1412 Ops[0].setInitial(Op0);
1415 checkForCycles(this);
1418 /// InitOperands - Initialize the operands list of this with 2 operands.
1419 void InitOperands(SDUse *Ops, const SDValue &Op0, const SDValue &Op1) {
1420 Ops[0].setUser(this);
1421 Ops[0].setInitial(Op0);
1422 Ops[1].setUser(this);
1423 Ops[1].setInitial(Op1);
1426 checkForCycles(this);
1429 /// InitOperands - Initialize the operands list of this with 3 operands.
1430 void InitOperands(SDUse *Ops, const SDValue &Op0, const SDValue &Op1,
1431 const SDValue &Op2) {
1432 Ops[0].setUser(this);
1433 Ops[0].setInitial(Op0);
1434 Ops[1].setUser(this);
1435 Ops[1].setInitial(Op1);
1436 Ops[2].setUser(this);
1437 Ops[2].setInitial(Op2);
1440 checkForCycles(this);
1443 /// InitOperands - Initialize the operands list of this with 4 operands.
1444 void InitOperands(SDUse *Ops, const SDValue &Op0, const SDValue &Op1,
1445 const SDValue &Op2, const SDValue &Op3) {
1446 Ops[0].setUser(this);
1447 Ops[0].setInitial(Op0);
1448 Ops[1].setUser(this);
1449 Ops[1].setInitial(Op1);
1450 Ops[2].setUser(this);
1451 Ops[2].setInitial(Op2);
1452 Ops[3].setUser(this);
1453 Ops[3].setInitial(Op3);
1456 checkForCycles(this);
1459 /// InitOperands - Initialize the operands list of this with N operands.
1460 void InitOperands(SDUse *Ops, const SDValue *Vals, unsigned N) {
1461 for (unsigned i = 0; i != N; ++i) {
1462 Ops[i].setUser(this);
1463 Ops[i].setInitial(Vals[i]);
1467 checkForCycles(this);
1470 /// DropOperands - Release the operands and set this node to have
1472 void DropOperands();
1476 // Define inline functions from the SDValue class.
1478 inline unsigned SDValue::getOpcode() const {
1479 return Node->getOpcode();
1481 inline EVT SDValue::getValueType() const {
1482 return Node->getValueType(ResNo);
1484 inline unsigned SDValue::getNumOperands() const {
1485 return Node->getNumOperands();
1487 inline const SDValue &SDValue::getOperand(unsigned i) const {
1488 return Node->getOperand(i);
1490 inline uint64_t SDValue::getConstantOperandVal(unsigned i) const {
1491 return Node->getConstantOperandVal(i);
1493 inline bool SDValue::isTargetOpcode() const {
1494 return Node->isTargetOpcode();
1496 inline bool SDValue::isTargetMemoryOpcode() const {
1497 return Node->isTargetMemoryOpcode();
1499 inline bool SDValue::isMachineOpcode() const {
1500 return Node->isMachineOpcode();
1502 inline unsigned SDValue::getMachineOpcode() const {
1503 return Node->getMachineOpcode();
1505 inline bool SDValue::use_empty() const {
1506 return !Node->hasAnyUseOfValue(ResNo);
1508 inline bool SDValue::hasOneUse() const {
1509 return Node->hasNUsesOfValue(1, ResNo);
1511 inline const DebugLoc SDValue::getDebugLoc() const {
1512 return Node->getDebugLoc();
1515 // Define inline functions from the SDUse class.
1517 inline void SDUse::set(const SDValue &V) {
1518 if (Val.getNode()) removeFromList();
1520 if (V.getNode()) V.getNode()->addUse(*this);
1523 inline void SDUse::setInitial(const SDValue &V) {
1525 V.getNode()->addUse(*this);
1528 inline void SDUse::setNode(SDNode *N) {
1529 if (Val.getNode()) removeFromList();
1531 if (N) N->addUse(*this);
1534 /// UnarySDNode - This class is used for single-operand SDNodes. This is solely
1535 /// to allow co-allocation of node operands with the node itself.
1536 class UnarySDNode : public SDNode {
1539 UnarySDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, SDValue X)
1540 : SDNode(Opc, dl, VTs) {
1541 InitOperands(&Op, X);
1545 /// BinarySDNode - This class is used for two-operand SDNodes. This is solely
1546 /// to allow co-allocation of node operands with the node itself.
1547 class BinarySDNode : public SDNode {
1550 BinarySDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, SDValue X, SDValue Y)
1551 : SDNode(Opc, dl, VTs) {
1552 InitOperands(Ops, X, Y);
1556 /// TernarySDNode - This class is used for three-operand SDNodes. This is solely
1557 /// to allow co-allocation of node operands with the node itself.
1558 class TernarySDNode : public SDNode {
1561 TernarySDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, SDValue X, SDValue Y,
1563 : SDNode(Opc, dl, VTs) {
1564 InitOperands(Ops, X, Y, Z);
1569 /// HandleSDNode - This class is used to form a handle around another node that
1570 /// is persistant and is updated across invocations of replaceAllUsesWith on its
1571 /// operand. This node should be directly created by end-users and not added to
1572 /// the AllNodes list.
1573 class HandleSDNode : public SDNode {
1576 // FIXME: Remove the "noinline" attribute once <rdar://problem/5852746> is
1578 #if __GNUC__==4 && __GNUC_MINOR__==2 && defined(__APPLE__) && !defined(__llvm__)
1579 explicit __attribute__((__noinline__)) HandleSDNode(SDValue X)
1581 explicit HandleSDNode(SDValue X)
1583 : SDNode(ISD::HANDLENODE, DebugLoc(), getSDVTList(MVT::Other)) {
1584 InitOperands(&Op, X);
1587 const SDValue &getValue() const { return Op; }
1590 /// Abstact virtual class for operations for memory operations
1591 class MemSDNode : public SDNode {
1593 // MemoryVT - VT of in-memory value.
1597 /// MMO - Memory reference information.
1598 MachineMemOperand *MMO;
1601 MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, EVT MemoryVT,
1602 MachineMemOperand *MMO);
1604 MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, const SDValue *Ops,
1605 unsigned NumOps, EVT MemoryVT, MachineMemOperand *MMO);
1607 bool readMem() const { return MMO->isLoad(); }
1608 bool writeMem() const { return MMO->isStore(); }
1610 /// Returns alignment and volatility of the memory access
1611 unsigned getOriginalAlignment() const {
1612 return MMO->getBaseAlignment();
1614 unsigned getAlignment() const {
1615 return MMO->getAlignment();
1618 /// getRawSubclassData - Return the SubclassData value, which contains an
1619 /// encoding of the volatile flag, as well as bits used by subclasses. This
1620 /// function should only be used to compute a FoldingSetNodeID value.
1621 unsigned getRawSubclassData() const {
1622 return SubclassData;
1625 // We access subclass data here so that we can check consistency
1626 // with MachineMemOperand information.
1627 bool isVolatile() const { return (SubclassData >> 5) & 1; }
1628 bool isNonTemporal() const { return (SubclassData >> 6) & 1; }
1630 /// Returns the SrcValue and offset that describes the location of the access
1631 const Value *getSrcValue() const { return MMO->getValue(); }
1632 int64_t getSrcValueOffset() const { return MMO->getOffset(); }
1634 /// getMemoryVT - Return the type of the in-memory value.
1635 EVT getMemoryVT() const { return MemoryVT; }
1637 /// getMemOperand - Return a MachineMemOperand object describing the memory
1638 /// reference performed by operation.
1639 MachineMemOperand *getMemOperand() const { return MMO; }
1641 /// refineAlignment - Update this MemSDNode's MachineMemOperand information
1642 /// to reflect the alignment of NewMMO, if it has a greater alignment.
1643 /// This must only be used when the new alignment applies to all users of
1644 /// this MachineMemOperand.
1645 void refineAlignment(const MachineMemOperand *NewMMO) {
1646 MMO->refineAlignment(NewMMO);
1649 const SDValue &getChain() const { return getOperand(0); }
1650 const SDValue &getBasePtr() const {
1651 return getOperand(getOpcode() == ISD::STORE ? 2 : 1);
1654 // Methods to support isa and dyn_cast
1655 static bool classof(const MemSDNode *) { return true; }
1656 static bool classof(const SDNode *N) {
1657 // For some targets, we lower some target intrinsics to a MemIntrinsicNode
1658 // with either an intrinsic or a target opcode.
1659 return N->getOpcode() == ISD::LOAD ||
1660 N->getOpcode() == ISD::STORE ||
1661 N->getOpcode() == ISD::ATOMIC_CMP_SWAP ||
1662 N->getOpcode() == ISD::ATOMIC_SWAP ||
1663 N->getOpcode() == ISD::ATOMIC_LOAD_ADD ||
1664 N->getOpcode() == ISD::ATOMIC_LOAD_SUB ||
1665 N->getOpcode() == ISD::ATOMIC_LOAD_AND ||
1666 N->getOpcode() == ISD::ATOMIC_LOAD_OR ||
1667 N->getOpcode() == ISD::ATOMIC_LOAD_XOR ||
1668 N->getOpcode() == ISD::ATOMIC_LOAD_NAND ||
1669 N->getOpcode() == ISD::ATOMIC_LOAD_MIN ||
1670 N->getOpcode() == ISD::ATOMIC_LOAD_MAX ||
1671 N->getOpcode() == ISD::ATOMIC_LOAD_UMIN ||
1672 N->getOpcode() == ISD::ATOMIC_LOAD_UMAX ||
1673 N->isTargetMemoryOpcode();
1677 /// AtomicSDNode - A SDNode reprenting atomic operations.
1679 class AtomicSDNode : public MemSDNode {
1683 // Opc: opcode for atomic
1684 // VTL: value type list
1685 // Chain: memory chain for operaand
1686 // Ptr: address to update as a SDValue
1687 // Cmp: compare value
1689 // SrcVal: address to update as a Value (used for MemOperand)
1690 // Align: alignment of memory
1691 AtomicSDNode(unsigned Opc, DebugLoc dl, SDVTList VTL, EVT MemVT,
1692 SDValue Chain, SDValue Ptr,
1693 SDValue Cmp, SDValue Swp, MachineMemOperand *MMO)
1694 : MemSDNode(Opc, dl, VTL, MemVT, MMO) {
1695 assert(readMem() && "Atomic MachineMemOperand is not a load!");
1696 assert(writeMem() && "Atomic MachineMemOperand is not a store!");
1697 InitOperands(Ops, Chain, Ptr, Cmp, Swp);
1699 AtomicSDNode(unsigned Opc, DebugLoc dl, SDVTList VTL, EVT MemVT,
1700 SDValue Chain, SDValue Ptr,
1701 SDValue Val, MachineMemOperand *MMO)
1702 : MemSDNode(Opc, dl, VTL, MemVT, MMO) {
1703 assert(readMem() && "Atomic MachineMemOperand is not a load!");
1704 assert(writeMem() && "Atomic MachineMemOperand is not a store!");
1705 InitOperands(Ops, Chain, Ptr, Val);
1708 const SDValue &getBasePtr() const { return getOperand(1); }
1709 const SDValue &getVal() const { return getOperand(2); }
1711 bool isCompareAndSwap() const {
1712 unsigned Op = getOpcode();
1713 return Op == ISD::ATOMIC_CMP_SWAP;
1716 // Methods to support isa and dyn_cast
1717 static bool classof(const AtomicSDNode *) { return true; }
1718 static bool classof(const SDNode *N) {
1719 return N->getOpcode() == ISD::ATOMIC_CMP_SWAP ||
1720 N->getOpcode() == ISD::ATOMIC_SWAP ||
1721 N->getOpcode() == ISD::ATOMIC_LOAD_ADD ||
1722 N->getOpcode() == ISD::ATOMIC_LOAD_SUB ||
1723 N->getOpcode() == ISD::ATOMIC_LOAD_AND ||
1724 N->getOpcode() == ISD::ATOMIC_LOAD_OR ||
1725 N->getOpcode() == ISD::ATOMIC_LOAD_XOR ||
1726 N->getOpcode() == ISD::ATOMIC_LOAD_NAND ||
1727 N->getOpcode() == ISD::ATOMIC_LOAD_MIN ||
1728 N->getOpcode() == ISD::ATOMIC_LOAD_MAX ||
1729 N->getOpcode() == ISD::ATOMIC_LOAD_UMIN ||
1730 N->getOpcode() == ISD::ATOMIC_LOAD_UMAX;
1734 /// MemIntrinsicSDNode - This SDNode is used for target intrinsics that touch
1735 /// memory and need an associated MachineMemOperand. Its opcode may be
1736 /// INTRINSIC_VOID, INTRINSIC_W_CHAIN, or a target-specific opcode with a
1737 /// value not less than FIRST_TARGET_MEMORY_OPCODE.
1738 class MemIntrinsicSDNode : public MemSDNode {
1740 MemIntrinsicSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs,
1741 const SDValue *Ops, unsigned NumOps,
1742 EVT MemoryVT, MachineMemOperand *MMO)
1743 : MemSDNode(Opc, dl, VTs, Ops, NumOps, MemoryVT, MMO) {
1746 // Methods to support isa and dyn_cast
1747 static bool classof(const MemIntrinsicSDNode *) { return true; }
1748 static bool classof(const SDNode *N) {
1749 // We lower some target intrinsics to their target opcode
1750 // early a node with a target opcode can be of this class
1751 return N->getOpcode() == ISD::INTRINSIC_W_CHAIN ||
1752 N->getOpcode() == ISD::INTRINSIC_VOID ||
1753 N->isTargetMemoryOpcode();
1757 /// ShuffleVectorSDNode - This SDNode is used to implement the code generator
1758 /// support for the llvm IR shufflevector instruction. It combines elements
1759 /// from two input vectors into a new input vector, with the selection and
1760 /// ordering of elements determined by an array of integers, referred to as
1761 /// the shuffle mask. For input vectors of width N, mask indices of 0..N-1
1762 /// refer to elements from the LHS input, and indices from N to 2N-1 the RHS.
1763 /// An index of -1 is treated as undef, such that the code generator may put
1764 /// any value in the corresponding element of the result.
1765 class ShuffleVectorSDNode : public SDNode {
1768 // The memory for Mask is owned by the SelectionDAG's OperandAllocator, and
1769 // is freed when the SelectionDAG object is destroyed.
1772 friend class SelectionDAG;
1773 ShuffleVectorSDNode(EVT VT, DebugLoc dl, SDValue N1, SDValue N2,
1775 : SDNode(ISD::VECTOR_SHUFFLE, dl, getSDVTList(VT)), Mask(M) {
1776 InitOperands(Ops, N1, N2);
1780 void getMask(SmallVectorImpl<int> &M) const {
1781 EVT VT = getValueType(0);
1783 for (unsigned i = 0, e = VT.getVectorNumElements(); i != e; ++i)
1784 M.push_back(Mask[i]);
1786 int getMaskElt(unsigned Idx) const {
1787 assert(Idx < getValueType(0).getVectorNumElements() && "Idx out of range!");
1791 bool isSplat() const { return isSplatMask(Mask, getValueType(0)); }
1792 int getSplatIndex() const {
1793 assert(isSplat() && "Cannot get splat index for non-splat!");
1794 EVT VT = getValueType(0);
1795 for (unsigned i = 0, e = VT.getVectorNumElements(); i != e; ++i) {
1801 static bool isSplatMask(const int *Mask, EVT VT);
1803 static bool classof(const ShuffleVectorSDNode *) { return true; }
1804 static bool classof(const SDNode *N) {
1805 return N->getOpcode() == ISD::VECTOR_SHUFFLE;
1809 class ConstantSDNode : public SDNode {
1810 const ConstantInt *Value;
1811 friend class SelectionDAG;
1812 ConstantSDNode(bool isTarget, const ConstantInt *val, EVT VT)
1813 : SDNode(isTarget ? ISD::TargetConstant : ISD::Constant,
1814 DebugLoc(), getSDVTList(VT)), Value(val) {
1818 const ConstantInt *getConstantIntValue() const { return Value; }
1819 const APInt &getAPIntValue() const { return Value->getValue(); }
1820 uint64_t getZExtValue() const { return Value->getZExtValue(); }
1821 int64_t getSExtValue() const { return Value->getSExtValue(); }
1823 bool isNullValue() const { return Value->isNullValue(); }
1824 bool isAllOnesValue() const { return Value->isAllOnesValue(); }
1826 static bool classof(const ConstantSDNode *) { return true; }
1827 static bool classof(const SDNode *N) {
1828 return N->getOpcode() == ISD::Constant ||
1829 N->getOpcode() == ISD::TargetConstant;
1833 class ConstantFPSDNode : public SDNode {
1834 const ConstantFP *Value;
1835 friend class SelectionDAG;
1836 ConstantFPSDNode(bool isTarget, const ConstantFP *val, EVT VT)
1837 : SDNode(isTarget ? ISD::TargetConstantFP : ISD::ConstantFP,
1838 DebugLoc(), getSDVTList(VT)), Value(val) {
1842 const APFloat& getValueAPF() const { return Value->getValueAPF(); }
1843 const ConstantFP *getConstantFPValue() const { return Value; }
1845 /// isZero - Return true if the value is positive or negative zero.
1846 bool isZero() const { return Value->isZero(); }
1848 /// isNaN - Return true if the value is a NaN.
1849 bool isNaN() const { return Value->isNaN(); }
1851 /// isExactlyValue - We don't rely on operator== working on double values, as
1852 /// it returns true for things that are clearly not equal, like -0.0 and 0.0.
1853 /// As such, this method can be used to do an exact bit-for-bit comparison of
1854 /// two floating point values.
1856 /// We leave the version with the double argument here because it's just so
1857 /// convenient to write "2.0" and the like. Without this function we'd
1858 /// have to duplicate its logic everywhere it's called.
1859 bool isExactlyValue(double V) const {
1861 // convert is not supported on this type
1862 if (&Value->getValueAPF().getSemantics() == &APFloat::PPCDoubleDouble)
1865 Tmp.convert(Value->getValueAPF().getSemantics(),
1866 APFloat::rmNearestTiesToEven, &ignored);
1867 return isExactlyValue(Tmp);
1869 bool isExactlyValue(const APFloat& V) const;
1871 bool isValueValidForType(EVT VT, const APFloat& Val);
1873 static bool classof(const ConstantFPSDNode *) { return true; }
1874 static bool classof(const SDNode *N) {
1875 return N->getOpcode() == ISD::ConstantFP ||
1876 N->getOpcode() == ISD::TargetConstantFP;
1880 class GlobalAddressSDNode : public SDNode {
1881 GlobalValue *TheGlobal;
1883 unsigned char TargetFlags;
1884 friend class SelectionDAG;
1885 GlobalAddressSDNode(unsigned Opc, const GlobalValue *GA, EVT VT,
1886 int64_t o, unsigned char TargetFlags);
1889 GlobalValue *getGlobal() const { return TheGlobal; }
1890 int64_t getOffset() const { return Offset; }
1891 unsigned char getTargetFlags() const { return TargetFlags; }
1892 // Return the address space this GlobalAddress belongs to.
1893 unsigned getAddressSpace() const;
1895 static bool classof(const GlobalAddressSDNode *) { return true; }
1896 static bool classof(const SDNode *N) {
1897 return N->getOpcode() == ISD::GlobalAddress ||
1898 N->getOpcode() == ISD::TargetGlobalAddress ||
1899 N->getOpcode() == ISD::GlobalTLSAddress ||
1900 N->getOpcode() == ISD::TargetGlobalTLSAddress;
1904 class FrameIndexSDNode : public SDNode {
1906 friend class SelectionDAG;
1907 FrameIndexSDNode(int fi, EVT VT, bool isTarg)
1908 : SDNode(isTarg ? ISD::TargetFrameIndex : ISD::FrameIndex,
1909 DebugLoc(), getSDVTList(VT)), FI(fi) {
1913 int getIndex() const { return FI; }
1915 static bool classof(const FrameIndexSDNode *) { return true; }
1916 static bool classof(const SDNode *N) {
1917 return N->getOpcode() == ISD::FrameIndex ||
1918 N->getOpcode() == ISD::TargetFrameIndex;
1922 class JumpTableSDNode : public SDNode {
1924 unsigned char TargetFlags;
1925 friend class SelectionDAG;
1926 JumpTableSDNode(int jti, EVT VT, bool isTarg, unsigned char TF)
1927 : SDNode(isTarg ? ISD::TargetJumpTable : ISD::JumpTable,
1928 DebugLoc(), getSDVTList(VT)), JTI(jti), TargetFlags(TF) {
1932 int getIndex() const { return JTI; }
1933 unsigned char getTargetFlags() const { return TargetFlags; }
1935 static bool classof(const JumpTableSDNode *) { return true; }
1936 static bool classof(const SDNode *N) {
1937 return N->getOpcode() == ISD::JumpTable ||
1938 N->getOpcode() == ISD::TargetJumpTable;
1942 class ConstantPoolSDNode : public SDNode {
1945 MachineConstantPoolValue *MachineCPVal;
1947 int Offset; // It's a MachineConstantPoolValue if top bit is set.
1948 unsigned Alignment; // Minimum alignment requirement of CP (not log2 value).
1949 unsigned char TargetFlags;
1950 friend class SelectionDAG;
1951 ConstantPoolSDNode(bool isTarget, Constant *c, EVT VT, int o, unsigned Align,
1953 : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool,
1955 getSDVTList(VT)), Offset(o), Alignment(Align), TargetFlags(TF) {
1956 assert((int)Offset >= 0 && "Offset is too large");
1959 ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v,
1960 EVT VT, int o, unsigned Align, unsigned char TF)
1961 : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool,
1963 getSDVTList(VT)), Offset(o), Alignment(Align), TargetFlags(TF) {
1964 assert((int)Offset >= 0 && "Offset is too large");
1965 Val.MachineCPVal = v;
1966 Offset |= 1 << (sizeof(unsigned)*CHAR_BIT-1);
1971 bool isMachineConstantPoolEntry() const {
1972 return (int)Offset < 0;
1975 Constant *getConstVal() const {
1976 assert(!isMachineConstantPoolEntry() && "Wrong constantpool type");
1977 return Val.ConstVal;
1980 MachineConstantPoolValue *getMachineCPVal() const {
1981 assert(isMachineConstantPoolEntry() && "Wrong constantpool type");
1982 return Val.MachineCPVal;
1985 int getOffset() const {
1986 return Offset & ~(1 << (sizeof(unsigned)*CHAR_BIT-1));
1989 // Return the alignment of this constant pool object, which is either 0 (for
1990 // default alignment) or the desired value.
1991 unsigned getAlignment() const { return Alignment; }
1992 unsigned char getTargetFlags() const { return TargetFlags; }
1994 const Type *getType() const;
1996 static bool classof(const ConstantPoolSDNode *) { return true; }
1997 static bool classof(const SDNode *N) {
1998 return N->getOpcode() == ISD::ConstantPool ||
1999 N->getOpcode() == ISD::TargetConstantPool;
2003 class BasicBlockSDNode : public SDNode {
2004 MachineBasicBlock *MBB;
2005 friend class SelectionDAG;
2006 /// Debug info is meaningful and potentially useful here, but we create
2007 /// blocks out of order when they're jumped to, which makes it a bit
2008 /// harder. Let's see if we need it first.
2009 explicit BasicBlockSDNode(MachineBasicBlock *mbb)
2010 : SDNode(ISD::BasicBlock, DebugLoc(), getSDVTList(MVT::Other)), MBB(mbb) {
2014 MachineBasicBlock *getBasicBlock() const { return MBB; }
2016 static bool classof(const BasicBlockSDNode *) { return true; }
2017 static bool classof(const SDNode *N) {
2018 return N->getOpcode() == ISD::BasicBlock;
2022 /// BuildVectorSDNode - A "pseudo-class" with methods for operating on
2024 class BuildVectorSDNode : public SDNode {
2025 // These are constructed as SDNodes and then cast to BuildVectorSDNodes.
2026 explicit BuildVectorSDNode(); // Do not implement
2028 /// isConstantSplat - Check if this is a constant splat, and if so, find the
2029 /// smallest element size that splats the vector. If MinSplatBits is
2030 /// nonzero, the element size must be at least that large. Note that the
2031 /// splat element may be the entire vector (i.e., a one element vector).
2032 /// Returns the splat element value in SplatValue. Any undefined bits in
2033 /// that value are zero, and the corresponding bits in the SplatUndef mask
2034 /// are set. The SplatBitSize value is set to the splat element size in
2035 /// bits. HasAnyUndefs is set to true if any bits in the vector are
2036 /// undefined. isBigEndian describes the endianness of the target.
2037 bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef,
2038 unsigned &SplatBitSize, bool &HasAnyUndefs,
2039 unsigned MinSplatBits = 0, bool isBigEndian = false);
2041 static inline bool classof(const BuildVectorSDNode *) { return true; }
2042 static inline bool classof(const SDNode *N) {
2043 return N->getOpcode() == ISD::BUILD_VECTOR;
2047 /// SrcValueSDNode - An SDNode that holds an arbitrary LLVM IR Value. This is
2048 /// used when the SelectionDAG needs to make a simple reference to something
2049 /// in the LLVM IR representation.
2051 class SrcValueSDNode : public SDNode {
2053 friend class SelectionDAG;
2054 /// Create a SrcValue for a general value.
2055 explicit SrcValueSDNode(const Value *v)
2056 : SDNode(ISD::SRCVALUE, DebugLoc(), getSDVTList(MVT::Other)), V(v) {}
2059 /// getValue - return the contained Value.
2060 const Value *getValue() const { return V; }
2062 static bool classof(const SrcValueSDNode *) { return true; }
2063 static bool classof(const SDNode *N) {
2064 return N->getOpcode() == ISD::SRCVALUE;
2068 class MDNodeSDNode : public SDNode {
2070 friend class SelectionDAG;
2071 explicit MDNodeSDNode(const MDNode *md)
2072 : SDNode(ISD::MDNODE_SDNODE, DebugLoc(), getSDVTList(MVT::Other)), MD(md) {}
2075 const MDNode *getMD() const { return MD; }
2077 static bool classof(const MDNodeSDNode *) { return true; }
2078 static bool classof(const SDNode *N) {
2079 return N->getOpcode() == ISD::MDNODE_SDNODE;
2084 class RegisterSDNode : public SDNode {
2086 friend class SelectionDAG;
2087 RegisterSDNode(unsigned reg, EVT VT)
2088 : SDNode(ISD::Register, DebugLoc(), getSDVTList(VT)), Reg(reg) {
2092 unsigned getReg() const { return Reg; }
2094 static bool classof(const RegisterSDNode *) { return true; }
2095 static bool classof(const SDNode *N) {
2096 return N->getOpcode() == ISD::Register;
2100 class BlockAddressSDNode : public SDNode {
2102 unsigned char TargetFlags;
2103 friend class SelectionDAG;
2104 BlockAddressSDNode(unsigned NodeTy, EVT VT, BlockAddress *ba,
2105 unsigned char Flags)
2106 : SDNode(NodeTy, DebugLoc(), getSDVTList(VT)),
2107 BA(ba), TargetFlags(Flags) {
2110 BlockAddress *getBlockAddress() const { return BA; }
2111 unsigned char getTargetFlags() const { return TargetFlags; }
2113 static bool classof(const BlockAddressSDNode *) { return true; }
2114 static bool classof(const SDNode *N) {
2115 return N->getOpcode() == ISD::BlockAddress ||
2116 N->getOpcode() == ISD::TargetBlockAddress;
2120 class EHLabelSDNode : public SDNode {
2123 friend class SelectionDAG;
2124 EHLabelSDNode(DebugLoc dl, SDValue ch, MCSymbol *L)
2125 : SDNode(ISD::EH_LABEL, dl, getSDVTList(MVT::Other)), Label(L) {
2126 InitOperands(&Chain, ch);
2129 MCSymbol *getLabel() const { return Label; }
2131 static bool classof(const EHLabelSDNode *) { return true; }
2132 static bool classof(const SDNode *N) {
2133 return N->getOpcode() == ISD::EH_LABEL;
2137 class ExternalSymbolSDNode : public SDNode {
2139 unsigned char TargetFlags;
2141 friend class SelectionDAG;
2142 ExternalSymbolSDNode(bool isTarget, const char *Sym, unsigned char TF, EVT VT)
2143 : SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol,
2144 DebugLoc(), getSDVTList(VT)), Symbol(Sym), TargetFlags(TF) {
2148 const char *getSymbol() const { return Symbol; }
2149 unsigned char getTargetFlags() const { return TargetFlags; }
2151 static bool classof(const ExternalSymbolSDNode *) { return true; }
2152 static bool classof(const SDNode *N) {
2153 return N->getOpcode() == ISD::ExternalSymbol ||
2154 N->getOpcode() == ISD::TargetExternalSymbol;
2158 class CondCodeSDNode : public SDNode {
2159 ISD::CondCode Condition;
2160 friend class SelectionDAG;
2161 explicit CondCodeSDNode(ISD::CondCode Cond)
2162 : SDNode(ISD::CONDCODE, DebugLoc(), getSDVTList(MVT::Other)),
2167 ISD::CondCode get() const { return Condition; }
2169 static bool classof(const CondCodeSDNode *) { return true; }
2170 static bool classof(const SDNode *N) {
2171 return N->getOpcode() == ISD::CONDCODE;
2175 /// CvtRndSatSDNode - NOTE: avoid using this node as this may disappear in the
2176 /// future and most targets don't support it.
2177 class CvtRndSatSDNode : public SDNode {
2178 ISD::CvtCode CvtCode;
2179 friend class SelectionDAG;
2180 explicit CvtRndSatSDNode(EVT VT, DebugLoc dl, const SDValue *Ops,
2181 unsigned NumOps, ISD::CvtCode Code)
2182 : SDNode(ISD::CONVERT_RNDSAT, dl, getSDVTList(VT), Ops, NumOps),
2184 assert(NumOps == 5 && "wrong number of operations");
2187 ISD::CvtCode getCvtCode() const { return CvtCode; }
2189 static bool classof(const CvtRndSatSDNode *) { return true; }
2190 static bool classof(const SDNode *N) {
2191 return N->getOpcode() == ISD::CONVERT_RNDSAT;
2198 static const uint64_t NoFlagSet = 0ULL;
2199 static const uint64_t ZExt = 1ULL<<0; ///< Zero extended
2200 static const uint64_t ZExtOffs = 0;
2201 static const uint64_t SExt = 1ULL<<1; ///< Sign extended
2202 static const uint64_t SExtOffs = 1;
2203 static const uint64_t InReg = 1ULL<<2; ///< Passed in register
2204 static const uint64_t InRegOffs = 2;
2205 static const uint64_t SRet = 1ULL<<3; ///< Hidden struct-ret ptr
2206 static const uint64_t SRetOffs = 3;
2207 static const uint64_t ByVal = 1ULL<<4; ///< Struct passed by value
2208 static const uint64_t ByValOffs = 4;
2209 static const uint64_t Nest = 1ULL<<5; ///< Nested fn static chain
2210 static const uint64_t NestOffs = 5;
2211 static const uint64_t ByValAlign = 0xFULL << 6; //< Struct alignment
2212 static const uint64_t ByValAlignOffs = 6;
2213 static const uint64_t Split = 1ULL << 10;
2214 static const uint64_t SplitOffs = 10;
2215 static const uint64_t OrigAlign = 0x1FULL<<27;
2216 static const uint64_t OrigAlignOffs = 27;
2217 static const uint64_t ByValSize = 0xffffffffULL << 32; //< Struct size
2218 static const uint64_t ByValSizeOffs = 32;
2220 static const uint64_t One = 1ULL; //< 1 of this type, for shifts
2224 ArgFlagsTy() : Flags(0) { }
2226 bool isZExt() const { return Flags & ZExt; }
2227 void setZExt() { Flags |= One << ZExtOffs; }
2229 bool isSExt() const { return Flags & SExt; }
2230 void setSExt() { Flags |= One << SExtOffs; }
2232 bool isInReg() const { return Flags & InReg; }
2233 void setInReg() { Flags |= One << InRegOffs; }
2235 bool isSRet() const { return Flags & SRet; }
2236 void setSRet() { Flags |= One << SRetOffs; }
2238 bool isByVal() const { return Flags & ByVal; }
2239 void setByVal() { Flags |= One << ByValOffs; }
2241 bool isNest() const { return Flags & Nest; }
2242 void setNest() { Flags |= One << NestOffs; }
2244 unsigned getByValAlign() const {
2246 ((One << ((Flags & ByValAlign) >> ByValAlignOffs)) / 2);
2248 void setByValAlign(unsigned A) {
2249 Flags = (Flags & ~ByValAlign) |
2250 (uint64_t(Log2_32(A) + 1) << ByValAlignOffs);
2253 bool isSplit() const { return Flags & Split; }
2254 void setSplit() { Flags |= One << SplitOffs; }
2256 unsigned getOrigAlign() const {
2258 ((One << ((Flags & OrigAlign) >> OrigAlignOffs)) / 2);
2260 void setOrigAlign(unsigned A) {
2261 Flags = (Flags & ~OrigAlign) |
2262 (uint64_t(Log2_32(A) + 1) << OrigAlignOffs);
2265 unsigned getByValSize() const {
2266 return (unsigned)((Flags & ByValSize) >> ByValSizeOffs);
2268 void setByValSize(unsigned S) {
2269 Flags = (Flags & ~ByValSize) | (uint64_t(S) << ByValSizeOffs);
2272 /// getArgFlagsString - Returns the flags as a string, eg: "zext align:4".
2273 std::string getArgFlagsString();
2275 /// getRawBits - Represent the flags as a bunch of bits.
2276 uint64_t getRawBits() const { return Flags; }
2279 /// InputArg - This struct carries flags and type information about a
2280 /// single incoming (formal) argument or incoming (from the perspective
2281 /// of the caller) return value virtual register.
2288 InputArg() : VT(MVT::Other), Used(false) {}
2289 InputArg(ISD::ArgFlagsTy flags, EVT vt, bool used)
2290 : Flags(flags), VT(vt), Used(used) {
2291 assert(VT.isSimple() &&
2292 "InputArg value type must be Simple!");
2296 /// OutputArg - This struct carries flags and a value for a
2297 /// single outgoing (actual) argument or outgoing (from the perspective
2298 /// of the caller) return value virtual register.
2305 OutputArg() : IsFixed(false) {}
2306 OutputArg(ISD::ArgFlagsTy flags, SDValue val, bool isfixed)
2307 : Flags(flags), Val(val), IsFixed(isfixed) {
2308 assert(Val.getValueType().isSimple() &&
2309 "OutputArg value type must be Simple!");
2314 /// VTSDNode - This class is used to represent EVT's, which are used
2315 /// to parameterize some operations.
2316 class VTSDNode : public SDNode {
2318 friend class SelectionDAG;
2319 explicit VTSDNode(EVT VT)
2320 : SDNode(ISD::VALUETYPE, DebugLoc(), getSDVTList(MVT::Other)),
2325 EVT getVT() const { return ValueType; }
2327 static bool classof(const VTSDNode *) { return true; }
2328 static bool classof(const SDNode *N) {
2329 return N->getOpcode() == ISD::VALUETYPE;
2333 /// LSBaseSDNode - Base class for LoadSDNode and StoreSDNode
2335 class LSBaseSDNode : public MemSDNode {
2336 //! Operand array for load and store
2338 \note Moving this array to the base class captures more
2339 common functionality shared between LoadSDNode and
2344 LSBaseSDNode(ISD::NodeType NodeTy, DebugLoc dl, SDValue *Operands,
2345 unsigned numOperands, SDVTList VTs, ISD::MemIndexedMode AM,
2346 EVT MemVT, MachineMemOperand *MMO)
2347 : MemSDNode(NodeTy, dl, VTs, MemVT, MMO) {
2348 SubclassData |= AM << 2;
2349 assert(getAddressingMode() == AM && "MemIndexedMode encoding error!");
2350 InitOperands(Ops, Operands, numOperands);
2351 assert((getOffset().getOpcode() == ISD::UNDEF || isIndexed()) &&
2352 "Only indexed loads and stores have a non-undef offset operand");
2355 const SDValue &getOffset() const {
2356 return getOperand(getOpcode() == ISD::LOAD ? 2 : 3);
2359 /// getAddressingMode - Return the addressing mode for this load or store:
2360 /// unindexed, pre-inc, pre-dec, post-inc, or post-dec.
2361 ISD::MemIndexedMode getAddressingMode() const {
2362 return ISD::MemIndexedMode((SubclassData >> 2) & 7);
2365 /// isIndexed - Return true if this is a pre/post inc/dec load/store.
2366 bool isIndexed() const { return getAddressingMode() != ISD::UNINDEXED; }
2368 /// isUnindexed - Return true if this is NOT a pre/post inc/dec load/store.
2369 bool isUnindexed() const { return getAddressingMode() == ISD::UNINDEXED; }
2371 static bool classof(const LSBaseSDNode *) { return true; }
2372 static bool classof(const SDNode *N) {
2373 return N->getOpcode() == ISD::LOAD ||
2374 N->getOpcode() == ISD::STORE;
2378 /// LoadSDNode - This class is used to represent ISD::LOAD nodes.
2380 class LoadSDNode : public LSBaseSDNode {
2381 friend class SelectionDAG;
2382 LoadSDNode(SDValue *ChainPtrOff, DebugLoc dl, SDVTList VTs,
2383 ISD::MemIndexedMode AM, ISD::LoadExtType ETy, EVT MemVT,
2384 MachineMemOperand *MMO)
2385 : LSBaseSDNode(ISD::LOAD, dl, ChainPtrOff, 3,
2386 VTs, AM, MemVT, MMO) {
2387 SubclassData |= (unsigned short)ETy;
2388 assert(getExtensionType() == ETy && "LoadExtType encoding error!");
2389 assert(readMem() && "Load MachineMemOperand is not a load!");
2390 assert(!writeMem() && "Load MachineMemOperand is a store!");
2394 /// getExtensionType - Return whether this is a plain node,
2395 /// or one of the varieties of value-extending loads.
2396 ISD::LoadExtType getExtensionType() const {
2397 return ISD::LoadExtType(SubclassData & 3);
2400 const SDValue &getBasePtr() const { return getOperand(1); }
2401 const SDValue &getOffset() const { return getOperand(2); }
2403 static bool classof(const LoadSDNode *) { return true; }
2404 static bool classof(const SDNode *N) {
2405 return N->getOpcode() == ISD::LOAD;
2409 /// StoreSDNode - This class is used to represent ISD::STORE nodes.
2411 class StoreSDNode : public LSBaseSDNode {
2412 friend class SelectionDAG;
2413 StoreSDNode(SDValue *ChainValuePtrOff, DebugLoc dl, SDVTList VTs,
2414 ISD::MemIndexedMode AM, bool isTrunc, EVT MemVT,
2415 MachineMemOperand *MMO)
2416 : LSBaseSDNode(ISD::STORE, dl, ChainValuePtrOff, 4,
2417 VTs, AM, MemVT, MMO) {
2418 SubclassData |= (unsigned short)isTrunc;
2419 assert(isTruncatingStore() == isTrunc && "isTrunc encoding error!");
2420 assert(!readMem() && "Store MachineMemOperand is a load!");
2421 assert(writeMem() && "Store MachineMemOperand is not a store!");
2425 /// isTruncatingStore - Return true if the op does a truncation before store.
2426 /// For integers this is the same as doing a TRUNCATE and storing the result.
2427 /// For floats, it is the same as doing an FP_ROUND and storing the result.
2428 bool isTruncatingStore() const { return SubclassData & 1; }
2430 const SDValue &getValue() const { return getOperand(1); }
2431 const SDValue &getBasePtr() const { return getOperand(2); }
2432 const SDValue &getOffset() const { return getOperand(3); }
2434 static bool classof(const StoreSDNode *) { return true; }
2435 static bool classof(const SDNode *N) {
2436 return N->getOpcode() == ISD::STORE;
2440 /// MachineSDNode - An SDNode that represents everything that will be needed
2441 /// to construct a MachineInstr. These nodes are created during the
2442 /// instruction selection proper phase.
2444 class MachineSDNode : public SDNode {
2446 typedef MachineMemOperand **mmo_iterator;
2449 friend class SelectionDAG;
2450 MachineSDNode(unsigned Opc, const DebugLoc DL, SDVTList VTs)
2451 : SDNode(Opc, DL, VTs), MemRefs(0), MemRefsEnd(0) {}
2453 /// LocalOperands - Operands for this instruction, if they fit here. If
2454 /// they don't, this field is unused.
2455 SDUse LocalOperands[4];
2457 /// MemRefs - Memory reference descriptions for this instruction.
2458 mmo_iterator MemRefs;
2459 mmo_iterator MemRefsEnd;
2462 mmo_iterator memoperands_begin() const { return MemRefs; }
2463 mmo_iterator memoperands_end() const { return MemRefsEnd; }
2464 bool memoperands_empty() const { return MemRefsEnd == MemRefs; }
2466 /// setMemRefs - Assign this MachineSDNodes's memory reference descriptor
2467 /// list. This does not transfer ownership.
2468 void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd) {
2469 MemRefs = NewMemRefs;
2470 MemRefsEnd = NewMemRefsEnd;
2473 static bool classof(const MachineSDNode *) { return true; }
2474 static bool classof(const SDNode *N) {
2475 return N->isMachineOpcode();
2479 class SDNodeIterator : public std::iterator<std::forward_iterator_tag,
2480 SDNode, ptrdiff_t> {
2484 SDNodeIterator(SDNode *N, unsigned Op) : Node(N), Operand(Op) {}
2486 bool operator==(const SDNodeIterator& x) const {
2487 return Operand == x.Operand;
2489 bool operator!=(const SDNodeIterator& x) const { return !operator==(x); }
2491 const SDNodeIterator &operator=(const SDNodeIterator &I) {
2492 assert(I.Node == Node && "Cannot assign iterators to two different nodes!");
2493 Operand = I.Operand;
2497 pointer operator*() const {
2498 return Node->getOperand(Operand).getNode();
2500 pointer operator->() const { return operator*(); }
2502 SDNodeIterator& operator++() { // Preincrement
2506 SDNodeIterator operator++(int) { // Postincrement
2507 SDNodeIterator tmp = *this; ++*this; return tmp;
2509 size_t operator-(SDNodeIterator Other) const {
2510 assert(Node == Other.Node &&
2511 "Cannot compare iterators of two different nodes!");
2512 return Operand - Other.Operand;
2515 static SDNodeIterator begin(SDNode *N) { return SDNodeIterator(N, 0); }
2516 static SDNodeIterator end (SDNode *N) {
2517 return SDNodeIterator(N, N->getNumOperands());
2520 unsigned getOperand() const { return Operand; }
2521 const SDNode *getNode() const { return Node; }
2524 template <> struct GraphTraits<SDNode*> {
2525 typedef SDNode NodeType;
2526 typedef SDNodeIterator ChildIteratorType;
2527 static inline NodeType *getEntryNode(SDNode *N) { return N; }
2528 static inline ChildIteratorType child_begin(NodeType *N) {
2529 return SDNodeIterator::begin(N);
2531 static inline ChildIteratorType child_end(NodeType *N) {
2532 return SDNodeIterator::end(N);
2536 /// LargestSDNode - The largest SDNode class.
2538 typedef LoadSDNode LargestSDNode;
2540 /// MostAlignedSDNode - The SDNode class with the greatest alignment
2543 typedef GlobalAddressSDNode MostAlignedSDNode;
2546 /// isNormalLoad - Returns true if the specified node is a non-extending
2547 /// and unindexed load.
2548 inline bool isNormalLoad(const SDNode *N) {
2549 const LoadSDNode *Ld = dyn_cast<LoadSDNode>(N);
2550 return Ld && Ld->getExtensionType() == ISD::NON_EXTLOAD &&
2551 Ld->getAddressingMode() == ISD::UNINDEXED;
2554 /// isNON_EXTLoad - Returns true if the specified node is a non-extending
2556 inline bool isNON_EXTLoad(const SDNode *N) {
2557 return isa<LoadSDNode>(N) &&
2558 cast<LoadSDNode>(N)->getExtensionType() == ISD::NON_EXTLOAD;
2561 /// isEXTLoad - Returns true if the specified node is a EXTLOAD.
2563 inline bool isEXTLoad(const SDNode *N) {
2564 return isa<LoadSDNode>(N) &&
2565 cast<LoadSDNode>(N)->getExtensionType() == ISD::EXTLOAD;
2568 /// isSEXTLoad - Returns true if the specified node is a SEXTLOAD.
2570 inline bool isSEXTLoad(const SDNode *N) {
2571 return isa<LoadSDNode>(N) &&
2572 cast<LoadSDNode>(N)->getExtensionType() == ISD::SEXTLOAD;
2575 /// isZEXTLoad - Returns true if the specified node is a ZEXTLOAD.
2577 inline bool isZEXTLoad(const SDNode *N) {
2578 return isa<LoadSDNode>(N) &&
2579 cast<LoadSDNode>(N)->getExtensionType() == ISD::ZEXTLOAD;
2582 /// isUNINDEXEDLoad - Returns true if the specified node is an unindexed load.
2584 inline bool isUNINDEXEDLoad(const SDNode *N) {
2585 return isa<LoadSDNode>(N) &&
2586 cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
2589 /// isNormalStore - Returns true if the specified node is a non-truncating
2590 /// and unindexed store.
2591 inline bool isNormalStore(const SDNode *N) {
2592 const StoreSDNode *St = dyn_cast<StoreSDNode>(N);
2593 return St && !St->isTruncatingStore() &&
2594 St->getAddressingMode() == ISD::UNINDEXED;
2597 /// isNON_TRUNCStore - Returns true if the specified node is a non-truncating
2599 inline bool isNON_TRUNCStore(const SDNode *N) {
2600 return isa<StoreSDNode>(N) && !cast<StoreSDNode>(N)->isTruncatingStore();
2603 /// isTRUNCStore - Returns true if the specified node is a truncating
2605 inline bool isTRUNCStore(const SDNode *N) {
2606 return isa<StoreSDNode>(N) && cast<StoreSDNode>(N)->isTruncatingStore();
2609 /// isUNINDEXEDStore - Returns true if the specified node is an
2610 /// unindexed store.
2611 inline bool isUNINDEXEDStore(const SDNode *N) {
2612 return isa<StoreSDNode>(N) &&
2613 cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
2618 } // end llvm namespace