LLVM API Documentation
00001 //===-- llvm/CodeGen/SelectionDAGNodes.h - SelectionDAG Nodes ---*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file declares the SDNode class and derived classes, which are used to 00011 // represent the nodes and operations present in a SelectionDAG. These nodes 00012 // and operations are machine code level operations, with some similarities to 00013 // the GCC RTL representation. 00014 // 00015 // Clients should include the SelectionDAG.h file instead of this file directly. 00016 // 00017 //===----------------------------------------------------------------------===// 00018 00019 #ifndef LLVM_CODEGEN_SELECTIONDAGNODES_H 00020 #define LLVM_CODEGEN_SELECTIONDAGNODES_H 00021 00022 #include "llvm/Constants.h" 00023 #include "llvm/ADT/FoldingSet.h" 00024 #include "llvm/ADT/GraphTraits.h" 00025 #include "llvm/ADT/iterator.h" 00026 #include "llvm/ADT/ilist_node.h" 00027 #include "llvm/ADT/STLExtras.h" 00028 #include "llvm/CodeGen/ValueTypes.h" 00029 #include "llvm/CodeGen/MachineMemOperand.h" 00030 #include "llvm/Support/Allocator.h" 00031 #include "llvm/Support/RecyclingAllocator.h" 00032 #include "llvm/Support/DataTypes.h" 00033 #include <cassert> 00034 00035 namespace llvm { 00036 00037 class SelectionDAG; 00038 class GlobalValue; 00039 class MachineBasicBlock; 00040 class MachineConstantPoolValue; 00041 class SDNode; 00042 class CompileUnitDesc; 00043 template <typename T> struct DenseMapInfo; 00044 template <typename T> struct simplify_type; 00045 template <typename T> struct ilist_traits; 00046 00047 /// SDVTList - This represents a list of ValueType's that has been intern'd by 00048 /// a SelectionDAG. Instances of this simple value class are returned by 00049 /// SelectionDAG::getVTList(...). 00050 /// 00051 struct SDVTList { 00052 const MVT *VTs; 00053 unsigned short NumVTs; 00054 }; 00055 00056 /// ISD namespace - This namespace contains an enum which represents all of the 00057 /// SelectionDAG node types and value types. 00058 /// 00059 namespace ISD { 00060 00061 //===--------------------------------------------------------------------===// 00062 /// ISD::NodeType enum - This enum defines all of the operators valid in a 00063 /// SelectionDAG. 00064 /// 00065 enum NodeType { 00066 // DELETED_NODE - This is an illegal flag value that is used to catch 00067 // errors. This opcode is not a legal opcode for any node. 00068 DELETED_NODE, 00069 00070 // EntryToken - This is the marker used to indicate the start of the region. 00071 EntryToken, 00072 00073 // TokenFactor - This node takes multiple tokens as input and produces a 00074 // single token result. This is used to represent the fact that the operand 00075 // operators are independent of each other. 00076 TokenFactor, 00077 00078 // AssertSext, AssertZext - These nodes record if a register contains a 00079 // value that has already been zero or sign extended from a narrower type. 00080 // These nodes take two operands. The first is the node that has already 00081 // been extended, and the second is a value type node indicating the width 00082 // of the extension 00083 AssertSext, AssertZext, 00084 00085 // Various leaf nodes. 00086 BasicBlock, VALUETYPE, ARG_FLAGS, CONDCODE, Register, 00087 Constant, ConstantFP, 00088 GlobalAddress, GlobalTLSAddress, FrameIndex, 00089 JumpTable, ConstantPool, ExternalSymbol, 00090 00091 // The address of the GOT 00092 GLOBAL_OFFSET_TABLE, 00093 00094 // FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and 00095 // llvm.returnaddress on the DAG. These nodes take one operand, the index 00096 // of the frame or return address to return. An index of zero corresponds 00097 // to the current function's frame or return address, an index of one to the 00098 // parent's frame or return address, and so on. 00099 FRAMEADDR, RETURNADDR, 00100 00101 // FRAME_TO_ARGS_OFFSET - This node represents offset from frame pointer to 00102 // first (possible) on-stack argument. This is needed for correct stack 00103 // adjustment during unwind. 00104 FRAME_TO_ARGS_OFFSET, 00105 00106 // RESULT, OUTCHAIN = EXCEPTIONADDR(INCHAIN) - This node represents the 00107 // address of the exception block on entry to an landing pad block. 00108 EXCEPTIONADDR, 00109 00110 // RESULT, OUTCHAIN = EHSELECTION(INCHAIN, EXCEPTION) - This node represents 00111 // the selection index of the exception thrown. 00112 EHSELECTION, 00113 00114 // OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents 00115 // 'eh_return' gcc dwarf builtin, which is used to return from 00116 // exception. The general meaning is: adjust stack by OFFSET and pass 00117 // execution to HANDLER. Many platform-related details also :) 00118 EH_RETURN, 00119 00120 // TargetConstant* - Like Constant*, but the DAG does not do any folding or 00121 // simplification of the constant. 00122 TargetConstant, 00123 TargetConstantFP, 00124 00125 // TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or 00126 // anything else with this node, and this is valid in the target-specific 00127 // dag, turning into a GlobalAddress operand. 00128 TargetGlobalAddress, 00129 TargetGlobalTLSAddress, 00130 TargetFrameIndex, 00131 TargetJumpTable, 00132 TargetConstantPool, 00133 TargetExternalSymbol, 00134 00135 /// RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) 00136 /// This node represents a target intrinsic function with no side effects. 00137 /// The first operand is the ID number of the intrinsic from the 00138 /// llvm::Intrinsic namespace. The operands to the intrinsic follow. The 00139 /// node has returns the result of the intrinsic. 00140 INTRINSIC_WO_CHAIN, 00141 00142 /// RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) 00143 /// This node represents a target intrinsic function with side effects that 00144 /// returns a result. The first operand is a chain pointer. The second is 00145 /// the ID number of the intrinsic from the llvm::Intrinsic namespace. The 00146 /// operands to the intrinsic follow. The node has two results, the result 00147 /// of the intrinsic and an output chain. 00148 INTRINSIC_W_CHAIN, 00149 00150 /// OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) 00151 /// This node represents a target intrinsic function with side effects that 00152 /// does not return a result. The first operand is a chain pointer. The 00153 /// second is the ID number of the intrinsic from the llvm::Intrinsic 00154 /// namespace. The operands to the intrinsic follow. 00155 INTRINSIC_VOID, 00156 00157 // CopyToReg - This node has three operands: a chain, a register number to 00158 // set to this value, and a value. 00159 CopyToReg, 00160 00161 // CopyFromReg - This node indicates that the input value is a virtual or 00162 // physical register that is defined outside of the scope of this 00163 // SelectionDAG. The register is available from the RegisterSDNode object. 00164 CopyFromReg, 00165 00166 // UNDEF - An undefined node 00167 UNDEF, 00168 00169 /// FORMAL_ARGUMENTS(CHAIN, CC#, ISVARARG, FLAG0, ..., FLAGn) - This node 00170 /// represents the formal arguments for a function. CC# is a Constant value 00171 /// indicating the calling convention of the function, and ISVARARG is a 00172 /// flag that indicates whether the function is varargs or not. This node 00173 /// has one result value for each incoming argument, plus one for the output 00174 /// chain. It must be custom legalized. See description of CALL node for 00175 /// FLAG argument contents explanation. 00176 /// 00177 FORMAL_ARGUMENTS, 00178 00179 /// RV1, RV2...RVn, CHAIN = CALL(CHAIN, CALLEE, 00180 /// ARG0, FLAG0, ARG1, FLAG1, ... ARGn, FLAGn) 00181 /// This node represents a fully general function call, before the legalizer 00182 /// runs. This has one result value for each argument / flag pair, plus 00183 /// a chain result. It must be custom legalized. Flag argument indicates 00184 /// misc. argument attributes. Currently: 00185 /// Bit 0 - signness 00186 /// Bit 1 - 'inreg' attribute 00187 /// Bit 2 - 'sret' attribute 00188 /// Bit 4 - 'byval' attribute 00189 /// Bit 5 - 'nest' attribute 00190 /// Bit 6-9 - alignment of byval structures 00191 /// Bit 10-26 - size of byval structures 00192 /// Bits 31:27 - argument ABI alignment in the first argument piece and 00193 /// alignment '1' in other argument pieces. 00194 /// 00195 /// CALL nodes use the CallSDNode subclass of SDNode, which 00196 /// additionally carries information about the calling convention, 00197 /// whether the call is varargs, and if it's marked as a tail call. 00198 /// 00199 CALL, 00200 00201 // EXTRACT_ELEMENT - This is used to get the lower or upper (determined by 00202 // a Constant, which is required to be operand #1) half of the integer or 00203 // float value specified as operand #0. This is only for use before 00204 // legalization, for values that will be broken into multiple registers. 00205 EXTRACT_ELEMENT, 00206 00207 // BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways. Given 00208 // two values of the same integer value type, this produces a value twice as 00209 // big. Like EXTRACT_ELEMENT, this can only be used before legalization. 00210 BUILD_PAIR, 00211 00212 // MERGE_VALUES - This node takes multiple discrete operands and returns 00213 // them all as its individual results. This nodes has exactly the same 00214 // number of inputs and outputs, and is only valid before legalization. 00215 // This node is useful for some pieces of the code generator that want to 00216 // think about a single node with multiple results, not multiple nodes. 00217 MERGE_VALUES, 00218 00219 // Simple integer binary arithmetic operators. 00220 ADD, SUB, MUL, SDIV, UDIV, SREM, UREM, 00221 00222 // SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing 00223 // a signed/unsigned value of type i[2*N], and return the full value as 00224 // two results, each of type iN. 00225 SMUL_LOHI, UMUL_LOHI, 00226 00227 // SDIVREM/UDIVREM - Divide two integers and produce both a quotient and 00228 // remainder result. 00229 SDIVREM, UDIVREM, 00230 00231 // CARRY_FALSE - This node is used when folding other nodes, 00232 // like ADDC/SUBC, which indicate the carry result is always false. 00233 CARRY_FALSE, 00234 00235 // Carry-setting nodes for multiple precision addition and subtraction. 00236 // These nodes take two operands of the same value type, and produce two 00237 // results. The first result is the normal add or sub result, the second 00238 // result is the carry flag result. 00239 ADDC, SUBC, 00240 00241 // Carry-using nodes for multiple precision addition and subtraction. These 00242 // nodes take three operands: The first two are the normal lhs and rhs to 00243 // the add or sub, and the third is the input carry flag. These nodes 00244 // produce two results; the normal result of the add or sub, and the output 00245 // carry flag. These nodes both read and write a carry flag to allow them 00246 // to them to be chained together for add and sub of arbitrarily large 00247 // values. 00248 ADDE, SUBE, 00249 00250 // RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition. 00251 // These nodes take two operands: the normal LHS and RHS to the add. They 00252 // produce two results: the normal result of the add, and a boolean that 00253 // indicates if an overflow occured (*not* a flag, because it may be stored 00254 // to memory, etc.). If the type of the boolean is not i1 then the high 00255 // bits conform to getBooleanContents. 00256 // These nodes are generated from the llvm.[su]add.with.overflow intrinsics. 00257 SADDO, UADDO, 00258 00259 // Same for subtraction 00260 SSUBO, USUBO, 00261 00262 // Same for multiplication 00263 SMULO, UMULO, 00264 00265 // Simple binary floating point operators. 00266 FADD, FSUB, FMUL, FDIV, FREM, 00267 00268 // FCOPYSIGN(X, Y) - Return the value of X with the sign of Y. NOTE: This 00269 // DAG node does not require that X and Y have the same type, just that they 00270 // are both floating point. X and the result must have the same type. 00271 // FCOPYSIGN(f32, f64) is allowed. 00272 FCOPYSIGN, 00273 00274 // INT = FGETSIGN(FP) - Return the sign bit of the specified floating point 00275 // value as an integer 0/1 value. 00276 FGETSIGN, 00277 00278 /// BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector 00279 /// with the specified, possibly variable, elements. The number of elements 00280 /// is required to be a power of two. 00281 BUILD_VECTOR, 00282 00283 /// INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element 00284 /// at IDX replaced with VAL. If the type of VAL is larger than the vector 00285 /// element type then VAL is truncated before replacement. 00286 INSERT_VECTOR_ELT, 00287 00288 /// EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR 00289 /// identified by the (potentially variable) element number IDX. 00290 EXTRACT_VECTOR_ELT, 00291 00292 /// CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of 00293 /// vector type with the same length and element type, this produces a 00294 /// concatenated vector result value, with length equal to the sum of the 00295 /// lengths of the input vectors. 00296 CONCAT_VECTORS, 00297 00298 /// EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an 00299 /// vector value) starting with the (potentially variable) element number 00300 /// IDX, which must be a multiple of the result vector length. 00301 EXTRACT_SUBVECTOR, 00302 00303 /// VECTOR_SHUFFLE(VEC1, VEC2, SHUFFLEVEC) - Returns a vector, of the same 00304 /// type as VEC1/VEC2. SHUFFLEVEC is a BUILD_VECTOR of constant int values 00305 /// (maybe of an illegal datatype) or undef that indicate which value each 00306 /// result element will get. The elements of VEC1/VEC2 are enumerated in 00307 /// order. This is quite similar to the Altivec 'vperm' instruction, except 00308 /// that the indices must be constants and are in terms of the element size 00309 /// of VEC1/VEC2, not in terms of bytes. 00310 VECTOR_SHUFFLE, 00311 00312 /// SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a 00313 /// scalar value into element 0 of the resultant vector type. The top 00314 /// elements 1 to N-1 of the N-element vector are undefined. 00315 SCALAR_TO_VECTOR, 00316 00317 // EXTRACT_SUBREG - This node is used to extract a sub-register value. 00318 // This node takes a superreg and a constant sub-register index as operands. 00319 // Note sub-register indices must be increasing. That is, if the 00320 // sub-register index of a 8-bit sub-register is N, then the index for a 00321 // 16-bit sub-register must be at least N+1. 00322 EXTRACT_SUBREG, 00323 00324 // INSERT_SUBREG - This node is used to insert a sub-register value. 00325 // This node takes a superreg, a subreg value, and a constant sub-register 00326 // index as operands. 00327 INSERT_SUBREG, 00328 00329 // MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing 00330 // an unsigned/signed value of type i[2*N], then return the top part. 00331 MULHU, MULHS, 00332 00333 // Bitwise operators - logical and, logical or, logical xor, shift left, 00334 // shift right algebraic (shift in sign bits), shift right logical (shift in 00335 // zeroes), rotate left, rotate right, and byteswap. 00336 AND, OR, XOR, SHL, SRA, SRL, ROTL, ROTR, BSWAP, 00337 00338 // Counting operators 00339 CTTZ, CTLZ, CTPOP, 00340 00341 // Select(COND, TRUEVAL, FALSEVAL). If the type of the boolean COND is not 00342 // i1 then the high bits must conform to getBooleanContents. 00343 SELECT, 00344 00345 // Select with condition operator - This selects between a true value and 00346 // a false value (ops #2 and #3) based on the boolean result of comparing 00347 // the lhs and rhs (ops #0 and #1) of a conditional expression with the 00348 // condition code in op #4, a CondCodeSDNode. 00349 SELECT_CC, 00350 00351 // SetCC operator - This evaluates to a true value iff the condition is 00352 // true. If the result value type is not i1 then the high bits conform 00353 // to getBooleanContents. The operands to this are the left and right 00354 // operands to compare (ops #0, and #1) and the condition code to compare 00355 // them with (op #2) as a CondCodeSDNode. 00356 SETCC, 00357 00358 // Vector SetCC operator - This evaluates to a vector of integer elements 00359 // with the high bit in each element set to true if the comparison is true 00360 // and false if the comparison is false. All other bits in each element 00361 // are undefined. The operands to this are the left and right operands 00362 // to compare (ops #0, and #1) and the condition code to compare them with 00363 // (op #2) as a CondCodeSDNode. 00364 VSETCC, 00365 00366 // SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded 00367 // integer shift operations, just like ADD/SUB_PARTS. The operation 00368 // ordering is: 00369 // [Lo,Hi] = op [LoLHS,HiLHS], Amt 00370 SHL_PARTS, SRA_PARTS, SRL_PARTS, 00371 00372 // Conversion operators. These are all single input single output 00373 // operations. For all of these, the result type must be strictly 00374 // wider or narrower (depending on the operation) than the source 00375 // type. 00376 00377 // SIGN_EXTEND - Used for integer types, replicating the sign bit 00378 // into new bits. 00379 SIGN_EXTEND, 00380 00381 // ZERO_EXTEND - Used for integer types, zeroing the new bits. 00382 ZERO_EXTEND, 00383 00384 // ANY_EXTEND - Used for integer types. The high bits are undefined. 00385 ANY_EXTEND, 00386 00387 // TRUNCATE - Completely drop the high bits. 00388 TRUNCATE, 00389 00390 // [SU]INT_TO_FP - These operators convert integers (whose interpreted sign 00391 // depends on the first letter) to floating point. 00392 SINT_TO_FP, 00393 UINT_TO_FP, 00394 00395 // SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to 00396 // sign extend a small value in a large integer register (e.g. sign 00397 // extending the low 8 bits of a 32-bit register to fill the top 24 bits 00398 // with the 7th bit). The size of the smaller type is indicated by the 1th 00399 // operand, a ValueType node. 00400 SIGN_EXTEND_INREG, 00401 00402 /// FP_TO_[US]INT - Convert a floating point value to a signed or unsigned 00403 /// integer. 00404 FP_TO_SINT, 00405 FP_TO_UINT, 00406 00407 /// X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type 00408 /// down to the precision of the destination VT. TRUNC is a flag, which is 00409 /// always an integer that is zero or one. If TRUNC is 0, this is a 00410 /// normal rounding, if it is 1, this FP_ROUND is known to not change the 00411 /// value of Y. 00412 /// 00413 /// The TRUNC = 1 case is used in cases where we know that the value will 00414 /// not be modified by the node, because Y is not using any of the extra 00415 /// precision of source type. This allows certain transformations like 00416 /// FP_EXTEND(FP_ROUND(X,1)) -> X which are not safe for 00417 /// FP_EXTEND(FP_ROUND(X,0)) because the extra bits aren't removed. 00418 FP_ROUND, 00419 00420 // FLT_ROUNDS_ - Returns current rounding mode: 00421 // -1 Undefined 00422 // 0 Round to 0 00423 // 1 Round to nearest 00424 // 2 Round to +inf 00425 // 3 Round to -inf 00426 FLT_ROUNDS_, 00427 00428 /// X = FP_ROUND_INREG(Y, VT) - This operator takes an FP register, and 00429 /// rounds it to a floating point value. It then promotes it and returns it 00430 /// in a register of the same size. This operation effectively just 00431 /// discards excess precision. The type to round down to is specified by 00432 /// the VT operand, a VTSDNode. 00433 FP_ROUND_INREG, 00434 00435 /// X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type. 00436 FP_EXTEND, 00437 00438 // BIT_CONVERT - Theis operator converts between integer and FP values, as 00439 // if one was stored to memory as integer and the other was loaded from the 00440 // same address (or equivalently for vector format conversions, etc). The 00441 // source and result are required to have the same bit size (e.g. 00442 // f32 <-> i32). This can also be used for int-to-int or fp-to-fp 00443 // conversions, but that is a noop, deleted by getNode(). 00444 BIT_CONVERT, 00445 00446 // CONVERT_RNDSAT - This operator is used to support various conversions 00447 // between various types (float, signed, unsigned and vectors of those 00448 // types) with rounding and saturation. NOTE: Avoid using this operator as 00449 // most target don't support it and the operator might be removed in the 00450 // future. It takes the following arguments: 00451 // 0) value 00452 // 1) dest type (type to convert to) 00453 // 2) src type (type to convert from) 00454 // 3) rounding imm 00455 // 4) saturation imm 00456 // 5) ISD::CvtCode indicating the type of conversion to do 00457 CONVERT_RNDSAT, 00458 00459 // FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, 00460 // FLOG, FLOG2, FLOG10, FEXP, FEXP2, 00461 // FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR - Perform various unary floating 00462 // point operations. These are inspired by libm. 00463 FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, 00464 FLOG, FLOG2, FLOG10, FEXP, FEXP2, 00465 FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR, 00466 00467 // LOAD and STORE have token chains as their first operand, then the same 00468 // operands as an LLVM load/store instruction, then an offset node that 00469 // is added / subtracted from the base pointer to form the address (for 00470 // indexed memory ops). 00471 LOAD, STORE, 00472 00473 // DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned 00474 // to a specified boundary. This node always has two return values: a new 00475 // stack pointer value and a chain. The first operand is the token chain, 00476 // the second is the number of bytes to allocate, and the third is the 00477 // alignment boundary. The size is guaranteed to be a multiple of the stack 00478 // alignment, and the alignment is guaranteed to be bigger than the stack 00479 // alignment (if required) or 0 to get standard stack alignment. 00480 DYNAMIC_STACKALLOC, 00481 00482 // Control flow instructions. These all have token chains. 00483 00484 // BR - Unconditional branch. The first operand is the chain 00485 // operand, the second is the MBB to branch to. 00486 BR, 00487 00488 // BRIND - Indirect branch. The first operand is the chain, the second 00489 // is the value to branch to, which must be of the same type as the target's 00490 // pointer type. 00491 BRIND, 00492 00493 // BR_JT - Jumptable branch. The first operand is the chain, the second 00494 // is the jumptable index, the last one is the jumptable entry index. 00495 BR_JT, 00496 00497 // BRCOND - Conditional branch. The first operand is the chain, the 00498 // second is the condition, the third is the block to branch to if the 00499 // condition is true. If the type of the condition is not i1, then the 00500 // high bits must conform to getBooleanContents. 00501 BRCOND, 00502 00503 // BR_CC - Conditional branch. The behavior is like that of SELECT_CC, in 00504 // that the condition is represented as condition code, and two nodes to 00505 // compare, rather than as a combined SetCC node. The operands in order are 00506 // chain, cc, lhs, rhs, block to branch to if condition is true. 00507 BR_CC, 00508 00509 // RET - Return from function. The first operand is the chain, 00510 // and any subsequent operands are pairs of return value and return value 00511 // attributes (see CALL for description of attributes) for the function. 00512 // This operation can have variable number of operands. 00513 RET, 00514 00515 // INLINEASM - Represents an inline asm block. This node always has two 00516 // return values: a chain and a flag result. The inputs are as follows: 00517 // Operand #0 : Input chain. 00518 // Operand #1 : a ExternalSymbolSDNode with a pointer to the asm string. 00519 // Operand #2n+2: A RegisterNode. 00520 // Operand #2n+3: A TargetConstant, indicating if the reg is a use/def 00521 // Operand #last: Optional, an incoming flag. 00522 INLINEASM, 00523 00524 // DBG_LABEL, EH_LABEL - Represents a label in mid basic block used to track 00525 // locations needed for debug and exception handling tables. These nodes 00526 // take a chain as input and return a chain. 00527 DBG_LABEL, 00528 EH_LABEL, 00529 00530 // DECLARE - Represents a llvm.dbg.declare intrinsic. It's used to track 00531 // local variable declarations for debugging information. First operand is 00532 // a chain, while the next two operands are first two arguments (address 00533 // and variable) of a llvm.dbg.declare instruction. 00534 DECLARE, 00535 00536 // STACKSAVE - STACKSAVE has one operand, an input chain. It produces a 00537 // value, the same type as the pointer type for the system, and an output 00538 // chain. 00539 STACKSAVE, 00540 00541 // STACKRESTORE has two operands, an input chain and a pointer to restore to 00542 // it returns an output chain. 00543 STACKRESTORE, 00544 00545 // CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end of 00546 // a call sequence, and carry arbitrary information that target might want 00547 // to know. The first operand is a chain, the rest are specified by the 00548 // target and not touched by the DAG optimizers. 00549 // CALLSEQ_START..CALLSEQ_END pairs may not be nested. 00550 CALLSEQ_START, // Beginning of a call sequence 00551 CALLSEQ_END, // End of a call sequence 00552 00553 // VAARG - VAARG has three operands: an input chain, a pointer, and a 00554 // SRCVALUE. It returns a pair of values: the vaarg value and a new chain. 00555 VAARG, 00556 00557 // VACOPY - VACOPY has five operands: an input chain, a destination pointer, 00558 // a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the 00559 // source. 00560 VACOPY, 00561 00562 // VAEND, VASTART - VAEND and VASTART have three operands: an input chain, a 00563 // pointer, and a SRCVALUE. 00564 VAEND, VASTART, 00565 00566 // SRCVALUE - This is a node type that holds a Value* that is used to 00567 // make reference to a value in the LLVM IR. 00568 SRCVALUE, 00569 00570 // MEMOPERAND - This is a node that contains a MachineMemOperand which 00571 // records information about a memory reference. This is used to make 00572 // AliasAnalysis queries from the backend. 00573 MEMOPERAND, 00574 00575 // PCMARKER - This corresponds to the pcmarker intrinsic. 00576 PCMARKER, 00577 00578 // READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic. 00579 // The only operand is a chain and a value and a chain are produced. The 00580 // value is the contents of the architecture specific cycle counter like 00581 // register (or other high accuracy low latency clock source) 00582 READCYCLECOUNTER, 00583 00584 // HANDLENODE node - Used as a handle for various purposes. 00585 HANDLENODE, 00586 00587 // DBG_STOPPOINT - This node is used to represent a source location for 00588 // debug info. It takes token chain as input, and carries a line number, 00589 // column number, and a pointer to a CompileUnitDesc object identifying 00590 // the containing compilation unit. It produces a token chain as output. 00591 DBG_STOPPOINT, 00592 00593 // DEBUG_LOC - This node is used to represent source line information 00594 // embedded in the code. It takes a token chain as input, then a line 00595 // number, then a column then a file id (provided by MachineModuleInfo.) It 00596 // produces a token chain as output. 00597 DEBUG_LOC, 00598 00599 // TRAMPOLINE - This corresponds to the init_trampoline intrinsic. 00600 // It takes as input a token chain, the pointer to the trampoline, 00601 // the pointer to the nested function, the pointer to pass for the 00602 // 'nest' parameter, a SRCVALUE for the trampoline and another for 00603 // the nested function (allowing targets to access the original 00604 // Function*). It produces the result of the intrinsic and a token 00605 // chain as output. 00606 TRAMPOLINE, 00607 00608 // TRAP - Trapping instruction 00609 TRAP, 00610 00611 // PREFETCH - This corresponds to a prefetch intrinsic. It takes chains are 00612 // their first operand. The other operands are the address to prefetch, 00613 // read / write specifier, and locality specifier. 00614 PREFETCH, 00615 00616 // OUTCHAIN = MEMBARRIER(INCHAIN, load-load, load-store, store-load, 00617 // store-store, device) 00618 // This corresponds to the memory.barrier intrinsic. 00619 // it takes an input chain, 4 operands to specify the type of barrier, an 00620 // operand specifying if the barrier applies to device and uncached memory 00621 // and produces an output chain. 00622 MEMBARRIER, 00623 00624 // Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) 00625 // this corresponds to the atomic.lcs intrinsic. 00626 // cmp is compared to *ptr, and if equal, swap is stored in *ptr. 00627 // the return is always the original value in *ptr 00628 ATOMIC_CMP_SWAP, 00629 00630 // Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) 00631 // this corresponds to the atomic.swap intrinsic. 00632 // amt is stored to *ptr atomically. 00633 // the return is always the original value in *ptr 00634 ATOMIC_SWAP, 00635 00636 // Val, OUTCHAIN = ATOMIC_L[OpName]S(INCHAIN, ptr, amt) 00637 // this corresponds to the atomic.[OpName] intrinsic. 00638 // op(*ptr, amt) is stored to *ptr atomically. 00639 // the return is always the original value in *ptr 00640 ATOMIC_LOAD_ADD, 00641 ATOMIC_LOAD_SUB, 00642 ATOMIC_LOAD_AND, 00643 ATOMIC_LOAD_OR, 00644 ATOMIC_LOAD_XOR, 00645 ATOMIC_LOAD_NAND, 00646 ATOMIC_LOAD_MIN, 00647 ATOMIC_LOAD_MAX, 00648 ATOMIC_LOAD_UMIN, 00649 ATOMIC_LOAD_UMAX, 00650 00651 // BUILTIN_OP_END - This must be the last enum value in this list. 00652 BUILTIN_OP_END 00653 }; 00654 00655 /// Node predicates 00656 00657 /// isBuildVectorAllOnes - Return true if the specified node is a 00658 /// BUILD_VECTOR where all of the elements are ~0 or undef. 00659 bool isBuildVectorAllOnes(const SDNode *N); 00660 00661 /// isBuildVectorAllZeros - Return true if the specified node is a 00662 /// BUILD_VECTOR where all of the elements are 0 or undef. 00663 bool isBuildVectorAllZeros(const SDNode *N); 00664 00665 /// isScalarToVector - Return true if the specified node is a 00666 /// ISD::SCALAR_TO_VECTOR node or a BUILD_VECTOR node where only the low 00667 /// element is not an undef. 00668 bool isScalarToVector(const SDNode *N); 00669 00670 /// isDebugLabel - Return true if the specified node represents a debug 00671 /// label (i.e. ISD::DBG_LABEL or TargetInstrInfo::DBG_LABEL node). 00672 bool isDebugLabel(const SDNode *N); 00673 00674 //===--------------------------------------------------------------------===// 00675 /// MemIndexedMode enum - This enum defines the load / store indexed 00676 /// addressing modes. 00677 /// 00678 /// UNINDEXED "Normal" load / store. The effective address is already 00679 /// computed and is available in the base pointer. The offset 00680 /// operand is always undefined. In addition to producing a 00681 /// chain, an unindexed load produces one value (result of the 00682 /// load); an unindexed store does not produce a value. 00683 /// 00684 /// PRE_INC Similar to the unindexed mode where the effective address is 00685 /// PRE_DEC the value of the base pointer add / subtract the offset. 00686 /// It considers the computation as being folded into the load / 00687 /// store operation (i.e. the load / store does the address 00688 /// computation as well as performing the memory transaction). 00689 /// The base operand is always undefined. In addition to 00690 /// producing a chain, pre-indexed load produces two values 00691 /// (result of the load and the result of the address 00692 /// computation); a pre-indexed store produces one value (result 00693 /// of the address computation). 00694 /// 00695 /// POST_INC The effective address is the value of the base pointer. The 00696 /// POST_DEC value of the offset operand is then added to / subtracted 00697 /// from the base after memory transaction. In addition to 00698 /// producing a chain, post-indexed load produces two values 00699 /// (the result of the load and the result of the base +/- offset 00700 /// computation); a post-indexed store produces one value (the 00701 /// the result of the base +/- offset computation). 00702 /// 00703 enum MemIndexedMode { 00704 UNINDEXED = 0, 00705 PRE_INC, 00706 PRE_DEC, 00707 POST_INC, 00708 POST_DEC, 00709 LAST_INDEXED_MODE 00710 }; 00711 00712 //===--------------------------------------------------------------------===// 00713 /// LoadExtType enum - This enum defines the three variants of LOADEXT 00714 /// (load with extension). 00715 /// 00716 /// SEXTLOAD loads the integer operand and sign extends it to a larger 00717 /// integer result type. 00718 /// ZEXTLOAD loads the integer operand and zero extends it to a larger 00719 /// integer result type. 00720 /// EXTLOAD is used for three things: floating point extending loads, 00721 /// integer extending loads [the top bits are undefined], and vector 00722 /// extending loads [load into low elt]. 00723 /// 00724 enum LoadExtType { 00725 NON_EXTLOAD = 0, 00726 EXTLOAD, 00727 SEXTLOAD, 00728 ZEXTLOAD, 00729 LAST_LOADEXT_TYPE 00730 }; 00731 00732 //===--------------------------------------------------------------------===// 00733 /// ISD::CondCode enum - These are ordered carefully to make the bitfields 00734 /// below work out, when considering SETFALSE (something that never exists 00735 /// dynamically) as 0. "U" -> Unsigned (for integer operands) or Unordered 00736 /// (for floating point), "L" -> Less than, "G" -> Greater than, "E" -> Equal 00737 /// to. If the "N" column is 1, the result of the comparison is undefined if 00738 /// the input is a NAN. 00739 /// 00740 /// All of these (except for the 'always folded ops') should be handled for 00741 /// floating point. For integer, only the SETEQ,SETNE,SETLT,SETLE,SETGT, 00742 /// SETGE,SETULT,SETULE,SETUGT, and SETUGE opcodes are used. 00743 /// 00744 /// Note that these are laid out in a specific order to allow bit-twiddling 00745 /// to transform conditions. 00746 enum CondCode { 00747 // Opcode N U L G E Intuitive operation 00748 SETFALSE, // 0 0 0 0 Always false (always folded) 00749 SETOEQ, // 0 0 0 1 True if ordered and equal 00750 SETOGT, // 0 0 1 0 True if ordered and greater than 00751 SETOGE, // 0 0 1 1 True if ordered and greater than or equal 00752 SETOLT, // 0 1 0 0 True if ordered and less than 00753 SETOLE, // 0 1 0 1 True if ordered and less than or equal 00754 SETONE, // 0 1 1 0 True if ordered and operands are unequal 00755 SETO, // 0 1 1 1 True if ordered (no nans) 00756 SETUO, // 1 0 0 0 True if unordered: isnan(X) | isnan(Y) 00757 SETUEQ, // 1 0 0 1 True if unordered or equal 00758 SETUGT, // 1 0 1 0 True if unordered or greater than 00759 SETUGE, // 1 0 1 1 True if unordered, greater than, or equal 00760 SETULT, // 1 1 0 0 True if unordered or less than 00761 SETULE, // 1 1 0 1 True if unordered, less than, or equal 00762 SETUNE, // 1 1 1 0 True if unordered or not equal 00763 SETTRUE, // 1 1 1 1 Always true (always folded) 00764 // Don't care operations: undefined if the input is a nan. 00765 SETFALSE2, // 1 X 0 0 0 Always false (always folded) 00766 SETEQ, // 1 X 0 0 1 True if equal 00767 SETGT, // 1 X 0 1 0 True if greater than 00768 SETGE, // 1 X 0 1 1 True if greater than or equal 00769 SETLT, // 1 X 1 0 0 True if less than 00770 SETLE, // 1 X 1 0 1 True if less than or equal 00771 SETNE, // 1 X 1 1 0 True if not equal 00772 SETTRUE2, // 1 X 1 1 1 Always true (always folded) 00773 00774 SETCC_INVALID // Marker value. 00775 }; 00776 00777 /// isSignedIntSetCC - Return true if this is a setcc instruction that 00778 /// performs a signed comparison when used with integer operands. 00779 inline bool isSignedIntSetCC(CondCode Code) { 00780 return Code == SETGT || Code == SETGE || Code == SETLT || Code == SETLE; 00781 } 00782 00783 /// isUnsignedIntSetCC - Return true if this is a setcc instruction that 00784 /// performs an unsigned comparison when used with integer operands. 00785 inline bool isUnsignedIntSetCC(CondCode Code) { 00786 return Code == SETUGT || Code == SETUGE || Code == SETULT || Code == SETULE; 00787 } 00788 00789 /// isTrueWhenEqual - Return true if the specified condition returns true if 00790 /// the two operands to the condition are equal. Note that if one of the two 00791 /// operands is a NaN, this value is meaningless. 00792 inline bool isTrueWhenEqual(CondCode Cond) { 00793 return ((int)Cond & 1) != 0; 00794 } 00795 00796 /// getUnorderedFlavor - This function returns 0 if the condition is always 00797 /// false if an operand is a NaN, 1 if the condition is always true if the 00798 /// operand is a NaN, and 2 if the condition is undefined if the operand is a 00799 /// NaN. 00800 inline unsigned getUnorderedFlavor(CondCode Cond) { 00801 return ((int)Cond >> 3) & 3; 00802 } 00803 00804 /// getSetCCInverse - Return the operation corresponding to !(X op Y), where 00805 /// 'op' is a valid SetCC operation. 00806 CondCode getSetCCInverse(CondCode Operation, bool isInteger); 00807 00808 /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X) 00809 /// when given the operation for (X op Y). 00810 CondCode getSetCCSwappedOperands(CondCode Operation); 00811 00812 /// getSetCCOrOperation - Return the result of a logical OR between different 00813 /// comparisons of identical values: ((X op1 Y) | (X op2 Y)). This 00814 /// function returns SETCC_INVALID if it is not possible to represent the 00815 /// resultant comparison. 00816 CondCode getSetCCOrOperation(CondCode Op1, CondCode Op2, bool isInteger); 00817 00818 /// getSetCCAndOperation - Return the result of a logical AND between 00819 /// different comparisons of identical values: ((X op1 Y) & (X op2 Y)). This 00820 /// function returns SETCC_INVALID if it is not possible to represent the 00821 /// resultant comparison. 00822 CondCode getSetCCAndOperation(CondCode Op1, CondCode Op2, bool isInteger); 00823 00824 //===--------------------------------------------------------------------===// 00825 /// CvtCode enum - This enum defines the various converts CONVERT_RNDSAT 00826 /// supports. 00827 enum CvtCode { 00828 CVT_FF, // Float from Float 00829