LLVM  14.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
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:
Inheritance graph
[legend]

Public Types

using VPBlockTy = enum { VPBasicBlockSC, VPRegionBlockSC }
 An enumeration for keeping track of the concrete subclass of VPBlockBase that are actually instantiated. More...
 
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. More...
 
void setParent (VPRegionBlock *P)
 
const VPBasicBlockgetEntryBasicBlock () const
 
VPBasicBlockgetEntryBasicBlock ()
 
const VPBasicBlockgetExitBasicBlock () const
 
VPBasicBlockgetExitBasicBlock ()
 
const VPBlocksTygetSuccessors () const
 
VPBlocksTygetSuccessors ()
 
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. More...
 
VPBlockBasegetEnclosingBlockWithPredecessors ()
 
const VPBlocksTygetHierarchicalSuccessors ()
 
VPBlockBasegetSingleHierarchicalSuccessor ()
 
const VPBlocksTygetHierarchicalPredecessors ()
 
VPBlockBasegetSingleHierarchicalPredecessor ()
 
VPValuegetCondBit ()
 
const VPValuegetCondBit () const
 
void setCondBit (VPValue *CV)
 Set the condition bit selecting the successor. More...
 
VPValuegetPredicate ()
 
const VPValuegetPredicate () const
 
void setPredicate (VPValue *Pred)
 Set the block's predicate. More...
 
void setOneSuccessor (VPBlockBase *Successor)
 Set a given VPBlockBase Successor as the single successor of this VPBlockBase. More...
 
void setTwoSuccessors (VPBlockBase *IfTrue, VPBlockBase *IfFalse, VPValue *Condition)
 Set two given VPBlockBases IfTrue and IfFalse to be the two successors of this VPBlockBase. More...
 
void setPredecessors (ArrayRef< VPBlockBase * > NewPreds)
 Set each VPBasicBlock in NewPreds as predecessor of this VPBlockBase. More...
 
void clearPredecessors ()
 Remove all the predecessor of this block. More...
 
void clearSuccessors ()
 Remove all the successors of this block and set to null its condition bit. More...
 
virtual void execute (struct VPTransformState *State)=0
 The method which generates the output IR that correspond to this VPBlockBase, thereby "executing" the VPlan. More...
 
bool isLegalToHoistInto ()
 Return true if it is legal to hoist instructions into this block. More...
 
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. More...
 
void printAsOperand (raw_ostream &OS, bool PrintType) 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. More...
 
void print (raw_ostream &O) const
 Print plain-text dump of this VPlan to O. More...
 
void printSuccessors (raw_ostream &O, const Twine &Indent) const
 Print the successors of this block to O, prefixing all lines with Indent. More...
 
LLVM_DUMP_METHOD void dump () const
 Dump this VPBlockBase to dbgs(). More...
 

Static Public Member Functions

static void deleteCFG (VPBlockBase *Entry)
 Delete all blocks reachable from a given VPBlockBase, inclusive. More...
 

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 388 of file VPlan.h.

Member Typedef Documentation

◆ VPBlocksTy

Definition at line 457 of file VPlan.h.

◆ VPBlockTy

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

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 455 of file VPlan.h.

Constructor & Destructor Documentation

◆ VPBlockBase()

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

Definition at line 447 of file VPlan.h.

◆ ~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 604 of file VPlan.h.

References llvm::SmallVectorImpl< T >::clear().

◆ clearSuccessors()

void llvm::VPBlockBase::clearSuccessors ( )
inline

Remove all the successors of this block and set to null its condition bit.

Definition at line 607 of file VPlan.h.

References llvm::SmallVectorImpl< T >::clear(), and setCondBit().

◆ deleteCFG()

void VPBlockBase::deleteCFG ( VPBlockBase Entry)
static

Delete all blocks reachable from a given VPBlockBase, inclusive.

Definition at line 213 of file VPlan.cpp.

Referenced by llvm::VPRegionBlock::~VPRegionBlock().

◆ dropAllReferences()

virtual void llvm::VPBlockBase::dropAllReferences ( VPValue NewValue)
pure virtual

Replace all operands of VPUsers in the block with NewValue and also replaces all uses of VPValues defined in the block with NewValue.

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

◆ dump()

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

Dump this VPBlockBase to dbgs().

Definition at line 655 of file VPlan.h.

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

◆ execute()

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

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

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

◆ getCondBit() [1/2]

const VPValue * VPBlockBase::getCondBit ( )
Returns
the condition bit selecting the successor.

Definition at line 191 of file VPlan.cpp.

References llvm::VPBlockUser::getSingleOperandOrNull().

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

◆ getCondBit() [2/2]

const VPValue* llvm::VPBlockBase::getCondBit ( ) const
Returns
the condition bit selecting the successor.

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

References assert(), getEnclosingBlockWithPredecessors(), and llvm::VPRegionBlock::getEntry().

Referenced by getEnclosingBlockWithPredecessors(), 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 175 of file VPlan.cpp.

References assert(), getEnclosingBlockWithSuccessors(), and llvm::VPRegionBlock::getExit().

Referenced by getEnclosingBlockWithSuccessors(), getHierarchicalSuccessors(), and getSingleHierarchicalSuccessor().

◆ getEntryBasicBlock() [1/2]

VPBasicBlock* llvm::VPBlockBase::getEntryBasicBlock ( )

◆ getEntryBasicBlock() [2/2]

VPBasicBlock * VPBlockBase::getEntryBasicBlock ( ) const
Returns
the VPBasicBlock that is the entry of this VPBlockBase, recursively, if the latter is a VPRegionBlock. Otherwise, if this VPBlockBase is a VPBasicBlock, it is returned.
the VPBasicBlock that is the entry of Block, possibly indirectly.

Definition at line 140 of file VPlan.cpp.

References llvm::RegionBase< Tr >::getEntry().

Referenced by llvm::VPlan::execute(), and llvm::InnerLoopVectorizer::fixCrossIterationPHIs().

◆ getExitBasicBlock() [1/2]

VPBasicBlock* llvm::VPBlockBase::getExitBasicBlock ( )

◆ getExitBasicBlock() [2/2]

VPBasicBlock * VPBlockBase::getExitBasicBlock ( ) const
Returns
the VPBasicBlock that is the exit of this VPBlockBase, recursively, if the latter is a VPRegionBlock. Otherwise, if this VPBlockBase is a VPBasicBlock, it is returned.
the VPBasicBlock that is the exit of Block, possibly indirectly.

Definition at line 161 of file VPlan.cpp.

References llvm::RegionBase< Tr >::getExit().

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

◆ 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 549 of file VPlan.h.

References getEnclosingBlockWithPredecessors(), and getPredecessors().

◆ 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 533 of file VPlan.h.

References getEnclosingBlockWithSuccessors(), and getSuccessors().

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

◆ getName()

const std::string& llvm::VPBlockBase::getName ( ) const
inline

◆ getNumPredecessors()

size_t llvm::VPBlockBase::getNumPredecessors ( ) const
inline

Definition at line 514 of file VPlan.h.

◆ getNumSuccessors()

size_t llvm::VPBlockBase::getNumSuccessors ( ) const
inline

Definition at line 513 of file VPlan.h.

◆ getParent() [1/2]

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

◆ getParent() [2/2]

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

Definition at line 471 of file VPlan.h.

◆ getPlan() [1/2]

const VPlan * VPBlockBase::getPlan ( )
Returns
A pointer to the plan containing the current block.

Definition at line 135 of file VPlan.cpp.

References getPlanEntry().

Referenced by llvm::VPValue::dump(), llvm::VPDef::dump(), llvm::operator<<(), and print().

◆ getPlan() [2/2]

const VPlan* llvm::VPBlockBase::getPlan ( ) const

◆ getPredecessors() [1/2]

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

Definition at line 499 of file VPlan.h.

◆ getPredecessors() [2/2]

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

◆ getPredicate() [1/2]

const VPValue * VPBlockBase::getPredicate ( )
Returns
the block's predicate.

Definition at line 201 of file VPlan.cpp.

References llvm::VPBlockUser::getSingleOperandOrNull().

Referenced by llvm::VPBasicBlock::print().

◆ getPredicate() [2/2]

const VPValue* llvm::VPBlockBase::getPredicate ( ) const
Returns
the block's predicate.

◆ 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 555 of file VPlan.h.

References getEnclosingBlockWithPredecessors(), and getSinglePredecessor().

Referenced by 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 539 of file VPlan.h.

References getEnclosingBlockWithSuccessors(), and getSingleSuccessor().

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

◆ getSinglePredecessor()

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

Definition at line 509 of file VPlan.h.

Referenced by getSingleHierarchicalPredecessor().

◆ getSingleSuccessor()

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

Definition at line 503 of file VPlan.h.

Referenced by getSingleHierarchicalSuccessor(), and llvm::VPlanTransforms::mergeReplicateRegions().

◆ getSuccessors() [1/2]

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

Definition at line 496 of file VPlan.h.

◆ getSuccessors() [2/2]

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

◆ 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 468 of file VPlan.h.

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

◆ isLegalToHoistInto()

bool llvm::VPBlockBase::isLegalToHoistInto ( )
inline

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

Definition at line 620 of file VPlan.h.

◆ print() [1/2]

void llvm::VPBlockBase::print ( raw_ostream O) const
inline

Print plain-text dump of this VPlan to O.

Definition at line 645 of file VPlan.h.

References getPlan(), llvm::RISCVFenceField::O, 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::VPRegionBlock, and llvm::VPBasicBlock.

Referenced by dump(), and print().

◆ printAsOperand()

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

Definition at line 631 of file VPlan.h.

References getName().

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

References llvm::empty(), getSuccessors(), llvm::AArch64CC::LS, and llvm::RISCVFenceField::O.

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

◆ setCondBit()

void VPBlockBase::setCondBit ( VPValue CV)

Set the condition bit selecting the successor.

Definition at line 199 of file VPlan.cpp.

References llvm::VPBlockUser::resetSingleOpUser().

Referenced by clearSuccessors(), and setTwoSuccessors().

◆ setName()

void llvm::VPBlockBase::setName ( const Twine newName)
inline

Definition at line 463 of file VPlan.h.

References llvm::Twine::str().

◆ 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 576 of file VPlan.h.

References assert(), and llvm::Successor.

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

◆ setParent()

void llvm::VPBlockBase::setParent ( VPRegionBlock P)
inline

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

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

◆ 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 597 of file VPlan.h.

References assert().

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

◆ setPredicate()

void VPBlockBase::setPredicate ( VPValue Pred)

Set the block's predicate.

Definition at line 209 of file VPlan.cpp.

References llvm::VPBlockUser::resetSingleOpUser().

◆ setTwoSuccessors()

void llvm::VPBlockBase::setTwoSuccessors ( VPBlockBase IfTrue,
VPBlockBase IfFalse,
VPValue Condition 
)
inline

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

Condition is set as the successor selector. This VPBlockBase is not added as predecessor of IfTrue or IfFalse. This VPBlockBase must have no successors.

Definition at line 585 of file VPlan.h.

References assert(), and setCondBit().

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

Friends And Related Function Documentation

◆ VPBlockUtils

friend class VPBlockUtils
friend

Definition at line 389 of file VPlan.h.


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