LLVM 20.0.0git
Classes | Public Member Functions | List of all members
llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator Class Reference

Merges shuffle masks and emits final shuffle instruction, if required. More...

Inheritance diagram for llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator:
Inheritance graph
[legend]

Public Member Functions

 ShuffleCostEstimator (Type *ScalarTy, TargetTransformInfo &TTI, ArrayRef< Value * > VectorizedVals, BoUpSLP &R, SmallPtrSetImpl< Value * > &CheckedExtracts)
 
ValueadjustExtracts (const TreeEntry *E, MutableArrayRef< int > Mask, ArrayRef< std::optional< TTI::ShuffleKind > > ShuffleKinds, unsigned NumParts, bool &UseVecBaseAsInput)
 
std::optional< InstructionCostneedToDelay (const TreeEntry *, ArrayRef< SmallVector< const TreeEntry * > >) const
 Checks if the specified entry E needs to be delayed because of its dependency nodes.
 
void add (const TreeEntry &E1, const TreeEntry &E2, ArrayRef< int > Mask)
 
void add (const TreeEntry &E1, ArrayRef< int > Mask)
 
void add (Value *V1, Value *V2, ArrayRef< int > Mask)
 Adds 2 input vectors and the mask for their shuffling.
 
void add (Value *V1, ArrayRef< int > Mask, bool ForExtracts=false)
 Adds another one input vector and the mask for the shuffling.
 
Valuegather (ArrayRef< Value * > VL, unsigned MaskVF=0, Value *Root=nullptr)
 
InstructionCost createFreeze (InstructionCost Cost)
 
InstructionCost finalize (ArrayRef< int > ExtMask, unsigned VF=0, function_ref< void(Value *&, SmallVectorImpl< int > &)> Action={})
 Finalize emission of the shuffles.
 
 ~ShuffleCostEstimator ()
 

Detailed Description

Merges shuffle masks and emits final shuffle instruction, if required.

It supports shuffling of 2 input vectors. It implements lazy shuffles emission, when the actual shuffle instruction is generated only if this is actually required. Otherwise, the shuffle instruction emission is delayed till the end of the process, to reduce the number of emitted instructions and further analysis/transformations.

Definition at line 8422 of file SLPVectorizer.cpp.

Constructor & Destructor Documentation

◆ ShuffleCostEstimator()

llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::ShuffleCostEstimator ( Type ScalarTy,
TargetTransformInfo TTI,
ArrayRef< Value * >  VectorizedVals,
BoUpSLP R,
SmallPtrSetImpl< Value * > &  CheckedExtracts 
)
inline

Definition at line 9102 of file SLPVectorizer.cpp.

◆ ~ShuffleCostEstimator()

llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::~ShuffleCostEstimator ( )
inline

Definition at line 9403 of file SLPVectorizer.cpp.

References assert(), and llvm::SmallVectorBase< Size_T >::empty().

Member Function Documentation

◆ add() [1/4]

void llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::add ( const TreeEntry &  E1,
ArrayRef< int >  Mask 
)
inline

◆ add() [2/4]

void llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::add ( const TreeEntry &  E1,
const TreeEntry &  E2,
ArrayRef< int >  Mask 
)
inline

◆ add() [3/4]

void llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::add ( Value V1,
ArrayRef< int >  Mask,
bool  ForExtracts = false 
)
inline

◆ add() [4/4]

void llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::add ( Value V1,
Value V2,
ArrayRef< int >  Mask 
)
inline

◆ adjustExtracts()

Value * llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::adjustExtracts ( const TreeEntry *  E,
MutableArrayRef< int >  Mask,
ArrayRef< std::optional< TTI::ShuffleKind > >  ShuffleKinds,
unsigned  NumParts,
bool UseVecBaseAsInput 
)
inline

◆ createFreeze()

InstructionCost llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::createFreeze ( InstructionCost  Cost)
inline

Definition at line 9371 of file SLPVectorizer.cpp.

◆ finalize()

InstructionCost llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::finalize ( ArrayRef< int >  ExtMask,
unsigned  VF = 0,
function_ref< void(Value *&, SmallVectorImpl< int > &)>  Action = {} 
)
inline

Finalize emission of the shuffles.

Definition at line 9374 of file SLPVectorizer.cpp.

◆ gather()

Value * llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::gather ( ArrayRef< Value * >  VL,
unsigned  MaskVF = 0,
Value Root = nullptr 
)
inline

◆ needToDelay()

std::optional< InstructionCost > llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::needToDelay ( const TreeEntry *  ,
ArrayRef< SmallVector< const TreeEntry * > >   
) const
inline

Checks if the specified entry E needs to be delayed because of its dependency nodes.

Definition at line 9211 of file SLPVectorizer.cpp.


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