LLVM 22.0.0git
llvm::VPBlockBase Class Referenceabstract

VPBlockBase is the building block of the Hierarchical Control-Flow Graph. More...

#include "Transforms/Vectorize/VPlan.h"

Inheritance diagram for llvm::VPBlockBase:
[legend]

Public Types

using VPBlockTy = enum { VPRegionBlockSC, VPBasicBlockSC, VPIRBasicBlockSC }
 An enumeration for keeping track of the concrete subclass of VPBlockBase that are actually instantiated.
using VPBlocksTy = SmallVectorImpl<VPBlockBase *>

Public Member Functions

virtual ~VPBlockBase ()=default
const std::string & getName () const
void setName (const Twine &newName)
unsigned getVPBlockID () const
VPRegionBlockgetParent ()
const VPRegionBlockgetParent () const
VPlangetPlan ()
const VPlangetPlan () const
void setPlan (VPlan *ParentPlan)
 Sets the pointer of the plan containing the block.
void setParent (VPRegionBlock *P)
const VPBasicBlockgetEntryBasicBlock () const
VPBasicBlockgetEntryBasicBlock ()
const VPBasicBlockgetExitingBasicBlock () const
VPBasicBlockgetExitingBasicBlock ()
const VPBlocksTygetSuccessors () const
VPBlocksTygetSuccessors ()
iterator_range< VPBlockBase ** > successors ()
iterator_range< VPBlockBase ** > predecessors ()
const VPBlocksTygetPredecessors () const
VPBlocksTygetPredecessors ()
VPBlockBasegetSingleSuccessor () const
VPBlockBasegetSinglePredecessor () const
size_t getNumSuccessors () const
size_t getNumPredecessors () const
bool hasPredecessors () const
 Returns true if this block has any predecessors.
VPBlockBasegetEnclosingBlockWithSuccessors ()
 An Enclosing Block of a block B is any block containing B, including B itself.
VPBlockBasegetEnclosingBlockWithPredecessors ()
const VPBlocksTygetHierarchicalSuccessors ()
VPBlockBasegetSingleHierarchicalSuccessor ()
const VPBlocksTygetHierarchicalPredecessors ()
VPBlockBasegetSingleHierarchicalPredecessor ()
void setOneSuccessor (VPBlockBase *Successor)
 Set a given VPBlockBase Successor as the single successor of this VPBlockBase.
void setTwoSuccessors (VPBlockBase *IfTrue, VPBlockBase *IfFalse)
 Set two given VPBlockBases IfTrue and IfFalse to be the two successors of this VPBlockBase.
void setPredecessors (ArrayRef< VPBlockBase * > NewPreds)
 Set each VPBasicBlock in NewPreds as predecessor of this VPBlockBase.
void setSuccessors (ArrayRef< VPBlockBase * > NewSuccs)
 Set each VPBasicBlock in NewSuccss as successor of this VPBlockBase.
void clearPredecessors ()
 Remove all the predecessor of this block.
void clearSuccessors ()
 Remove all the successors of this block.
void swapPredecessors ()
 Swap predecessors of the block.
void swapSuccessors ()
 Swap successors of the block. The block must have exactly 2 successors.
unsigned getIndexForPredecessor (const VPBlockBase *Pred) const
 Returns the index for Pred in the blocks predecessors list.
unsigned getIndexForSuccessor (const VPBlockBase *Succ) const
 Returns the index for Succ in the blocks successor list.
virtual void execute (VPTransformState *State)=0
 The method which generates the output IR that correspond to this VPBlockBase, thereby "executing" the VPlan.
virtual InstructionCost cost (ElementCount VF, VPCostContext &Ctx)=0
 Return the cost of the block.
bool isLegalToHoistInto ()
 Return true if it is legal to hoist instructions into this block.
void printAsOperand (raw_ostream &OS, bool PrintType=false) const
virtual void print (raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const =0
 Print plain-text dump of this VPBlockBase to O, prefixing all lines with Indent.
void print (raw_ostream &O) const
 Print plain-text dump of this VPlan to O.
void printSuccessors (raw_ostream &O, const Twine &Indent) const
 Print the successors of this block to O, prefixing all lines with Indent.
LLVM_DUMP_METHOD void dump () const
 Dump this VPBlockBase to dbgs().
virtual VPBlockBaseclone ()=0
 Clone the current block and it's recipes without updating the operands of the cloned recipes, including all blocks in the single-entry single-exit region for VPRegionBlocks.

Protected Member Functions

 VPBlockBase (const unsigned char SC, const std::string &N)

Friends

class VPBlockUtils

Detailed Description

VPBlockBase is the building block of the Hierarchical Control-Flow Graph.

A VPBlockBase can be either a VPBasicBlock or a VPRegionBlock.

Definition at line 81 of file VPlan.h.

Member Typedef Documentation

◆ VPBlocksTy

Definition at line 160 of file VPlan.h.

◆ VPBlockTy

using llvm::VPBlockBase::VPBlockTy = enum { VPRegionBlockSC, VPBasicBlockSC, VPIRBasicBlockSC }

An enumeration for keeping track of the concrete subclass of VPBlockBase that are actually instantiated.

Values of this enumeration are kept in the SubclassID field of the VPBlockBase objects. They are used for concrete type identification.

Definition at line 158 of file VPlan.h.

Constructor & Destructor Documentation

◆ VPBlockBase()

◆ ~VPBlockBase()

virtual llvm::VPBlockBase::~VPBlockBase ( )
virtualdefault

Member Function Documentation

◆ clearPredecessors()

void llvm::VPBlockBase::clearPredecessors ( )
inline

Remove all the predecessor of this block.

Definition at line 307 of file VPlan.h.

Referenced by llvm::VPBlockUtils::insertBlockBefore(), and llvm::VPBlockUtils::reassociateBlocks().

◆ clearSuccessors()

void llvm::VPBlockBase::clearSuccessors ( )
inline

Remove all the successors of this block.

Definition at line 310 of file VPlan.h.

Referenced by llvm::VPBlockUtils::insertBlockAfter(), and llvm::VPBlockUtils::reassociateBlocks().

◆ clone()

virtual VPBlockBase * llvm::VPBlockBase::clone ( )
pure virtual

Clone the current block and it's recipes without updating the operands of the cloned recipes, including all blocks in the single-entry single-exit region for VPRegionBlocks.

Implemented in llvm::VPBasicBlock, llvm::VPIRBasicBlock, and llvm::VPRegionBlock.

References VPBlockBase().

◆ cost()

virtual InstructionCost llvm::VPBlockBase::cost ( ElementCount VF,
VPCostContext & Ctx )
pure virtual

Return the cost of the block.

Implemented in llvm::VPBasicBlock, and llvm::VPRegionBlock.

◆ dump()

LLVM_DUMP_METHOD void llvm::VPBlockBase::dump ( ) const
inline

Dump this VPBlockBase to dbgs().

Definition at line 377 of file VPlan.h.

References llvm::dbgs(), LLVM_DUMP_METHOD, and print().

◆ execute()

virtual void llvm::VPBlockBase::execute ( VPTransformState * State)
pure virtual

The method which generates the output IR that correspond to this VPBlockBase, thereby "executing" the VPlan.

Implemented in llvm::VPBasicBlock, llvm::VPIRBasicBlock, and llvm::VPRegionBlock.

◆ getEnclosingBlockWithPredecessors()

VPBlockBase * VPBlockBase::getEnclosingBlockWithPredecessors ( )
Returns
the closest enclosing block starting from "this", which has predecessors.
the root enclosing block if all enclosing blocks have no predecessors.

Definition at line 212 of file VPlan.cpp.

References assert(), and VPBlockBase().

Referenced by getHierarchicalPredecessors(), and getSingleHierarchicalPredecessor().

◆ getEnclosingBlockWithSuccessors()

VPBlockBase * VPBlockBase::getEnclosingBlockWithSuccessors ( )

An Enclosing Block of a block B is any block containing B, including B itself.

Returns
the closest enclosing block starting from "this", which has successors.
the root enclosing block if all enclosing blocks have no successors.

Definition at line 204 of file VPlan.cpp.

References assert(), and VPBlockBase().

Referenced by getHierarchicalSuccessors(), and getSingleHierarchicalSuccessor().

◆ getEntryBasicBlock() [1/2]

VPBasicBlock * VPBlockBase::getEntryBasicBlock ( )

◆ getEntryBasicBlock() [2/2]

◆ getExitingBasicBlock() [1/2]

VPBasicBlock * VPBlockBase::getExitingBasicBlock ( )

Definition at line 197 of file VPlan.cpp.

References llvm::Block, llvm::cast(), llvm::dyn_cast(), and VPBlockBase().

◆ getExitingBasicBlock() [2/2]

const VPBasicBlock * VPBlockBase::getExitingBasicBlock ( ) const

◆ getHierarchicalPredecessors()

const VPBlocksTy & llvm::VPBlockBase::getHierarchicalPredecessors ( )
inline
Returns
the predecessors either attached directly to this VPBlockBase or, if this VPBlockBase is the entry block of a VPRegionBlock and has no predecessors of its own, search recursively for the first enclosing VPRegionBlock that has predecessors and return them. If no such VPRegionBlock exists, return the (empty) predecessors of the topmost VPBlockBase reached.

Definition at line 258 of file VPlan.h.

References getEnclosingBlockWithPredecessors().

◆ getHierarchicalSuccessors()

const VPBlocksTy & llvm::VPBlockBase::getHierarchicalSuccessors ( )
inline
Returns
the successors either attached directly to this VPBlockBase or, if this VPBlockBase is the exit block of a VPRegionBlock and has no successors of its own, search recursively for the first enclosing VPRegionBlock that has successors and return them. If no such VPRegionBlock exists, return the (empty) successors of the topmost VPBlockBase reached.

Definition at line 242 of file VPlan.h.

References getEnclosingBlockWithSuccessors().

Referenced by llvm::VPBasicBlock::connectToPredecessors(), and llvm::VPIRBasicBlock::execute().

◆ getIndexForPredecessor()

unsigned llvm::VPBlockBase::getIndexForPredecessor ( const VPBlockBase * Pred) const
inline

Returns the index for Pred in the blocks predecessors list.

Definition at line 328 of file VPlan.h.

References assert(), llvm::count(), llvm::find(), and VPBlockBase().

Referenced by llvm::VPBlockUtils::insertOnEdge().

◆ getIndexForSuccessor()

unsigned llvm::VPBlockBase::getIndexForSuccessor ( const VPBlockBase * Succ) const
inline

Returns the index for Succ in the blocks successor list.

Definition at line 335 of file VPlan.h.

References assert(), llvm::count(), llvm::find(), and VPBlockBase().

Referenced by llvm::VPBlockUtils::insertOnEdge().

◆ getName()

◆ getNumPredecessors()

◆ getNumSuccessors()

◆ getParent() [1/2]

◆ getParent() [2/2]

const VPRegionBlock * llvm::VPBlockBase::getParent ( ) const
inline

Definition at line 174 of file VPlan.h.

◆ getPlan() [1/2]

◆ getPlan() [2/2]

const VPlan * VPBlockBase::getPlan ( ) const

Definition at line 167 of file VPlan.cpp.

References getPlanEntry().

◆ getPredecessors() [1/2]

VPBlocksTy & llvm::VPBlockBase::getPredecessors ( )
inline

Definition at line 205 of file VPlan.h.

◆ getPredecessors() [2/2]

◆ getSingleHierarchicalPredecessor()

VPBlockBase * llvm::VPBlockBase::getSingleHierarchicalPredecessor ( )
inline
Returns
the hierarchical predecessor of this VPBlockBase if it has a single hierarchical predecessor. Otherwise return a null pointer.

Definition at line 264 of file VPlan.h.

References getEnclosingBlockWithPredecessors(), and VPBlockBase().

Referenced by createScalarIVSteps(), and llvm::VPBasicBlock::execute().

◆ getSingleHierarchicalSuccessor()

VPBlockBase * llvm::VPBlockBase::getSingleHierarchicalSuccessor ( )
inline
Returns
the hierarchical successor of this VPBlockBase if it has a single hierarchical successor. Otherwise return a null pointer.

Definition at line 248 of file VPlan.h.

References getEnclosingBlockWithSuccessors(), and VPBlockBase().

◆ getSinglePredecessor()

◆ getSingleSuccessor()

◆ getSuccessors() [1/2]

VPBlocksTy & llvm::VPBlockBase::getSuccessors ( )
inline

Definition at line 199 of file VPlan.h.

◆ getSuccessors() [2/2]

◆ getVPBlockID()

unsigned llvm::VPBlockBase::getVPBlockID ( ) const
inline
Returns
an ID for the concrete type of this object. This is used to implement the classof checks. This should not be used for any other purpose, as the values may change as LLVM evolves.

Definition at line 171 of file VPlan.h.

◆ hasPredecessors()

bool llvm::VPBlockBase::hasPredecessors ( ) const
inline

Returns true if this block has any predecessors.

Definition at line 223 of file VPlan.h.

Referenced by llvm::VPBasicBlock::getCFGPredecessor(), llvm::VPlan::hasEarlyExit(), and llvm::VPlan::hasScalarTail().

◆ isLegalToHoistInto()

bool llvm::VPBlockBase::isLegalToHoistInto ( )
inline

Return true if it is legal to hoist instructions into this block.

Definition at line 349 of file VPlan.h.

◆ predecessors()

iterator_range< VPBlockBase ** > llvm::VPBlockBase::predecessors ( )
inline

Definition at line 202 of file VPlan.h.

Referenced by llvm::VPBlockUtils::insertBlockBefore().

◆ print() [1/2]

void VPBlockBase::print ( raw_ostream & O) const

Print plain-text dump of this VPlan to O.

Definition at line 697 of file VPlan.cpp.

References getPlan(), and print().

◆ print() [2/2]

virtual void llvm::VPBlockBase::print ( raw_ostream & O,
const Twine & Indent,
VPSlotTracker & SlotTracker ) const
pure virtual

Print plain-text dump of this VPBlockBase to O, prefixing all lines with Indent.

SlotTracker is used to print unnamed VPValue's using consequtive numbers.

Note that the numbering is applied to the whole VPlan, so printing individual blocks is consistent with the whole VPlan printing.

Implemented in llvm::VPBasicBlock, and llvm::VPRegionBlock.

References printSuccessors().

Referenced by print().

◆ printAsOperand()

void llvm::VPBlockBase::printAsOperand ( raw_ostream & OS,
bool PrintType = false ) const
inline

Definition at line 356 of file VPlan.h.

References getName().

Referenced by llvm::VPPhiAccessors::printPhiOperands().

◆ printSuccessors()

void VPBlockBase::printSuccessors ( raw_ostream & O,
const Twine & Indent ) const

Print the successors of this block to O, prefixing all lines with Indent.

Definition at line 702 of file VPlan.cpp.

References getSuccessors().

Referenced by llvm::VPBasicBlock::print(), print(), and llvm::VPRegionBlock::print().

◆ setName()

◆ setOneSuccessor()

void llvm::VPBlockBase::setOneSuccessor ( VPBlockBase * Successor)
inline

Set a given VPBlockBase Successor as the single successor of this VPBlockBase.

This VPBlockBase is not added as predecessor of Successor. This VPBlockBase must have no successors.

Definition at line 271 of file VPlan.h.

References assert(), getParent(), llvm::Successor, and VPBlockBase().

◆ setParent()

◆ setPlan()

void VPBlockBase::setPlan ( VPlan * ParentPlan)

Sets the pointer of the plan containing the block.

The block must be the entry block into the VPlan.

Definition at line 184 of file VPlan.cpp.

References assert(), and llvm::VPlan::getEntry().

Referenced by llvm::VPlan::setEntry().

◆ setPredecessors()

void llvm::VPBlockBase::setPredecessors ( ArrayRef< VPBlockBase * > NewPreds)
inline

Set each VPBasicBlock in NewPreds as predecessor of this VPBlockBase.

This VPBlockBase must have no predecessors. This VPBlockBase is not added as successor of any VPBasicBlock in NewPreds.

Definition at line 291 of file VPlan.h.

References assert().

Referenced by cloneFrom(), and llvm::VPBlockUtils::insertTwoBlocksAfter().

◆ setSuccessors()

void llvm::VPBlockBase::setSuccessors ( ArrayRef< VPBlockBase * > NewSuccs)
inline

Set each VPBasicBlock in NewSuccss as successor of this VPBlockBase.

This VPBlockBase must have no successors. This VPBlockBase is not added as predecessor of any VPBasicBlock in NewSuccs.

Definition at line 300 of file VPlan.h.

References assert().

Referenced by cloneFrom().

◆ setTwoSuccessors()

void llvm::VPBlockBase::setTwoSuccessors ( VPBlockBase * IfTrue,
VPBlockBase * IfFalse )
inline

Set two given VPBlockBases IfTrue and IfFalse to be the two successors of this VPBlockBase.

This VPBlockBase is not added as predecessor of IfTrue or IfFalse. This VPBlockBase must have no successors.

Definition at line 282 of file VPlan.h.

References assert(), and VPBlockBase().

Referenced by llvm::VPBlockUtils::insertTwoBlocksAfter().

◆ successors()

iterator_range< VPBlockBase ** > llvm::VPBlockBase::successors ( )
inline

Definition at line 201 of file VPlan.h.

Referenced by cloneFrom(), and llvm::VPBlockUtils::insertBlockAfter().

◆ swapPredecessors()

void llvm::VPBlockBase::swapPredecessors ( )
inline

Swap predecessors of the block.

The block must have exactly 2 predecessors.

Definition at line 314 of file VPlan.h.

References assert(), and std::swap().

Referenced by canonicalHeaderAndLatch().

◆ swapSuccessors()

void llvm::VPBlockBase::swapSuccessors ( )
inline

Swap successors of the block. The block must have exactly 2 successors.

Definition at line 322 of file VPlan.h.

References assert(), and std::swap().

Referenced by addInitialSkeleton(), llvm::VPlanTransforms::attachCheckBlock(), llvm::VPlanTransforms::handleUncountableEarlyExit(), and llvm::EpilogueVectorizerMainLoop::introduceCheckBlockInVPlan().

◆ VPBlockUtils

friend class VPBlockUtils
friend

Definition at line 82 of file VPlan.h.

References llvm::Successor, VPBlockBase(), and VPBlockUtils.

Referenced by VPBlockUtils.


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