LLVM: llvm::BuildVectorSDNode Class Reference (original) (raw)

A "pseudo-class" with methods for operating on BUILD_VECTORs. More...

#include "[llvm/CodeGen/SelectionDAGNodes.h](SelectionDAGNodes%5F8h%5Fsource.html)"

Public Member Functions
BuildVectorSDNode ()=delete
LLVM_ABI bool isConstantSplat (APInt &SplatValue, APInt &SplatUndef, unsigned &SplatBitSize, bool &HasAnyUndefs, unsigned MinSplatBits=0, bool isBigEndian=false) const
Check if this is a constant splat, and if so, find the smallest element size that splats the vector.
LLVM_ABI SDValue getSplatValue (const APInt &DemandedElts, BitVector *UndefElements=nullptr) const
Returns the demanded splatted value or a null value if this is not a splat.
LLVM_ABI SDValue getSplatValue (BitVector *UndefElements=nullptr) const
Returns the splatted value or a null value if this is not a splat.
LLVM_ABI bool getRepeatedSequence (const APInt &DemandedElts, SmallVectorImpl< SDValue > &Sequence, BitVector *UndefElements=nullptr) const
Find the shortest repeating sequence of values in the build vector.
LLVM_ABI bool getRepeatedSequence (SmallVectorImpl< SDValue > &Sequence, BitVector *UndefElements=nullptr) const
Find the shortest repeating sequence of values in the build vector.
LLVM_ABI ConstantSDNode * getConstantSplatNode (const APInt &DemandedElts, BitVector *UndefElements=nullptr) const
Returns the demanded splatted constant or null if this is not a constant splat.
LLVM_ABI ConstantSDNode * getConstantSplatNode (BitVector *UndefElements=nullptr) const
Returns the splatted constant or null if this is not a constant splat.
LLVM_ABI ConstantFPSDNode * getConstantFPSplatNode (const APInt &DemandedElts, BitVector *UndefElements=nullptr) const
Returns the demanded splatted constant FP or null if this is not a constant FP splat.
LLVM_ABI ConstantFPSDNode * getConstantFPSplatNode (BitVector *UndefElements=nullptr) const
Returns the splatted constant FP or null if this is not a constant FP splat.
LLVM_ABI int32_t getConstantFPSplatPow2ToLog2Int (BitVector *UndefElements, uint32_t BitWidth) const
If this is a constant FP splat and the splatted constant FP is an exact power or 2, return the log base 2 integer value.
LLVM_ABI bool getConstantRawBits (bool IsLittleEndian, unsigned DstEltSizeInBits, SmallVectorImpl< APInt > &RawBitElements, BitVector &UndefElements) const
Extract the raw bit data from a build vector of Undef, Constant or ConstantFP node elements.
LLVM_ABI bool isConstant () const
LLVM_ABI std::optional< std::pair< APInt, APInt > > isConstantSequence () const
If this BuildVector is constant and represents the numerical series "<a, a+n, a+2n, a+3n, ...>" where a is integer and n is a non-zero integer, the value "<a,n>" is returned.
Public Member Functions inherited from llvm::SDNode
unsigned getOpcode () const
Return the SelectionDAG opcode value for this node.
bool isTargetOpcode () const
Test if this node has a target-specific opcode (in the ISD namespace).
bool isUndef () const
Returns true if the node type is UNDEF or POISON.
bool isAnyAdd () const
Returns true if the node type is ADD or PTRADD.
bool isMemIntrinsic () const
Test if this node is a memory intrinsic (with valid pointer information).
bool isStrictFPOpcode ()
Test if this node is a strict floating point pseudo-op.
bool isAssert () const
Test if this node is an assert operation.
bool isVPOpcode () const
Test if this node is a vector predication operation.
bool isMachineOpcode () const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode.
unsigned getMachineOpcode () const
This may only be called if isMachineOpcode returns true.
bool getHasDebugValue () const
void setHasDebugValue (bool b)
bool isDivergent () const
bool use_empty () const
Return true if there are no uses of this node.
bool hasOneUse () const
Return true if there is exactly one use of this node.
size_t use_size () const
Return the number of uses of this node.
int getNodeId () const
Return the unique node id.
void setNodeId (int Id)
Set unique node id.
int getCombinerWorklistIndex () const
Get worklist index for DAGCombiner.
void setCombinerWorklistIndex (int Index)
Set worklist index for DAGCombiner.
unsigned getIROrder () const
Return the node ordering.
void setIROrder (unsigned Order)
Set the node ordering.
const DebugLoc & getDebugLoc () const
Return the source location info.
void setDebugLoc (DebugLoc dl)
Set source location info.
use_iterator use_begin () const
Provide iteration support to walk over all uses of an SDNode.
iterator_range< use_iterator > uses ()
iterator_range< use_iterator > uses () const
user_iterator user_begin () const
Provide iteration support to walk over all users of an SDNode.
iterator_range< user_iterator > users ()
iterator_range< user_iterator > users () const
bool hasNUsesOfValue (unsigned NUses, unsigned Value) const
Return true if there are exactly NUSES uses of the indicated value.
LLVM_ABI bool hasAnyUseOfValue (unsigned Value) const
Return true if there are any use of the indicated value.
LLVM_ABI bool isOnlyUserOf (const SDNode *N) const
Return true if this node is the only use of N.
LLVM_ABI bool isOperandOf (const SDNode *N) const
Return true if this node is an operand of N.
bool isPredecessorOf (const SDNode *N) const
Return true if this node is a predecessor of N.
LLVM_ABI bool hasPredecessor (const SDNode *N) const
Return true if N is a predecessor of this node.
unsigned getNumOperands () const
Return the number of values used by this operation.
uint64_t getConstantOperandVal (unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
uint64_t getAsZExtVal () const
Helper method returns the zero-extended integer value of a ConstantSDNode.
const APInt & getConstantOperandAPInt (unsigned Num) const
Helper method returns the APInt of a ConstantSDNode operand.
const APInt & getAsAPIntVal () const
Helper method returns the APInt value of a ConstantSDNode.
std::optional< APInt > bitcastToAPInt () const
const SDValue & getOperand (unsigned Num) const
op_iterator op_begin () const
op_iterator op_end () const
ArrayRef< SDUse > ops () const
iterator_range< value_op_iterator > op_values () const
SDVTList getVTList () const
SDNode * getGluedNode () const
If this node has a glue operand, return the node to which the glue operand points.
SDNode * getGluedUser () const
If this node has a glue value with a user, return the user (there is at most one).
SDNodeFlags getFlags () const
void setFlags (SDNodeFlags NewFlags)
void dropFlags (unsigned Mask)
LLVM_ABI void intersectFlagsWith (const SDNodeFlags Flags)
Clear any flags in this node that aren't also set in Flags.
bool hasPoisonGeneratingFlags () const
void setCFIType (uint32_t Type)
uint32_t getCFIType () const
unsigned getNumValues () const
Return the number of values defined/returned by this operator.
EVT getValueType (unsigned ResNo) const
Return the type of a specified result.
MVT getSimpleValueType (unsigned ResNo) const
Return the type of a specified result as a simple type.
TypeSize getValueSizeInBits (unsigned ResNo) const
Returns MVT::getSizeInBits(getValueType(ResNo)).
value_iterator value_begin () const
value_iterator value_end () const
iterator_range< value_iterator > values () const
LLVM_ABI std::string getOperationName (const SelectionDAG *G=nullptr) const
Return the opcode of this operation for printing.
LLVM_ABI void print_types (raw_ostream &OS, const SelectionDAG *G) const
LLVM_ABI void print_details (raw_ostream &OS, const SelectionDAG *G) const
LLVM_ABI void print (raw_ostream &OS, const SelectionDAG *G=nullptr) const
LLVM_ABI void printr (raw_ostream &OS, const SelectionDAG *G=nullptr) const
LLVM_ABI void printrFull (raw_ostream &O, const SelectionDAG *G=nullptr) const
Print a SelectionDAG node and all children down to the leaves.
LLVM_ABI void printrWithDepth (raw_ostream &O, const SelectionDAG *G=nullptr, unsigned depth=100) const
Print a SelectionDAG node and children up to depth "depth." The given SelectionDAG allows target-specific nodes to be printed in human-readable form.
LLVM_ABI void dump () const
Dump this node, for debugging.
LLVM_ABI void dumpr () const
Dump (recursively) this node and its use-def subgraph.
LLVM_ABI void dump (const SelectionDAG *G) const
Dump this node, for debugging.
LLVM_ABI void dumpr (const SelectionDAG *G) const
Dump (recursively) this node and its use-def subgraph.
LLVM_ABI void dumprFull (const SelectionDAG *G=nullptr) const
printrFull to dbgs().
LLVM_ABI void dumprWithDepth (const SelectionDAG *G=nullptr, unsigned depth=100) const
printrWithDepth to dbgs().
LLVM_ABI void Profile (FoldingSetNodeID &ID) const
Gather unique data for the node.
void addUse (SDUse &U)
This method should only be used by the SDUse class.
Public Member Functions inherited from llvm::FoldingSetBase::Node
Node ()=default
void * getNextInBucket () const
void SetNextInBucket (void *N)
Public Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< SDNode, Options... >::type >
self_iterator getIterator ()
reverse_self_iterator getReverseIterator ()
std::enable_if_t< T::is_sentinel_tracking_explicit, bool > isSentinel () const
Check whether this is the sentinel node.
Public Member Functions inherited from llvm::ilist_detail::node_parent_access< ilist_node_impl< ilist_detail::compute_node_options< SDNode, Options... >::type >, ilist_detail::compute_node_options< SDNode, Options... >::type::parent_ty >
const ilist_detail::compute_node_options< SDNode, Options... >::type::parent_ty * getParent () const
void setParent (ilist_detail::compute_node_options< SDNode, Options... >::type::parent_ty *Parent)
Static Public Member Functions
static LLVM_ABI void recastRawBits (bool IsLittleEndian, unsigned DstEltSizeInBits, SmallVectorImpl< APInt > &DstBitElements, ArrayRef< APInt > SrcBitElements, BitVector &DstUndefElements, const BitVector &SrcUndefElements)
Recast bit data SrcBitElements to DstEltSizeInBits wide elements.
static bool classof (const SDNode *N)
Static Public Member Functions inherited from llvm::SDNode
static use_iterator use_end ()
static user_iterator user_end ()
static bool hasPredecessorHelper (const SDNode *N, SmallPtrSetImpl< const SDNode * > &Visited, SmallVectorImpl< const SDNode * > &Worklist, unsigned int MaxSteps=0, bool TopologicalPrune=false)
Returns true if N is a predecessor of any node in Worklist.
static LLVM_ABI bool areOnlyUsersOf (ArrayRef< const SDNode * > Nodes, const SDNode *N)
Return true if all the users of N are contained in Nodes.
static constexpr size_t getMaxNumOperands ()
Return the maximum number of operands that a SDNode can hold.
static LLVM_ABI const char * getIndexedModeName (ISD::MemIndexedMode AM)
Additional Inherited Members
Public Types inherited from llvm::SDNode
using op_iterator = SDUse *
using value_iterator = const EVT *
Public Attributes inherited from llvm::SDNode
uint16_t PersistentId = 0xffff
Unique and persistent id per SDNode in the DAG.
Protected Types inherited from llvm::SDNode
enum { NumSDNodeBits = 3 }
enum { NumMemSDNodeBits = NumSDNodeBits + 4 }
enum { NumLSBaseSDNodeBits = NumMemSDNodeBits + 3 }
Protected Types inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< SDNode, Options... >::type >
using self_iterator
using const_self_iterator
using reverse_self_iterator
using const_reverse_self_iterator
Protected Member Functions inherited from llvm::SDNode
SDNode (unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTs)
Create an SDNode.
LLVM_ABI void DropOperands ()
Release the operands and set this node to have zero operands.
Protected Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< SDNode, Options... >::type >
ilist_node_impl ()=default
Static Protected Member Functions inherited from llvm::SDNode
static SDVTList getSDVTList (MVT VT)
Protected Attributes inherited from llvm::SDNode
union {
char RawSDNodeBits [sizeof(uint16_t)]
SDNodeBitfields SDNodeBits
ConstantSDNodeBitfields ConstantSDNodeBits
MemSDNodeBitfields MemSDNodeBits
LSBaseSDNodeBitfields LSBaseSDNodeBits
LoadSDNodeBitfields LoadSDNodeBits
StoreSDNodeBitfields StoreSDNodeBits
};

A "pseudo-class" with methods for operating on BUILD_VECTORs.

Definition at line 2215 of file SelectionDAGNodes.h.

llvm::BuildVectorSDNode::BuildVectorSDNode ( ) explicitdelete

classof()

getConstantFPSplatNode() [1/2]

Returns the splatted constant FP or null if this is not a constant FP splat.

If passed a non-null UndefElements bitvector, it will resize it to match the vector width and set the bits where elements are undef.

Definition at line 13892 of file SelectionDAG.cpp.

References llvm::dyn_cast_or_null(), and getSplatValue().

getConstantFPSplatNode() [2/2]

Returns the demanded splatted constant FP or null if this is not a constant FP splat.

The DemandedElts mask indicates the elements that must be in the splat. If passed a non-null UndefElements bitvector, it will resize it to match the vector width and set the bits where elements are undef.

Definition at line 13885 of file SelectionDAG.cpp.

References llvm::dyn_cast_or_null(), and getSplatValue().

getConstantFPSplatPow2ToLog2Int()

int32_t BuildVectorSDNode::getConstantFPSplatPow2ToLog2Int ( BitVector * UndefElements,
uint32_t BitWidth ) const

getConstantRawBits()

Extract the raw bit data from a build vector of Undef, Constant or ConstantFP node elements.

Each raw bit element will be DstEltSizeInBits wide, undef elements are treated as zero, and entirely undefined elements are flagged in UndefElements.

Definition at line 13914 of file SelectionDAG.cpp.

References assert(), llvm::dyn_cast(), llvm::SDNode::getNumOperands(), llvm::SDNode::getOperand(), llvm::EVT::getScalarSizeInBits(), llvm::SDNode::getValueType(), llvm::APInt::getZero(), I, isConstant(), recastRawBits(), and llvm::BitVector::set().

Referenced by llvm::SelectionDAG::FoldConstantBuildVector().

getConstantSplatNode() [1/2]

Returns the splatted constant or null if this is not a constant splat.

If passed a non-null UndefElements bitvector, it will resize it to match the vector width and set the bits where elements are undef.

Definition at line 13880 of file SelectionDAG.cpp.

References llvm::dyn_cast_or_null(), and getSplatValue().

getConstantSplatNode() [2/2]

getRepeatedSequence() [1/2]

Find the shortest repeating sequence of values in the build vector.

e.g. { u, X, u, X, u, u, X, u } -> { X } { X, Y, u, Y, u, u, X, u } -> { X, Y }

Currently this must be a power-of-2 build vector. The DemandedElts mask indicates the elements that must be present, undemanded elements in Sequence may be null (SDValue()). If passed a non-null UndefElements bitvector, it will resize it to match the original vector width and set the bits where elements are undef. If result is false, Sequence will be empty.

Definition at line 13820 of file SelectionDAG.cpp.

References AbstractManglingParser< Derived, Alloc >::NumOps, assert(), llvm::BitVector::clear(), llvm::APInt::getBitWidth(), llvm::SDNode::getNumOperands(), llvm::SDNode::getOperand(), I, llvm::isPowerOf2_32(), llvm::SDNode::isUndef(), llvm::SDValue::isUndef(), llvm::BitVector::resize(), and SDValue().

Referenced by getRepeatedSequence(), and lowerBuildVectorAsBroadcast().

getRepeatedSequence() [2/2]

Find the shortest repeating sequence of values in the build vector.

e.g. { u, X, u, X, u, u, X, u } -> { X } { X, Y, u, Y, u, u, X, u } -> { X, Y }

Currently this must be a power-of-2 build vector. If passed a non-null UndefElements bitvector, it will resize it to match the original vector width and set the bits where elements are undef. If result is false, Sequence will be empty.

Definition at line 13866 of file SelectionDAG.cpp.

References llvm::APInt::getAllOnes(), llvm::SDNode::getNumOperands(), and getRepeatedSequence().

getSplatValue() [1/2]

SDValue BuildVectorSDNode::getSplatValue ( BitVector * UndefElements = nullptr ) const

getSplatValue() [2/2]

Returns the demanded splatted value or a null value if this is not a splat.

The DemandedElts mask indicates the elements that must be in the splat. If passed a non-null UndefElements bitvector, it will resize it to match the vector width and set the bits where elements are undef.

Definition at line 13780 of file SelectionDAG.cpp.

References AbstractManglingParser< Derived, Alloc >::NumOps, assert(), llvm::BitVector::clear(), llvm::APInt::countr_zero(), llvm::APInt::getBitWidth(), llvm::SDNode::getNumOperands(), llvm::SDNode::getOperand(), llvm::SDNode::isUndef(), llvm::BitVector::resize(), and SDValue().

Referenced by combineGatherScatter(), combinePExtTruncate(), createMMXBuildVector(), getConstantFPSplatNode(), getConstantFPSplatNode(), getConstantFPSplatPow2ToLog2Int(), getConstantSplatNode(), getConstantSplatNode(), getSplatValue(), llvm::SelectionDAG::getVectorShuffle(), and lowerVECTOR_SHUFFLE().

isConstant()

bool BuildVectorSDNode::isConstant ( ) const

isConstantSequence()

std::optional< std::pair< APInt, APInt > > BuildVectorSDNode::isConstantSequence ( ) const

If this BuildVector is constant and represents the numerical series "<a, a+n, a+2n, a+3n, ...>" where a is integer and n is a non-zero integer, the value "<a,n>" is returned.

Definition at line 14014 of file SelectionDAG.cpp.

References AbstractManglingParser< Derived, Alloc >::NumOps, llvm::SDNode::getConstantOperandAPInt(), llvm::SDNode::getNumOperands(), llvm::SDNode::getOperand(), llvm::EVT::getScalarSizeInBits(), llvm::SDNode::getValueType(), llvm::isa(), llvm::APInt::isZero(), and llvm::APInt::trunc().

isConstantSplat()

Check if this is a constant splat, and if so, find the smallest element size that splats the vector.

If MinSplatBits is nonzero, the element size must be at least that large. Note that the splat element may be the entire vector (i.e., a one element vector). Returns the splat element value in SplatValue. Any undefined bits in that value are zero, and the corresponding bits in the SplatUndef mask are set. The SplatBitSize value is set to the splat element size in bits. HasAnyUndefs is set to true if any bits in the vector are undefined. isBigEndian describes the endianness of the target.

Definition at line 13704 of file SelectionDAG.cpp.

References AbstractManglingParser< Derived, Alloc >::NumOps, assert(), llvm::dyn_cast(), llvm::APInt::extractBits(), llvm::SDNode::getNumOperands(), llvm::SDNode::getOperand(), llvm::EVT::getScalarSizeInBits(), llvm::EVT::getSizeInBits(), llvm::SDNode::getValueType(), llvm::APInt::insertBits(), llvm::SDValue::isUndef(), llvm::EVT::isVector(), and llvm::APInt::setBits().

Referenced by getVShiftAmt(), getVShiftImm(), getVShiftImm(), INITIALIZE_PASS(), isVectorAllOnes(), lowerBuildVectorAsBroadcast(), PerformANDCombine(), llvm::PPCTargetLowering::PerformDAGCombine(), performDSPShiftCombine(), PerformORCombine(), resolveBuildVector(), llvm::SystemZVectorConstantInfo::SystemZVectorConstantInfo(), and tryCombineShiftImm().

recastRawBits()

Recast bit data SrcBitElements to DstEltSizeInBits wide elements.

Undef elements are treated as zero, and entirely undefined elements are flagged in DstUndefElements.

Definition at line 13950 of file SelectionDAG.cpp.

References assert(), llvm::SmallVectorImpl< T >::assign(), llvm::BitVector::clear(), llvm::APInt::extractBits(), llvm::APInt::getBitWidth(), llvm::APInt::getZero(), I, llvm::APInt::insertBits(), llvm::BitVector::reset(), llvm::BitVector::resize(), llvm::BitVector::set(), llvm::ArrayRef< T >::size(), and llvm::BitVector::size().

Referenced by llvm::SelectionDAG::FoldConstantArithmetic(), and getConstantRawBits().


The documentation for this class was generated from the following files: