SelectionDAGNodes.h revision 99a6cb92d173c142073416c81efe6d3daeb80b49
1//===-- llvm/CodeGen/SelectionDAGNodes.h - SelectionDAG Nodes ---*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file declares 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. 14// 15// Clients should include the SelectionDAG.h file instead of this file directly. 16// 17//===----------------------------------------------------------------------===// 18 19#ifndef LLVM_CODEGEN_SELECTIONDAGNODES_H 20#define LLVM_CODEGEN_SELECTIONDAGNODES_H 21 22#include "llvm/Value.h" 23#include "llvm/ADT/FoldingSet.h" 24#include "llvm/ADT/GraphTraits.h" 25#include "llvm/ADT/iterator.h" 26#include "llvm/ADT/APFloat.h" 27#include "llvm/ADT/APInt.h" 28#include "llvm/ADT/ilist_node.h" 29#include "llvm/ADT/STLExtras.h" 30#include "llvm/CodeGen/ValueTypes.h" 31#include "llvm/CodeGen/MachineMemOperand.h" 32#include "llvm/Support/Allocator.h" 33#include "llvm/Support/RecyclingAllocator.h" 34#include "llvm/Support/DataTypes.h" 35#include <cassert> 36 37namespace llvm { 38 39class SelectionDAG; 40class GlobalValue; 41class MachineBasicBlock; 42class MachineConstantPoolValue; 43class SDNode; 44class CompileUnitDesc; 45template <typename T> struct DenseMapInfo; 46template <typename T> struct simplify_type; 47template <typename T> class ilist_traits; 48 49/// SDVTList - This represents a list of ValueType's that has been intern'd by 50/// a SelectionDAG. Instances of this simple value class are returned by 51/// SelectionDAG::getVTList(...). 52/// 53struct SDVTList { 54 const MVT *VTs; 55 unsigned short NumVTs; 56}; 57 58/// ISD namespace - This namespace contains an enum which represents all of the 59/// SelectionDAG node types and value types. 60/// 61namespace ISD { 62 63 //===--------------------------------------------------------------------===// 64 /// ISD::NodeType enum - This enum defines all of the operators valid in a 65 /// SelectionDAG. 66 /// 67 enum NodeType { 68 // DELETED_NODE - This is an illegal flag value that is used to catch 69 // errors. This opcode is not a legal opcode for any node. 70 DELETED_NODE, 71 72 // EntryToken - This is the marker used to indicate the start of the region. 73 EntryToken, 74 75 // Token factor - This node takes multiple tokens as input and produces a 76 // single token result. This is used to represent the fact that the operand 77 // operators are independent of each other. 78 TokenFactor, 79 80 // AssertSext, AssertZext - These nodes record if a register contains a 81 // value that has already been zero or sign extended from a narrower type. 82 // These nodes take two operands. The first is the node that has already 83 // been extended, and the second is a value type node indicating the width 84 // of the extension 85 AssertSext, AssertZext, 86 87 // Various leaf nodes. 88 BasicBlock, VALUETYPE, ARG_FLAGS, CONDCODE, Register, 89 Constant, ConstantFP, 90 GlobalAddress, GlobalTLSAddress, FrameIndex, 91 JumpTable, ConstantPool, ExternalSymbol, 92 93 // The address of the GOT 94 GLOBAL_OFFSET_TABLE, 95 96 // FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and 97 // llvm.returnaddress on the DAG. These nodes take one operand, the index 98 // of the frame or return address to return. An index of zero corresponds 99 // to the current function's frame or return address, an index of one to the 100 // parent's frame or return address, and so on. 101 FRAMEADDR, RETURNADDR, 102 103 // FRAME_TO_ARGS_OFFSET - This node represents offset from frame pointer to 104 // first (possible) on-stack argument. This is needed for correct stack 105 // adjustment during unwind. 106 FRAME_TO_ARGS_OFFSET, 107 108 // RESULT, OUTCHAIN = EXCEPTIONADDR(INCHAIN) - This node represents the 109 // address of the exception block on entry to an landing pad block. 110 EXCEPTIONADDR, 111 112 // RESULT, OUTCHAIN = EHSELECTION(INCHAIN, EXCEPTION) - This node represents 113 // the selection index of the exception thrown. 114 EHSELECTION, 115 116 // OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents 117 // 'eh_return' gcc dwarf builtin, which is used to return from 118 // exception. The general meaning is: adjust stack by OFFSET and pass 119 // execution to HANDLER. Many platform-related details also :) 120 EH_RETURN, 121 122 // TargetConstant* - Like Constant*, but the DAG does not do any folding or 123 // simplification of the constant. 124 TargetConstant, 125 TargetConstantFP, 126 127 // TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or 128 // anything else with this node, and this is valid in the target-specific 129 // dag, turning into a GlobalAddress operand. 130 TargetGlobalAddress, 131 TargetGlobalTLSAddress, 132 TargetFrameIndex, 133 TargetJumpTable, 134 TargetConstantPool, 135 TargetExternalSymbol, 136 137 /// RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) 138 /// This node represents a target intrinsic function with no side effects. 139 /// The first operand is the ID number of the intrinsic from the 140 /// llvm::Intrinsic namespace. The operands to the intrinsic follow. The 141 /// node has returns the result of the intrinsic. 142 INTRINSIC_WO_CHAIN, 143 144 /// RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) 145 /// This node represents a target intrinsic function with side effects that 146 /// returns a result. The first operand is a chain pointer. The second is 147 /// the ID number of the intrinsic from the llvm::Intrinsic namespace. The 148 /// operands to the intrinsic follow. The node has two results, the result 149 /// of the intrinsic and an output chain. 150 INTRINSIC_W_CHAIN, 151 152 /// OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) 153 /// This node represents a target intrinsic function with side effects that 154 /// does not return a result. The first operand is a chain pointer. The 155 /// second is the ID number of the intrinsic from the llvm::Intrinsic 156 /// namespace. The operands to the intrinsic follow. 157 INTRINSIC_VOID, 158 159 // CopyToReg - This node has three operands: a chain, a register number to 160 // set to this value, and a value. 161 CopyToReg, 162 163 // CopyFromReg - This node indicates that the input value is a virtual or 164 // physical register that is defined outside of the scope of this 165 // SelectionDAG. The register is available from the RegisterSDNode object. 166 CopyFromReg, 167 168 // UNDEF - An undefined node 169 UNDEF, 170 171 /// FORMAL_ARGUMENTS(CHAIN, CC#, ISVARARG, FLAG0, ..., FLAGn) - This node 172 /// represents the formal arguments for a function. CC# is a Constant value 173 /// indicating the calling convention of the function, and ISVARARG is a 174 /// flag that indicates whether the function is varargs or not. This node 175 /// has one result value for each incoming argument, plus one for the output 176 /// chain. It must be custom legalized. See description of CALL node for 177 /// FLAG argument contents explanation. 178 /// 179 FORMAL_ARGUMENTS, 180 181 /// RV1, RV2...RVn, CHAIN = CALL(CHAIN, CC#, ISVARARG, ISTAILCALL, CALLEE, 182 /// ARG0, FLAG0, ARG1, FLAG1, ... ARGn, FLAGn) 183 /// This node represents a fully general function call, before the legalizer 184 /// runs. This has one result value for each argument / flag pair, plus 185 /// a chain result. It must be custom legalized. Flag argument indicates 186 /// misc. argument attributes. Currently: 187 /// Bit 0 - signness 188 /// Bit 1 - 'inreg' attribute 189 /// Bit 2 - 'sret' attribute 190 /// Bit 4 - 'byval' attribute 191 /// Bit 5 - 'nest' attribute 192 /// Bit 6-9 - alignment of byval structures 193 /// Bit 10-26 - size of byval structures 194 /// Bits 31:27 - argument ABI alignment in the first argument piece and 195 /// alignment '1' in other argument pieces. 196 CALL, 197 198 // EXTRACT_ELEMENT - This is used to get the lower or upper (determined by 199 // a Constant, which is required to be operand #1) half of the integer or 200 // float value specified as operand #0. This is only for use before 201 // legalization, for values that will be broken into multiple registers. 202 EXTRACT_ELEMENT, 203 204 // BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways. Given 205 // two values of the same integer value type, this produces a value twice as 206 // big. Like EXTRACT_ELEMENT, this can only be used before legalization. 207 BUILD_PAIR, 208 209 // MERGE_VALUES - This node takes multiple discrete operands and returns 210 // them all as its individual results. This nodes has exactly the same 211 // number of inputs and outputs, and is only valid before legalization. 212 // This node is useful for some pieces of the code generator that want to 213 // think about a single node with multiple results, not multiple nodes. 214 MERGE_VALUES, 215 216 // Simple integer binary arithmetic operators. 217 ADD, SUB, MUL, SDIV, UDIV, SREM, UREM, 218 219 // SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing 220 // a signed/unsigned value of type i[2*N], and return the full value as 221 // two results, each of type iN. 222 SMUL_LOHI, UMUL_LOHI, 223 224 // SDIVREM/UDIVREM - Divide two integers and produce both a quotient and 225 // remainder result. 226 SDIVREM, UDIVREM, 227 228 // CARRY_FALSE - This node is used when folding other nodes, 229 // like ADDC/SUBC, which indicate the carry result is always false. 230 CARRY_FALSE, 231 232 // Carry-setting nodes for multiple precision addition and subtraction. 233 // These nodes take two operands of the same value type, and produce two 234 // results. The first result is the normal add or sub result, the second 235 // result is the carry flag result. 236 ADDC, SUBC, 237 238 // Carry-using nodes for multiple precision addition and subtraction. These 239 // nodes take three operands: The first two are the normal lhs and rhs to 240 // the add or sub, and the third is the input carry flag. These nodes 241 // produce two results; the normal result of the add or sub, and the output 242 // carry flag. These nodes both read and write a carry flag to allow them 243 // to them to be chained together for add and sub of arbitrarily large 244 // values. 245 ADDE, SUBE, 246 247 // Simple binary floating point operators. 248 FADD, FSUB, FMUL, FDIV, FREM, 249 250 // FCOPYSIGN(X, Y) - Return the value of X with the sign of Y. NOTE: This 251 // DAG node does not require that X and Y have the same type, just that they 252 // are both floating point. X and the result must have the same type. 253 // FCOPYSIGN(f32, f64) is allowed. 254 FCOPYSIGN, 255 256 // INT = FGETSIGN(FP) - Return the sign bit of the specified floating point 257 // value as an integer 0/1 value. 258 FGETSIGN, 259 260 /// BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector 261 /// with the specified, possibly variable, elements. The number of elements 262 /// is required to be a power of two. 263 BUILD_VECTOR, 264 265 /// INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element 266 /// at IDX replaced with VAL. If the type of VAL is larger than the vector 267 /// element type then VAL is truncated before replacement. 268 INSERT_VECTOR_ELT, 269 270 /// EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR 271 /// identified by the (potentially variable) element number IDX. 272 EXTRACT_VECTOR_ELT, 273 274 /// CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of 275 /// vector type with the same length and element type, this produces a 276 /// concatenated vector result value, with length equal to the sum of the 277 /// lengths of the input vectors. 278 CONCAT_VECTORS, 279 280 /// EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an 281 /// vector value) starting with the (potentially variable) element number 282 /// IDX, which must be a multiple of the result vector length. 283 EXTRACT_SUBVECTOR, 284 285 /// VECTOR_SHUFFLE(VEC1, VEC2, SHUFFLEVEC) - Returns a vector, of the same 286 /// type as VEC1/VEC2. SHUFFLEVEC is a BUILD_VECTOR of constant int values 287 /// (maybe of an illegal datatype) or undef that indicate which value each 288 /// result element will get. The elements of VEC1/VEC2 are enumerated in 289 /// order. This is quite similar to the Altivec 'vperm' instruction, except 290 /// that the indices must be constants and are in terms of the element size 291 /// of VEC1/VEC2, not in terms of bytes. 292 VECTOR_SHUFFLE, 293 294 /// SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a 295 /// scalar value into element 0 of the resultant vector type. The top 296 /// elements 1 to N-1 of the N-element vector are undefined. 297 SCALAR_TO_VECTOR, 298 299 // EXTRACT_SUBREG - This node is used to extract a sub-register value. 300 // This node takes a superreg and a constant sub-register index as operands. 301 // Note sub-register indices must be increasing. That is, if the 302 // sub-register index of a 8-bit sub-register is N, then the index for a 303 // 16-bit sub-register must be at least N+1. 304 EXTRACT_SUBREG, 305 306 // INSERT_SUBREG - This node is used to insert a sub-register value. 307 // This node takes a superreg, a subreg value, and a constant sub-register 308 // index as operands. 309 INSERT_SUBREG, 310 311 // MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing 312 // an unsigned/signed value of type i[2*N], then return the top part. 313 MULHU, MULHS, 314 315 // Bitwise operators - logical and, logical or, logical xor, shift left, 316 // shift right algebraic (shift in sign bits), shift right logical (shift in 317 // zeroes), rotate left, rotate right, and byteswap. 318 AND, OR, XOR, SHL, SRA, SRL, ROTL, ROTR, BSWAP, 319 320 // Counting operators 321 CTTZ, CTLZ, CTPOP, 322 323 // Select(COND, TRUEVAL, FALSEVAL) 324 SELECT, 325 326 // Select with condition operator - This selects between a true value and 327 // a false value (ops #2 and #3) based on the boolean result of comparing 328 // the lhs and rhs (ops #0 and #1) of a conditional expression with the 329 // condition code in op #4, a CondCodeSDNode. 330 SELECT_CC, 331 332 // SetCC operator - This evaluates to a boolean (i1) true value if the 333 // condition is true. The operands to this are the left and right operands 334 // to compare (ops #0, and #1) and the condition code to compare them with 335 // (op #2) as a CondCodeSDNode. 336 SETCC, 337 338 // Vector SetCC operator - This evaluates to a vector of integer elements 339 // with the high bit in each element set to true if the comparison is true 340 // and false if the comparison is false. All other bits in each element 341 // are undefined. The operands to this are the left and right operands 342 // to compare (ops #0, and #1) and the condition code to compare them with 343 // (op #2) as a CondCodeSDNode. 344 VSETCC, 345 346 // SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded 347 // integer shift operations, just like ADD/SUB_PARTS. The operation 348 // ordering is: 349 // [Lo,Hi] = op [LoLHS,HiLHS], Amt 350 SHL_PARTS, SRA_PARTS, SRL_PARTS, 351 352 // Conversion operators. These are all single input single output 353 // operations. For all of these, the result type must be strictly 354 // wider or narrower (depending on the operation) than the source 355 // type. 356 357 // SIGN_EXTEND - Used for integer types, replicating the sign bit 358 // into new bits. 359 SIGN_EXTEND, 360 361 // ZERO_EXTEND - Used for integer types, zeroing the new bits. 362 ZERO_EXTEND, 363 364 // ANY_EXTEND - Used for integer types. The high bits are undefined. 365 ANY_EXTEND, 366 367 // TRUNCATE - Completely drop the high bits. 368 TRUNCATE, 369 370 // [SU]INT_TO_FP - These operators convert integers (whose interpreted sign 371 // depends on the first letter) to floating point. 372 SINT_TO_FP, 373 UINT_TO_FP, 374 375 // SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to 376 // sign extend a small value in a large integer register (e.g. sign 377 // extending the low 8 bits of a 32-bit register to fill the top 24 bits 378 // with the 7th bit). The size of the smaller type is indicated by the 1th 379 // operand, a ValueType node. 380 SIGN_EXTEND_INREG, 381 382 /// FP_TO_[US]INT - Convert a floating point value to a signed or unsigned 383 /// integer. 384 FP_TO_SINT, 385 FP_TO_UINT, 386 387 /// X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type 388 /// down to the precision of the destination VT. TRUNC is a flag, which is 389 /// always an integer that is zero or one. If TRUNC is 0, this is a 390 /// normal rounding, if it is 1, this FP_ROUND is known to not change the 391 /// value of Y. 392 /// 393 /// The TRUNC = 1 case is used in cases where we know that the value will 394 /// not be modified by the node, because Y is not using any of the extra 395 /// precision of source type. This allows certain transformations like 396 /// FP_EXTEND(FP_ROUND(X,1)) -> X which are not safe for 397 /// FP_EXTEND(FP_ROUND(X,0)) because the extra bits aren't removed. 398 FP_ROUND, 399 400 // FLT_ROUNDS_ - Returns current rounding mode: 401 // -1 Undefined 402 // 0 Round to 0 403 // 1 Round to nearest 404 // 2 Round to +inf 405 // 3 Round to -inf 406 FLT_ROUNDS_, 407 408 /// X = FP_ROUND_INREG(Y, VT) - This operator takes an FP register, and 409 /// rounds it to a floating point value. It then promotes it and returns it 410 /// in a register of the same size. This operation effectively just 411 /// discards excess precision. The type to round down to is specified by 412 /// the VT operand, a VTSDNode. 413 FP_ROUND_INREG, 414 415 /// X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type. 416 FP_EXTEND, 417 418 // BIT_CONVERT - Theis operator converts between integer and FP values, as 419 // if one was stored to memory as integer and the other was loaded from the 420 // same address (or equivalently for vector format conversions, etc). The 421 // source and result are required to have the same bit size (e.g. 422 // f32 <-> i32). This can also be used for int-to-int or fp-to-fp 423 // conversions, but that is a noop, deleted by getNode(). 424 BIT_CONVERT, 425 426 // FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, 427 // FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR - Perform various unary floating 428 // point operations. These are inspired by libm. 429 FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, 430 FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR, 431 432 // LOAD and STORE have token chains as their first operand, then the same 433 // operands as an LLVM load/store instruction, then an offset node that 434 // is added / subtracted from the base pointer to form the address (for 435 // indexed memory ops). 436 LOAD, STORE, 437 438 // DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned 439 // to a specified boundary. This node always has two return values: a new 440 // stack pointer value and a chain. The first operand is the token chain, 441 // the second is the number of bytes to allocate, and the third is the 442 // alignment boundary. The size is guaranteed to be a multiple of the stack 443 // alignment, and the alignment is guaranteed to be bigger than the stack 444 // alignment (if required) or 0 to get standard stack alignment. 445 DYNAMIC_STACKALLOC, 446 447 // Control flow instructions. These all have token chains. 448 449 // BR - Unconditional branch. The first operand is the chain 450 // operand, the second is the MBB to branch to. 451 BR, 452 453 // BRIND - Indirect branch. The first operand is the chain, the second 454 // is the value to branch to, which must be of the same type as the target's 455 // pointer type. 456 BRIND, 457 458 // BR_JT - Jumptable branch. The first operand is the chain, the second 459 // is the jumptable index, the last one is the jumptable entry index. 460 BR_JT, 461 462 // BRCOND - Conditional branch. The first operand is the chain, 463 // the second is the condition, the third is the block to branch 464 // to if the condition is true. 465 BRCOND, 466 467 // BR_CC - Conditional branch. The behavior is like that of SELECT_CC, in 468 // that the condition is represented as condition code, and two nodes to 469 // compare, rather than as a combined SetCC node. The operands in order are 470 // chain, cc, lhs, rhs, block to branch to if condition is true. 471 BR_CC, 472 473 // RET - Return from function. The first operand is the chain, 474 // and any subsequent operands are pairs of return value and return value 475 // signness for the function. This operation can have variable number of 476 // operands. 477 RET, 478 479 // INLINEASM - Represents an inline asm block. This node always has two 480 // return values: a chain and a flag result. The inputs are as follows: 481 // Operand #0 : Input chain. 482 // Operand #1 : a ExternalSymbolSDNode with a pointer to the asm string. 483 // Operand #2n+2: A RegisterNode. 484 // Operand #2n+3: A TargetConstant, indicating if the reg is a use/def 485 // Operand #last: Optional, an incoming flag. 486 INLINEASM, 487 488 // DBG_LABEL, EH_LABEL - Represents a label in mid basic block used to track 489 // locations needed for debug and exception handling tables. These nodes 490 // take a chain as input and return a chain. 491 DBG_LABEL, 492 EH_LABEL, 493 494 // DECLARE - Represents a llvm.dbg.declare intrinsic. It's used to track 495 // local variable declarations for debugging information. First operand is 496 // a chain, while the next two operands are first two arguments (address 497 // and variable) of a llvm.dbg.declare instruction. 498 DECLARE, 499 500 // STACKSAVE - STACKSAVE has one operand, an input chain. It produces a 501 // value, the same type as the pointer type for the system, and an output 502 // chain. 503 STACKSAVE, 504 505 // STACKRESTORE has two operands, an input chain and a pointer to restore to 506 // it returns an output chain. 507 STACKRESTORE, 508 509 // CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end of 510 // a call sequence, and carry arbitrary information that target might want 511 // to know. The first operand is a chain, the rest are specified by the 512 // target and not touched by the DAG optimizers. 513 // CALLSEQ_START..CALLSEQ_END pairs may not be nested. 514 CALLSEQ_START, // Beginning of a call sequence 515 CALLSEQ_END, // End of a call sequence 516 517 // VAARG - VAARG has three operands: an input chain, a pointer, and a 518 // SRCVALUE. It returns a pair of values: the vaarg value and a new chain. 519 VAARG, 520 521 // VACOPY - VACOPY has five operands: an input chain, a destination pointer, 522 // a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the 523 // source. 524 VACOPY, 525 526 // VAEND, VASTART - VAEND and VASTART have three operands: an input chain, a 527 // pointer, and a SRCVALUE. 528 VAEND, VASTART, 529 530 // SRCVALUE - This is a node type that holds a Value* that is used to 531 // make reference to a value in the LLVM IR. 532 SRCVALUE, 533 534 // MEMOPERAND - This is a node that contains a MachineMemOperand which 535 // records information about a memory reference. This is used to make 536 // AliasAnalysis queries from the backend. 537 MEMOPERAND, 538 539 // PCMARKER - This corresponds to the pcmarker intrinsic. 540 PCMARKER, 541 542 // READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic. 543 // The only operand is a chain and a value and a chain are produced. The 544 // value is the contents of the architecture specific cycle counter like 545 // register (or other high accuracy low latency clock source) 546 READCYCLECOUNTER, 547 548 // HANDLENODE node - Used as a handle for various purposes. 549 HANDLENODE, 550 551 // DBG_STOPPOINT - This node is used to represent a source location for 552 // debug info. It takes token chain as input, and carries a line number, 553 // column number, and a pointer to a CompileUnitDesc object identifying 554 // the containing compilation unit. It produces a token chain as output. 555 DBG_STOPPOINT, 556 557 // DEBUG_LOC - This node is used to represent source line information 558 // embedded in the code. It takes a token chain as input, then a line 559 // number, then a column then a file id (provided by MachineModuleInfo.) It 560 // produces a token chain as output. 561 DEBUG_LOC, 562 563 // TRAMPOLINE - This corresponds to the init_trampoline intrinsic. 564 // It takes as input a token chain, the pointer to the trampoline, 565 // the pointer to the nested function, the pointer to pass for the 566 // 'nest' parameter, a SRCVALUE for the trampoline and another for 567 // the nested function (allowing targets to access the original 568 // Function*). It produces the result of the intrinsic and a token 569 // chain as output. 570 TRAMPOLINE, 571 572 // TRAP - Trapping instruction 573 TRAP, 574 575 // PREFETCH - This corresponds to a prefetch intrinsic. It takes chains are 576 // their first operand. The other operands are the address to prefetch, 577 // read / write specifier, and locality specifier. 578 PREFETCH, 579 580 // OUTCHAIN = MEMBARRIER(INCHAIN, load-load, load-store, store-load, 581 // store-store, device) 582 // This corresponds to the memory.barrier intrinsic. 583 // it takes an input chain, 4 operands to specify the type of barrier, an 584 // operand specifying if the barrier applies to device and uncached memory 585 // and produces an output chain. 586 MEMBARRIER, 587 588 // Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) 589 // this corresponds to the atomic.lcs intrinsic. 590 // cmp is compared to *ptr, and if equal, swap is stored in *ptr. 591 // the return is always the original value in *ptr 592 ATOMIC_CMP_SWAP, 593 594 // Val, OUTCHAIN = ATOMIC_LOAD_ADD(INCHAIN, ptr, amt) 595 // this corresponds to the atomic.las intrinsic. 596 // *ptr + amt is stored to *ptr atomically. 597 // the return is always the original value in *ptr 598 ATOMIC_LOAD_ADD, 599 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 604 ATOMIC_SWAP, 605 606 // Val, OUTCHAIN = ATOMIC_LOAD_SUB(INCHAIN, ptr, amt) 607 // this corresponds to the atomic.lss intrinsic. 608 // *ptr - amt is stored to *ptr atomically. 609 // the return is always the original value in *ptr 610 ATOMIC_LOAD_SUB, 611 612 // Val, OUTCHAIN = ATOMIC_L[OpName]S(INCHAIN, ptr, amt) 613 // this corresponds to the atomic.[OpName] intrinsic. 614 // op(*ptr, amt) is stored to *ptr atomically. 615 // the return is always the original value in *ptr 616 ATOMIC_LOAD_AND, 617 ATOMIC_LOAD_OR, 618 ATOMIC_LOAD_XOR, 619 ATOMIC_LOAD_NAND, 620 ATOMIC_LOAD_MIN, 621 ATOMIC_LOAD_MAX, 622 ATOMIC_LOAD_UMIN, 623 ATOMIC_LOAD_UMAX, 624 625 // BUILTIN_OP_END - This must be the last enum value in this list. 626 BUILTIN_OP_END 627 }; 628 629 /// Node predicates 630 631 /// isBuildVectorAllOnes - Return true if the specified node is a 632 /// BUILD_VECTOR where all of the elements are ~0 or undef. 633 bool isBuildVectorAllOnes(const SDNode *N); 634 635 /// isBuildVectorAllZeros - Return true if the specified node is a 636 /// BUILD_VECTOR where all of the elements are 0 or undef. 637 bool isBuildVectorAllZeros(const SDNode *N); 638 639 /// isScalarToVector - Return true if the specified node is a 640 /// ISD::SCALAR_TO_VECTOR node or a BUILD_VECTOR node where only the low 641 /// element is not an undef. 642 bool isScalarToVector(const SDNode *N); 643 644 /// isDebugLabel - Return true if the specified node represents a debug 645 /// label (i.e. ISD::DBG_LABEL or TargetInstrInfo::DBG_LABEL node). 646 bool isDebugLabel(const SDNode *N); 647 648 //===--------------------------------------------------------------------===// 649 /// MemIndexedMode enum - This enum defines the load / store indexed 650 /// addressing modes. 651 /// 652 /// UNINDEXED "Normal" load / store. The effective address is already 653 /// computed and is available in the base pointer. The offset 654 /// operand is always undefined. In addition to producing a 655 /// chain, an unindexed load produces one value (result of the 656 /// load); an unindexed store does not produce a value. 657 /// 658 /// PRE_INC Similar to the unindexed mode where the effective address is 659 /// PRE_DEC the value of the base pointer add / subtract the offset. 660 /// It considers the computation as being folded into the load / 661 /// store operation (i.e. the load / store does the address 662 /// computation as well as performing the memory transaction). 663 /// The base operand is always undefined. In addition to 664 /// producing a chain, pre-indexed load produces two values 665 /// (result of the load and the result of the address 666 /// computation); a pre-indexed store produces one value (result 667 /// of the address computation). 668 /// 669 /// POST_INC The effective address is the value of the base pointer. The 670 /// POST_DEC value of the offset operand is then added to / subtracted 671 /// from the base after memory transaction. In addition to 672 /// producing a chain, post-indexed load produces two values 673 /// (the result of the load and the result of the base +/- offset 674 /// computation); a post-indexed store produces one value (the 675 /// the result of the base +/- offset computation). 676 /// 677 enum MemIndexedMode { 678 UNINDEXED = 0, 679 PRE_INC, 680 PRE_DEC, 681 POST_INC, 682 POST_DEC, 683 LAST_INDEXED_MODE 684 }; 685 686 //===--------------------------------------------------------------------===// 687 /// LoadExtType enum - This enum defines the three variants of LOADEXT 688 /// (load with extension). 689 /// 690 /// SEXTLOAD loads the integer operand and sign extends it to a larger 691 /// integer result type. 692 /// ZEXTLOAD loads the integer operand and zero extends it to a larger 693 /// integer result type. 694 /// EXTLOAD is used for three things: floating point extending loads, 695 /// integer extending loads [the top bits are undefined], and vector 696 /// extending loads [load into low elt]. 697 /// 698 enum LoadExtType { 699 NON_EXTLOAD = 0, 700 EXTLOAD, 701 SEXTLOAD, 702 ZEXTLOAD, 703 LAST_LOADX_TYPE 704 }; 705 706 //===--------------------------------------------------------------------===// 707 /// ISD::CondCode enum - These are ordered carefully to make the bitfields 708 /// below work out, when considering SETFALSE (something that never exists 709 /// dynamically) as 0. "U" -> Unsigned (for integer operands) or Unordered 710 /// (for floating point), "L" -> Less than, "G" -> Greater than, "E" -> Equal 711 /// to. If the "N" column is 1, the result of the comparison is undefined if 712 /// the input is a NAN. 713 /// 714 /// All of these (except for the 'always folded ops') should be handled for 715 /// floating point. For integer, only the SETEQ,SETNE,SETLT,SETLE,SETGT, 716 /// SETGE,SETULT,SETULE,SETUGT, and SETUGE opcodes are used. 717 /// 718 /// Note that these are laid out in a specific order to allow bit-twiddling 719 /// to transform conditions. 720 enum CondCode { 721 // Opcode N U L G E Intuitive operation 722 SETFALSE, // 0 0 0 0 Always false (always folded) 723 SETOEQ, // 0 0 0 1 True if ordered and equal 724 SETOGT, // 0 0 1 0 True if ordered and greater than 725 SETOGE, // 0 0 1 1 True if ordered and greater than or equal 726 SETOLT, // 0 1 0 0 True if ordered and less than 727 SETOLE, // 0 1 0 1 True if ordered and less than or equal 728 SETONE, // 0 1 1 0 True if ordered and operands are unequal 729 SETO, // 0 1 1 1 True if ordered (no nans) 730 SETUO, // 1 0 0 0 True if unordered: isnan(X) | isnan(Y) 731 SETUEQ, // 1 0 0 1 True if unordered or equal 732 SETUGT, // 1 0 1 0 True if unordered or greater than 733 SETUGE, // 1 0 1 1 True if unordered, greater than, or equal 734 SETULT, // 1 1 0 0 True if unordered or less than 735 SETULE, // 1 1 0 1 True if unordered, less than, or equal 736 SETUNE, // 1 1 1 0 True if unordered or not equal 737 SETTRUE, // 1 1 1 1 Always true (always folded) 738 // Don't care operations: undefined if the input is a nan. 739 SETFALSE2, // 1 X 0 0 0 Always false (always folded) 740 SETEQ, // 1 X 0 0 1 True if equal 741 SETGT, // 1 X 0 1 0 True if greater than 742 SETGE, // 1 X 0 1 1 True if greater than or equal 743 SETLT, // 1 X 1 0 0 True if less than 744 SETLE, // 1 X 1 0 1 True if less than or equal 745 SETNE, // 1 X 1 1 0 True if not equal 746 SETTRUE2, // 1 X 1 1 1 Always true (always folded) 747 748 SETCC_INVALID // Marker value. 749 }; 750 751 /// isSignedIntSetCC - Return true if this is a setcc instruction that 752 /// performs a signed comparison when used with integer operands. 753 inline bool isSignedIntSetCC(CondCode Code) { 754 return Code == SETGT || Code == SETGE || Code == SETLT || Code == SETLE; 755 } 756 757 /// isUnsignedIntSetCC - Return true if this is a setcc instruction that 758 /// performs an unsigned comparison when used with integer operands. 759 inline bool isUnsignedIntSetCC(CondCode Code) { 760 return Code == SETUGT || Code == SETUGE || Code == SETULT || Code == SETULE; 761 } 762 763 /// isTrueWhenEqual - Return true if the specified condition returns true if 764 /// the two operands to the condition are equal. Note that if one of the two 765 /// operands is a NaN, this value is meaningless. 766 inline bool isTrueWhenEqual(CondCode Cond) { 767 return ((int)Cond & 1) != 0; 768 } 769 770 /// getUnorderedFlavor - This function returns 0 if the condition is always 771 /// false if an operand is a NaN, 1 if the condition is always true if the 772 /// operand is a NaN, and 2 if the condition is undefined if the operand is a 773 /// NaN. 774 inline unsigned getUnorderedFlavor(CondCode Cond) { 775 return ((int)Cond >> 3) & 3; 776 } 777 778 /// getSetCCInverse - Return the operation corresponding to !(X op Y), where 779 /// 'op' is a valid SetCC operation. 780 CondCode getSetCCInverse(CondCode Operation, bool isInteger); 781 782 /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X) 783 /// when given the operation for (X op Y). 784 CondCode getSetCCSwappedOperands(CondCode Operation); 785 786 /// getSetCCOrOperation - Return the result of a logical OR between different 787 /// comparisons of identical values: ((X op1 Y) | (X op2 Y)). This 788 /// function returns SETCC_INVALID if it is not possible to represent the 789 /// resultant comparison. 790 CondCode getSetCCOrOperation(CondCode Op1, CondCode Op2, bool isInteger); 791 792 /// getSetCCAndOperation - Return the result of a logical AND between 793 /// different comparisons of identical values: ((X op1 Y) & (X op2 Y)). This 794 /// function returns SETCC_INVALID if it is not possible to represent the 795 /// resultant comparison. 796 CondCode getSetCCAndOperation(CondCode Op1, CondCode Op2, bool isInteger); 797} // end llvm::ISD namespace 798 799 800//===----------------------------------------------------------------------===// 801/// SDValue - Unlike LLVM values, Selection DAG nodes may return multiple 802/// values as the result of a computation. Many nodes return multiple values, 803/// from loads (which define a token and a return value) to ADDC (which returns 804/// a result and a carry value), to calls (which may return an arbitrary number 805/// of values). 806/// 807/// As such, each use of a SelectionDAG computation must indicate the node that 808/// computes it as well as which return value to use from that node. This pair 809/// of information is represented with the SDValue value type. 810/// 811class SDValue { 812public: 813 SDNode *Val; // The node defining the value we are using. 814private: 815 unsigned ResNo; // Which return value of the node we are using. 816public: 817 SDValue() : Val(0), ResNo(0) {} 818 SDValue(SDNode *val, unsigned resno) : Val(val), ResNo(resno) {} 819 820 /// get the index which selects a specific result in the SDNode 821 unsigned getResNo() const { return ResNo; } 822 823 bool operator==(const SDValue &O) const { 824 return Val == O.Val && ResNo == O.ResNo; 825 } 826 bool operator!=(const SDValue &O) const { 827 return !operator==(O); 828 } 829 bool operator<(const SDValue &O) const { 830 return Val < O.Val || (Val == O.Val && ResNo < O.ResNo); 831 } 832 833 SDValue getValue(unsigned R) const { 834 return SDValue(Val, R); 835 } 836 837 // isOperandOf - Return true if this node is an operand of N. 838 bool isOperandOf(SDNode *N) const; 839 840 /// getValueType - Return the ValueType of the referenced return value. 841 /// 842 inline MVT getValueType() const; 843 844 /// getValueSizeInBits - Returns the size of the value in bits. 845 /// 846 unsigned getValueSizeInBits() const { 847 return getValueType().getSizeInBits(); 848 } 849 850 // Forwarding methods - These forward to the corresponding methods in SDNode. 851 inline unsigned getOpcode() const; 852 inline unsigned getNumOperands() const; 853 inline const SDValue &getOperand(unsigned i) const; 854 inline uint64_t getConstantOperandVal(unsigned i) const; 855 inline bool isTargetOpcode() const; 856 inline bool isMachineOpcode() const; 857 inline unsigned getMachineOpcode() const; 858 859 860 /// reachesChainWithoutSideEffects - Return true if this operand (which must 861 /// be a chain) reaches the specified operand without crossing any 862 /// side-effecting instructions. In practice, this looks through token 863 /// factors and non-volatile loads. In order to remain efficient, this only 864 /// looks a couple of nodes in, it does not do an exhaustive search. 865 bool reachesChainWithoutSideEffects(SDValue Dest, 866 unsigned Depth = 2) const; 867 868 /// use_empty - Return true if there are no nodes using value ResNo 869 /// of node Val. 870 /// 871 inline bool use_empty() const; 872 873 /// hasOneUse - Return true if there is exactly one node using value 874 /// ResNo of node Val. 875 /// 876 inline bool hasOneUse() const; 877}; 878 879 880template<> struct DenseMapInfo<SDValue> { 881 static inline SDValue getEmptyKey() { 882 return SDValue((SDNode*)-1, -1U); 883 } 884 static inline SDValue getTombstoneKey() { 885 return SDValue((SDNode*)-1, 0); 886 } 887 static unsigned getHashValue(const SDValue &Val) { 888 return ((unsigned)((uintptr_t)Val.Val >> 4) ^ 889 (unsigned)((uintptr_t)Val.Val >> 9)) + Val.getResNo(); 890 } 891 static bool isEqual(const SDValue &LHS, const SDValue &RHS) { 892 return LHS == RHS; 893 } 894 static bool isPod() { return true; } 895}; 896 897/// simplify_type specializations - Allow casting operators to work directly on 898/// SDValues as if they were SDNode*'s. 899template<> struct simplify_type<SDValue> { 900 typedef SDNode* SimpleType; 901 static SimpleType getSimplifiedValue(const SDValue &Val) { 902 return static_cast<SimpleType>(Val.Val); 903 } 904}; 905template<> struct simplify_type<const SDValue> { 906 typedef SDNode* SimpleType; 907 static SimpleType getSimplifiedValue(const SDValue &Val) { 908 return static_cast<SimpleType>(Val.Val); 909 } 910}; 911 912/// SDUse - Represents a use of the SDNode referred by 913/// the SDValue. 914class SDUse { 915 SDValue Operand; 916 /// User - Parent node of this operand. 917 SDNode *User; 918 /// Prev, next - Pointers to the uses list of the SDNode referred by 919 /// this operand. 920 SDUse **Prev, *Next; 921public: 922 friend class SDNode; 923 SDUse(): Operand(), User(NULL), Prev(NULL), Next(NULL) {} 924 925 SDUse(SDNode *val, unsigned resno) : 926 Operand(val,resno), User(NULL), Prev(NULL), Next(NULL) {} 927 928 SDUse& operator= (const SDValue& Op) { 929 Operand = Op; 930 Next = NULL; 931 Prev = NULL; 932 return *this; 933 } 934 935 SDUse& operator= (const SDUse& Op) { 936 Operand = Op; 937 Next = NULL; 938 Prev = NULL; 939 return *this; 940 } 941 942 SDUse *getNext() { return Next; } 943 944 SDNode *getUser() { return User; } 945 946 void setUser(SDNode *p) { User = p; } 947 948 operator SDValue() const { return Operand; } 949 950 const SDValue& getSDValue() const { return Operand; } 951 952 SDNode *&getVal() { return Operand.Val; } 953 SDNode *const &getVal() const { return Operand.Val; } 954 955 bool operator==(const SDValue &O) const { 956 return Operand == O; 957 } 958 959 bool operator!=(const SDValue &O) const { 960 return !(Operand == O); 961 } 962 963 bool operator<(const SDValue &O) const { 964 return Operand < O; 965 } 966 967protected: 968 void addToList(SDUse **List) { 969 Next = *List; 970 if (Next) Next->Prev = &Next; 971 Prev = List; 972 *List = this; 973 } 974 975 void removeFromList() { 976 *Prev = Next; 977 if (Next) Next->Prev = Prev; 978 } 979}; 980 981 982/// simplify_type specializations - Allow casting operators to work directly on 983/// SDValues as if they were SDNode*'s. 984template<> struct simplify_type<SDUse> { 985 typedef SDNode* SimpleType; 986 static SimpleType getSimplifiedValue(const SDUse &Val) { 987 return static_cast<SimpleType>(Val.getVal()); 988 } 989}; 990template<> struct simplify_type<const SDUse> { 991 typedef SDNode* SimpleType; 992 static SimpleType getSimplifiedValue(const SDUse &Val) { 993 return static_cast<SimpleType>(Val.getVal()); 994 } 995}; 996 997 998/// SDOperandPtr - A helper SDValue pointer class, that can handle 999/// arrays of SDUse and arrays of SDValue objects. This is required 1000/// in many places inside the SelectionDAG. 1001/// 1002class SDOperandPtr { 1003 const SDValue *ptr; // The pointer to the SDValue object 1004 int object_size; // The size of the object containg the SDValue 1005public: 1006 SDOperandPtr() : ptr(0), object_size(0) {} 1007 1008 SDOperandPtr(SDUse * use_ptr) { 1009 ptr = &use_ptr->getSDValue(); 1010 object_size = (int)sizeof(SDUse); 1011 } 1012 1013 SDOperandPtr(const SDValue * op_ptr) { 1014 ptr = op_ptr; 1015 object_size = (int)sizeof(SDValue); 1016 } 1017 1018 const SDValue operator *() { return *ptr; } 1019 const SDValue *operator ->() { return ptr; } 1020 SDOperandPtr operator ++ () { 1021 ptr = (SDValue*)((char *)ptr + object_size); 1022 return *this; 1023 } 1024 1025 SDOperandPtr operator ++ (int) { 1026 SDOperandPtr tmp = *this; 1027 ptr = (SDValue*)((char *)ptr + object_size); 1028 return tmp; 1029 } 1030 1031 SDValue operator[] (int idx) const { 1032 return *(SDValue*)((char*) ptr + object_size * idx); 1033 } 1034}; 1035 1036/// SDNode - Represents one node in the SelectionDAG. 1037/// 1038class SDNode : public FoldingSetNode, public ilist_node<SDNode> { 1039private: 1040 /// NodeType - The operation that this node performs. 1041 /// 1042 short NodeType; 1043 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 unsigned short OperandsNeedDelete : 1; 1047 1048protected: 1049 /// SubclassData - This member is defined by this class, but is not used for 1050 /// anything. Subclasses can use it to hold whatever state they find useful. 1051 /// This field is initialized to zero by the ctor. 1052 unsigned short SubclassData : 15; 1053 1054private: 1055 /// NodeId - Unique id per SDNode in the DAG. 1056 int NodeId; 1057 1058 /// OperandList - The values that are used by this operation. 1059 /// 1060 SDUse *OperandList; 1061 1062 /// ValueList - The types of the values this node defines. SDNode's may 1063 /// define multiple values simultaneously. 1064 const MVT *ValueList; 1065 1066 /// NumOperands/NumValues - The number of entries in the Operand/Value list. 1067 unsigned short NumOperands, NumValues; 1068 1069 /// Uses - List of uses for this SDNode. 1070 SDUse *Uses; 1071 1072 /// addUse - add SDUse to the list of uses. 1073 void addUse(SDUse &U) { U.addToList(&Uses); } 1074 1075 // Out-of-line virtual method to give class a home. 1076 virtual void ANCHOR(); 1077public: 1078 virtual ~SDNode() { 1079 assert(NumOperands == 0 && "Operand list not cleared before deletion"); 1080 NodeType = ISD::DELETED_NODE; 1081 } 1082 1083 //===--------------------------------------------------------------------===// 1084 // Accessors 1085 // 1086 1087 /// getOpcode - Return the SelectionDAG opcode value for this node. For 1088 /// pre-isel nodes (those for which isMachineOpcode returns false), these 1089 /// are the opcode values in the ISD and <target>ISD namespaces. For 1090 /// post-isel opcodes, see getMachineOpcode. 1091 unsigned getOpcode() const { return (unsigned short)NodeType; } 1092 1093 /// isTargetOpcode - Test if this node has a target-specific opcode (in the 1094 /// <target>ISD namespace). 1095 bool isTargetOpcode() const { return NodeType >= ISD::BUILTIN_OP_END; } 1096 1097 /// isMachineOpcode - Test if this node has a post-isel opcode, directly 1098 /// corresponding to a MachineInstr opcode. 1099 bool isMachineOpcode() const { return NodeType < 0; } 1100 1101 /// getMachineOpcode - This may only be called if isMachineOpcode returns 1102 /// true. It returns the MachineInstr opcode value that the node's opcode 1103 /// corresponds to. 1104 unsigned getMachineOpcode() const { 1105 assert(isMachineOpcode() && "Not a MachineInstr opcode!"); 1106 return ~NodeType; 1107 } 1108 1109 /// use_empty - Return true if there are no uses of this node. 1110 /// 1111 bool use_empty() const { return Uses == NULL; } 1112 1113 /// hasOneUse - Return true if there is exactly one use of this node. 1114 /// 1115 bool hasOneUse() const { 1116 return !use_empty() && next(use_begin()) == use_end(); 1117 } 1118 1119 /// use_size - Return the number of uses of this node. This method takes 1120 /// time proportional to the number of uses. 1121 /// 1122 size_t use_size() const { return std::distance(use_begin(), use_end()); } 1123 1124 /// getNodeId - Return the unique node id. 1125 /// 1126 int getNodeId() const { return NodeId; } 1127 1128 /// setNodeId - Set unique node id. 1129 void setNodeId(int Id) { NodeId = Id; } 1130 1131 /// use_iterator - This class provides iterator support for SDUse 1132 /// operands that use a specific SDNode. 1133 class use_iterator 1134 : public forward_iterator<SDUse, ptrdiff_t> { 1135 SDUse *Op; 1136 explicit use_iterator(SDUse *op) : Op(op) { 1137 } 1138 friend class SDNode; 1139 public: 1140 typedef forward_iterator<SDUse, ptrdiff_t>::reference reference; 1141 typedef forward_iterator<SDUse, ptrdiff_t>::pointer pointer; 1142 1143 use_iterator(const use_iterator &I) : Op(I.Op) {} 1144 use_iterator() : Op(0) {} 1145 1146 bool operator==(const use_iterator &x) const { 1147 return Op == x.Op; 1148 } 1149 bool operator!=(const use_iterator &x) const { 1150 return !operator==(x); 1151 } 1152 1153 /// atEnd - return true if this iterator is at the end of uses list. 1154 bool atEnd() const { return Op == 0; } 1155 1156 // Iterator traversal: forward iteration only. 1157 use_iterator &operator++() { // Preincrement 1158 assert(Op && "Cannot increment end iterator!"); 1159 Op = Op->getNext(); 1160 return *this; 1161 } 1162 1163 use_iterator operator++(int) { // Postincrement 1164 use_iterator tmp = *this; ++*this; return tmp; 1165 } 1166 1167 /// Retrieve a pointer to the current user node. 1168 SDNode *operator*() const { 1169 assert(Op && "Cannot dereference end iterator!"); 1170 return Op->getUser(); 1171 } 1172 1173 SDNode *operator->() const { return operator*(); } 1174 1175 SDUse &getUse() const { return *Op; } 1176 1177 /// getOperandNo - Retrive the operand # of this use in its user. 1178 /// 1179 unsigned getOperandNo() const { 1180 assert(Op && "Cannot dereference end iterator!"); 1181 return (unsigned)(Op - Op->getUser()->OperandList); 1182 } 1183 }; 1184 1185 /// use_begin/use_end - Provide iteration support to walk over all uses 1186 /// of an SDNode. 1187 1188 use_iterator use_begin() const { 1189 return use_iterator(Uses); 1190 } 1191 1192 static use_iterator use_end() { return use_iterator(0); } 1193 1194 1195 /// hasNUsesOfValue - Return true if there are exactly NUSES uses of the 1196 /// indicated value. This method ignores uses of other values defined by this 1197 /// operation. 1198 bool hasNUsesOfValue(unsigned NUses, unsigned Value) const; 1199 1200 /// hasAnyUseOfValue - Return true if there are any use of the indicated 1201 /// value. This method ignores uses of other values defined by this operation. 1202 bool hasAnyUseOfValue(unsigned Value) const; 1203 1204 /// isOnlyUserOf - Return true if this node is the only use of N. 1205 /// 1206 bool isOnlyUserOf(SDNode *N) const; 1207 1208 /// isOperandOf - Return true if this node is an operand of N. 1209 /// 1210 bool isOperandOf(SDNode *N) const; 1211 1212 /// isPredecessorOf - Return true if this node is a predecessor of N. This 1213 /// node is either an operand of N or it can be reached by recursively 1214 /// traversing up the operands. 1215 /// NOTE: this is an expensive method. Use it carefully. 1216 bool isPredecessorOf(SDNode *N) const; 1217 1218 /// getNumOperands - Return the number of values used by this operation. 1219 /// 1220 unsigned getNumOperands() const { return NumOperands; } 1221 1222 /// getConstantOperandVal - Helper method returns the integer value of a 1223 /// ConstantSDNode operand. 1224 uint64_t getConstantOperandVal(unsigned Num) const; 1225 1226 const SDValue &getOperand(unsigned Num) const { 1227 assert(Num < NumOperands && "Invalid child # of SDNode!"); 1228 return OperandList[Num].getSDValue(); 1229 } 1230 1231 typedef SDUse* op_iterator; 1232 op_iterator op_begin() const { return OperandList; } 1233 op_iterator op_end() const { return OperandList+NumOperands; } 1234 1235 1236 SDVTList getVTList() const { 1237 SDVTList X = { ValueList, NumValues }; 1238 return X; 1239 }; 1240 1241 /// getNumValues - Return the number of values defined/returned by this 1242 /// operator. 1243 /// 1244 unsigned getNumValues() const { return NumValues; } 1245 1246 /// getValueType - Return the type of a specified result. 1247 /// 1248 MVT getValueType(unsigned ResNo) const { 1249 assert(ResNo < NumValues && "Illegal result number!"); 1250 return ValueList[ResNo]; 1251 } 1252 1253 /// getValueSizeInBits - Returns MVT::getSizeInBits(getValueType(ResNo)). 1254 /// 1255 unsigned getValueSizeInBits(unsigned ResNo) const { 1256 return getValueType(ResNo).getSizeInBits(); 1257 } 1258 1259 typedef const MVT* value_iterator; 1260 value_iterator value_begin() const { return ValueList; } 1261 value_iterator value_end() const { return ValueList+NumValues; } 1262 1263 /// getOperationName - Return the opcode of this operation for printing. 1264 /// 1265 std::string getOperationName(const SelectionDAG *G = 0) const; 1266 static const char* getIndexedModeName(ISD::MemIndexedMode AM); 1267 void print(raw_ostream &OS, const SelectionDAG *G = 0) const; 1268 void dump() const; 1269 void dump(const SelectionDAG *G) const; 1270 1271 static bool classof(const SDNode *) { return true; } 1272 1273 /// Profile - Gather unique data for the node. 1274 /// 1275 void Profile(FoldingSetNodeID &ID) const; 1276 1277protected: 1278 friend class SelectionDAG; 1279 friend class ilist_traits<SDNode>; 1280 1281 /// getValueTypeList - Return a pointer to the specified value type. 1282 /// 1283 static const MVT *getValueTypeList(MVT VT); 1284 static SDVTList getSDVTList(MVT VT) { 1285 SDVTList Ret = { getValueTypeList(VT), 1 }; 1286 return Ret; 1287 } 1288 1289 SDNode(unsigned Opc, SDVTList VTs, const SDValue *Ops, unsigned NumOps) 1290 : NodeType(Opc), OperandsNeedDelete(true), SubclassData(0), 1291 NodeId(-1), Uses(NULL) { 1292 NumOperands = NumOps; 1293 OperandList = NumOps ? new SDUse[NumOperands] : 0; 1294 1295 for (unsigned i = 0; i != NumOps; ++i) { 1296 OperandList[i] = Ops[i]; 1297 OperandList[i].setUser(this); 1298 Ops[i].Val->addUse(OperandList[i]); 1299 } 1300 1301 ValueList = VTs.VTs; 1302 NumValues = VTs.NumVTs; 1303 } 1304 1305 SDNode(unsigned Opc, SDVTList VTs, const SDUse *Ops, unsigned NumOps) 1306 : NodeType(Opc), OperandsNeedDelete(true), SubclassData(0), 1307 NodeId(-1), Uses(NULL) { 1308 OperandsNeedDelete = true; 1309 NumOperands = NumOps; 1310 OperandList = NumOps ? new SDUse[NumOperands] : 0; 1311 1312 for (unsigned i = 0; i != NumOps; ++i) { 1313 OperandList[i] = Ops[i]; 1314 OperandList[i].setUser(this); 1315 Ops[i].getVal()->addUse(OperandList[i]); 1316 } 1317 1318 ValueList = VTs.VTs; 1319 NumValues = VTs.NumVTs; 1320 } 1321 1322 /// This constructor adds no operands itself; operands can be 1323 /// set later with InitOperands. 1324 SDNode(unsigned Opc, SDVTList VTs) 1325 : NodeType(Opc), OperandsNeedDelete(false), SubclassData(0), 1326 NodeId(-1), Uses(NULL) { 1327 NumOperands = 0; 1328 OperandList = 0; 1329 ValueList = VTs.VTs; 1330 NumValues = VTs.NumVTs; 1331 } 1332 1333 /// InitOperands - Initialize the operands list of this node with the 1334 /// specified values, which are part of the node (thus they don't need to be 1335 /// copied in or allocated). 1336 void InitOperands(SDUse *Ops, unsigned NumOps) { 1337 assert(OperandList == 0 && "Operands already set!"); 1338 NumOperands = NumOps; 1339 OperandList = Ops; 1340 Uses = NULL; 1341 1342 for (unsigned i = 0; i != NumOps; ++i) { 1343 OperandList[i].setUser(this); 1344 Ops[i].getVal()->addUse(OperandList[i]); 1345 } 1346 } 1347 1348 /// DropOperands - Release the operands and set this node to have 1349 /// zero operands. 1350 void DropOperands(); 1351 1352 void addUser(unsigned i, SDNode *User) { 1353 assert(User->OperandList[i].getUser() && "Node without parent"); 1354 addUse(User->OperandList[i]); 1355 } 1356 1357 void removeUser(unsigned i, SDNode *User) { 1358 assert(User->OperandList[i].getUser() && "Node without parent"); 1359 SDUse &Op = User->OperandList[i]; 1360 Op.removeFromList(); 1361 } 1362}; 1363 1364 1365// Define inline functions from the SDValue class. 1366 1367inline unsigned SDValue::getOpcode() const { 1368 return Val->getOpcode(); 1369} 1370inline MVT SDValue::getValueType() const { 1371 return Val->getValueType(ResNo); 1372} 1373inline unsigned SDValue::getNumOperands() const { 1374 return Val->getNumOperands(); 1375} 1376inline const SDValue &SDValue::getOperand(unsigned i) const { 1377 return Val->getOperand(i); 1378} 1379inline uint64_t SDValue::getConstantOperandVal(unsigned i) const { 1380 return Val->getConstantOperandVal(i); 1381} 1382inline bool SDValue::isTargetOpcode() const { 1383 return Val->isTargetOpcode(); 1384} 1385inline bool SDValue::isMachineOpcode() const { 1386 return Val->isMachineOpcode(); 1387} 1388inline unsigned SDValue::getMachineOpcode() const { 1389 return Val->getMachineOpcode(); 1390} 1391inline bool SDValue::use_empty() const { 1392 return !Val->hasAnyUseOfValue(ResNo); 1393} 1394inline bool SDValue::hasOneUse() const { 1395 return Val->hasNUsesOfValue(1, ResNo); 1396} 1397 1398/// UnarySDNode - This class is used for single-operand SDNodes. This is solely 1399/// to allow co-allocation of node operands with the node itself. 1400class UnarySDNode : public SDNode { 1401 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1402 SDUse Op; 1403public: 1404 UnarySDNode(unsigned Opc, SDVTList VTs, SDValue X) 1405 : SDNode(Opc, VTs) { 1406 Op = X; 1407 InitOperands(&Op, 1); 1408 } 1409}; 1410 1411/// BinarySDNode - This class is used for two-operand SDNodes. This is solely 1412/// to allow co-allocation of node operands with the node itself. 1413class BinarySDNode : public SDNode { 1414 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1415 SDUse Ops[2]; 1416public: 1417 BinarySDNode(unsigned Opc, SDVTList VTs, SDValue X, SDValue Y) 1418 : SDNode(Opc, VTs) { 1419 Ops[0] = X; 1420 Ops[1] = Y; 1421 InitOperands(Ops, 2); 1422 } 1423}; 1424 1425/// TernarySDNode - This class is used for three-operand SDNodes. This is solely 1426/// to allow co-allocation of node operands with the node itself. 1427class TernarySDNode : public SDNode { 1428 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1429 SDUse Ops[3]; 1430public: 1431 TernarySDNode(unsigned Opc, SDVTList VTs, SDValue X, SDValue Y, 1432 SDValue Z) 1433 : SDNode(Opc, VTs) { 1434 Ops[0] = X; 1435 Ops[1] = Y; 1436 Ops[2] = Z; 1437 InitOperands(Ops, 3); 1438 } 1439}; 1440 1441 1442/// HandleSDNode - This class is used to form a handle around another node that 1443/// is persistant and is updated across invocations of replaceAllUsesWith on its 1444/// operand. This node should be directly created by end-users and not added to 1445/// the AllNodes list. 1446class HandleSDNode : public SDNode { 1447 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1448 SDUse Op; 1449public: 1450 // FIXME: Remove the "noinline" attribute once <rdar://problem/5852746> is 1451 // fixed. 1452#ifdef __GNUC__ 1453 explicit __attribute__((__noinline__)) HandleSDNode(SDValue X) 1454#else 1455 explicit HandleSDNode(SDValue X) 1456#endif 1457 : SDNode(ISD::HANDLENODE, getSDVTList(MVT::Other)) { 1458 Op = X; 1459 InitOperands(&Op, 1); 1460 } 1461 ~HandleSDNode(); 1462 const SDValue &getValue() const { return Op.getSDValue(); } 1463}; 1464 1465/// Abstact virtual class for operations for memory operations 1466class MemSDNode : public SDNode { 1467 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1468 1469private: 1470 // MemoryVT - VT of in-memory value. 1471 MVT MemoryVT; 1472 1473 //! SrcValue - Memory location for alias analysis. 1474 const Value *SrcValue; 1475 1476 //! SVOffset - Memory location offset. Note that base is defined in MemSDNode 1477 int SVOffset; 1478 1479 /// Flags - the low bit indicates whether this is a volatile reference; 1480 /// the remainder is a log2 encoding of the alignment in bytes. 1481 unsigned Flags; 1482 1483public: 1484 MemSDNode(unsigned Opc, SDVTList VTs, MVT MemoryVT, 1485 const Value *srcValue, int SVOff, 1486 unsigned alignment, bool isvolatile); 1487 1488 /// Returns alignment and volatility of the memory access 1489 unsigned getAlignment() const { return (1u << (Flags >> 1)) >> 1; } 1490 bool isVolatile() const { return Flags & 1; } 1491 1492 /// Returns the SrcValue and offset that describes the location of the access 1493 const Value *getSrcValue() const { return SrcValue; } 1494 int getSrcValueOffset() const { return SVOffset; } 1495 1496 /// getMemoryVT - Return the type of the in-memory value. 1497 MVT getMemoryVT() const { return MemoryVT; } 1498 1499 /// getMemOperand - Return a MachineMemOperand object describing the memory 1500 /// reference performed by operation. 1501 MachineMemOperand getMemOperand() const; 1502 1503 const SDValue &getChain() const { return getOperand(0); } 1504 const SDValue &getBasePtr() const { 1505 return getOperand(getOpcode() == ISD::STORE ? 2 : 1); 1506 } 1507 1508 /// getRawFlags - Represent the flags as a bunch of bits. 1509 /// 1510 unsigned getRawFlags() const { return Flags; } 1511 1512 // Methods to support isa and dyn_cast 1513 static bool classof(const MemSDNode *) { return true; } 1514 static bool classof(const SDNode *N) { 1515 return N->getOpcode() == ISD::LOAD || 1516 N->getOpcode() == ISD::STORE || 1517 N->getOpcode() == ISD::ATOMIC_CMP_SWAP || 1518 N->getOpcode() == ISD::ATOMIC_LOAD_ADD || 1519 N->getOpcode() == ISD::ATOMIC_SWAP || 1520 N->getOpcode() == ISD::ATOMIC_LOAD_SUB || 1521 N->getOpcode() == ISD::ATOMIC_LOAD_AND || 1522 N->getOpcode() == ISD::ATOMIC_LOAD_OR || 1523 N->getOpcode() == ISD::ATOMIC_LOAD_XOR || 1524 N->getOpcode() == ISD::ATOMIC_LOAD_NAND || 1525 N->getOpcode() == ISD::ATOMIC_LOAD_MIN || 1526 N->getOpcode() == ISD::ATOMIC_LOAD_MAX || 1527 N->getOpcode() == ISD::ATOMIC_LOAD_UMIN || 1528 N->getOpcode() == ISD::ATOMIC_LOAD_UMAX; 1529 } 1530}; 1531 1532/// Atomic operations node 1533class AtomicSDNode : public MemSDNode { 1534 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1535 SDUse Ops[4]; 1536 1537 public: 1538 // Opc: opcode for atomic 1539 // VTL: value type list 1540 // Chain: memory chain for operaand 1541 // Ptr: address to update as a SDValue 1542 // Cmp: compare value 1543 // Swp: swap value 1544 // SrcVal: address to update as a Value (used for MemOperand) 1545 // Align: alignment of memory 1546 AtomicSDNode(unsigned Opc, SDVTList VTL, SDValue Chain, SDValue Ptr, 1547 SDValue Cmp, SDValue Swp, const Value* SrcVal, 1548 unsigned Align=0) 1549 : MemSDNode(Opc, VTL, Cmp.getValueType(), SrcVal, /*SVOffset=*/0, 1550 Align, /*isVolatile=*/true) { 1551 Ops[0] = Chain; 1552 Ops[1] = Ptr; 1553 Ops[2] = Swp; 1554 Ops[3] = Cmp; 1555 InitOperands(Ops, 4); 1556 } 1557 AtomicSDNode(unsigned Opc, SDVTList VTL, SDValue Chain, SDValue Ptr, 1558 SDValue Val, const Value* SrcVal, unsigned Align=0) 1559 : MemSDNode(Opc, VTL, Val.getValueType(), SrcVal, /*SVOffset=*/0, 1560 Align, /*isVolatile=*/true) { 1561 Ops[0] = Chain; 1562 Ops[1] = Ptr; 1563 Ops[2] = Val; 1564 InitOperands(Ops, 3); 1565 } 1566 1567 const SDValue &getBasePtr() const { return getOperand(1); } 1568 const SDValue &getVal() const { return getOperand(2); } 1569 1570 bool isCompareAndSwap() const { return getOpcode() == ISD::ATOMIC_CMP_SWAP; } 1571 1572 // Methods to support isa and dyn_cast 1573 static bool classof(const AtomicSDNode *) { return true; } 1574 static bool classof(const SDNode *N) { 1575 return N->getOpcode() == ISD::ATOMIC_CMP_SWAP || 1576 N->getOpcode() == ISD::ATOMIC_LOAD_ADD || 1577 N->getOpcode() == ISD::ATOMIC_SWAP || 1578 N->getOpcode() == ISD::ATOMIC_LOAD_SUB || 1579 N->getOpcode() == ISD::ATOMIC_LOAD_AND || 1580 N->getOpcode() == ISD::ATOMIC_LOAD_OR || 1581 N->getOpcode() == ISD::ATOMIC_LOAD_XOR || 1582 N->getOpcode() == ISD::ATOMIC_LOAD_NAND || 1583 N->getOpcode() == ISD::ATOMIC_LOAD_MIN || 1584 N->getOpcode() == ISD::ATOMIC_LOAD_MAX || 1585 N->getOpcode() == ISD::ATOMIC_LOAD_UMIN || 1586 N->getOpcode() == ISD::ATOMIC_LOAD_UMAX; 1587 } 1588}; 1589 1590class ConstantSDNode : public SDNode { 1591 APInt Value; 1592 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1593protected: 1594 friend class SelectionDAG; 1595 ConstantSDNode(bool isTarget, const APInt &val, MVT VT) 1596 : SDNode(isTarget ? ISD::TargetConstant : ISD::Constant, getSDVTList(VT)), 1597 Value(val) { 1598 } 1599public: 1600 1601 const APInt &getAPIntValue() const { return Value; } 1602 uint64_t getValue() const { return Value.getZExtValue(); } 1603 1604 int64_t getSignExtended() const { 1605 unsigned Bits = getValueType(0).getSizeInBits(); 1606 return ((int64_t)Value.getZExtValue() << (64-Bits)) >> (64-Bits); 1607 } 1608 1609 bool isNullValue() const { return Value == 0; } 1610 bool isAllOnesValue() const { 1611 return Value == getValueType(0).getIntegerVTBitMask(); 1612 } 1613 1614 static bool classof(const ConstantSDNode *) { return true; } 1615 static bool classof(const SDNode *N) { 1616 return N->getOpcode() == ISD::Constant || 1617 N->getOpcode() == ISD::TargetConstant; 1618 } 1619}; 1620 1621class ConstantFPSDNode : public SDNode { 1622 APFloat Value; 1623 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1624protected: 1625 friend class SelectionDAG; 1626 ConstantFPSDNode(bool isTarget, const APFloat& val, MVT VT) 1627 : SDNode(isTarget ? ISD::TargetConstantFP : ISD::ConstantFP, 1628 getSDVTList(VT)), Value(val) { 1629 } 1630public: 1631 1632 const APFloat& getValueAPF() const { return Value; } 1633 1634 /// isExactlyValue - We don't rely on operator== working on double values, as 1635 /// it returns true for things that are clearly not equal, like -0.0 and 0.0. 1636 /// As such, this method can be used to do an exact bit-for-bit comparison of 1637 /// two floating point values. 1638 1639 /// We leave the version with the double argument here because it's just so 1640 /// convenient to write "2.0" and the like. Without this function we'd 1641 /// have to duplicate its logic everywhere it's called. 1642 bool isExactlyValue(double V) const { 1643 // convert is not supported on this type 1644 if (&Value.getSemantics() == &APFloat::PPCDoubleDouble) 1645 return false; 1646 APFloat Tmp(V); 1647 Tmp.convert(Value.getSemantics(), APFloat::rmNearestTiesToEven); 1648 return isExactlyValue(Tmp); 1649 } 1650 bool isExactlyValue(const APFloat& V) const; 1651 1652 bool isValueValidForType(MVT VT, const APFloat& Val); 1653 1654 static bool classof(const ConstantFPSDNode *) { return true; } 1655 static bool classof(const SDNode *N) { 1656 return N->getOpcode() == ISD::ConstantFP || 1657 N->getOpcode() == ISD::TargetConstantFP; 1658 } 1659}; 1660 1661class GlobalAddressSDNode : public SDNode { 1662 GlobalValue *TheGlobal; 1663 int Offset; 1664 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1665protected: 1666 friend class SelectionDAG; 1667 GlobalAddressSDNode(bool isTarget, const GlobalValue *GA, MVT VT, int o = 0); 1668public: 1669 1670 GlobalValue *getGlobal() const { return TheGlobal; } 1671 int getOffset() const { return Offset; } 1672 1673 static bool classof(const GlobalAddressSDNode *) { return true; } 1674 static bool classof(const SDNode *N) { 1675 return N->getOpcode() == ISD::GlobalAddress || 1676 N->getOpcode() == ISD::TargetGlobalAddress || 1677 N->getOpcode() == ISD::GlobalTLSAddress || 1678 N->getOpcode() == ISD::TargetGlobalTLSAddress; 1679 } 1680}; 1681 1682class FrameIndexSDNode : public SDNode { 1683 int FI; 1684 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1685protected: 1686 friend class SelectionDAG; 1687 FrameIndexSDNode(int fi, MVT VT, bool isTarg) 1688 : SDNode(isTarg ? ISD::TargetFrameIndex : ISD::FrameIndex, getSDVTList(VT)), 1689 FI(fi) { 1690 } 1691public: 1692 1693 int getIndex() const { return FI; } 1694 1695 static bool classof(const FrameIndexSDNode *) { return true; } 1696 static bool classof(const SDNode *N) { 1697 return N->getOpcode() == ISD::FrameIndex || 1698 N->getOpcode() == ISD::TargetFrameIndex; 1699 } 1700}; 1701 1702class JumpTableSDNode : public SDNode { 1703 int JTI; 1704 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1705protected: 1706 friend class SelectionDAG; 1707 JumpTableSDNode(int jti, MVT VT, bool isTarg) 1708 : SDNode(isTarg ? ISD::TargetJumpTable : ISD::JumpTable, getSDVTList(VT)), 1709 JTI(jti) { 1710 } 1711public: 1712 1713 int getIndex() const { return JTI; } 1714 1715 static bool classof(const JumpTableSDNode *) { return true; } 1716 static bool classof(const SDNode *N) { 1717 return N->getOpcode() == ISD::JumpTable || 1718 N->getOpcode() == ISD::TargetJumpTable; 1719 } 1720}; 1721 1722class ConstantPoolSDNode : public SDNode { 1723 union { 1724 Constant *ConstVal; 1725 MachineConstantPoolValue *MachineCPVal; 1726 } Val; 1727 int Offset; // It's a MachineConstantPoolValue if top bit is set. 1728 unsigned Alignment; 1729 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1730protected: 1731 friend class SelectionDAG; 1732 ConstantPoolSDNode(bool isTarget, Constant *c, MVT VT, int o=0) 1733 : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 1734 getSDVTList(VT)), Offset(o), Alignment(0) { 1735 assert((int)Offset >= 0 && "Offset is too large"); 1736 Val.ConstVal = c; 1737 } 1738 ConstantPoolSDNode(bool isTarget, Constant *c, MVT VT, int o, unsigned Align) 1739 : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 1740 getSDVTList(VT)), Offset(o), Alignment(Align) { 1741 assert((int)Offset >= 0 && "Offset is too large"); 1742 Val.ConstVal = c; 1743 } 1744 ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v, 1745 MVT VT, int o=0) 1746 : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 1747 getSDVTList(VT)), Offset(o), Alignment(0) { 1748 assert((int)Offset >= 0 && "Offset is too large"); 1749 Val.MachineCPVal = v; 1750 Offset |= 1 << (sizeof(unsigned)*8-1); 1751 } 1752 ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v, 1753 MVT VT, int o, unsigned Align) 1754 : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 1755 getSDVTList(VT)), Offset(o), Alignment(Align) { 1756 assert((int)Offset >= 0 && "Offset is too large"); 1757 Val.MachineCPVal = v; 1758 Offset |= 1 << (sizeof(unsigned)*8-1); 1759 } 1760public: 1761 1762 bool isMachineConstantPoolEntry() const { 1763 return (int)Offset < 0; 1764 } 1765 1766 Constant *getConstVal() const { 1767 assert(!isMachineConstantPoolEntry() && "Wrong constantpool type"); 1768 return Val.ConstVal; 1769 } 1770 1771 MachineConstantPoolValue *getMachineCPVal() const { 1772 assert(isMachineConstantPoolEntry() && "Wrong constantpool type"); 1773 return Val.MachineCPVal; 1774 } 1775 1776 int getOffset() const { 1777 return Offset & ~(1 << (sizeof(unsigned)*8-1)); 1778 } 1779 1780 // Return the alignment of this constant pool object, which is either 0 (for 1781 // default alignment) or log2 of the desired value. 1782 unsigned getAlignment() const { return Alignment; } 1783 1784 const Type *getType() const; 1785 1786 static bool classof(const ConstantPoolSDNode *) { return true; } 1787 static bool classof(const SDNode *N) { 1788 return N->getOpcode() == ISD::ConstantPool || 1789 N->getOpcode() == ISD::TargetConstantPool; 1790 } 1791}; 1792 1793class BasicBlockSDNode : public SDNode { 1794 MachineBasicBlock *MBB; 1795 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1796protected: 1797 friend class SelectionDAG; 1798 explicit BasicBlockSDNode(MachineBasicBlock *mbb) 1799 : SDNode(ISD::BasicBlock, getSDVTList(MVT::Other)), MBB(mbb) { 1800 } 1801public: 1802 1803 MachineBasicBlock *getBasicBlock() const { return MBB; } 1804 1805 static bool classof(const BasicBlockSDNode *) { return true; } 1806 static bool classof(const SDNode *N) { 1807 return N->getOpcode() == ISD::BasicBlock; 1808 } 1809}; 1810 1811/// SrcValueSDNode - An SDNode that holds an arbitrary LLVM IR Value. This is 1812/// used when the SelectionDAG needs to make a simple reference to something 1813/// in the LLVM IR representation. 1814/// 1815/// Note that this is not used for carrying alias information; that is done 1816/// with MemOperandSDNode, which includes a Value which is required to be a 1817/// pointer, and several other fields specific to memory references. 1818/// 1819class SrcValueSDNode : public SDNode { 1820 const Value *V; 1821 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1822protected: 1823 friend class SelectionDAG; 1824 /// Create a SrcValue for a general value. 1825 explicit SrcValueSDNode(const Value *v) 1826 : SDNode(ISD::SRCVALUE, getSDVTList(MVT::Other)), V(v) {} 1827 1828public: 1829 /// getValue - return the contained Value. 1830 const Value *getValue() const { return V; } 1831 1832 static bool classof(const SrcValueSDNode *) { return true; } 1833 static bool classof(const SDNode *N) { 1834 return N->getOpcode() == ISD::SRCVALUE; 1835 } 1836}; 1837 1838 1839/// MemOperandSDNode - An SDNode that holds a MachineMemOperand. This is 1840/// used to represent a reference to memory after ISD::LOAD 1841/// and ISD::STORE have been lowered. 1842/// 1843class MemOperandSDNode : public SDNode { 1844 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1845protected: 1846 friend class SelectionDAG; 1847 /// Create a MachineMemOperand node 1848 explicit MemOperandSDNode(const MachineMemOperand &mo) 1849 : SDNode(ISD::MEMOPERAND, getSDVTList(MVT::Other)), MO(mo) {} 1850 1851public: 1852 /// MO - The contained MachineMemOperand. 1853 const MachineMemOperand MO; 1854 1855 static bool classof(const MemOperandSDNode *) { return true; } 1856 static bool classof(const SDNode *N) { 1857 return N->getOpcode() == ISD::MEMOPERAND; 1858 } 1859}; 1860 1861 1862class RegisterSDNode : public SDNode { 1863 unsigned Reg; 1864 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1865protected: 1866 friend class SelectionDAG; 1867 RegisterSDNode(unsigned reg, MVT VT) 1868 : SDNode(ISD::Register, getSDVTList(VT)), Reg(reg) { 1869 } 1870public: 1871 1872 unsigned getReg() const { return Reg; } 1873 1874 static bool classof(const RegisterSDNode *) { return true; } 1875 static bool classof(const SDNode *N) { 1876 return N->getOpcode() == ISD::Register; 1877 } 1878}; 1879 1880class DbgStopPointSDNode : public SDNode { 1881 SDUse Chain; 1882 unsigned Line; 1883 unsigned Column; 1884 const CompileUnitDesc *CU; 1885 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1886protected: 1887 friend class SelectionDAG; 1888 DbgStopPointSDNode(SDValue ch, unsigned l, unsigned c, 1889 const CompileUnitDesc *cu) 1890 : SDNode(ISD::DBG_STOPPOINT, getSDVTList(MVT::Other)), 1891 Line(l), Column(c), CU(cu) { 1892 Chain = ch; 1893 InitOperands(&Chain, 1); 1894 } 1895public: 1896 unsigned getLine() const { return Line; } 1897 unsigned getColumn() const { return Column; } 1898 const CompileUnitDesc *getCompileUnit() const { return CU; } 1899 1900 static bool classof(const DbgStopPointSDNode *) { return true; } 1901 static bool classof(const SDNode *N) { 1902 return N->getOpcode() == ISD::DBG_STOPPOINT; 1903 } 1904}; 1905 1906class LabelSDNode : public SDNode { 1907 SDUse Chain; 1908 unsigned LabelID; 1909 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1910protected: 1911 friend class SelectionDAG; 1912 LabelSDNode(unsigned NodeTy, SDValue ch, unsigned id) 1913 : SDNode(NodeTy, getSDVTList(MVT::Other)), LabelID(id) { 1914 Chain = ch; 1915 InitOperands(&Chain, 1); 1916 } 1917public: 1918 unsigned getLabelID() const { return LabelID; } 1919 1920 static bool classof(const LabelSDNode *) { return true; } 1921 static bool classof(const SDNode *N) { 1922 return N->getOpcode() == ISD::DBG_LABEL || 1923 N->getOpcode() == ISD::EH_LABEL; 1924 } 1925}; 1926 1927class ExternalSymbolSDNode : public SDNode { 1928 const char *Symbol; 1929 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1930protected: 1931 friend class SelectionDAG; 1932 ExternalSymbolSDNode(bool isTarget, const char *Sym, MVT VT) 1933 : SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol, 1934 getSDVTList(VT)), Symbol(Sym) { 1935 } 1936public: 1937 1938 const char *getSymbol() const { return Symbol; } 1939 1940 static bool classof(const ExternalSymbolSDNode *) { return true; } 1941 static bool classof(const SDNode *N) { 1942 return N->getOpcode() == ISD::ExternalSymbol || 1943 N->getOpcode() == ISD::TargetExternalSymbol; 1944 } 1945}; 1946 1947class CondCodeSDNode : public SDNode { 1948 ISD::CondCode Condition; 1949 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 1950protected: 1951 friend class SelectionDAG; 1952 explicit CondCodeSDNode(ISD::CondCode Cond) 1953 : SDNode(ISD::CONDCODE, getSDVTList(MVT::Other)), Condition(Cond) { 1954 } 1955public: 1956 1957 ISD::CondCode get() const { return Condition; } 1958 1959 static bool classof(const CondCodeSDNode *) { return true; } 1960 static bool classof(const SDNode *N) { 1961 return N->getOpcode() == ISD::CONDCODE; 1962 } 1963}; 1964 1965namespace ISD { 1966 struct ArgFlagsTy { 1967 private: 1968 static const uint64_t NoFlagSet = 0ULL; 1969 static const uint64_t ZExt = 1ULL<<0; ///< Zero extended 1970 static const uint64_t ZExtOffs = 0; 1971 static const uint64_t SExt = 1ULL<<1; ///< Sign extended 1972 static const uint64_t SExtOffs = 1; 1973 static const uint64_t InReg = 1ULL<<2; ///< Passed in register 1974 static const uint64_t InRegOffs = 2; 1975 static const uint64_t SRet = 1ULL<<3; ///< Hidden struct-ret ptr 1976 static const uint64_t SRetOffs = 3; 1977 static const uint64_t ByVal = 1ULL<<4; ///< Struct passed by value 1978 static const uint64_t ByValOffs = 4; 1979 static const uint64_t Nest = 1ULL<<5; ///< Nested fn static chain 1980 static const uint64_t NestOffs = 5; 1981 static const uint64_t ByValAlign = 0xFULL << 6; //< Struct alignment 1982 static const uint64_t ByValAlignOffs = 6; 1983 static const uint64_t Split = 1ULL << 10; 1984 static const uint64_t SplitOffs = 10; 1985 static const uint64_t OrigAlign = 0x1FULL<<27; 1986 static const uint64_t OrigAlignOffs = 27; 1987 static const uint64_t ByValSize = 0xffffffffULL << 32; //< Struct size 1988 static const uint64_t ByValSizeOffs = 32; 1989 1990 static const uint64_t One = 1ULL; //< 1 of this type, for shifts 1991 1992 uint64_t Flags; 1993 public: 1994 ArgFlagsTy() : Flags(0) { } 1995 1996 bool isZExt() const { return Flags & ZExt; } 1997 void setZExt() { Flags |= One << ZExtOffs; } 1998 1999 bool isSExt() const { return Flags & SExt; } 2000 void setSExt() { Flags |= One << SExtOffs; } 2001 2002 bool isInReg() const { return Flags & InReg; } 2003 void setInReg() { Flags |= One << InRegOffs; } 2004 2005 bool isSRet() const { return Flags & SRet; } 2006 void setSRet() { Flags |= One << SRetOffs; } 2007 2008 bool isByVal() const { return Flags & ByVal; } 2009 void setByVal() { Flags |= One << ByValOffs; } 2010 2011 bool isNest() const { return Flags & Nest; } 2012 void setNest() { Flags |= One << NestOffs; } 2013 2014 unsigned getByValAlign() const { 2015 return (unsigned) 2016 ((One << ((Flags & ByValAlign) >> ByValAlignOffs)) / 2); 2017 } 2018 void setByValAlign(unsigned A) { 2019 Flags = (Flags & ~ByValAlign) | 2020 (uint64_t(Log2_32(A) + 1) << ByValAlignOffs); 2021 } 2022 2023 bool isSplit() const { return Flags & Split; } 2024 void setSplit() { Flags |= One << SplitOffs; } 2025 2026 unsigned getOrigAlign() const { 2027 return (unsigned) 2028 ((One << ((Flags & OrigAlign) >> OrigAlignOffs)) / 2); 2029 } 2030 void setOrigAlign(unsigned A) { 2031 Flags = (Flags & ~OrigAlign) | 2032 (uint64_t(Log2_32(A) + 1) << OrigAlignOffs); 2033 } 2034 2035 unsigned getByValSize() const { 2036 return (unsigned)((Flags & ByValSize) >> ByValSizeOffs); 2037 } 2038 void setByValSize(unsigned S) { 2039 Flags = (Flags & ~ByValSize) | (uint64_t(S) << ByValSizeOffs); 2040 } 2041 2042 /// getArgFlagsString - Returns the flags as a string, eg: "zext align:4". 2043 std::string getArgFlagsString(); 2044 2045 /// getRawBits - Represent the flags as a bunch of bits. 2046 uint64_t getRawBits() const { return Flags; } 2047 }; 2048} 2049 2050/// ARG_FLAGSSDNode - Leaf node holding parameter flags. 2051class ARG_FLAGSSDNode : public SDNode { 2052 ISD::ArgFlagsTy TheFlags; 2053 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 2054protected: 2055 friend class SelectionDAG; 2056 explicit ARG_FLAGSSDNode(ISD::ArgFlagsTy Flags) 2057 : SDNode(ISD::ARG_FLAGS, getSDVTList(MVT::Other)), TheFlags(Flags) { 2058 } 2059public: 2060 ISD::ArgFlagsTy getArgFlags() const { return TheFlags; } 2061 2062 static bool classof(const ARG_FLAGSSDNode *) { return true; } 2063 static bool classof(const SDNode *N) { 2064 return N->getOpcode() == ISD::ARG_FLAGS; 2065 } 2066}; 2067 2068/// VTSDNode - This class is used to represent MVT's, which are used 2069/// to parameterize some operations. 2070class VTSDNode : public SDNode { 2071 MVT ValueType; 2072 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 2073protected: 2074 friend class SelectionDAG; 2075 explicit VTSDNode(MVT VT) 2076 : SDNode(ISD::VALUETYPE, getSDVTList(MVT::Other)), ValueType(VT) { 2077 } 2078public: 2079 2080 MVT getVT() const { return ValueType; } 2081 2082 static bool classof(const VTSDNode *) { return true; } 2083 static bool classof(const SDNode *N) { 2084 return N->getOpcode() == ISD::VALUETYPE; 2085 } 2086}; 2087 2088/// LSBaseSDNode - Base class for LoadSDNode and StoreSDNode 2089/// 2090class LSBaseSDNode : public MemSDNode { 2091protected: 2092 //! Operand array for load and store 2093 /*! 2094 \note Moving this array to the base class captures more 2095 common functionality shared between LoadSDNode and 2096 StoreSDNode 2097 */ 2098 SDUse Ops[4]; 2099public: 2100 LSBaseSDNode(ISD::NodeType NodeTy, SDValue *Operands, unsigned numOperands, 2101 SDVTList VTs, ISD::MemIndexedMode AM, MVT VT, 2102 const Value *SV, int SVO, unsigned Align, bool Vol) 2103 : MemSDNode(NodeTy, VTs, VT, SV, SVO, Align, Vol) { 2104 SubclassData = AM; 2105 for (unsigned i = 0; i != numOperands; ++i) 2106 Ops[i] = Operands[i]; 2107 InitOperands(Ops, numOperands); 2108 assert(Align != 0 && "Loads and stores should have non-zero aligment"); 2109 assert((getOffset().getOpcode() == ISD::UNDEF || isIndexed()) && 2110 "Only indexed loads and stores have a non-undef offset operand"); 2111 } 2112 2113 const SDValue &getOffset() const { 2114 return getOperand(getOpcode() == ISD::LOAD ? 2 : 3); 2115 } 2116 2117 /// getAddressingMode - Return the addressing mode for this load or store: 2118 /// unindexed, pre-inc, pre-dec, post-inc, or post-dec. 2119 ISD::MemIndexedMode getAddressingMode() const { 2120 return ISD::MemIndexedMode(SubclassData & 7); 2121 } 2122 2123 /// isIndexed - Return true if this is a pre/post inc/dec load/store. 2124 bool isIndexed() const { return getAddressingMode() != ISD::UNINDEXED; } 2125 2126 /// isUnindexed - Return true if this is NOT a pre/post inc/dec load/store. 2127 bool isUnindexed() const { return getAddressingMode() == ISD::UNINDEXED; } 2128 2129 static bool classof(const LSBaseSDNode *) { return true; } 2130 static bool classof(const SDNode *N) { 2131 return N->getOpcode() == ISD::LOAD || 2132 N->getOpcode() == ISD::STORE; 2133 } 2134}; 2135 2136/// LoadSDNode - This class is used to represent ISD::LOAD nodes. 2137/// 2138class LoadSDNode : public LSBaseSDNode { 2139 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 2140protected: 2141 friend class SelectionDAG; 2142 LoadSDNode(SDValue *ChainPtrOff, SDVTList VTs, 2143 ISD::MemIndexedMode AM, ISD::LoadExtType ETy, MVT LVT, 2144 const Value *SV, int O=0, unsigned Align=0, bool Vol=false) 2145 : LSBaseSDNode(ISD::LOAD, ChainPtrOff, 3, 2146 VTs, AM, LVT, SV, O, Align, Vol) { 2147 SubclassData |= (unsigned short)ETy << 3; 2148 } 2149public: 2150 2151 /// getExtensionType - Return whether this is a plain node, 2152 /// or one of the varieties of value-extending loads. 2153 ISD::LoadExtType getExtensionType() const { 2154 return ISD::LoadExtType((SubclassData >> 3) & 3); 2155 } 2156 2157 const SDValue &getBasePtr() const { return getOperand(1); } 2158 const SDValue &getOffset() const { return getOperand(2); } 2159 2160 static bool classof(const LoadSDNode *) { return true; } 2161 static bool classof(const SDNode *N) { 2162 return N->getOpcode() == ISD::LOAD; 2163 } 2164}; 2165 2166/// StoreSDNode - This class is used to represent ISD::STORE nodes. 2167/// 2168class StoreSDNode : public LSBaseSDNode { 2169 virtual void ANCHOR(); // Out-of-line virtual method to give class a home. 2170protected: 2171 friend class SelectionDAG; 2172 StoreSDNode(SDValue *ChainValuePtrOff, SDVTList VTs, 2173 ISD::MemIndexedMode AM, bool isTrunc, MVT SVT, 2174 const Value *SV, int O=0, unsigned Align=0, bool Vol=false) 2175 : LSBaseSDNode(ISD::STORE, ChainValuePtrOff, 4, 2176 VTs, AM, SVT, SV, O, Align, Vol) { 2177 SubclassData |= (unsigned short)isTrunc << 3; 2178 } 2179public: 2180 2181 /// isTruncatingStore - Return true if the op does a truncation before store. 2182 /// For integers this is the same as doing a TRUNCATE and storing the result. 2183 /// For floats, it is the same as doing an FP_ROUND and storing the result. 2184 bool isTruncatingStore() const { return (SubclassData >> 3) & 1; } 2185 2186 const SDValue &getValue() const { return getOperand(1); } 2187 const SDValue &getBasePtr() const { return getOperand(2); } 2188 const SDValue &getOffset() const { return getOperand(3); } 2189 2190 static bool classof(const StoreSDNode *) { return true; } 2191 static bool classof(const SDNode *N) { 2192 return N->getOpcode() == ISD::STORE; 2193 } 2194}; 2195 2196 2197class SDNodeIterator : public forward_iterator<SDNode, ptrdiff_t> { 2198 SDNode *Node; 2199 unsigned Operand; 2200 2201 SDNodeIterator(SDNode *N, unsigned Op) : Node(N), Operand(Op) {} 2202public: 2203 bool operator==(const SDNodeIterator& x) const { 2204 return Operand == x.Operand; 2205 } 2206 bool operator!=(const SDNodeIterator& x) const { return !operator==(x); } 2207 2208 const SDNodeIterator &operator=(const SDNodeIterator &I) { 2209 assert(I.Node == Node && "Cannot assign iterators to two different nodes!"); 2210 Operand = I.Operand; 2211 return *this; 2212 } 2213 2214 pointer operator*() const { 2215 return Node->getOperand(Operand).Val; 2216 } 2217 pointer operator->() const { return operator*(); } 2218 2219 SDNodeIterator& operator++() { // Preincrement 2220 ++Operand; 2221 return *this; 2222 } 2223 SDNodeIterator operator++(int) { // Postincrement 2224 SDNodeIterator tmp = *this; ++*this; return tmp; 2225 } 2226 2227 static SDNodeIterator begin(SDNode *N) { return SDNodeIterator(N, 0); } 2228 static SDNodeIterator end (SDNode *N) { 2229 return SDNodeIterator(N, N->getNumOperands()); 2230 } 2231 2232 unsigned getOperand() const { return Operand; } 2233 const SDNode *getNode() const { return Node; } 2234}; 2235 2236template <> struct GraphTraits<SDNode*> { 2237 typedef SDNode NodeType; 2238 typedef SDNodeIterator ChildIteratorType; 2239 static inline NodeType *getEntryNode(SDNode *N) { return N; } 2240 static inline ChildIteratorType child_begin(NodeType *N) { 2241 return SDNodeIterator::begin(N); 2242 } 2243 static inline ChildIteratorType child_end(NodeType *N) { 2244 return SDNodeIterator::end(N); 2245 } 2246}; 2247 2248/// LargestSDNode - The largest SDNode class. 2249/// 2250typedef LoadSDNode LargestSDNode; 2251 2252/// MostAlignedSDNode - The SDNode class with the greatest alignment 2253/// requirement. 2254/// 2255typedef ConstantSDNode MostAlignedSDNode; 2256 2257namespace ISD { 2258 /// isNormalLoad - Returns true if the specified node is a non-extending 2259 /// and unindexed load. 2260 inline bool isNormalLoad(const SDNode *N) { 2261 const LoadSDNode *Ld = dyn_cast<LoadSDNode>(N); 2262 return Ld && Ld->getExtensionType() == ISD::NON_EXTLOAD && 2263 Ld->getAddressingMode() == ISD::UNINDEXED; 2264 } 2265 2266 /// isNON_EXTLoad - Returns true if the specified node is a non-extending 2267 /// load. 2268 inline bool isNON_EXTLoad(const SDNode *N) { 2269 return isa<LoadSDNode>(N) && 2270 cast<LoadSDNode>(N)->getExtensionType() == ISD::NON_EXTLOAD; 2271 } 2272 2273 /// isEXTLoad - Returns true if the specified node is a EXTLOAD. 2274 /// 2275 inline bool isEXTLoad(const SDNode *N) { 2276 return isa<LoadSDNode>(N) && 2277 cast<LoadSDNode>(N)->getExtensionType() == ISD::EXTLOAD; 2278 } 2279 2280 /// isSEXTLoad - Returns true if the specified node is a SEXTLOAD. 2281 /// 2282 inline bool isSEXTLoad(const SDNode *N) { 2283 return isa<LoadSDNode>(N) && 2284 cast<LoadSDNode>(N)->getExtensionType() == ISD::SEXTLOAD; 2285 } 2286 2287 /// isZEXTLoad - Returns true if the specified node is a ZEXTLOAD. 2288 /// 2289 inline bool isZEXTLoad(const SDNode *N) { 2290 return isa<LoadSDNode>(N) && 2291 cast<LoadSDNode>(N)->getExtensionType() == ISD::ZEXTLOAD; 2292 } 2293 2294 /// isUNINDEXEDLoad - Returns true if the specified node is an unindexed load. 2295 /// 2296 inline bool isUNINDEXEDLoad(const SDNode *N) { 2297 return isa<LoadSDNode>(N) && 2298 cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED; 2299 } 2300 2301 /// isNormalStore - Returns true if the specified node is a non-truncating 2302 /// and unindexed store. 2303 inline bool isNormalStore(const SDNode *N) { 2304 const StoreSDNode *St = dyn_cast<StoreSDNode>(N); 2305 return St && !St->isTruncatingStore() && 2306 St->getAddressingMode() == ISD::UNINDEXED; 2307 } 2308 2309 /// isNON_TRUNCStore - Returns true if the specified node is a non-truncating 2310 /// store. 2311 inline bool isNON_TRUNCStore(const SDNode *N) { 2312 return isa<StoreSDNode>(N) && !cast<StoreSDNode>(N)->isTruncatingStore(); 2313 } 2314 2315 /// isTRUNCStore - Returns true if the specified node is a truncating 2316 /// store. 2317 inline bool isTRUNCStore(const SDNode *N) { 2318 return isa<StoreSDNode>(N) && cast<StoreSDNode>(N)->isTruncatingStore(); 2319 } 2320 2321 /// isUNINDEXEDStore - Returns true if the specified node is an 2322 /// unindexed store. 2323 inline bool isUNINDEXEDStore(const SDNode *N) { 2324 return isa<StoreSDNode>(N) && 2325 cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED; 2326 } 2327} 2328 2329 2330} // end llvm namespace 2331 2332#endif 2333