//===-- llvm/CodeGen/SelectionDAGNodes.h - SelectionDAG Nodes ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares the SDNode class and derived classes, which are used to
// represent the nodes and operations present in a SelectionDAG. These nodes
// and operations are machine code level operations, with some similarities to
// the GCC RTL representation.
//
// Clients should include the SelectionDAG.h file instead of this file directly.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CODEGEN_SELECTIONDAGNODES_H
#define LLVM_CODEGEN_SELECTIONDAGNODES_H
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/Value.h"
#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/iterator"
#include "llvm/Support/DataTypes.h"
#include <cassert>
#include <vector>
namespace llvm {
class SelectionDAG;
class GlobalValue;
class MachineBasicBlock;
class SDNode;
template <typename T> struct simplify_type;
template <typename T> struct ilist_traits;
template<typename NodeTy, typename Traits> class iplist;
template<typename NodeTy> class ilist_iterator;
/// ISD namespace - This namespace contains an enum which represents all of the
/// SelectionDAG node types and value types.
///
namespace ISD {
//===--------------------------------------------------------------------===//
/// ISD::NodeType enum - This enum defines all of the operators valid in a
/// SelectionDAG.
///
enum NodeType {
// EntryToken - This is the marker used to indicate the start of the region.
EntryToken,
// Token factor - This node takes multiple tokens as input and produces a
// single token result. This is used to represent the fact that the operand
// operators are independent of each other.
TokenFactor,
// AssertSext, AssertZext - These nodes record if a register contains a
// value that has already been zero or sign extended from a narrower type.
// These nodes take two operands. The first is the node that has already
// been extended, and the second is a value type node indicating the width
// of the extension
AssertSext, AssertZext,
// Various leaf nodes.
Constant, ConstantFP, STRING,
GlobalAddress, FrameIndex, ConstantPool,
BasicBlock, ExternalSymbol, VALUETYPE, CONDCODE, Register,
// ConstantVec works like Constant or ConstantFP, except that it is not a
// leaf node. All operands are either Constant or ConstantFP nodes.
ConstantVec,
// TargetConstant - Like Constant, but the DAG does not do any folding or
// simplification of the constant. This is used by the DAG->DAG selector.
TargetConstant,
// TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or
// anything else with this node, and this is valid in the target-specific
// dag, turning into a GlobalAddress operand.
TargetGlobalAddress,
TargetFrameIndex,
TargetConstantPool,
TargetExternalSymbol,
// CopyToReg - This node has three operands: a chain, a register number to
// set to this value, and a value.
CopyToReg,
// CopyFromReg - This node indicates that the input value is a virtual or
// physical register that is defined outside of the scope of this
// SelectionDAG. The register is available from the RegSDNode object.
CopyFromReg,
// UNDEF - An undefined node
UNDEF,
// EXTRACT_ELEMENT - This is used to get the first or second (determined by
// a Constant, which is required to be operand #1), element of the aggregate
// value specified as operand #0. This is only for use before legalization,
// for values that will be broken into multiple registers.
EXTRACT_ELEMENT,
// BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways. Given
// two values of the same integer value type, this produces a value twice as
// big. Like EXTRACT_ELEMENT, this can only be used before legalization.
BUILD_PAIR,
// MERGE_VALUES - This node takes multiple discrete operands and returns
// them all as its individual results. This nodes has exactly the same
// number of inputs and outputs, and is only valid before legalization.
// This node is useful for some pieces of the code generator that want to
// think about a single node with multiple results, not multiple nodes.
MERGE_VALUES,
// Simple integer binary arithmetic operators.
ADD, SUB, MUL, SDIV, UDIV, SREM, UREM,
// Simple binary floating point operators.
FADD, FSUB, FMUL, FDIV, FREM,
// Simple abstract vector operators. Unlike the integer and floating point
// binary operators, these nodes also take two additional operands:
// a constant element count, and a value type node indicating the type of
// the elements. The order is op0, op1, count, type. All vector opcodes,
// including VLOAD, must currently have count and type as their 3rd and 4th
// arguments.
VADD, VSUB, VMUL,
// MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing
// an unsigned/signed value of type i[2*n], then return the top part.
MULHU, MULHS,
// Bitwise operators - logical and, logical or, logical xor, shift left,
// shift right algebraic (shift in sign bits), shift right logical (shift in
// zeroes), rotate left, rotate right, and byteswap.
AND, OR, XOR, SHL, SRA, SRL, ROTL, ROTR, BSWAP,
// Counting operators
CTTZ, CTLZ