LLVM 22.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
llvm::VPBasicBlock Class Reference

VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph. More...

#include "Transforms/Vectorize/VPlan.h"

Inheritance diagram for llvm::VPBasicBlock:
[legend]

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 () 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 VPRecipeBasefront () const
 
VPRecipeBasefront ()
 
const VPRecipeBaseback () const
 
VPRecipeBaseback ()
 
RecipeListTygetRecipeList ()
 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< iteratorphis ()
 Returns an iterator range over the PHI-like recipes in the block.
 
VPBasicBlocksplitAt (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.
 
VPRegionBlockgetEnclosingLoopRegion ()
 
const VPRegionBlockgetEnclosingLoopRegion () const
 
void print (raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override
 Print this VPBsicBlock to O, prefixing all lines with Indent.
 
VPRecipeBasegetTerminator ()
 If the block has multiple successors, return the branch recipe terminating the block.
 
const VPRecipeBasegetTerminator () const
 
bool isExiting () const
 Returns true if the block is exiting it's parent region.
 
VPBasicBlockclone () override
 Clone the current block and it's recipes, without updating the operands of the cloned recipes.
 
const VPBasicBlockgetCFGPredecessor (unsigned Idx) const
 Returns the predecessor block at index Idx with the predecessors as per the corresponding plain CFG.
 
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
 
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
 
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.
 

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.
 

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 &State)
 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.
 

Friends

class VPlan
 

Detailed Description

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.

Definition at line 3639 of file VPlan.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 3667 of file VPlan.h.

◆ const_reverse_iterator

Definition at line 3669 of file VPlan.h.

◆ iterator

Instruction iterators...

Definition at line 3666 of file VPlan.h.

◆ RecipeListTy

Definition at line 3650 of file VPlan.h.

◆ reverse_iterator

Definition at line 3668 of file VPlan.h.

Constructor & Destructor Documentation

◆ VPBasicBlock()

llvm::VPBasicBlock::VPBasicBlock ( const unsigned char  BlockSC,
const Twine Name = "" 
)
inlineprotected

Definition at line 3656 of file VPlan.h.

◆ ~VPBasicBlock()

llvm::VPBasicBlock::~VPBasicBlock ( )
inlineoverride

Member Function Documentation

◆ appendRecipe()

void llvm::VPBasicBlock::appendRecipe ( VPRecipeBase Recipe)
inline

◆ back() [1/2]

VPRecipeBase & llvm::VPBasicBlock::back ( )
inline

Definition at line 3689 of file VPlan.h.

◆ back() [2/2]

const VPRecipeBase & llvm::VPBasicBlock::back ( ) const
inline

◆ begin() [1/2]

iterator llvm::VPBasicBlock::begin ( )
inline

◆ begin() [2/2]

const_iterator llvm::VPBasicBlock::begin ( ) const
inline

Definition at line 3675 of file VPlan.h.

◆ classof()

static bool llvm::VPBasicBlock::classof ( const VPBlockBase V)
inlinestatic

Method to support type inquiry through isa, cast, and dyn_cast.

Definition at line 3700 of file VPlan.h.

◆ clone()

VPBasicBlock * VPBasicBlock::clone ( )
overridevirtual

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 573 of file VPlan.cpp.

References appendRecipe(), llvm::VPlan::createVPBasicBlock(), llvm::VPBlockBase::getName(), and llvm::VPBlockBase::getPlan().

◆ connectToPredecessors()

void VPBasicBlock::connectToPredecessors ( VPTransformState State)
protected

◆ cost()

InstructionCost VPBasicBlock::cost ( ElementCount  VF,
VPCostContext Ctx 
)
overridevirtual

Return the cost of this VPBasicBlock.

Implements llvm::VPBlockBase.

Definition at line 803 of file VPlan.cpp.

References Recipes.

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

◆ empty()

bool llvm::VPBasicBlock::empty ( ) const
inline

◆ end() [1/2]

iterator llvm::VPBasicBlock::end ( )
inline

◆ end() [2/2]

const_iterator llvm::VPBasicBlock::end ( ) const
inline

Definition at line 3677 of file VPlan.h.

◆ execute()

void VPBasicBlock::execute ( VPTransformState State)
overridevirtual

◆ executeRecipes()

void VPBasicBlock::executeRecipes ( VPTransformState State,
BasicBlock BB 
)
protected

◆ front() [1/2]

VPRecipeBase & llvm::VPBasicBlock::front ( )
inline

Definition at line 3687 of file VPlan.h.

◆ front() [2/2]

const VPRecipeBase & llvm::VPBasicBlock::front ( ) const
inline

Definition at line 3686 of file VPlan.h.

◆ getCFGPredecessor()

const VPBasicBlock * VPBasicBlock::getCFGPredecessor ( unsigned  Idx) const

Returns the predecessor block at index Idx with the predecessors as per the corresponding plain CFG.

If the block is an entry block to a region, the first predecessor is the single predecessor of a region, and the second predecessor is the exiting block of the region.

Definition at line 810 of file VPlan.cpp.

References assert(), llvm::RegionBase< Tr >::getEntry(), llvm::VPBlockBase::getExitingBasicBlock(), llvm::VPBlockBase::getNumPredecessors(), llvm::VPBlockBase::getParent(), llvm::VPBlockBase::getPredecessors(), and Idx.

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

◆ getEnclosingLoopRegion() [1/2]

VPRegionBlock * VPBasicBlock::getEnclosingLoopRegion ( )

◆ getEnclosingLoopRegion() [2/2]

const VPRegionBlock * VPBasicBlock::getEnclosingLoopRegion ( ) const

Definition at line 626 of file VPlan.cpp.

References getEnclosingLoopRegionForRegion(), and llvm::VPBlockBase::getParent().

◆ getFirstNonPhi()

VPBasicBlock::iterator VPBasicBlock::getFirstNonPhi ( )

Return the position of the first non-phi node recipe in the block.

Definition at line 236 of file VPlan.cpp.

References begin(), and end().

Referenced by llvm::VPlanTransforms::adjustFixedOrderRecurrences(), createExtractsForLiveOuts(), legalizeAndOptimizeInductions(), mergeReplicateRegionsIntoSuccessors(), replaceVPBBWithIRVPBB(), and sinkScalarOperands().

◆ getRecipeList()

RecipeListTy & llvm::VPBasicBlock::getRecipeList ( )
inline

Returns a reference to the list of recipes.

Definition at line 3692 of file VPlan.h.

Referenced by llvm::VPRecipeBase::eraseFromParent(), and llvm::VPRecipeBase::removeFromParent().

◆ getSublistAccess()

static RecipeListTy VPBasicBlock::* llvm::VPBasicBlock::getSublistAccess ( VPRecipeBase )
inlinestatic

Returns a pointer to a member of the recipe list.

Definition at line 3695 of file VPlan.h.

◆ getTerminator() [1/2]

VPRecipeBase * VPBasicBlock::getTerminator ( )

◆ getTerminator() [2/2]

const VPRecipeBase * VPBasicBlock::getTerminator ( ) const

Definition at line 673 of file VPlan.cpp.

References back(), and hasConditionalTerminator().

◆ insert()

void llvm::VPBasicBlock::insert ( VPRecipeBase Recipe,
iterator  InsertPt 
)
inline

◆ isExiting()

bool VPBasicBlock::isExiting ( ) const

Returns true if the block is exiting it's parent region.

Definition at line 679 of file VPlan.cpp.

References llvm::VPBlockBase::getExitingBasicBlock(), and llvm::VPBlockBase::getParent().

Referenced by hasConditionalTerminator().

◆ phis()

iterator_range< iterator > llvm::VPBasicBlock::phis ( )
inline

◆ print() [1/3]

void VPBlockBase::print ( raw_ostream O) const

Print plain-text dump of this VPlan to O.

Definition at line 367 of file VPlan.cpp.

◆ print() [2/3]

void VPBasicBlock::print ( raw_ostream O,
const Twine Indent,
VPSlotTracker SlotTracker 
) const
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 701 of file VPlan.cpp.

References llvm::VPBlockBase::getName(), llvm::VPDef::print(), and llvm::VPBlockBase::printSuccessors().

◆ print() [3/3]

virtual void llvm::VPBlockBase::print ( raw_ostream O,
const Twine Indent,
VPSlotTracker SlotTracker 
) const
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.

◆ rbegin() [1/2]

reverse_iterator llvm::VPBasicBlock::rbegin ( )
inline

Definition at line 3679 of file VPlan.h.

◆ rbegin() [2/2]

const_reverse_iterator llvm::VPBasicBlock::rbegin ( ) const
inline

Definition at line 3680 of file VPlan.h.

◆ rend() [1/2]

reverse_iterator llvm::VPBasicBlock::rend ( )
inline

Definition at line 3681 of file VPlan.h.

◆ rend() [2/2]

const_reverse_iterator llvm::VPBasicBlock::rend ( ) const
inline

Definition at line 3682 of file VPlan.h.

◆ size()

size_t llvm::VPBasicBlock::size ( ) const
inline

Definition at line 3684 of file VPlan.h.

Referenced by llvm::VPIRBasicBlock::execute().

◆ splitAt()

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 594 of file VPlan.cpp.

References assert(), llvm::VPlan::createVPBasicBlock(), llvm::BasicBlock::end(), end(), llvm::VPBlockBase::getName(), llvm::VPBlockBase::getPlan(), llvm::VPBlockUtils::insertBlockAfter(), llvm::make_early_inc_range(), llvm::make_range(), and llvm::SplitBlock().

Referenced by addReplicateRegions().

Friends And Related Function Documentation

◆ VPlan

friend class VPlan
friend

Definition at line 3640 of file VPlan.h.

Member Data Documentation

◆ Recipes

RecipeListTy llvm::VPBasicBlock::Recipes
protected

The VPRecipes held in the order of output instructions to generate.

Definition at line 3654 of file VPlan.h.

Referenced by llvm::VPIRBasicBlock::clone(), cost(), and executeRecipes().


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