14031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//===-- llvm/CodeGen/ISDOpcodes.h - CodeGen opcodes -------------*- C++ -*-===//
24031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//
34031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//                     The LLVM Compiler Infrastructure
44031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//
54031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman// This file is distributed under the University of Illinois Open Source
64031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman// License. See LICENSE.TXT for details.
74031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//
84031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//===----------------------------------------------------------------------===//
94031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//
104031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman// This file declares codegen opcodes and related utilities.
114031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//
124031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//===----------------------------------------------------------------------===//
134031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
144031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman#ifndef LLVM_CODEGEN_ISDOPCODES_H
154031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman#define LLVM_CODEGEN_ISDOPCODES_H
164031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
174031d59685cef09fad651dd39020ccca4c13ef89Dan Gohmannamespace llvm {
184031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
194031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman/// ISD namespace - This namespace contains an enum which represents all of the
204031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman/// SelectionDAG node types and value types.
214031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman///
224031d59685cef09fad651dd39020ccca4c13ef89Dan Gohmannamespace ISD {
234031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
244031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  //===--------------------------------------------------------------------===//
254031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// ISD::NodeType enum - This enum defines the target-independent operators
264031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// for a SelectionDAG.
274031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
284031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// Targets may also define target-dependent operator codes for SDNodes. For
294031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// example, on x86, these are the enum values in the X86ISD namespace.
304031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// Targets should aim to use target-independent operators to model their
314031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// instruction sets as much as possible, and only use target-dependent
324031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// operators when they have special requirements.
334031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
344031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// Finally, during and after selection proper, SNodes may use special
354031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// operator codes that correspond directly with MachineInstr opcodes. These
364031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// are used to represent selected instructions. See the isMachineOpcode()
374031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// and getMachineOpcode() member functions of SDNode.
384031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
394031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  enum NodeType {
40f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// DELETED_NODE - This is an illegal value that is used to catch
41f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// errors.  This opcode is not a legal opcode for any node.
424031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    DELETED_NODE,
434031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
44f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// EntryToken - This is the marker used to indicate the start of a region.
454031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EntryToken,
464031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
47f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// TokenFactor - This node takes multiple tokens as input and produces a
48f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// single token result. This is used to represent the fact that the operand
49f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// operators are independent of each other.
504031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TokenFactor,
514031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
52f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// AssertSext, AssertZext - These nodes record if a register contains a
53f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// value that has already been zero or sign extended from a narrower type.
54f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// These nodes take two operands.  The first is the node that has already
55f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// been extended, and the second is a value type node indicating the width
56f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// of the extension
574031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    AssertSext, AssertZext,
584031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
59f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Various leaf nodes.
609cf37e8b48732fccd4c301ed51aafed7074bd84eJakob Stoklund Olesen    BasicBlock, VALUETYPE, CONDCODE, Register, RegisterMask,
614031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    Constant, ConstantFP,
624031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    GlobalAddress, GlobalTLSAddress, FrameIndex,
634031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    JumpTable, ConstantPool, ExternalSymbol, BlockAddress,
644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
65f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// The address of the GOT
664031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    GLOBAL_OFFSET_TABLE,
674031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
68f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and
69f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// llvm.returnaddress on the DAG.  These nodes take one operand, the index
70f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// of the frame or return address to return.  An index of zero corresponds
71f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to the current function's frame or return address, an index of one to
72f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// the parent's frame or return address, and so on.
734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FRAMEADDR, RETURNADDR,
744031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
75f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// LOCAL_RECOVER - Represents the llvm.localrecover intrinsic.
76f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// Materializes the offset from the local object pointer of another
77f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// function to a particular local object passed to llvm.localescape. The
78f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// operand is the MCSymbol label used to represent this offset, since
79f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// typically the offset is not known until after code generation of the
80f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// parent.
81f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    LOCAL_RECOVER,
82ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines
83dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines    /// READ_REGISTER, WRITE_REGISTER - This node represents llvm.register on
84dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines    /// the DAG, which implements the named register global variables extension.
85dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines    READ_REGISTER,
86dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines    WRITE_REGISTER,
87dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines
88f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FRAME_TO_ARGS_OFFSET - This node represents offset from frame pointer to
89f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// first (possible) on-stack argument. This is needed for correct stack
90f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// adjustment during unwind.
914031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FRAME_TO_ARGS_OFFSET,
924031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
93f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents
94f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// 'eh_return' gcc dwarf builtin, which is used to return from
95f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// exception. The general meaning is: adjust stack by OFFSET and pass
96f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// execution to HANDLER. Many platform-related details also :)
974031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EH_RETURN,
984031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
99f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// RESULT, OUTCHAIN = EH_SJLJ_SETJMP(INCHAIN, buffer)
100f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// This corresponds to the eh.sjlj.setjmp intrinsic.
101f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// It takes an input chain and a pointer to the jump buffer as inputs
102f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// and returns an outchain.
10323ff7cff52702a8bff904d8ab4c9ca67cc19d6caJim Grosbach    EH_SJLJ_SETJMP,
1045eb195153950bc7ebfc30649494a78b2096b5ef8Jim Grosbach
105f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// OUTCHAIN = EH_SJLJ_LONGJMP(INCHAIN, buffer)
106f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// This corresponds to the eh.sjlj.longjmp intrinsic.
107f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// It takes an input chain and a pointer to the jump buffer as inputs
108f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// and returns an outchain.
1095eb195153950bc7ebfc30649494a78b2096b5ef8Jim Grosbach    EH_SJLJ_LONGJMP,
1105eb195153950bc7ebfc30649494a78b2096b5ef8Jim Grosbach
111f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// OUTCHAIN = EH_SJLJ_SETUP_DISPATCH(INCHAIN)
112f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// The target initializes the dispatch table here.
113f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    EH_SJLJ_SETUP_DISPATCH,
114f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar
115f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// TargetConstant* - Like Constant*, but the DAG does not do any folding,
116f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// simplification, or lowering of the constant. They are used for constants
117f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// which are known to fit in the immediate fields of their users, or for
118f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// carrying magic numbers which are not values which need to be
119f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// materialized in registers.
1204031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetConstant,
1214031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetConstantFP,
1224031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
123f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or
124f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// anything else with this node, and this is valid in the target-specific
125f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// dag, turning into a GlobalAddress operand.
1264031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetGlobalAddress,
1274031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetGlobalTLSAddress,
1284031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetFrameIndex,
1294031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetJumpTable,
1304031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetConstantPool,
1314031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetExternalSymbol,
1324031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetBlockAddress,
1334031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
134f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    MCSymbol,
135f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar
13674500bdba3eae36a1a8a17d8bad0b971b9c212ecJakob Stoklund Olesen    /// TargetIndex - Like a constant pool entry, but with completely
13774500bdba3eae36a1a8a17d8bad0b971b9c212ecJakob Stoklund Olesen    /// target-dependent semantics. Holds target flags, a 32-bit index, and a
13874500bdba3eae36a1a8a17d8bad0b971b9c212ecJakob Stoklund Olesen    /// 64-bit index. Targets can use this however they like.
13974500bdba3eae36a1a8a17d8bad0b971b9c212ecJakob Stoklund Olesen    TargetIndex,
14074500bdba3eae36a1a8a17d8bad0b971b9c212ecJakob Stoklund Olesen
1414031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...)
1424031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// This node represents a target intrinsic function with no side effects.
1434031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// The first operand is the ID number of the intrinsic from the
1444031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// llvm::Intrinsic namespace.  The operands to the intrinsic follow.  The
1452bff8abbf2c02065556332d50c4e4cf86a09034dJim Grosbach    /// node returns the result of the intrinsic.
1464031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    INTRINSIC_WO_CHAIN,
1474031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
1484031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...)
1494031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// This node represents a target intrinsic function with side effects that
1504031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// returns a result.  The first operand is a chain pointer.  The second is
1514031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// the ID number of the intrinsic from the llvm::Intrinsic namespace.  The
1524031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// operands to the intrinsic follow.  The node has two results, the result
1534031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// of the intrinsic and an output chain.
1544031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    INTRINSIC_W_CHAIN,
1554031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
1564031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...)
1574031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// This node represents a target intrinsic function with side effects that
1584031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// does not return a result.  The first operand is a chain pointer.  The
1594031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// second is the ID number of the intrinsic from the llvm::Intrinsic
1604031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// namespace.  The operands to the intrinsic follow.
1614031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    INTRINSIC_VOID,
1624031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
163f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// CopyToReg - This node has three operands: a chain, a register number to
164f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// set to this value, and a value.
1654031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CopyToReg,
1664031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
167f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// CopyFromReg - This node indicates that the input value is a virtual or
168f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// physical register that is defined outside of the scope of this
169f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SelectionDAG.  The register is available from the RegisterSDNode object.
1704031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CopyFromReg,
1714031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
172f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// UNDEF - An undefined node.
1734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    UNDEF,
1744031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
175f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// EXTRACT_ELEMENT - This is used to get the lower or upper (determined by
176f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// a Constant, which is required to be operand #1) half of the integer or
177f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// float value specified as operand #0.  This is only for use before
178f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// legalization, for values that will be broken into multiple registers.
1794031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EXTRACT_ELEMENT,
1804031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
181f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
182f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Given two values of the same integer value type, this produces a value
183f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// twice as big.  Like EXTRACT_ELEMENT, this can only be used before
184f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// legalization.
1854031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BUILD_PAIR,
1864031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
187f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// MERGE_VALUES - This node takes multiple discrete operands and returns
188f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// them all as its individual results.  This nodes has exactly the same
189f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// number of inputs and outputs. This node is useful for some pieces of the
190f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// code generator that want to think about a single node with multiple
191f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// results, not multiple nodes.
1924031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    MERGE_VALUES,
1934031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
194f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Simple integer binary arithmetic operators.
1954031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ADD, SUB, MUL, SDIV, UDIV, SREM, UREM,
1964031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
197f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing
198f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// a signed/unsigned value of type i[2*N], and return the full value as
199f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// two results, each of type iN.
2004031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SMUL_LOHI, UMUL_LOHI,
2014031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
202f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SDIVREM/UDIVREM - Divide two integers and produce both a quotient and
203f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// remainder result.
2044031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SDIVREM, UDIVREM,
2054031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
206f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// CARRY_FALSE - This node is used when folding other nodes,
207f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// like ADDC/SUBC, which indicate the carry result is always false.
2084031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CARRY_FALSE,
2094031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
210f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Carry-setting nodes for multiple precision addition and subtraction.
211f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// These nodes take two operands of the same value type, and produce two
212f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// results.  The first result is the normal add or sub result, the second
213f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// result is the carry flag result.
2144031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ADDC, SUBC,
2154031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
216f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Carry-using nodes for multiple precision addition and subtraction. These
217f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// nodes take three operands: The first two are the normal lhs and rhs to
218f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// the add or sub, and the third is the input carry flag.  These nodes
219f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// produce two results; the normal result of the add or sub, and the output
220f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// carry flag.  These nodes both read and write a carry flag to allow them
221f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to them to be chained together for add and sub of arbitrarily large
222f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// values.
2234031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ADDE, SUBE,
2244031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
225f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
226f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// These nodes take two operands: the normal LHS and RHS to the add. They
227f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// produce two results: the normal result of the add, and a boolean that
228f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// indicates if an overflow occurred (*not* a flag, because it may be store
229f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to memory, etc.).  If the type of the boolean is not i1 then the high
230f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// bits conform to getBooleanContents.
231f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// These nodes are generated from llvm.[su]add.with.overflow intrinsics.
2324031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SADDO, UADDO,
2334031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
234f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Same for subtraction.
2354031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SSUBO, USUBO,
2364031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
237f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Same for multiplication.
2384031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SMULO, UMULO,
2394031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
240f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Simple binary floating point operators.
241ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines    FADD, FSUB, FMUL, FDIV, FREM,
242ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines
243ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines    /// FMA - Perform a * b + c with no intermediate rounding step.
244ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines    FMA,
245ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines
246ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines    /// FMAD - Perform a * b + c, while getting the same result as the
247ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines    /// separately rounded operations.
248ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines    FMAD,
2494031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
250f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.  NOTE: This
2516948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    /// DAG node does not require that X and Y have the same type, just that
2526948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    /// they are both floating point.  X and the result must have the same type.
253f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FCOPYSIGN(f32, f64) is allowed.
2544031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FCOPYSIGN,
2554031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
256f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// INT = FGETSIGN(FP) - Return the sign bit of the specified floating point
257f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// value as an integer 0/1 value.
2584031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FGETSIGN,
2594031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
260de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar    /// Returns platform specific canonical encoding of a floating point number.
261de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar    FCANONICALIZE,
262de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar
2634031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the
2644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// specified, possibly variable, elements.  The number of elements is
2654031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// required to be a power of two.  The types of the operands must all be
2664031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// the same and must match the vector element type, except that integer
2674031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// types are allowed to be larger than the element type, in which case
2684031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// the operands are implicitly truncated.
2694031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BUILD_VECTOR,
2704031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
2714031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element
2724031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// at IDX replaced with VAL.  If the type of VAL is larger than the vector
2734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// element type then VAL is truncated before replacement.
2744031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    INSERT_VECTOR_ELT,
2754031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
2764031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR
2774031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// identified by the (potentially variable) element number IDX.  If the
2784031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// return type is an integer type larger than the element type of the
2794031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// vector, the result is extended to the width of the return type.
2804031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EXTRACT_VECTOR_ELT,
2814031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
2824031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of
2834031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// vector type with the same length and element type, this produces a
2844031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// concatenated vector result value, with length equal to the sum of the
2854031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// lengths of the input vectors.
2864031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CONCAT_VECTORS,
2874031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
288cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    /// INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector
289cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    /// with VECTOR2 inserted into VECTOR1 at the (potentially
290cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    /// variable) element number IDX, which must be a multiple of the
291cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    /// VECTOR2 vector length.  The elements of VECTOR1 starting at
292cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    /// IDX are overwritten with VECTOR2.  Elements IDX through
293cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    /// vector_length(VECTOR2) must be valid VECTOR1 indices.
294cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    INSERT_SUBVECTOR,
295cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene
2964031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an
2976736e19f4c9af1181cedca54ba6e3a1420454928Bob Wilson    /// vector value) starting with the element number IDX, which must be a
2986736e19f4c9af1181cedca54ba6e3a1420454928Bob Wilson    /// constant multiple of the result vector length.
2994031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EXTRACT_SUBVECTOR,
3004031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
301bf17cfa3f904e488e898ac2e3af706fd1a892f08Wesley Peck    /// VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as
3024031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// VEC1/VEC2.  A VECTOR_SHUFFLE node also contains an array of constant int
3034031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// values that indicate which value (or undef) each result element will
304bf17cfa3f904e488e898ac2e3af706fd1a892f08Wesley Peck    /// get.  These constant ints are accessible through the
305bf17cfa3f904e488e898ac2e3af706fd1a892f08Wesley Peck    /// ShuffleVectorSDNode class.  This is quite similar to the Altivec
3064031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// 'vperm' instruction, except that the indices must be constants and are
3074031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// in terms of the element size of VEC1/VEC2, not in terms of bytes.
3084031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    VECTOR_SHUFFLE,
3094031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
3104031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a
3114031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// scalar value into element 0 of the resultant vector type.  The top
3124031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// elements 1 to N-1 of the N-element vector are undefined.  The type
3134031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// of the operand must match the vector element type, except when they
3144031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// are integer types.  In this case the operand is allowed to be wider
3154031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// than the vector element type, and is implicitly truncated to it.
3164031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SCALAR_TO_VECTOR,
3174031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
318f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// MULHU/MULHS - Multiply high - Multiply two integers of type iN,
319f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// producing an unsigned/signed value of type i[2*N], then return the top
320f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// part.
3214031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    MULHU, MULHS,
3224031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
3236948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    /// [US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned
3246948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    /// integers.
3256948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    SMIN, SMAX, UMIN, UMAX,
3266948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar
327e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// Bitwise operators - logical and, logical or, logical xor.
328e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    AND, OR, XOR,
329f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem
330e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// Shift and rotation operations.  After legalization, the type of the
331e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// shift amount is known to be TLI.getShiftAmountTy().  Before legalization
332e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// the shift amount can be any type, but care must be taken to ensure it is
333e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// large enough.  TLI.getShiftAmountTy() is i8 on some targets, but before
334e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// legalization, types like i1024 can occur and i8 doesn't have enough bits
335a6b20ced765b67a85d9219d0c8547fc9c133e14fMichael Liao    /// to represent the shift amount.
336a6b20ced765b67a85d9219d0c8547fc9c133e14fMichael Liao    /// When the 1st operand is a vector, the shift amount must be in the same
337a6b20ced765b67a85d9219d0c8547fc9c133e14fMichael Liao    /// type. (TLI.getShiftAmountTy() will return the same type when the input
338a6b20ced765b67a85d9219d0c8547fc9c133e14fMichael Liao    /// type is a vector.)
339e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    SHL, SRA, SRL, ROTL, ROTR,
340e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner
341e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// Byte Swap and Counting operators.
342f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    BSWAP, CTTZ, CTLZ, CTPOP, BITREVERSE,
3434031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
34463974b2144c87c962effdc0508c27643c8ad98b6Chandler Carruth    /// Bit counting operators with an undefined result for zero inputs.
34563974b2144c87c962effdc0508c27643c8ad98b6Chandler Carruth    CTTZ_ZERO_UNDEF, CTLZ_ZERO_UNDEF,
34663974b2144c87c962effdc0508c27643c8ad98b6Chandler Carruth
347f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Select(COND, TRUEVAL, FALSEVAL).  If the type of the boolean COND is not
348f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// i1 then the high bits must conform to getBooleanContents.
3494031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SELECT,
3504031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
351f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Select with a vector condition (op #0) and two vector operands (ops #1
352f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// and #2), returning a vector result.  All vectors have the same length.
353f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Much like the scalar select and setcc, each bit in the condition selects
354f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// whether the corresponding result element is taken from op #1 or op #2.
355f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// At first, the VSELECT condition is of vXi1 type. Later, targets may
356f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// change the condition type in order to match the VSELECT node using a
357f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// pattern. The condition follows the BooleanContent format of the target.
35828b77e968d2b01fc9da724762bd8ddcd80650e32Duncan Sands    VSELECT,
35928b77e968d2b01fc9da724762bd8ddcd80650e32Duncan Sands
360f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Select with condition operator - This selects between a true value and
361f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// a false value (ops #2 and #3) based on the boolean result of comparing
362f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// the lhs and rhs (ops #0 and #1) of a conditional expression with the
363f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// condition code in op #4, a CondCodeSDNode.
3644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SELECT_CC,
3654031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
36694c22716d60ff5edf6a98a3c67e0faa001be1142Sylvestre Ledru    /// SetCC operator - This evaluates to a true value iff the condition is
367f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// true.  If the result value type is not i1 then the high bits conform
368f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to getBooleanContents.  The operands to this are the left and right
369f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// operands to compare (ops #0, and #1) and the condition code to compare
370f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// them with (op #2) as a CondCodeSDNode. If the operands are vector types
371f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// then the result type must also be a vector type.
3724031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETCC,
3734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
374f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// Like SetCC, ops #0 and #1 are the LHS and RHS operands to compare, but
375f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// op #2 is a *carry value*. This operator checks the result of
376f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// "LHS - RHS - Carry", and can be used to compare two wide integers:
377f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// (setcce lhshi rhshi (subc lhslo rhslo) cc). Only valid for integers.
378f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    SETCCE,
379f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar
380f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded
381f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// integer shift operations.  The operation ordering is:
382f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///       [Lo,Hi] = op [LoLHS,HiLHS], Amt
3834031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SHL_PARTS, SRA_PARTS, SRL_PARTS,
3844031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
385f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Conversion operators.  These are all single input single output
386f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// operations.  For all of these, the result type must be strictly
387f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// wider or narrower (depending on the operation) than the source
388f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// type.
3894031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
390f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SIGN_EXTEND - Used for integer types, replicating the sign bit
391f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// into new bits.
3924031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SIGN_EXTEND,
3934031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
394f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// ZERO_EXTEND - Used for integer types, zeroing the new bits.
3954031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ZERO_EXTEND,
3964031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
397f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// ANY_EXTEND - Used for integer types.  The high bits are undefined.
3984031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ANY_EXTEND,
3994031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
400f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// TRUNCATE - Completely drop the high bits.
4014031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TRUNCATE,
4024031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
403f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// [SU]INT_TO_FP - These operators convert integers (whose interpreted sign
404f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// depends on the first letter) to floating point.
4054031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SINT_TO_FP,
4064031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    UINT_TO_FP,
4074031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
408f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to
409f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// sign extend a small value in a large integer register (e.g. sign
410f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// extending the low 8 bits of a 32-bit register to fill the top 24 bits
411f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// with the 7th bit).  The size of the smaller type is indicated by the 1th
412f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// operand, a ValueType node.
4134031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SIGN_EXTEND_INREG,
4144031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
415c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// ANY_EXTEND_VECTOR_INREG(Vector) - This operator represents an
416c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// in-register any-extension of the low lanes of an integer vector. The
417c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// result type must have fewer elements than the operand type, and those
418c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// elements must be larger integer types such that the total size of the
419c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// operand type and the result type match. Each of the low operand
420c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// elements is any-extended into the corresponding, wider result
421c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// elements with the high bits becoming undef.
422c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    ANY_EXTEND_VECTOR_INREG,
423c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines
424c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// SIGN_EXTEND_VECTOR_INREG(Vector) - This operator represents an
425c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// in-register sign-extension of the low lanes of an integer vector. The
426c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// result type must have fewer elements than the operand type, and those
427c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// elements must be larger integer types such that the total size of the
428c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// operand type and the result type match. Each of the low operand
429c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// elements is sign-extended into the corresponding, wider result
430c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// elements.
431c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    // FIXME: The SIGN_EXTEND_INREG node isn't specifically limited to
432c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    // scalars, but it also doesn't handle vectors well. Either it should be
433c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    // restricted to scalars or this node (and its handling) should be merged
434c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    // into it.
435c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    SIGN_EXTEND_VECTOR_INREG,
436c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines
437c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// ZERO_EXTEND_VECTOR_INREG(Vector) - This operator represents an
438c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// in-register zero-extension of the low lanes of an integer vector. The
439c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// result type must have fewer elements than the operand type, and those
440c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// elements must be larger integer types such that the total size of the
441c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// operand type and the result type match. Each of the low operand
442c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// elements is zero-extended into the corresponding, wider result
443c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// elements.
444c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    ZERO_EXTEND_VECTOR_INREG,
445c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines
4464031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// FP_TO_[US]INT - Convert a floating point value to a signed or unsigned
4474031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// integer.
4484031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FP_TO_SINT,
4494031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FP_TO_UINT,
4504031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
4514031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type
4524031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// down to the precision of the destination VT.  TRUNC is a flag, which is
4534031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// always an integer that is zero or one.  If TRUNC is 0, this is a
4544031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// normal rounding, if it is 1, this FP_ROUND is known to not change the
4554031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// value of Y.
4564031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ///
4574031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// The TRUNC = 1 case is used in cases where we know that the value will
4584031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// not be modified by the node, because Y is not using any of the extra
4594031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// precision of source type.  This allows certain transformations like
4604031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// FP_EXTEND(FP_ROUND(X,1)) -> X which are not safe for
4614031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// FP_EXTEND(FP_ROUND(X,0)) because the extra bits aren't removed.
4624031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FP_ROUND,
4634031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
464f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FLT_ROUNDS_ - Returns current rounding mode:
465f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// -1 Undefined
466f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///  0 Round to 0
467f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///  1 Round to nearest
468f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///  2 Round to +inf
469f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///  3 Round to -inf
4704031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FLT_ROUNDS_,
4714031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
4724031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// X = FP_ROUND_INREG(Y, VT) - This operator takes an FP register, and
4734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// rounds it to a floating point value.  It then promotes it and returns it
4744031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// in a register of the same size.  This operation effectively just
4754031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// discards excess precision.  The type to round down to is specified by
4764031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// the VT operand, a VTSDNode.
4774031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FP_ROUND_INREG,
4784031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
4794031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
4804031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FP_EXTEND,
4814031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
482f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BITCAST - This operator converts between integer, vector and FP
483f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// values, as if the value was stored to memory with one type and loaded
484f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// from the same address with the other type (or equivalently for vector
485f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// format conversions, etc).  The source and result are required to have
486f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// the same bit size (e.g.  f32 <-> i32).  This can also be used for
487f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// int-to-int or fp-to-fp conversions, but that is a noop, deleted by
488f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// getNode().
489de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar    ///
490de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar    /// This operator is subtly different from the bitcast instruction from
491de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar    /// LLVM-IR since this node may change the bits in the register. For
492de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar    /// example, this occurs on big-endian NEON and big-endian MSA where the
493de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar    /// layout of the bits in the register depends on the vector type and this
494de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar    /// operator acts as a shuffle operation for some vector type combinations.
495bf17cfa3f904e488e898ac2e3af706fd1a892f08Wesley Peck    BITCAST,
4964031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
49759d3ae6cdc4316ad338cd848251f33a236ccb36cMatt Arsenault    /// ADDRSPACECAST - This operator converts between pointers of different
49859d3ae6cdc4316ad338cd848251f33a236ccb36cMatt Arsenault    /// address spaces.
49959d3ae6cdc4316ad338cd848251f33a236ccb36cMatt Arsenault    ADDRSPACECAST,
50059d3ae6cdc4316ad338cd848251f33a236ccb36cMatt Arsenault
501f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// CONVERT_RNDSAT - This operator is used to support various conversions
502f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// between various types (float, signed, unsigned and vectors of those
503f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// types) with rounding and saturation. NOTE: Avoid using this operator as
504f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// most target don't support it and the operator might be removed in the
505f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// future. It takes the following arguments:
506f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   0) value
507f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   1) dest type (type to convert to)
508f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   2) src type (type to convert from)
509f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   3) rounding imm
510f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   4) saturation imm
511f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   5) ISD::CvtCode indicating the type of conversion to do
5124031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CONVERT_RNDSAT,
5134031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
51437ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines    /// FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions
51537ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines    /// and truncation for half-precision (16 bit) floating numbers. These nodes
51637ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines    /// form a semi-softened interface for dealing with f16 (as an i16), which
51737ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines    /// is often a storage-only type but has native conversions.
51837ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines    FP16_TO_FP, FP_TO_FP16,
5194031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
520f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW,
521f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FLOG, FLOG2, FLOG10, FEXP, FEXP2,
52241418d17cced656f91038b2482bc9d173b4974b0Hal Finkel    /// FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR - Perform various unary
523f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// floating point operations. These are inspired by libm.
5244031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW,
5254031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FLOG, FLOG2, FLOG10, FEXP, FEXP2,
52641418d17cced656f91038b2482bc9d173b4974b0Hal Finkel    FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR,
527f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two
528f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// values.
529f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// In the case where a single input is NaN, the non-NaN input is returned.
530f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    ///
531f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// The return value of (FMINNUM 0.0, -0.0) could be either 0.0 or -0.0.
53237ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines    FMINNUM, FMAXNUM,
533f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// FMINNAN/FMAXNAN - Behave identically to FMINNUM/FMAXNUM, except that
534f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// when a single input is NaN, NaN is returned.
535f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    FMINNAN, FMAXNAN,
53637ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines
5378688a58c53b46d2dda9bf50dafd5195790a7ed58Evan Cheng    /// FSINCOS - Compute both fsin and fcos as a single operation.
5388688a58c53b46d2dda9bf50dafd5195790a7ed58Evan Cheng    FSINCOS,
5394031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
540f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// LOAD and STORE have token chains as their first operand, then the same
541f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// operands as an LLVM load/store instruction, then an offset node that
542f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// is added / subtracted from the base pointer to form the address (for
543f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// indexed memory ops).
5444031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    LOAD, STORE,
5454031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
546f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned
547f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to a specified boundary.  This node always has two return values: a new
548f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// stack pointer value and a chain. The first operand is the token chain,
549f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// the second is the number of bytes to allocate, and the third is the
550f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// alignment boundary.  The size is guaranteed to be a multiple of the
551f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// stack alignment, and the alignment is guaranteed to be bigger than the
552f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// stack alignment (if required) or 0 to get standard stack alignment.
5534031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    DYNAMIC_STACKALLOC,
5544031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
555f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Control flow instructions.  These all have token chains.
5564031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
557f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BR - Unconditional branch.  The first operand is the chain
558f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// operand, the second is the MBB to branch to.
5594031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BR,
5604031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
561f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BRIND - Indirect branch.  The first operand is the chain, the second
562f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// is the value to branch to, which must be of the same type as the
563f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// target's pointer type.
5644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BRIND,
5654031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
566f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BR_JT - Jumptable branch. The first operand is the chain, the second
567f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// is the jumptable index, the last one is the jumptable entry index.
5684031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BR_JT,
5694031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
570f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BRCOND - Conditional branch.  The first operand is the chain, the
571f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// second is the condition, the third is the block to branch to if the
572f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// condition is true.  If the type of the condition is not i1, then the
573f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// high bits must conform to getBooleanContents.
5744031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BRCOND,
5754031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
576f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BR_CC - Conditional branch.  The behavior is like that of SELECT_CC, in
577f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// that the condition is represented as condition code, and two nodes to
578f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// compare, rather than as a combined SetCC node.  The operands in order
579f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// are chain, cc, lhs, rhs, block to branch to if condition is true.
5804031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BR_CC,
5814031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
582f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// INLINEASM - Represents an inline asm block.  This node always has two
583f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// return values: a chain and a flag result.  The inputs are as follows:
584f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   Operand #0  : Input chain.
585f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   Operand #1  : a ExternalSymbolSDNode with a pointer to the asm string.
586f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   Operand #2  : a MDNodeSDNode with the !srcloc metadata.
587f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   Operand #3  : HasSideEffect, IsAlignStack bits.
588f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   After this, it is followed by a list of operands with this format:
589f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///     ConstantSDNode: Flags that encode whether it is a mem or not, the
590f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///                     of operands that follow, etc.  See InlineAsm.h.
591f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///     ... however many operands ...
592f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   Operand #last: Optional, an incoming flag.
593f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///
594f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// The variable width operands are required to represent target addressing
595f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// modes as a single "operand", even though they may have multiple
596f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SDOperands.
5974031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    INLINEASM,
5984031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
599f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// EH_LABEL - Represents a label in mid basic block used to track
600f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// locations needed for debug and exception handling tables.  These nodes
601f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// take a chain as input and return a chain.
6024031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EH_LABEL,
6034031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
604f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// CATCHPAD - Represents a catchpad instruction.
605f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    CATCHPAD,
606f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar
607f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// CATCHRET - Represents a return from a catch block funclet. Used for
608f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// MSVC compatible exception handling. Takes a chain operand and a
609f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// destination basic block operand.
610f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    CATCHRET,
611f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar
612f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// CLEANUPRET - Represents a return from a cleanup block funclet.  Used for
613f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// MSVC compatible exception handling. Takes only a chain operand.
614f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    CLEANUPRET,
615f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar
616f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// STACKSAVE - STACKSAVE has one operand, an input chain.  It produces a
617f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// value, the same type as the pointer type for the system, and an output
618f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// chain.
6194031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    STACKSAVE,
6204031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
621f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// STACKRESTORE has two operands, an input chain and a pointer to restore
622f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to it returns an output chain.
6234031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    STACKRESTORE,
6244031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
625f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end
626f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// of a call sequence, and carry arbitrary information that target might
627f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// want to know.  The first operand is a chain, the rest are specified by
628f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// the target and not touched by the DAG optimizers.
629f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// CALLSEQ_START..CALLSEQ_END pairs may not be nested.
6304031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CALLSEQ_START,  // Beginning of a call sequence
6314031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CALLSEQ_END,    // End of a call sequence
6324031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
633f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE,
634f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// and the alignment. It returns a pair of values: the vaarg value and a
635f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// new chain.
6364031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    VAARG,
6374031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
638f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// VACOPY - VACOPY has 5 operands: an input chain, a destination pointer,
639f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the
640f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// source.
6414031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    VACOPY,
6424031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
643f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// VAEND, VASTART - VAEND and VASTART have three operands: an input chain,
644f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// pointer, and a SRCVALUE.
6454031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    VAEND, VASTART,
6464031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
647f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SRCVALUE - This is a node type that holds a Value* that is used to
648f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// make reference to a value in the LLVM IR.
6494031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SRCVALUE,
650bf17cfa3f904e488e898ac2e3af706fd1a892f08Wesley Peck
651f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// MDNODE_SDNODE - This is a node that holdes an MDNode*, which is used to
652f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// reference metadata in the IR.
6534031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    MDNODE_SDNODE,
6544031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
655f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// PCMARKER - This corresponds to the pcmarker intrinsic.
6564031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    PCMARKER,
6574031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
658f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
659f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// It produces a chain and one i64 value. The only operand is a chain.
660f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// If i64 is not legal, the result will be expanded into smaller values.
661f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// Still, it returns an i64, so targets should set legality for i64.
662f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// The result is the content of the architecture-specific cycle
663f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// counter-like register (or other high accuracy low latency clock source).
6644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    READCYCLECOUNTER,
6654031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
666f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// HANDLENODE node - Used as a handle for various purposes.
6674031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    HANDLENODE,
6684031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
669f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// INIT_TRAMPOLINE - This corresponds to the init_trampoline intrinsic.  It
670f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// takes as input a token chain, the pointer to the trampoline, the pointer
671f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to the nested function, the pointer to pass for the 'nest' parameter, a
672f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SRCVALUE for the trampoline and another for the nested function
673f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// (allowing targets to access the original Function*).
674f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// It produces a token chain as output.
6754a544a79bd735967f1d33fe675ae4566dbd17813Duncan Sands    INIT_TRAMPOLINE,
6764a544a79bd735967f1d33fe675ae4566dbd17813Duncan Sands
677f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// ADJUST_TRAMPOLINE - This corresponds to the adjust_trampoline intrinsic.
678f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// It takes a pointer to the trampoline and produces a (possibly) new
679f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// pointer to the same trampoline with platform-specific adjustments
680f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// applied.  The pointer it returns points to an executable block of code.
6814a544a79bd735967f1d33fe675ae4566dbd17813Duncan Sands    ADJUST_TRAMPOLINE,
6824031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
683f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// TRAP - Trapping instruction
6844031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TRAP,
6854031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
686f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// DEBUGTRAP - Trap intended to get the attention of a debugger.
687a6063c6e29746d9425bdf46d680e28a48dcf58f9Dan Gohman    DEBUGTRAP,
688d4347e1af9141ec9f8e3e527367bfd16c0cc4ffbDan Gohman
689f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// PREFETCH - This corresponds to a prefetch intrinsic. The first operand
690f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// is the chain.  The other operands are the address to prefetch,
691f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// read / write specifier, locality specifier and instruction / data cache
692f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// specifier.
6934031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    PREFETCH,
6944031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
695f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope)
696f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// This corresponds to the fence instruction. It takes an input chain, and
697f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// two integer constants: an AtomicOrdering and a SynchronizationScope.
69814648468011c92a4210f8118721d58c25043daf8Eli Friedman    ATOMIC_FENCE,
69914648468011c92a4210f8118721d58c25043daf8Eli Friedman
700f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr)
701f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// This corresponds to "load atomic" instruction.
702327236cd6c211e54fc6288b0ac2b413901cc0611Eli Friedman    ATOMIC_LOAD,
703327236cd6c211e54fc6288b0ac2b413901cc0611Eli Friedman
70436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines    /// OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val)
705f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// This corresponds to "store atomic" instruction.
706327236cd6c211e54fc6288b0ac2b413901cc0611Eli Friedman    ATOMIC_STORE,
707327236cd6c211e54fc6288b0ac2b413901cc0611Eli Friedman
708f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap)
709268c743a3ba44ada364938bc5ff9b1be219df54fAmara Emerson    /// For double-word atomic operations:
710268c743a3ba44ada364938bc5ff9b1be219df54fAmara Emerson    /// ValLo, ValHi, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmpLo, cmpHi,
711268c743a3ba44ada364938bc5ff9b1be219df54fAmara Emerson    ///                                          swapLo, swapHi)
712f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// This corresponds to the cmpxchg instruction.
7134031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_CMP_SWAP,
7144031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
715c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// Val, Success, OUTCHAIN
716c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    ///     = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap)
717c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// N.b. this is still a strong cmpxchg operation, so
718c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    /// Success == "Val == cmp".
719c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines    ATOMIC_CMP_SWAP_WITH_SUCCESS,
720c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines
721f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt)
722f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt)
723268c743a3ba44ada364938bc5ff9b1be219df54fAmara Emerson    /// For double-word atomic operations:
724268c743a3ba44ada364938bc5ff9b1be219df54fAmara Emerson    /// ValLo, ValHi, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amtLo, amtHi)
725268c743a3ba44ada364938bc5ff9b1be219df54fAmara Emerson    /// ValLo, ValHi, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amtLo, amtHi)
726f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// These correspond to the atomicrmw instruction.
727327236cd6c211e54fc6288b0ac2b413901cc0611Eli Friedman    ATOMIC_SWAP,
7284031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_ADD,
7294031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_SUB,
7304031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_AND,
7314031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_OR,
7324031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_XOR,
7334031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_NAND,
7344031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_MIN,
7354031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_MAX,
7364031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_UMIN,
7374031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_UMAX,
7384031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
7396948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    // Masked load and store - consecutive vector load and store operations
7406948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    // with additional mask operand that prevents memory accesses to the
7416948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    // masked-off lanes.
742ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines    MLOAD, MSTORE,
743ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines
7446948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    // Masked gather and scatter - load and store operations for a vector of
7456948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    // random addresses with additional mask operand that prevents memory
7466948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    // accesses to the masked-off lanes.
7476948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    MGATHER, MSCATTER,
7486948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar
749c05d30601ced172b55be81bb529df6be91d6ae15Nadav Rotem    /// This corresponds to the llvm.lifetime.* intrinsics. The first operand
750c05d30601ced172b55be81bb529df6be91d6ae15Nadav Rotem    /// is the chain and the second operand is the alloca pointer.
751c05d30601ced172b55be81bb529df6be91d6ae15Nadav Rotem    LIFETIME_START, LIFETIME_END,
752c05d30601ced172b55be81bb529df6be91d6ae15Nadav Rotem
7536948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    /// GC_TRANSITION_START/GC_TRANSITION_END - These operators mark the
7546948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    /// beginning and end of GC transition  sequence, and carry arbitrary
7556948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    /// information that target might need for lowering.  The first operand is
7566948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    /// a chain, the rest are specified by the target and not touched by the DAG
7576948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    /// optimizers. GC_TRANSITION_START..GC_TRANSITION_END pairs may not be
7586948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    /// nested.
7596948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    GC_TRANSITION_START,
7606948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar    GC_TRANSITION_END,
7616948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar
762f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// GET_DYNAMIC_AREA_OFFSET - get offset from native SP to the address of
763f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// the most recent dynamic alloca. For most targets that would be 0, but
764f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// for some others (e.g. PowerPC, PowerPC64) that would be compile-time
765f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    /// known nonzero constant. The only operand here is the chain.
766f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar    GET_DYNAMIC_AREA_OFFSET,
767f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar
7684031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// BUILTIN_OP_END - This must be the last enum value in this list.
7694031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// The target-specific pre-isel opcode values start here.
7704031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BUILTIN_OP_END
7714031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  };
7724031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
7734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// FIRST_TARGET_MEMORY_OPCODE - Target-specific pre-isel operations
7744031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// which do not reference a specific memory location should be less than
7754031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// this value. Those that do must not be less than this value, and can
7764031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// be used with SelectionDAG::getMemIntrinsicNode.
777f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar  static const int FIRST_TARGET_MEMORY_OPCODE = BUILTIN_OP_END+300;
7784031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
7794031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  //===--------------------------------------------------------------------===//
7804031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// MemIndexedMode enum - This enum defines the load / store indexed
7814031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// addressing modes.
7824031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
7834031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// UNINDEXED    "Normal" load / store. The effective address is already
7844031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              computed and is available in the base pointer. The offset
7854031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              operand is always undefined. In addition to producing a
7864031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              chain, an unindexed load produces one value (result of the
7874031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              load); an unindexed store does not produce a value.
7884031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
7894031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// PRE_INC      Similar to the unindexed mode where the effective address is
7904031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// PRE_DEC      the value of the base pointer add / subtract the offset.
7914031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              It considers the computation as being folded into the load /
7924031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              store operation (i.e. the load / store does the address
7934031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              computation as well as performing the memory transaction).
7944031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              The base operand is always undefined. In addition to
7954031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              producing a chain, pre-indexed load produces two values
7964031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              (result of the load and the result of the address
7974031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              computation); a pre-indexed store produces one value (result
7984031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              of the address computation).
7994031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
8004031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// POST_INC     The effective address is the value of the base pointer. The
8014031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// POST_DEC     value of the offset operand is then added to / subtracted
8024031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              from the base after memory transaction. In addition to
8034031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              producing a chain, post-indexed load produces two values
8044031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              (the result of the load and the result of the base +/- offset
8054031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              computation); a post-indexed store produces one value (the
8064031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              the result of the base +/- offset computation).
8074031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  enum MemIndexedMode {
8084031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    UNINDEXED = 0,
8094031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    PRE_INC,
8104031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    PRE_DEC,
8114031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    POST_INC,
8124031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    POST_DEC,
8134031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    LAST_INDEXED_MODE
8144031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  };
8154031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
8164031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  //===--------------------------------------------------------------------===//
8174031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// LoadExtType enum - This enum defines the three variants of LOADEXT
8184031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// (load with extension).
8194031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
8204031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// SEXTLOAD loads the integer operand and sign extends it to a larger
8214031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///          integer result type.
8224031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// ZEXTLOAD loads the integer operand and zero extends it to a larger
8234031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///          integer result type.
82479976e9ff18265c5b8c991db0c2ff6d2edad94feBob Wilson  /// EXTLOAD  is used for two things: floating point extending loads and
82579976e9ff18265c5b8c991db0c2ff6d2edad94feBob Wilson  ///          integer extending loads [the top bits are undefined].
8264031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  enum LoadExtType {
8274031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    NON_EXTLOAD = 0,
8284031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EXTLOAD,
8294031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SEXTLOAD,
8304031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ZEXTLOAD,
8314031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    LAST_LOADEXT_TYPE
8324031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  };
8334031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
834ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines  NodeType getExtForLoadExtType(bool IsFP, LoadExtType);
83536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
8364031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  //===--------------------------------------------------------------------===//
8374031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// ISD::CondCode enum - These are ordered carefully to make the bitfields
8384031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// below work out, when considering SETFALSE (something that never exists
8394031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// dynamically) as 0.  "U" -> Unsigned (for integer operands) or Unordered
8404031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// (for floating point), "L" -> Less than, "G" -> Greater than, "E" -> Equal
8414031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// to.  If the "N" column is 1, the result of the comparison is undefined if
8424031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// the input is a NAN.
8434031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
8444031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// All of these (except for the 'always folded ops') should be handled for
8454031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// floating point.  For integer, only the SETEQ,SETNE,SETLT,SETLE,SETGT,
8464031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// SETGE,SETULT,SETULE,SETUGT, and SETUGE opcodes are used.
8474031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
8484031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// Note that these are laid out in a specific order to allow bit-twiddling
8494031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// to transform conditions.
8504031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  enum CondCode {
8514031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    // Opcode          N U L G E       Intuitive operation
8524031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETFALSE,      //    0 0 0 0       Always false (always folded)
8534031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETOEQ,        //    0 0 0 1       True if ordered and equal
8544031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETOGT,        //    0 0 1 0       True if ordered and greater than
8554031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETOGE,        //    0 0 1 1       True if ordered and greater than or equal
8564031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETOLT,        //    0 1 0 0       True if ordered and less than
8574031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETOLE,        //    0 1 0 1       True if ordered and less than or equal
8584031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETONE,        //    0 1 1 0       True if ordered and operands are unequal
8594031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETO,          //    0 1 1 1       True if ordered (no nans)
8604031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETUO,         //    1 0 0 0       True if unordered: isnan(X) | isnan(Y)
8614031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETUEQ,        //    1 0 0 1       True if unordered or equal
8624031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETUGT,        //    1 0 1 0       True if unordered or greater than
8634031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETUGE,        //    1 0 1 1       True if unordered, greater than, or equal
8644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETULT,        //    1 1 0 0       True if unordered or less than
8654031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETULE,        //    1 1 0 1       True if unordered, less than, or equal
8664031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETUNE,        //    1 1 1 0       True if unordered or not equal
8674031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETTRUE,       //    1 1 1 1       Always true (always folded)
8684031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    // Don't care operations: undefined if the input is a nan.
8694031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETFALSE2,     //  1 X 0 0 0       Always false (always folded)
8704031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETEQ,         //  1 X 0 0 1       True if equal
8714031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETGT,         //  1 X 0 1 0       True if greater than
8724031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETGE,         //  1 X 0 1 1       True if greater than or equal
8734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETLT,         //  1 X 1 0 0       True if less than
8744031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETLE,         //  1 X 1 0 1       True if less than or equal
8754031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETNE,         //  1 X 1 1 0       True if not equal
8764031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETTRUE2,      //  1 X 1 1 1       Always true (always folded)
8774031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
8784031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETCC_INVALID       // Marker value.
8794031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  };
8804031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
881de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// Return true if this is a setcc instruction that performs a signed
882de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// comparison when used with integer operands.
8834031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  inline bool isSignedIntSetCC(CondCode Code) {
8844031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    return Code == SETGT || Code == SETGE || Code == SETLT || Code == SETLE;
8854031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  }
8864031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
887de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// Return true if this is a setcc instruction that performs an unsigned
888de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// comparison when used with integer operands.
8894031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  inline bool isUnsignedIntSetCC(CondCode Code) {
8904031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    return Code == SETUGT || Code == SETUGE || Code == SETULT || Code == SETULE;
8914031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  }
8924031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
893de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// Return true if the specified condition returns true if the two operands to
894de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// the condition are equal. Note that if one of the two operands is a NaN,
895de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// this value is meaningless.
8964031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  inline bool isTrueWhenEqual(CondCode Cond) {
8974031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    return ((int)Cond & 1) != 0;
8984031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  }
8994031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
900de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// This function returns 0 if the condition is always false if an operand is
901de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// a NaN, 1 if the condition is always true if the operand is a NaN, and 2 if
902de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// the condition is undefined if the operand is a NaN.
9034031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  inline unsigned getUnorderedFlavor(CondCode Cond) {
9044031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    return ((int)Cond >> 3) & 3;
9054031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  }
9064031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
907de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// Return the operation corresponding to !(X op Y), where 'op' is a valid
908de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// SetCC operation.
9094031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  CondCode getSetCCInverse(CondCode Operation, bool isInteger);
9104031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
911de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// Return the operation corresponding to (Y op X) when given the operation
912de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// for (X op Y).
9134031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  CondCode getSetCCSwappedOperands(CondCode Operation);
9144031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
915de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// Return the result of a logical OR between different comparisons of
916de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// identical values: ((X op1 Y) | (X op2 Y)). This function returns
917de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// SETCC_INVALID if it is not possible to represent the resultant comparison.
9184031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  CondCode getSetCCOrOperation(CondCode Op1, CondCode Op2, bool isInteger);
9194031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
920de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// Return the result of a logical AND between different comparisons of
921de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// identical values: ((X op1 Y) & (X op2 Y)). This function returns
922de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// SETCC_INVALID if it is not possible to represent the resultant comparison.
9234031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  CondCode getSetCCAndOperation(CondCode Op1, CondCode Op2, bool isInteger);
9244031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
9254031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  //===--------------------------------------------------------------------===//
926de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  /// This enum defines the various converts CONVERT_RNDSAT supports.
9274031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  enum CvtCode {
928f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_FF,     /// Float from Float
929f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_FS,     /// Float from Signed
930f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_FU,     /// Float from Unsigned
931f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_SF,     /// Signed from Float
932f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_UF,     /// Unsigned from Float
933f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_SS,     /// Signed from Signed
934f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_SU,     /// Signed from Unsigned
935f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_US,     /// Unsigned from Signed
936f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_UU,     /// Unsigned from Unsigned
937f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_INVALID /// Marker - Invalid opcode
9384031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  };
9394031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
9404031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman} // end llvm::ISD namespace
9414031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
9424031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman} // end llvm namespace
9434031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
9444031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman#endif
945