class SDNode

Declaration

class SDNode : public Node, public ilist_node { /* full declaration omitted */ };

Description

Represents one node in the SelectionDAG.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:455

Inherits from: FoldingSetBase::Node, ilist_node

Member Variables

private int16_t NodeType
The operation that this node performs.
protected anonymous struct / union
private int NodeId = -1
Unique id per SDNode in the DAG.
private llvm::SDUse* OperandList = nullptr
The values that are used by this operation.
private const llvm::EVT* ValueList
The types of the values this node defines. SDNode's may define multiple values simultaneously.
private llvm::SDUse* UseList = nullptr
List of uses for this SDNode.
private unsigned short NumOperands = 0
The number of entries in the Operand/Value list.
private unsigned short NumValues
private unsigned int IROrder
private llvm::DebugLoc debugLoc
Source line information.
private llvm::SDNodeFlags Flags
public uint16_t PersistentId
Unique and persistent id per SDNode in the DAG. Used for debug printing. We do not place that under `#if LLVM_ENABLE_ABI_BREAKING_CHECKS` intentionally because it adds unneeded complexity without noticeable benefits (see discussion with @thakisin D120714).

Method Overview

Inherited from FoldingSetBase::Node:

Methods

void DropOperands()

Description

Release the operands and set this node to have zero operands.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1079

void Profile(llvm::FoldingSetNodeID& ID) const

Description

Gather unique data for the node.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1054

Parameters

llvm::FoldingSetNodeID& ID

SDNode(unsigned int Opc,
       unsigned int Order,
       llvm::DebugLoc dl,
       llvm::SDVTList VTs)

Description

Create an SDNode. SDNodes are created without any operands, and never own the operand storage. To add operands, see SelectionDAG::createOperands.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1069

Parameters

unsigned int Opc
unsigned int Order
llvm::DebugLoc dl
llvm::SDVTList VTs

void addUse(llvm::SDUse& U)

Description

This method should only be used by the SDUse class.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1057

Parameters

llvm::SDUse& U

static bool areOnlyUsersOf(
    ArrayRef<const llvm::SDNode*> Nodes,
    const llvm::SDNode* N)

Description

Return true if all the users of N are contained in Nodes. NOTE: Requires at least one match, but doesn't require them all.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:893

Parameters

ArrayRef<const llvm::SDNode*> Nodes
const llvm::SDNode* N

void dump(const llvm::SelectionDAG* G) const

Description

Dump this node, for debugging. The given SelectionDAG allows target-specific nodes to be printed in human-readable form.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1032

Parameters

const llvm::SelectionDAG* G

void dump() const

Description

Dump this node, for debugging.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1024

void dumpr(const llvm::SelectionDAG* G) const

Description

Dump (recursively) this node and its use-def subgraph. The given SelectionDAG allows target-specific nodes to be printed in human-readable form.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1037

Parameters

const llvm::SelectionDAG* G

void dumpr() const

Description

Dump (recursively) this node and its use-def subgraph.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1027

void dumprFull(
    const llvm::SelectionDAG* G = nullptr) const

Description

printrFull to dbgs(). The given SelectionDAG allows target-specific nodes to be printed in human-readable form. Unlike dumpr, this will print the whole DAG, including children that appear multiple times.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1043

Parameters

const llvm::SelectionDAG* G = nullptr

void dumprWithDepth(
    const llvm::SelectionDAG* G = nullptr,
    unsigned int depth = 100) const

Description

printrWithDepth to dbgs(). The given SelectionDAG allows target-specific nodes to be printed in human-readable form. Unlike dumpr, this will print children that appear multiple times wherever they are used.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1050

Parameters

const llvm::SelectionDAG* G = nullptr
unsigned int depth = 100

inline const llvm::APInt& getConstantOperandAPInt(
    unsigned int Num) const

Description

Helper method returns the APInt of a ConstantSDNode operand.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:907

Parameters

unsigned int Num

inline uint64_t getConstantOperandVal(
    unsigned int Num) const

Description

Helper method returns the integer value of a ConstantSDNode operand.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:904

Parameters

unsigned int Num

const llvm::DebugLoc& getDebugLoc() const

Description

Return the source location info.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:726

llvm::SDNodeFlags getFlags() const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:960

llvm::SDNode* getGluedNode() const

Description

If this node has a glue operand, return the node to which the glue operand points. Otherwise return NULL.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:944

llvm::SDNode* getGluedUser() const

Description

If this node has a glue value with a user, return the user (there is at most one). Otherwise return NULL.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:953

bool getHasDebugValue() const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:698

unsigned int getIROrder() const

Description

Return the node ordering.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:720

static const char* getIndexedModeName(
    ISD::MemIndexedMode AM)

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1000

Parameters

ISD::MemIndexedMode AM

unsigned int getMachineOpcode() const

Description

This may only be called if isMachineOpcode returns true. It returns the MachineInstr opcode value that the node's opcode corresponds to.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:693

static constexpr size_t getMaxNumOperands()

Description

Return the maximum number of operands that a SDNode can hold.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:899

int getNodeId() const

Description

Return the unique node id.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:714

unsigned int getNumOperands() const

Description

Return the number of values used by this operation.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:896

unsigned int getNumValues() const

Description

Return the number of values defined/returned by this operator.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:968

unsigned int getOpcode() const

Description

Return the SelectionDAG opcode value for this node. For pre-isel nodes (those for which isMachineOpcode returns false), these are the opcode values in the ISD and <target >ISD namespaces. For post-isel opcodes, see getMachineOpcode.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:633

const llvm::SDValue& getOperand(
    unsigned int Num) const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:909

Parameters

unsigned int Num

std::string getOperationName(
    const llvm::SelectionDAG* G = nullptr) const

Description

Return the opcode of this operation for printing.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:999

Parameters

const llvm::SelectionDAG* G = nullptr

static llvm::SDVTList getSDVTList(llvm::EVT VT)

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1060

Parameters

llvm::EVT VT

llvm::MVT getSimpleValueType(
    unsigned int ResNo) const

Description

Return the type of a specified result as a simple type.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:977

Parameters

unsigned int ResNo

llvm::SDVTList getVTList() const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:937

llvm::TypeSize getValueSizeInBits(
    unsigned int ResNo) const

Description

Returns MVT::getSizeInBits(getValueType(ResNo)). If the value type is a scalable vector type, the scalable property will be set and the runtime size will be a positive integer multiple of the base size.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:986

Parameters

unsigned int ResNo

llvm::EVT getValueType(unsigned int ResNo) const

Description

Return the type of a specified result.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:971

Parameters

unsigned int ResNo

static const llvm::EVT* getValueTypeList(
    llvm::EVT VT)

Description

Return a pointer to the specified value type.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:614

Parameters

llvm::EVT VT

bool hasAnyUseOfValue(unsigned int Value) const

Description

Return true if there are any use of the indicated value. This method ignores uses of other values defined by this operation.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:807

Parameters

unsigned int Value

bool hasNUsesOfValue(unsigned int NUses,
                     unsigned int Value) const

Description

Return true if there are exactly NUSES uses of the indicated value. This method ignores uses of other values defined by this operation.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:803

Parameters

unsigned int NUses
unsigned int Value

bool hasOneUse() const

Description

Return true if there is exactly one use of this node.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:707

bool hasPredecessor(const llvm::SDNode* N) const

Description

Return true if N is a predecessor of this node. N is either an operand of this node, or can be reached by recursively traversing up the operands. NOTE: This is an expensive method. Use it carefully.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:826

Parameters

const llvm::SDNode* N

static bool hasPredecessorHelper(
    const llvm::SDNode* N,
    SmallPtrSetImpl<const llvm::SDNode*>& Visited,
    SmallVectorImpl<const llvm::SDNode*>&
        Worklist,
    unsigned int MaxSteps = 0,
    bool TopologicalPrune = false)

Description

Returns true if N is a predecessor of any node in Worklist. This helper keeps Visited and Worklist sets externally to allow unions searches to be performed in parallel, caching of results across queries and incremental addition to Worklist. Stops early if N is found but will resume. Remember to clear Visited and Worklists if DAG changes. MaxSteps gives a maximum number of nodes to visit before giving up. The TopologicalPrune flag signals that positive NodeIds are topologically ordered (Operands have strictly smaller node id) and search can be pruned leveraging this.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:837

Parameters

const llvm::SDNode* N
SmallPtrSetImpl<const llvm::SDNode*>& Visited
SmallVectorImpl<const llvm::SDNode*>& Worklist
unsigned int MaxSteps = 0
bool TopologicalPrune = false

void intersectFlagsWith(
    const llvm::SDNodeFlags Flags)

Description

Clear any flags in this node that aren't also set in Flags. If Flags is not in a defined state then this has no effect.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:965

Parameters

const llvm::SDNodeFlags Flags

bool isDivergent() const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:701

bool isMachineOpcode() const

Description

Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:688

bool isMemIntrinsic() const

Description

Test if this node is a memory intrinsic (with valid pointer information). INTRINSIC_W_CHAIN and INTRINSIC_VOID nodes are sometimes created for non-memory intrinsics (with chains) that are not really instances of MemSDNode. For such nodes, we need some extra state to determine the proper classof relationship.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:663

bool isOnlyUserOf(const llvm::SDNode* N) const

Description

Return true if this node is the only use of N.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:810

Parameters

const llvm::SDNode* N

bool isOperandOf(const llvm::SDNode* N) const

Description

Return true if this node is an operand of N.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:813

Parameters

const llvm::SDNode* N

bool isPredecessorOf(const llvm::SDNode* N) const

Description

Return true if this node is a predecessor of N. NOTE: Implemented on top of hasPredecessor and every bit as expensive. Use carefully.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:818

Parameters

const llvm::SDNode* N

bool isStrictFPOpcode()

Description

Test if this node is a strict floating point pseudo-op.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:670

bool isTargetMemoryOpcode() const

Description

Test if this node has a target-specific memory-referencing opcode (in the < target > ISD namespace and greater than FIRST_TARGET_MEMORY_OPCODE).

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:651

bool isTargetOpcode() const

Description

Test if this node has a target-specific opcode (in the < target > ISD namespace).

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:637

bool isTargetStrictFPOpcode() const

Description

Test if this node has a target-specific opcode that may raise FP exceptions (in the < target > ISD namespace and greater than FIRST_TARGET_STRICTFP_OPCODE). Note that all target memory opcode are currently automatically considered to possibly raise FP exceptions as well.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:644

bool isUndef() const

Description

Return true if the type of the node type undefined.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:656

bool isVPOpcode() const

Description

Test if this node is a vector predication operation.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:684

llvm::SDNode::op_iterator op_begin() const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:916

llvm::SDNode::op_iterator op_end() const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:917

iterator_range<llvm::SDNode::value_op_iterator>
op_values() const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:932

ArrayRef<llvm::SDUse> ops() const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:918

void print(
    llvm::raw_ostream& OS,
    const llvm::SelectionDAG* G = nullptr) const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1003

Parameters

llvm::raw_ostream& OS
const llvm::SelectionDAG* G = nullptr

void print_details(
    llvm::raw_ostream& OS,
    const llvm::SelectionDAG* G) const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1002

Parameters

llvm::raw_ostream& OS
const llvm::SelectionDAG* G

void print_types(
    llvm::raw_ostream& OS,
    const llvm::SelectionDAG* G) const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1001

Parameters

llvm::raw_ostream& OS
const llvm::SelectionDAG* G

void printr(
    llvm::raw_ostream& OS,
    const llvm::SelectionDAG* G = nullptr) const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1004

Parameters

llvm::raw_ostream& OS
const llvm::SelectionDAG* G = nullptr

void printrFull(
    llvm::raw_ostream& O,
    const llvm::SelectionDAG* G = nullptr) const

Description

Print a SelectionDAG node and all children down to the leaves. The given SelectionDAG allows target-specific nodes to be printed in human-readable form. Unlike printr, this will print the whole DAG, including children that appear multiple times.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1012

Parameters

llvm::raw_ostream& O
const llvm::SelectionDAG* G = nullptr

void printrWithDepth(
    llvm::raw_ostream& O,
    const llvm::SelectionDAG* G = nullptr,
    unsigned int depth = 100) const

Description

Print a SelectionDAG node and children up to depth "depth." The given SelectionDAG allows target-specific nodes to be printed in human-readable form. Unlike printr, this will print children that appear multiple times wherever they are used.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1020

Parameters

llvm::raw_ostream& O
const llvm::SelectionDAG* G = nullptr
unsigned int depth = 100

void setDebugLoc(llvm::DebugLoc dl)

Description

Set source location info. Try to avoid this, putting it in the constructor is preferable.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:730

Parameters

llvm::DebugLoc dl

void setFlags(llvm::SDNodeFlags NewFlags)

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:961

Parameters

llvm::SDNodeFlags NewFlags

void setHasDebugValue(bool b)

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:699

Parameters

bool b

void setIROrder(unsigned int Order)

Description

Set the node ordering.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:723

Parameters

unsigned int Order

void setNodeId(int Id)

Description

Set unique node id.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:717

Parameters

int Id

llvm::SDNode::use_iterator use_begin() const

Description

Provide iteration support to walk over all uses of an SDNode.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:788

bool use_empty() const

Description

Return true if there are no uses of this node.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:704

static llvm::SDNode::use_iterator use_end()

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:792

size_t use_size() const

Description

Return the number of uses of this node. This method takes time proportional to the number of uses.

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:711

inline iterator_range<llvm::SDNode::use_iterator>
uses()

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:794

inline iterator_range<llvm::SDNode::use_iterator>
uses() const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:797

llvm::SDNode::value_iterator value_begin() const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:992

llvm::SDNode::value_iterator value_end() const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:993

iterator_range<llvm::SDNode::value_iterator>
values() const

Declared at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:994