LLVM 18.0.0git
|
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions. More...
#include "Transforms/Vectorize/VPlan.h"
Public Member Functions | |
VPRecipeBase (const unsigned char SC, ArrayRef< VPValue * > Operands, DebugLoc DL={}) | |
template<typename IterT > | |
VPRecipeBase (const unsigned char SC, iterator_range< IterT > Operands, DebugLoc DL={}) | |
virtual | ~VPRecipeBase ()=default |
VPBasicBlock * | getParent () |
const VPBasicBlock * | getParent () const |
virtual void | execute (VPTransformState &State)=0 |
The method which generates the output IR instructions that correspond to this VPRecipe, thereby "executing" the VPlan. | |
void | insertBefore (VPRecipeBase *InsertPos) |
Insert an unlinked recipe into a basic block immediately before the specified recipe. | |
void | insertBefore (VPBasicBlock &BB, iplist< VPRecipeBase >::iterator IP) |
Insert an unlinked recipe into BB immediately before the insertion point IP ;. | |
void | insertAfter (VPRecipeBase *InsertPos) |
Insert an unlinked Recipe into a basic block immediately after the specified Recipe. | |
void | moveAfter (VPRecipeBase *MovePos) |
Unlink this recipe from its current VPBasicBlock and insert it into the VPBasicBlock that MovePos lives in, right after MovePos. | |
void | moveBefore (VPBasicBlock &BB, iplist< VPRecipeBase >::iterator I) |
Unlink this recipe and insert into BB before I. | |
void | removeFromParent () |
This method unlinks 'this' from the containing basic block, but does not delete it. | |
iplist< VPRecipeBase >::iterator | eraseFromParent () |
This method unlinks 'this' from the containing basic block and deletes it. | |
Instruction * | getUnderlyingInstr () |
Returns the underlying instruction, if the recipe is a VPValue or nullptr otherwise. | |
const Instruction * | getUnderlyingInstr () const |
bool | mayHaveSideEffects () const |
Returns true if the recipe may have side-effects. | |
bool | isPhi () const |
Returns true for PHI-like recipes. | |
bool | mayReadFromMemory () const |
Returns true if the recipe may read from memory. | |
bool | mayWriteToMemory () const |
Returns true if the recipe may write to memory. | |
bool | mayReadOrWriteMemory () const |
Returns true if the recipe may read from or write to memory. | |
DebugLoc | getDebugLoc () const |
Returns the debug location of the recipe. | |
![]() | |
VPRecipeBase * | getPrevNode () |
const VPRecipeBase * | getPrevNode () const |
Get the previous node, or nullptr for the list head. | |
VPRecipeBase * | getNextNode () |
Get the next node, or nullptr for the list tail. | |
const VPRecipeBase * | getNextNode () const |
Get the next node, or nullptr for the list tail. | |
![]() | |
self_iterator | getIterator () |
const_self_iterator | getIterator () const |
reverse_self_iterator | getReverseIterator () |
const_reverse_self_iterator | getReverseIterator () const |
bool | isSentinel () const |
Check whether this is the sentinel node. | |
![]() | |
VPDef (const unsigned char SC) | |
virtual | ~VPDef () |
VPValue * | getVPSingleValue () |
Returns the only VPValue defined by the VPDef. | |
const VPValue * | getVPSingleValue () const |
VPValue * | getVPValue (unsigned I) |
Returns the VPValue with index I defined by the VPDef. | |
const VPValue * | getVPValue (unsigned I) const |
ArrayRef< VPValue * > | definedValues () |
Returns an ArrayRef of the values defined by the VPDef. | |
ArrayRef< VPValue * > | definedValues () const |
Returns an ArrayRef of the values defined by the VPDef. | |
unsigned | getNumDefinedValues () const |
Returns the number of values defined by the VPDef. | |
unsigned | getVPDefID () const |
void | dump () const |
Dump the VPDef to stderr (for debugging). | |
virtual void | print (raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const =0 |
Each concrete VPDef prints itself. | |
![]() | |
VPUser ()=delete | |
VPUser (const VPUser &)=delete | |
VPUser & | operator= (const VPUser &)=delete |
virtual | ~VPUser () |
VPUserID | getVPUserID () const |
void | addOperand (VPValue *Operand) |
unsigned | getNumOperands () const |
VPValue * | getOperand (unsigned N) const |
void | setOperand (unsigned I, VPValue *New) |
void | removeLastOperand () |
operand_iterator | op_begin () |
const_operand_iterator | op_begin () const |
operand_iterator | op_end () |
const_operand_iterator | op_end () const |
operand_range | operands () |
const_operand_range | operands () const |
virtual bool | usesScalars (const VPValue *Op) const |
Returns true if the VPUser uses scalars of operand Op . | |
virtual bool | onlyFirstLaneUsed (const VPValue *Op) const |
Returns true if the VPUser only uses the first lane of operand Op . | |
Static Public Member Functions | |
static bool | classof (const VPDef *D) |
Method to support type inquiry through isa, cast, and dyn_cast. | |
static bool | classof (const VPUser *U) |
Friends | |
class | VPBlockUtils |
Additional Inherited Members | |
![]() | |
using | VPRecipeTy = enum { VPBranchOnMaskSC, VPDerivedIVSC, VPExpandSCEVSC, VPInstructionSC, VPInterleaveSC, VPReductionSC, VPReplicateSC, VPScalarIVStepsSC, VPWidenCallSC, VPWidenCanonicalIVSC, VPWidenCastSC, VPWidenGEPSC, VPWidenMemoryInstructionSC, VPWidenSC, VPWidenSelectSC, VPBlendSC, VPPredInstPHISC, VPCanonicalIVPHISC, VPActiveLaneMaskPHISC, VPFirstOrderRecurrencePHISC, VPWidenPHISC, VPWidenIntOrFpInductionSC, VPWidenPointerInductionSC, VPReductionPHISC, VPFirstPHISC=VPBlendSC, VPFirstHeaderPHISC=VPCanonicalIVPHISC, VPLastHeaderPHISC=VPReductionPHISC, VPLastPHISC=VPReductionPHISC, } |
An enumeration for keeping track of the concrete subclass of VPRecipeBase that is actually instantiated. | |
![]() | |
enum class | VPUserID { Recipe , LiveOut } |
Subclass identifier (for isa/dyn_cast). More... | |
typedef SmallVectorImpl< VPValue * >::iterator | operand_iterator |
typedef SmallVectorImpl< VPValue * >::const_iterator | const_operand_iterator |
typedef iterator_range< operand_iterator > | operand_range |
typedef iterator_range< const_operand_iterator > | const_operand_range |
![]() | |
using | self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, false, false >::type |
using | const_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, false, true >::type |
using | reverse_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, true, false >::type |
using | const_reverse_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, ilist_detail::compute_node_options< T, Options... >::type, true, true >::type |
![]() | |
ilist_node_with_parent ()=default | |
![]() | |
ilist_node_impl ()=default | |
![]() | |
void | printOperands (raw_ostream &O, VPSlotTracker &SlotTracker) const |
Print the operands to O . | |
VPUser (ArrayRef< VPValue * > Operands, VPUserID ID) | |
VPUser (std::initializer_list< VPValue * > Operands, VPUserID ID) | |
template<typename IterT > | |
VPUser (iterator_range< IterT > Operands, VPUserID ID) | |
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
VPRecipeBase owns the VPValues it defines through VPDef and is responsible for deleting its defined values. Single-value VPRecipeBases that also inherit from VPValue must make sure to inherit from VPRecipeBase before VPValue.
|
inline |
|
virtualdefault |
Definition at line 784 of file VPlan.h.
References llvm::VPUser::Recipe.
iplist< VPRecipeBase >::iterator VPRecipeBase::eraseFromParent | ( | ) |
This method unlinks 'this' from the containing basic block and deletes it.
Definition at line 220 of file VPlanRecipes.cpp.
References assert(), llvm::iplist_impl< IntrusiveListT, TraitsT >::erase(), llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >::getIterator(), getParent(), and llvm::VPBasicBlock::getRecipeList().
Referenced by addVPLaneMaskPhiAndUpdateExitBranch(), and createReplicateRegion().
|
pure virtual |
The method which generates the output IR instructions that correspond to this VPRecipe, thereby "executing" the VPlan.
Implemented in llvm::VPInstruction, llvm::VPWidenRecipe, llvm::VPWidenCastRecipe, llvm::VPWidenCallRecipe, llvm::VPWidenSelectRecipe, llvm::VPWidenGEPRecipe, llvm::VPWidenIntOrFpInductionRecipe, llvm::VPWidenPointerInductionRecipe, llvm::VPWidenPHIRecipe, llvm::VPFirstOrderRecurrencePHIRecipe, llvm::VPReductionPHIRecipe, llvm::VPBlendRecipe, llvm::VPInterleaveRecipe, llvm::VPReductionRecipe, llvm::VPReplicateRecipe, llvm::VPBranchOnMaskRecipe, llvm::VPPredInstPHIRecipe, llvm::VPWidenMemoryInstructionRecipe, llvm::VPExpandSCEVRecipe, llvm::VPCanonicalIVPHIRecipe, llvm::VPActiveLaneMaskPHIRecipe, llvm::VPWidenCanonicalIVRecipe, llvm::VPDerivedIVRecipe, llvm::VPScalarIVStepsRecipe, and llvm::VPHeaderPHIRecipe.
|
inline |
Returns the debug location of the recipe.
Definition at line 808 of file VPlan.h.
References DL.
Referenced by llvm::VPWidenRecipe::execute(), llvm::VPWidenCastRecipe::execute(), llvm::VPWidenSelectRecipe::execute(), llvm::VPBlendRecipe::execute(), llvm::VPCanonicalIVPHIRecipe::execute(), llvm::VPActiveLaneMaskPHIRecipe::execute(), and llvm::VPInstruction::print().
|
inline |
Definition at line 733 of file VPlan.h.
Referenced by llvm::VPlanTransforms::adjustFixedOrderRecurrences(), llvm::VPInstruction::dump(), eraseFromParent(), llvm::VPWidenPointerInductionRecipe::execute(), insertAfter(), insertBefore(), removeFromParent(), llvm::InnerLoopVectorizer::scalarizeInstruction(), llvm::VPBuilder::setInsertPoint(), and sinkScalarOperands().
|
inline |
|
inline |
Returns the underlying instruction, if the recipe is a VPValue or nullptr otherwise.
Definition at line 771 of file VPlan.h.
References llvm::VPDef::getVPSingleValue().
Referenced by createReplicateRegion(), llvm::VPWidenCallRecipe::execute(), llvm::VPWidenGEPRecipe::execute(), llvm::VPWidenPointerInductionRecipe::execute(), llvm::VPReplicateRecipe::execute(), llvm::VPWidenCallRecipe::print(), llvm::VPReductionRecipe::print(), and llvm::VPReplicateRecipe::print().
|
inline |
Definition at line 774 of file VPlan.h.
References llvm::VPDef::getVPSingleValue().
void VPRecipeBase::insertAfter | ( | VPRecipeBase * | InsertPos | ) |
Insert an unlinked Recipe into a basic block immediately after the specified Recipe.
Definition at line 206 of file VPlanRecipes.cpp.
References assert(), llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), llvm::VPBasicBlock::getRecipeList(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::insertAfter().
Referenced by llvm::VPlanTransforms::addActiveLaneMask(), and moveAfter().
void VPRecipeBase::insertBefore | ( | VPBasicBlock & | BB, |
iplist< VPRecipeBase >::iterator | IP | ||
) |
Insert an unlinked recipe into BB
immediately before the insertion point IP
;.
Definition at line 198 of file VPlanRecipes.cpp.
References assert(), llvm::VPBasicBlock::end(), llvm::VPBasicBlock::getRecipeList(), I, and llvm::iplist_impl< IntrusiveListT, TraitsT >::insert().
void VPRecipeBase::insertBefore | ( | VPRecipeBase * | InsertPos | ) |
Insert an unlinked recipe into a basic block immediately before the specified recipe.
Definition at line 190 of file VPlanRecipes.cpp.
References assert(), llvm::ilist_node_impl< OptionsT >::getIterator(), getParent(), llvm::VPBasicBlock::getRecipeList(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::insert().
Referenced by moveBefore(), and llvm::VPlanTransforms::VPInstructionsToVPRecipes().
|
inline |
Returns true for PHI-like recipes.
Definition at line 792 of file VPlan.h.
References llvm::VPDef::getVPDefID().
bool VPRecipeBase::mayHaveSideEffects | ( | ) | const |
Returns true if the recipe may have side-effects.
Definition at line 113 of file VPlanRecipes.cpp.
References assert(), llvm::VPInstruction::CalculateTripCountMinusVF, llvm::VPInstruction::CanonicalIVIncrement, llvm::VPInstruction::CanonicalIVIncrementForPart, getOpcode(), llvm::VPDef::getVPDefID(), llvm::VPDef::getVPSingleValue(), I, mayHaveSideEffects(), mayWriteToMemory(), and llvm::VPInstruction::Not.
Referenced by mayHaveSideEffects(), and sinkScalarOperands().
bool VPRecipeBase::mayReadFromMemory | ( | ) | const |
Returns true if the recipe may read from memory.
Definition at line 79 of file VPlanRecipes.cpp.
References assert(), llvm::VPDef::getVPDefID(), llvm::VPDef::getVPSingleValue(), and I.
Referenced by mayReadOrWriteMemory().
|
inline |
Returns true if the recipe may read from or write to memory.
Definition at line 803 of file VPlan.h.
References mayReadFromMemory(), and mayWriteToMemory().
Referenced by sinkScalarOperands().
bool VPRecipeBase::mayWriteToMemory | ( | ) | const |
Returns true if the recipe may write to memory.
Definition at line 45 of file VPlanRecipes.cpp.
References assert(), llvm::VPDef::getVPDefID(), llvm::VPDef::getVPSingleValue(), and I.
Referenced by mayHaveSideEffects(), and mayReadOrWriteMemory().
void VPRecipeBase::moveAfter | ( | VPRecipeBase * | MovePos | ) |
Unlink this recipe from its current VPBasicBlock and insert it into the VPBasicBlock that MovePos lives in, right after MovePos.
Definition at line 225 of file VPlanRecipes.cpp.
References insertAfter(), and removeFromParent().
void VPRecipeBase::moveBefore | ( | VPBasicBlock & | BB, |
iplist< VPRecipeBase >::iterator | I | ||
) |
Unlink this recipe and insert into BB before I.
Definition at line 230 of file VPlanRecipes.cpp.
References I, insertBefore(), and removeFromParent().
Referenced by sinkScalarOperands().
void VPRecipeBase::removeFromParent | ( | ) |
This method unlinks 'this' from the containing basic block, but does not delete it.
Definition at line 214 of file VPlanRecipes.cpp.
References assert(), llvm::ilist_node_impl< ilist_detail::compute_node_options< T, Options... >::type >::getIterator(), getParent(), llvm::VPBasicBlock::getRecipeList(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::remove().
Referenced by moveAfter(), and moveBefore().
|
friend |