LLVM 22.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 |
bool | hasPredecessors () const |
Returns true if this block has any predecessors. | |
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 | 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 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 307 of file VPlan.h.
References llvm::SmallVectorImpl< T >::clear().
Referenced by llvm::VPBlockUtils::insertBlockBefore(), and llvm::VPBlockUtils::reassociateBlocks().
|
inline |
Remove all the successors of this block.
Definition at line 310 of file VPlan.h.
References llvm::SmallVectorImpl< T >::clear().
Referenced by llvm::VPBlockUtils::insertBlockAfter(), and 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 377 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().
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().
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 addExitUsersForFirstOrderRecurrences(), llvm::VPlanTransforms::addExplicitVectorLength(), llvm::VPlanTransforms::adjustFixedOrderRecurrences(), llvm::calculateRegisterUsageForPlan(), llvm::VPlanTransforms::clearReductionWrapFlags(), llvm::VPlanTransforms::createLoopRegions(), createScalarIVSteps(), findHeaderMask(), llvm::VPlan::getCanonicalIV(), llvm::VPlanTransforms::handleMaxMinNumReductions(), llvm::VPlanTransforms::introduceMasksAndLinearize(), legalizeAndOptimizeInductions(), llvm::VPlanTransforms::narrowInterleaveGroups(), optimizeVectorInductionWidthForTCAndVFUF(), preparePlanForEpilogueVectorLoop(), preparePlanForMainVectorLoop(), removeRedundantCanonicalIVs(), removeRedundantExpandSCEVRecipes(), removeRedundantInductionCasts(), llvm::LoopVectorizationPlanner::selectInterleaveCount(), sinkScalarOperands(), transformRecipestoEVLRecipes(), 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 addVPLaneMaskPhiAndUpdateExitBranch(), llvm::VPBasicBlock::connectToPredecessors(), llvm::VPIRPhi::execute(), expandVPWidenIntOrFpInduction(), expandVPWidenPointerInduction(), llvm::VPBasicBlock::getCFGPredecessor(), llvm::VPlanTransforms::handleMaxMinNumReductions(), llvm::VPBasicBlock::isExiting(), simplifyBranchConditionForVFAndUF(), sinkScalarOperands(), and tryToReplaceALMWithWideALM().
|
inline |
|
inline |
Definition at line 242 of file VPlan.h.
Referenced by llvm::VPBasicBlock::connectToPredecessors(), and llvm::VPIRBasicBlock::execute().
|
inline |
Returns the index for Pred
in the blocks predecessors list.
Definition at line 328 of file VPlan.h.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::count(), and find().
Referenced by llvm::VPBlockUtils::insertOnEdge().
|
inline |
Returns the index for Succ
in the blocks successor list.
Definition at line 335 of file VPlan.h.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::count(), and find().
|
inline |
Definition at line 164 of file VPlan.h.
References Name.
Referenced by llvm::VPBasicBlock::clone(), llvm::VPRegionBlock::clone(), llvm::VPBasicBlock::executeRecipes(), llvm::VPBasicBlock::print(), llvm::VPRegionBlock::print(), and llvm::VPBasicBlock::splitAt().
|
inline |
Definition at line 220 of file VPlan.h.
References llvm::SmallVectorBase< Size_T >::size().
Referenced by llvm::VPlanTransforms::attachCheckBlock(), llvm::VPBasicBlock::getCFGPredecessor(), llvm::VPlanTransforms::handleUncountableEarlyExit(), and llvm::EpilogueVectorizerMainLoop::introduceCheckBlockInVPlan().
|
inline |
Definition at line 219 of file VPlan.h.
References llvm::SmallVectorBase< Size_T >::size().
Referenced by llvm::VPlan::duplicate(), llvm::VPIRBasicBlock::execute(), hasConditionalTerminator(), llvm::EpilogueVectorizerMainLoop::introduceCheckBlockInVPlan(), and llvm::VPBlockUtils::isLatch().
|
inline |
Definition at line 173 of file VPlan.h.
Referenced by addReplicateRegions(), llvm::VPBlockUtils::connectBlocks(), llvm::VPRegionBlock::dissolveToCFGLoop(), llvm::VPBasicBlock::execute(), llvm::VPBasicBlock::getCFGPredecessor(), llvm::VPBasicBlock::getEnclosingLoopRegion(), hasConditionalTerminator(), hoistPreviousBeforeFORUsers(), llvm::VPBlockUtils::insertBlockAfter(), llvm::VPBlockUtils::insertBlockBefore(), llvm::VPBlockUtils::insertTwoBlocksAfter(), llvm::VPBasicBlock::isExiting(), llvm::vputils::isSingleScalar(), llvm::VPlanTransforms::materializeBuildVectors(), scalarizeInstruction(), and llvm::VPRecipeBuilder::tryToCreateWidenRecipe().
|
inline |
VPlan * VPBlockBase::getPlan | ( | ) |
Definition at line 155 of file VPlan.cpp.
References getPlanEntry().
Referenced by llvm::VPBasicBlock::clone(), llvm::VPIRBasicBlock::clone(), llvm::VPRegionBlock::clone(), llvm::VPBasicBlock::connectToPredecessors(), llvm::VPBuilder::createElementCount(), llvm::VPRegionBlock::dissolveToCFGLoop(), expandVPWidenIntOrFpInduction(), llvm::VPSlotTracker::getOrCreateName(), isDefinedInsideLoopRegions(), llvm::operator<<(), print(), replaceVPBBWithIRVPBB(), scalarizeInstruction(), and llvm::VPBasicBlock::splitAt().
Definition at line 157 of file VPlan.cpp.
References getPlanEntry().
|
inline |
|
inline |
Definition at line 204 of file VPlan.h.
Referenced by llvm::VPlanTransforms::addMiddleCheck(), canonicalHeaderAndLatch(), llvm::VPlanTransforms::canonicalizeEVLLoops(), cloneFrom(), llvm::VPBlockUtils::connectBlocks(), llvm::VPBasicBlock::connectToPredecessors(), createLoopRegion(), llvm::VPIRPhi::execute(), llvm::VPBasicBlock::getCFGPredecessor(), llvm::VPlanTransforms::handleEarlyExits(), llvm::VPlanTransforms::handleUncountableEarlyExit(), llvm::VPBlockUtils::insertBlockAfter(), llvm::VPBlockUtils::insertBlockBefore(), llvm::VPBlockUtils::isHeader(), llvm::VPBlockUtils::reassociateBlocks(), llvm::VPlanTransforms::removeBranchOnConst(), and llvm::VPRegionBlock::setEntry().
|
inline |
Definition at line 264 of file VPlan.h.
References getSinglePredecessor().
Referenced by createScalarIVSteps(), and llvm::VPBasicBlock::execute().
|
inline |
Definition at line 248 of file VPlan.h.
References getSingleSuccessor().
|
inline |
Definition at line 215 of file VPlan.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), and llvm::SmallVectorBase< Size_T >::size().
Referenced by llvm::VPlanTransforms::addMiddleCheck(), addScalarResumePhis(), llvm::VPlanTransforms::attachCheckBlock(), llvm::VPRegionBlock::dissolveToCFGLoop(), getSingleHierarchicalPredecessor(), llvm::VPlan::getVectorPreheader(), llvm::VPlanTransforms::handleEarlyExits(), llvm::VPlanTransforms::handleUncountableEarlyExit(), llvm::VPlan::hasScalarTail(), llvm::EpilogueVectorizerMainLoop::introduceCheckBlockInVPlan(), llvm::VPlanTransforms::replaceSymbolicStrides(), and simplifyBranchConditionForVFAndUF().
|
inline |
Definition at line 209 of file VPlan.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), and llvm::SmallVectorBase< Size_T >::size().
Referenced by addExitUsersForFirstOrderRecurrences(), addInitialSkeleton(), addScalarResumePhis(), llvm::VPBasicBlock::connectToPredecessors(), createLoopRegion(), llvm::VPRegionBlock::dissolveToCFGLoop(), llvm::VPIRBasicBlock::execute(), llvm::VPlan::getCanonicalIV(), llvm::VPlan::getMiddleBlock(), getSingleHierarchicalSuccessor(), llvm::VPlanTransforms::materializeConstantVectorTripCount(), mergeReplicateRegionsIntoSuccessors(), simplifyBranchConditionForVFAndUF(), and sinkScalarOperands().
|
inline |
|
inline |
Definition at line 198 of file VPlan.h.
Referenced by addInitialSkeleton(), llvm::VPRegionBlock::cost(), createCondBranch(), llvm::VPlanTransforms::handleUncountableEarlyExit(), llvm::VPBlockUtils::insertBlockAfter(), llvm::VPBlockUtils::insertBlockBefore(), llvm::VPBlockUtils::insertTwoBlocksAfter(), llvm::EpilogueVectorizerMainLoop::introduceCheckBlockInVPlan(), llvm::VPlanTransforms::introduceMasksAndLinearize(), llvm::VPBlockUtils::isLatch(), printSuccessors(), llvm::VPBlockUtils::reassociateBlocks(), llvm::VPRegionBlock::setExiting(), and sinkScalarOperands().
|
inline |
|
inline |
Returns true if this block has any predecessors.
Definition at line 223 of file VPlan.h.
References llvm::SmallVectorBase< Size_T >::empty().
Referenced by llvm::VPBasicBlock::getCFGPredecessor(), llvm::VPlan::hasEarlyExit(), and llvm::VPlan::hasScalarTail().
|
inline |
|
inline |
Definition at line 202 of file VPlan.h.
Referenced by llvm::VPBlockUtils::insertBlockBefore().
void VPBlockBase::print | ( | raw_ostream & | O | ) | 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, llvm::VPRegionBlock, llvm::VPBasicBlock, and llvm::VPRegionBlock.
Referenced by print().
|
inline |
Definition at line 356 of file VPlan.h.
Referenced by llvm::VPPhiAccessors::printPhiOperands().
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 692 of file VPlan.cpp.
References getSuccessors().
Referenced by llvm::VPBasicBlock::print(), and llvm::VPRegionBlock::print().
Definition at line 166 of file VPlan.h.
References Name, and llvm::Twine::str().
Referenced by llvm::LoopVectorizationPlanner::buildVPlans(), llvm::VPlanTransforms::createLoopRegions(), and llvm::LoopVectorizePass::processLoop().
|
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(), llvm::SmallVectorBase< Size_T >::empty(), getParent(), and llvm::Successor.
|
inline |
Definition at line 184 of file VPlan.h.
References P.
Referenced by createLoopRegion(), 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 291 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 300 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 282 of file VPlan.h.
References assert(), and llvm::SmallVectorBase< Size_T >::empty().
Referenced by llvm::VPBlockUtils::insertTwoBlocksAfter().
|
inline |
Definition at line 201 of file VPlan.h.
Referenced by cloneFrom(), and llvm::VPBlockUtils::insertBlockAfter().
|
inline |
Swap predecessors of the block.
The block must have exactly 2 predecessors.
Definition at line 314 of file VPlan.h.
References assert(), llvm::SmallVectorBase< Size_T >::size(), and std::swap().
Referenced by canonicalHeaderAndLatch().
|
inline |
Swap successors of the block. The block must have exactly 2 successors.
Definition at line 322 of file VPlan.h.
References assert(), llvm::SmallVectorBase< Size_T >::size(), and std::swap().
Referenced by addInitialSkeleton(), llvm::VPlanTransforms::attachCheckBlock(), llvm::VPlanTransforms::handleUncountableEarlyExit(), and llvm::EpilogueVectorizerMainLoop::introduceCheckBlockInVPlan().
|
friend |