LLVM 21.0.0git
|
VPBlockBase is the building block of the Hierarchical Control-Flow Graph. More...
#include "Transforms/Vectorize/VPlan.h"
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 |
VPRegionBlock * | getParent () |
const VPRegionBlock * | getParent () const |
VPlan * | getPlan () |
const VPlan * | getPlan () const |
void | setPlan (VPlan *ParentPlan) |
Sets the pointer of the plan containing the block. | |
void | setParent (VPRegionBlock *P) |
const VPBasicBlock * | getEntryBasicBlock () const |
VPBasicBlock * | getEntryBasicBlock () |
const VPBasicBlock * | getExitingBasicBlock () const |
VPBasicBlock * | getExitingBasicBlock () |
const VPBlocksTy & | getSuccessors () const |
VPBlocksTy & | getSuccessors () |
iterator_range< VPBlockBase ** > | successors () |
iterator_range< VPBlockBase ** > | predecessors () |
const VPBlocksTy & | getPredecessors () const |
VPBlocksTy & | getPredecessors () |
VPBlockBase * | getSingleSuccessor () const |
VPBlockBase * | getSinglePredecessor () const |
size_t | getNumSuccessors () const |
size_t | getNumPredecessors () const |
VPBlockBase * | getEnclosingBlockWithSuccessors () |
An Enclosing Block of a block B is any block containing B, including B itself. | |
VPBlockBase * | getEnclosingBlockWithPredecessors () |
const VPBlocksTy & | getHierarchicalSuccessors () |
VPBlockBase * | getSingleHierarchicalSuccessor () |
const VPBlocksTy & | getHierarchicalPredecessors () |
VPBlockBase * | getSingleHierarchicalPredecessor () |
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 | swapSuccessors () |
Swap successors of the block. The block must have exactly 2 successors. | |
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 VPBlockBase * | clone ()=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 |
VPBlockBase is the building block of the Hierarchical Control-Flow Graph.
A VPBlockBase can be either a VPBasicBlock or a VPRegionBlock.
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.
|
virtualdefault |
|
inline |
Remove all the predecessor of this block.
Definition at line 301 of file VPlan.h.
References llvm::SmallVectorImpl< T >::clear().
Referenced by llvm::VPBlockUtils::reassociateBlocks().
|
inline |
Remove all the successors of this block.
Definition at line 304 of file VPlan.h.
References llvm::SmallVectorImpl< T >::clear().
Referenced by llvm::VPBlockUtils::reassociateBlocks().
|
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.
|
pure virtual |
Return the cost of the block.
Implemented in llvm::VPBasicBlock, and llvm::VPRegionBlock.
|
inline |
Dump this VPBlockBase to dbgs().
Definition at line 350 of file VPlan.h.
References llvm::dbgs(), and print().
|
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.
VPBlockBase * VPBlockBase::getEnclosingBlockWithPredecessors | ( | ) |
Definition at line 202 of file VPlan.cpp.
References assert(), getEnclosingBlockWithPredecessors(), and llvm::VPRegionBlock::getEntry().
Referenced by getEnclosingBlockWithPredecessors(), getHierarchicalPredecessors(), and getSingleHierarchicalPredecessor().
VPBlockBase * VPBlockBase::getEnclosingBlockWithSuccessors | ( | ) |
An Enclosing Block of a block B is any block containing B, including B itself.
Definition at line 194 of file VPlan.cpp.
References assert(), getEnclosingBlockWithSuccessors(), and llvm::VPRegionBlock::getExiting().
Referenced by getEnclosingBlockWithSuccessors(), getHierarchicalSuccessors(), and getSingleHierarchicalSuccessor().
VPBasicBlock * VPBlockBase::getEntryBasicBlock | ( | ) |
Definition at line 167 of file VPlan.cpp.
References llvm::Block, and llvm::RegionBase< Tr >::getEntry().
const VPBasicBlock * VPBlockBase::getEntryBasicBlock | ( | ) | const |
Definition at line 160 of file VPlan.cpp.
References llvm::Block, and llvm::RegionBase< Tr >::getEntry().
Referenced by addCanonicalIVRecipes(), addExitUsersForFirstOrderRecurrences(), llvm::VPlanTransforms::adjustFixedOrderRecurrences(), llvm::VPlanTransforms::clearReductionWrapFlags(), collectAllHeaderMasks(), llvm::VPRecipeBuilder::createHeaderMask(), createScalarIVSteps(), llvm::LoopVectorizationPlanner::executePlan(), llvm::InnerLoopVectorizer::fixVectorizedLoop(), llvm::VPlan::getCanonicalIV(), legalizeAndOptimizeInductions(), preparePlanForEpilogueVectorLoop(), preparePlanForMainVectorLoop(), removeRedundantCanonicalIVs(), removeRedundantExpandSCEVRecipes(), removeRedundantInductionCasts(), sinkScalarOperands(), llvm::VPlanTransforms::tryAddExplicitVectorLength(), and llvm::VPlanTransforms::unrollByUF().
VPBasicBlock * VPBlockBase::getExitingBasicBlock | ( | ) |
Definition at line 187 of file VPlan.cpp.
References llvm::Block.
const VPBasicBlock * VPBlockBase::getExitingBasicBlock | ( | ) | const |
Definition at line 180 of file VPlan.cpp.
References llvm::Block.
Referenced by addCanonicalIVRecipes(), addVPLaneMaskPhiAndUpdateExitBranch(), llvm::VPBasicBlock::connectToPredecessors(), llvm::VPIRInstruction::execute(), llvm::VPlan::execute(), llvm::VPRegionBlock::getPreheaderVPBB(), llvm::VPlanTransforms::optimizeForVFAndUF(), and sinkScalarOperands().
|
inline |
Definition at line 252 of file VPlan.h.
References getEnclosingBlockWithPredecessors(), and getPredecessors().
|
inline |
Definition at line 236 of file VPlan.h.
References getEnclosingBlockWithSuccessors(), and getSuccessors().
Referenced by llvm::VPBasicBlock::connectToPredecessors().
|
inline |
|
inline |
Definition at line 217 of file VPlan.h.
References llvm::SmallVectorBase< Size_T >::size().
|
inline |
Definition at line 216 of file VPlan.h.
References llvm::SmallVectorBase< Size_T >::size().
Referenced by llvm::VPlan::getExitBlocks(), hasConditionalTerminator(), llvm::InnerLoopVectorizer::introduceCheckBlockInVPlan(), and llvm::VPlan::isExitBlock().
|
inline |
Definition at line 170 of file VPlan.h.
Referenced by addReplicateRegions(), llvm::VPBlockUtils::connectBlocks(), hasConditionalTerminator(), hoistPreviousBeforeFORUsers(), llvm::VPBlockUtils::insertBlockAfter(), llvm::VPBlockUtils::insertBlockBefore(), llvm::VPBlockUtils::insertTwoBlocksAfter(), isHeaderVPBB(), llvm::InnerLoopVectorizer::scalarizeInstruction(), and setOneSuccessor().
|
inline |
VPlan * VPBlockBase::getPlan | ( | ) |
Definition at line 155 of file VPlan.cpp.
References getPlanEntry().
Referenced by llvm::VPWidenPointerInductionRecipe::execute(), llvm::VPIRInstruction::extractLastLaneOfOperand(), llvm::VPSlotTracker::getOrCreateName(), isDefinedInsideLoopRegions(), replaceVPBBWithIRVPBB(), and llvm::InnerLoopVectorizer::scalarizeInstruction().
Definition at line 157 of file VPlan.cpp.
References getPlanEntry().
|
inline |
|
inline |
Definition at line 201 of file VPlan.h.
Referenced by cloneFrom(), llvm::VPBlockUtils::connectBlocks(), llvm::VPIRInstruction::execute(), getHierarchicalPredecessors(), llvm::VPBlockUtils::insertBlockAfter(), llvm::VPBlockUtils::insertBlockBefore(), llvm::VPBlockUtils::insertOnEdge(), llvm::VPIRInstruction::print(), llvm::VPBlockUtils::reassociateBlocks(), and llvm::VPRegionBlock::setEntry().
|
inline |
Definition at line 258 of file VPlan.h.
References getEnclosingBlockWithPredecessors(), and getSinglePredecessor().
Referenced by createScalarIVSteps().
|
inline |
Definition at line 242 of file VPlan.h.
References getEnclosingBlockWithSuccessors(), and getSingleSuccessor().
|
inline |
Definition at line 212 of file VPlan.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), and llvm::SmallVectorBase< Size_T >::size().
Referenced by addScalarResumePhis(), llvm::VPRegionBlock::getPreheaderVPBB(), getSingleHierarchicalPredecessor(), llvm::VPlan::getVectorPreheader(), llvm::InnerLoopVectorizer::introduceCheckBlockInVPlan(), llvm::VPlanTransforms::optimizeForVFAndUF(), and llvm::VPlanTransforms::optimizeInductionExitUsers().
|
inline |
Definition at line 206 of file VPlan.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), and llvm::SmallVectorBase< Size_T >::size().
Referenced by addExitUsersForFirstOrderRecurrences(), addScalarResumePhis(), llvm::LoopVectorizationPlanner::executePlan(), llvm::VPlan::getCanonicalIV(), getSingleHierarchicalSuccessor(), mergeReplicateRegionsIntoSuccessors(), llvm::VPlanTransforms::optimizeForVFAndUF(), and sinkScalarOperands().
|
inline |
|
inline |
Definition at line 195 of file VPlan.h.
Referenced by getHierarchicalSuccessors(), llvm::VPBlockUtils::insertBlockAfter(), llvm::VPBlockUtils::insertBlockBefore(), llvm::VPBlockUtils::insertTwoBlocksAfter(), llvm::InnerLoopVectorizer::introduceCheckBlockInVPlan(), llvm::VPBlockUtils::reassociateBlocks(), llvm::VPRegionBlock::setExiting(), and sinkScalarOperands().
|
inline |
|
inline |
|
inline |
Definition at line 199 of file VPlan.h.
Referenced by llvm::VPBlockUtils::insertBlockBefore().
void VPBlockBase::print | ( | raw_ostream & | O | ) | const |
Print plain-text dump of this VPlan to O
.
Definition at line 628 of file VPlan.cpp.
References llvm::print().
|
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, llvm::VPRegionBlock, llvm::VPBasicBlock, and llvm::VPRegionBlock.
Referenced by dump().
|
inline |
void VPBlockBase::printSuccessors | ( | raw_ostream & | O, |
const Twine & | Indent | ||
) | const |
Definition at line 163 of file VPlan.h.
References Name, and llvm::Twine::str().
Referenced by llvm::LoopVectorizationPlanner::buildVPlans().
|
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 265 of file VPlan.h.
References assert(), llvm::SmallVectorBase< Size_T >::empty(), getParent(), and llvm::Successor.
|
inline |
Definition at line 181 of file VPlan.h.
References P.
Referenced by llvm::VPBlockUtils::insertBlockAfter(), llvm::VPBlockUtils::insertBlockBefore(), llvm::VPBlockUtils::insertTwoBlocksAfter(), llvm::VPRegionBlock::setEntry(), and llvm::VPRegionBlock::setExiting().
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 174 of file VPlan.cpp.
References assert(), and llvm::VPlan::getEntry().
Referenced by llvm::VPlan::setEntry().
|
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 285 of file VPlan.h.
References assert(), and llvm::SmallVectorBase< Size_T >::empty().
Referenced by cloneFrom(), and llvm::VPBlockUtils::insertTwoBlocksAfter().
|
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 294 of file VPlan.h.
References assert(), and llvm::SmallVectorBase< Size_T >::empty().
Referenced by cloneFrom().
|
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 276 of file VPlan.h.
References assert(), and llvm::SmallVectorBase< Size_T >::empty().
Referenced by llvm::VPBlockUtils::insertTwoBlocksAfter().
|
inline |
Definition at line 198 of file VPlan.h.
Referenced by cloneFrom(), and llvm::VPBlockUtils::insertBlockAfter().
|
inline |
Swap successors of the block. The block must have exactly 2 successors.
Definition at line 309 of file VPlan.h.
References assert(), llvm::SmallVectorBase< Size_T >::size(), and std::swap().
Referenced by llvm::VPlanTransforms::handleUncountableEarlyExit(), and llvm::InnerLoopVectorizer::introduceCheckBlockInVPlan().
|
friend |