LLVM  13.0.0git
Public Member Functions | Friends | List of all members
llvm::VPlan Class Reference

VPlan models a candidate for vectorization, encoding various decisions take to produce efficient output IR, including which branches, basic-blocks and output IR instructions to generate, and their cost. More...

#include "Transforms/Vectorize/VPlan.h"

Public Member Functions

 VPlan (VPBlockBase *Entry=nullptr)
 
 ~VPlan ()
 
void execute (struct VPTransformState *State)
 Generate the IR code for this VPlan. More...
 
VPBlockBasegetEntry ()
 
const VPBlockBasegetEntry () const
 
VPBlockBasesetEntry (VPBlockBase *Block)
 
VPValuegetOrCreateBackedgeTakenCount ()
 The backedge taken count of the original loop. More...
 
void addVF (ElementCount VF)
 
bool hasVF (ElementCount VF)
 
const std::string & getName () const
 
void setName (const Twine &newName)
 
void addExternalDef (VPValue *VPVal)
 Add VPVal to the pool of external definitions if it's not already in the pool. More...
 
void addVPValue (Value *V)
 
void addVPValue (Value *V, VPValue *VPV)
 
VPValuegetVPValue (Value *V)
 
VPValuegetOrAddVPValue (Value *V)
 
void removeVPValueFor (Value *V)
 
VPLoopInfogetVPLoopInfo ()
 Return the VPLoopInfo analysis for this VPlan. More...
 
const VPLoopInfogetVPLoopInfo () const
 
void print (raw_ostream &O) const
 Print this VPlan to O. More...
 
void printDOT (raw_ostream &O) const
 Print this VPlan in DOT format to O. More...
 
LLVM_DUMP_METHOD void dump () const
 Dump the plan to stderr (for debugging). More...
 
iterator_range< mapped_iterator< Use *, std::function< VPValue *(Value *)> > > mapToVPValues (User::op_range Operands)
 Returns a range mapping the values the range Operands to their corresponding VPValues. More...
 

Friends

class VPlanPrinter
 
class VPSlotTracker
 

Detailed Description

VPlan models a candidate for vectorization, encoding various decisions take to produce efficient output IR, including which branches, basic-blocks and output IR instructions to generate, and their cost.

VPlan holds a Hierarchical-CFG of VPBasicBlocks and VPRegionBlocks rooted at an Entry VPBlock.

Definition at line 1755 of file VPlan.h.

Constructor & Destructor Documentation

◆ VPlan()

llvm::VPlan::VPlan ( VPBlockBase Entry = nullptr)
inline

Definition at line 1791 of file VPlan.h.

◆ ~VPlan()

llvm::VPlan::~VPlan ( )
inline

Definition at line 1796 of file VPlan.h.

Member Function Documentation

◆ addExternalDef()

void llvm::VPlan::addExternalDef ( VPValue VPVal)
inline

Add VPVal to the pool of external definitions if it's not already in the pool.

Definition at line 1841 of file VPlan.h.

References llvm::SetVector< T, Vector, Set >::insert().

◆ addVF()

void llvm::VPlan::addVF ( ElementCount  VF)
inline

◆ addVPValue() [1/2]

void llvm::VPlan::addVPValue ( Value V)
inline

◆ addVPValue() [2/2]

void llvm::VPlan::addVPValue ( Value V,
VPValue VPV 
)
inline

◆ dump()

LLVM_DUMP_METHOD void VPlan::dump ( ) const

Dump the plan to stderr (for debugging).

Definition at line 788 of file VPlan.cpp.

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

◆ execute()

void VPlan::execute ( struct VPTransformState State)

Generate the IR code for this VPlan.

Generate the code inside the body of the vectorized loop.

Assumes a single LoopVectorBody basic-block was created for this. Introduce additional basic-blocks as needed, and fill them all.

Definition at line 683 of file VPlan.cpp.

References llvm::LoopBase< BlockT, LoopT >::addBasicBlockToLoop(), assert(), BB, llvm::VPTransformState::Builder, Builder, llvm::VPTransformState::CFG, llvm::BranchInst::Create(), llvm::IRBuilderBase::CreateUnreachable(), llvm::depth_first(), llvm::VPTransformState::DT, EnableVPlanNativePath, llvm::Instruction::eraseFromParent(), llvm::ConstantInt::get(), llvm::VPBlockBase::getEntryBasicBlock(), llvm::LoopBase< BlockT, LoopT >::getExitBlock(), llvm::BasicBlock::getFirstInsertionPt(), llvm::VPBlockBase::getHierarchicalSuccessors(), llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), llvm::VPValue::getNumUsers(), llvm::BasicBlock::getSingleSuccessor(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), llvm::VPTransformState::CFGState::LastBB, llvm::VPTransformState::LI, llvm::MergeBlockIntoPredecessor(), llvm::VPTransformState::CFGState::PrevBB, llvm::VPTransformState::CFGState::PrevVPBB, llvm::VPTransformState::set(), llvm::IRBuilderBase::SetInsertPoint(), llvm::BasicBlock::splitBasicBlock(), llvm::MCID::Terminator, llvm::VPTransformState::TripCount, llvm::VPTransformState::UF, llvm::VPTransformState::VF, llvm::VPTransformState::CFGState::VPBB2IRBB, llvm::VPTransformState::CFGState::VPBBsToFix, and llvm::VPTransformState::VPValue2Value.

◆ getEntry() [1/2]

VPBlockBase* llvm::VPlan::getEntry ( )
inline

◆ getEntry() [2/2]

const VPBlockBase* llvm::VPlan::getEntry ( ) const
inline

Definition at line 1816 of file VPlan.h.

◆ getName()

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

Definition at line 1835 of file VPlan.h.

Referenced by llvm::VPlanPrinter::dump().

◆ getOrAddVPValue()

VPValue* llvm::VPlan::getOrAddVPValue ( Value V)
inline

◆ getOrCreateBackedgeTakenCount()

VPValue* llvm::VPlan::getOrCreateBackedgeTakenCount ( )
inline

The backedge taken count of the original loop.

Definition at line 1825 of file VPlan.h.

◆ getVPLoopInfo() [1/2]

VPLoopInfo& llvm::VPlan::getVPLoopInfo ( )
inline

Return the VPLoopInfo analysis for this VPlan.

Definition at line 1873 of file VPlan.h.

Referenced by llvm::VPlanHCFGBuilder::buildHierarchicalCFG().

◆ getVPLoopInfo() [2/2]

const VPLoopInfo& llvm::VPlan::getVPLoopInfo ( ) const
inline

Definition at line 1874 of file VPlan.h.

◆ getVPValue()

VPValue* llvm::VPlan::getVPValue ( Value V)
inline

◆ hasVF()

bool llvm::VPlan::hasVF ( ElementCount  VF)
inline

◆ mapToVPValues()

iterator_range<mapped_iterator<Use *, std::function<VPValue *(Value *)> > > llvm::VPlan::mapToVPValues ( User::op_range  Operands)
inline

Returns a range mapping the values the range Operands to their corresponding VPValues.

Definition at line 1890 of file VPlan.h.

References function, getOrAddVPValue(), llvm::map_range(), and Operands.

◆ print()

LLVM_DUMP_METHOD void VPlan::print ( raw_ostream O) const

Print this VPlan to O.

Definition at line 770 of file VPlan.cpp.

References llvm::depth_first(), getEntry(), and llvm::RISCVFenceField::O.

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

◆ printDOT()

LLVM_DUMP_METHOD void VPlan::printDOT ( raw_ostream O) const

Print this VPlan in DOT format to O.

Definition at line 782 of file VPlan.cpp.

References llvm::RISCVFenceField::O, and Printer.

◆ removeVPValueFor()

void llvm::VPlan::removeVPValueFor ( Value V)
inline

◆ setEntry()

VPBlockBase* llvm::VPlan::setEntry ( VPBlockBase Block)
inline

Definition at line 1818 of file VPlan.h.

Referenced by llvm::VPlanHCFGBuilder::buildHierarchicalCFG().

◆ setName()

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

Definition at line 1837 of file VPlan.h.

References llvm::Twine::str().

Referenced by llvm::VPlanHCFGBuilder::buildHierarchicalCFG().

Friends And Related Function Documentation

◆ VPlanPrinter

friend class VPlanPrinter
friend

Definition at line 1756 of file VPlan.h.

◆ VPSlotTracker

friend class VPSlotTracker
friend

Definition at line 1757 of file VPlan.h.


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