LLVM 20.0.0git
|
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph. More...
#include "Transforms/Vectorize/VPlan.h"
Public Types | |
using | RecipeListTy = iplist< VPRecipeBase > |
using | iterator = RecipeListTy::iterator |
Instruction iterators... | |
using | const_iterator = RecipeListTy::const_iterator |
using | reverse_iterator = RecipeListTy::reverse_iterator |
using | const_reverse_iterator = RecipeListTy::const_reverse_iterator |
Public Types inherited from llvm::VPBlockBase | |
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 | |
VPBasicBlock (const Twine &Name="", VPRecipeBase *Recipe=nullptr) | |
~VPBasicBlock () override | |
iterator | begin () |
Recipe iterator methods. | |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
reverse_iterator | rbegin () |
const_reverse_iterator | rbegin () const |
reverse_iterator | rend () |
const_reverse_iterator | rend () const |
size_t | size () const |
bool | empty () const |
const VPRecipeBase & | front () const |
VPRecipeBase & | front () |
const VPRecipeBase & | back () const |
VPRecipeBase & | back () |
RecipeListTy & | getRecipeList () |
Returns a reference to the list of recipes. | |
void | insert (VPRecipeBase *Recipe, iterator InsertPt) |
void | appendRecipe (VPRecipeBase *Recipe) |
Augment the existing recipes of a VPBasicBlock with an additional Recipe as the last recipe. | |
void | execute (VPTransformState *State) override |
The method which generates the output IR instructions that correspond to this VPBasicBlock, thereby "executing" the VPlan. | |
InstructionCost | cost (ElementCount VF, VPCostContext &Ctx) override |
Return the cost of this VPBasicBlock. | |
iterator | getFirstNonPhi () |
Return the position of the first non-phi node recipe in the block. | |
iterator_range< iterator > | phis () |
Returns an iterator range over the PHI-like recipes in the block. | |
void | dropAllReferences (VPValue *NewValue) override |
Replace all operands of VPUsers in the block with NewValue and also replaces all uses of VPValues defined in the block with NewValue. | |
VPBasicBlock * | splitAt (iterator SplitAt) |
Split current block at SplitAt by inserting a new block between the current block and its successors and moving all recipes starting at SplitAt to the new block. | |
VPRegionBlock * | getEnclosingLoopRegion () |
const VPRegionBlock * | getEnclosingLoopRegion () const |
void | print (raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override |
Print this VPBsicBlock to O , prefixing all lines with Indent . | |
VPRecipeBase * | getTerminator () |
If the block has multiple successors, return the branch recipe terminating the block. | |
const VPRecipeBase * | getTerminator () const |
bool | isExiting () const |
Returns true if the block is exiting it's parent region. | |
VPBasicBlock * | clone () override |
Clone the current block and it's recipes, without updating the operands of the cloned recipes. | |
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 . | |
Public Member Functions inherited from llvm::VPBlockBase | |
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. | |
virtual void | dropAllReferences (VPValue *NewValue)=0 |
Replace all operands of VPUsers in the block with NewValue and also replaces all uses of VPValues defined in the block with NewValue. | |
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. | |
Static Public Member Functions | |
static RecipeListTy VPBasicBlock::* | getSublistAccess (VPRecipeBase *) |
Returns a pointer to a member of the recipe list. | |
static bool | classof (const VPBlockBase *V) |
Method to support type inquiry through isa, cast, and dyn_cast. | |
Static Public Member Functions inherited from llvm::VPBlockBase | |
static void | deleteCFG (VPBlockBase *Entry) |
Delete all blocks reachable from a given VPBlockBase, inclusive. | |
Protected Member Functions | |
VPBasicBlock (const unsigned char BlockSC, const Twine &Name="") | |
void | executeRecipes (VPTransformState *State, BasicBlock *BB) |
Execute the recipes in the IR basic block BB . | |
void | connectToPredecessors (VPTransformState::CFGState &CFG) |
Connect the VPBBs predecessors' in the VPlan CFG to the IR basic block generated for this VPBB. | |
Protected Member Functions inherited from llvm::VPBlockBase | |
VPBlockBase (const unsigned char SC, const std::string &N) | |
Protected Attributes | |
RecipeListTy | Recipes |
The VPRecipes held in the order of output instructions to generate. | |
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
It holds a sequence of zero or more VPRecipe's each representing a sequence of output IR instructions. All PHI-like recipes must come before any non-PHI recipes.
Instruction iterators...
|
inline |
Definition at line 3482 of file VPlan.h.
References appendRecipe().
|
inlineoverride |
Definition at line 3488 of file VPlan.h.
References llvm::iplist_impl< IntrusiveListT, TraitsT >::pop_back(), and Recipes.
|
inline |
Augment the existing recipes of a VPBasicBlock with an additional Recipe
as the last recipe.
Definition at line 3542 of file VPlan.h.
References end(), and insert().
Referenced by llvm::vputils::getOrCreateVPValueForSCEVExpr(), llvm::VPlanTransforms::optimizeForVFAndUF(), llvm::VPlanTransforms::truncateToMinimalBitwidths(), and VPBasicBlock().
|
inline |
|
inline |
Definition at line 3516 of file VPlan.h.
References Recipes.
Referenced by hasConditionalTerminator(), and llvm::VPlanTransforms::optimizeForVFAndUF().
|
inline |
Recipe iterator methods.
Definition at line 3502 of file VPlan.h.
References Recipes.
Referenced by llvm::InnerLoopVectorizer::createInductionResumeVPValues(), llvm::VPlan::getCanonicalIV(), getFirstNonPhi(), and phis().
|
inline |
|
inlinestatic |
|
inlineoverridevirtual |
Clone the current block and it's recipes, without updating the operands of the cloned recipes.
Implements llvm::VPBlockBase.
Reimplemented in llvm::VPIRBasicBlock.
Definition at line 3590 of file VPlan.h.
References llvm::VPBlockBase::getName().
|
protected |
Connect the VPBBs predecessors' in the VPlan CFG to the IR basic block generated for this VPBB.
Definition at line 419 of file VPlan.cpp.
References llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), assert(), llvm::VPTransformState::CFG, llvm::BranchInst::Create(), llvm::dbgs(), DL, llvm::VPTransformState::CFGState::DTU, llvm::MachineBasicBlock::eraseFromParent(), llvm::VPBlockBase::getExitingBasicBlock(), llvm::VPBlockBase::getHierarchicalSuccessors(), llvm::Value::getName(), llvm::BasicBlock::getTerminator(), llvm::DominatorTreeBase< BasicBlock, false >::Insert, LLVM_DEBUG, and llvm::VPTransformState::CFGState::VPBB2IRBB.
|
overridevirtual |
Return the cost of this VPBasicBlock.
Implements llvm::VPBlockBase.
Definition at line 765 of file VPlan.cpp.
References llvm::VPTransformState::VF.
|
overridevirtual |
Replace all operands of VPUsers in the block with NewValue
and also replaces all uses of VPValues defined in the block with NewValue.
Implements llvm::VPBlockBase.
Definition at line 516 of file VPlan.cpp.
References I.
|
inline |
Definition at line 3513 of file VPlan.h.
References Recipes.
Referenced by llvm::LoopVectorizationPlanner::executePlan(), llvm::VPlan::getCanonicalIV(), and hasConditionalTerminator().
|
inline |
Definition at line 3504 of file VPlan.h.
References Recipes.
Referenced by appendRecipe(), getFirstNonPhi(), llvm::VPRecipeBase::insertBefore(), licm(), mergeBlocksIntoPredecessors(), replaceVPBBWithIRVPBB(), and llvm::VPBuilder::setInsertPoint().
|
inline |
|
overridevirtual |
The method which generates the output IR instructions that correspond to this VPBasicBlock, thereby "executing" the VPlan.
Implements llvm::VPBlockBase.
Reimplemented in llvm::VPIRBasicBlock.
Definition at line 477 of file VPlan.cpp.
References llvm::LoopBase< BlockT, LoopT >::addBasicBlockToLoop(), llvm::VPTransformState::Builder, llvm::VPTransformState::CFG, llvm::IRBuilderBase::CreateUnreachable(), llvm::VPTransformState::CurrentVectorLoop, getParent(), llvm::VPTransformState::Lane, llvm::VPTransformState::LI, llvm::VPTransformState::CFGState::PrevBB, llvm::IRBuilderBase::SetInsertPoint(), and llvm::VPTransformState::CFGState::VPBB2IRBB.
Referenced by llvm::LoopVectorizationPlanner::executePlan(), and executeRecipes().
|
protected |
Execute the recipes in the IR basic block BB
.
Definition at line 526 of file VPlan.cpp.
References llvm::VPTransformState::CFG, llvm::dbgs(), execute(), llvm::Value::getName(), getName(), LLVM_DEBUG, and llvm::VPTransformState::CFGState::PrevVPBB.
|
inline |
|
inline |
VPRegionBlock * VPBasicBlock::getEnclosingLoopRegion | ( | ) |
Definition at line 566 of file VPlan.cpp.
References getEnclosingLoopRegionForRegion(), and getParent().
Referenced by hoistPreviousBeforeFORUsers().
const VPRegionBlock * VPBasicBlock::getEnclosingLoopRegion | ( | ) | const |
Definition at line 570 of file VPlan.cpp.
References getEnclosingLoopRegionForRegion(), and getParent().
VPBasicBlock::iterator VPBasicBlock::getFirstNonPhi | ( | ) |
Return the position of the first non-phi node recipe in the block.
Definition at line 213 of file VPlan.cpp.
References begin(), and end().
Referenced by llvm::VPlanTransforms::adjustFixedOrderRecurrences(), llvm::VPRecipeBuilder::createHeaderMask(), legalizeAndOptimizeInductions(), mergeReplicateRegionsIntoSuccessors(), phis(), and sinkScalarOperands().
|
inline |
Returns a reference to the list of recipes.
Definition at line 3520 of file VPlan.h.
References Recipes.
Referenced by llvm::VPRecipeBase::eraseFromParent(), and llvm::VPRecipeBase::removeFromParent().
|
inlinestatic |
VPRecipeBase * VPBasicBlock::getTerminator | ( | ) |
If the block has multiple successors, return the branch recipe terminating the block.
If there are no or only a single successor, return nullptr;
Definition at line 602 of file VPlan.cpp.
References hasConditionalTerminator().
Referenced by addVPLaneMaskPhiAndUpdateExitBranch().
const VPRecipeBase * VPBasicBlock::getTerminator | ( | ) | const |
Definition at line 608 of file VPlan.cpp.
References hasConditionalTerminator().
|
inline |
Definition at line 3533 of file VPlan.h.
References assert(), llvm::iplist_impl< IntrusiveListT, TraitsT >::insert(), and Recipes.
Referenced by appendRecipe(), llvm::VPRecipeBuilder::createHeaderMask(), llvm::VPRecipeBase::insertAfter(), and llvm::VPRecipeBase::insertBefore().
bool VPBasicBlock::isExiting | ( | ) | const |
Returns true if the block is exiting it's parent region.
Definition at line 614 of file VPlan.cpp.
References getParent().
Referenced by hasConditionalTerminator().
|
inline |
Returns an iterator range over the PHI-like recipes in the block.
Definition at line 3555 of file VPlan.h.
References begin(), getFirstNonPhi(), and llvm::make_range().
Referenced by addExitUsersForFirstOrderRecurrences(), llvm::VPlanTransforms::adjustFixedOrderRecurrences(), llvm::VPlanTransforms::clearReductionWrapFlags(), collectAllHeaderMasks(), llvm::EpilogueVectorizerMainLoop::createEpilogueVectorizedLoopSkeleton(), legalizeAndOptimizeInductions(), removeRedundantCanonicalIVs(), removeRedundantInductionCasts(), and llvm::VPlanTransforms::unrollByUF().
|
inline |
|
overridevirtual |
Print this VPBsicBlock 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.
Implements llvm::VPBlockBase.
Definition at line 631 of file VPlan.cpp.
References getName(), and llvm::VPDef::print().
|
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.
Implements llvm::VPBlockBase.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
VPBasicBlock * VPBasicBlock::splitAt | ( | iterator | SplitAt | ) |
Split current block at SplitAt
by inserting a new block between the current block and its successors and moving all recipes starting at SplitAt to the new block.
Returns the new block.
Definition at line 538 of file VPlan.cpp.
References assert(), llvm::BasicBlock::end(), getName(), llvm::VPBlockUtils::insertBlockAfter(), llvm::make_early_inc_range(), llvm::make_range(), llvm::SplitBlock(), and llvm::successors().
Referenced by addReplicateRegions().
|
protected |
The VPRecipes held in the order of output instructions to generate.
Definition at line 3476 of file VPlan.h.
Referenced by back(), begin(), llvm::VPIRBasicBlock::clone(), empty(), end(), front(), getRecipeList(), getSublistAccess(), insert(), rbegin(), rend(), size(), and ~VPBasicBlock().