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