LLVM 20.0.0git
Static Public Member Functions | List of all members
llvm::sandboxir::VecUtils Class Reference

#include "llvm/Transforms/Vectorize/SandboxVectorizer/VecUtils.h"

Static Public Member Functions

static int getNumElements (Type *Ty)
 \Returns the number of elements in Ty.
 
static TypegetElementType (Type *Ty)
 Returns Ty if scalar or its element type if vector.
 
template<typename LoadOrStoreT >
static bool areConsecutive (LoadOrStoreT *I1, LoadOrStoreT *I2, ScalarEvolution &SE, const DataLayout &DL)
 \Returns true if I1 and I2 are load/stores accessing consecutive memory addresses.
 
template<typename LoadOrStoreT >
static bool areConsecutive (ArrayRef< Value * > &Bndl, ScalarEvolution &SE, const DataLayout &DL)
 
static unsigned getNumLanes (Type *Ty)
 \Returns the number of vector lanes of Ty or 1 if not a vector.
 
static unsigned getNumLanes (Value *V)
 \Returns the expected vector lanes of V or 1 if not a vector.
 
static unsigned getNumLanes (ArrayRef< Value * > Bndl)
 \Returns the total number of lanes across all values in Bndl.
 
static TypegetWideType (Type *ElemTy, unsigned NumElts)
 \Returns <NumElts x ElemTy>.
 
static InstructiongetLowest (ArrayRef< Instruction * > Instrs)
 
static TypetryGetCommonScalarType (ArrayRef< Value * > Bndl)
 If all values in Bndl are of the same scalar type then return it, otherwise return nullptr.
 
static TypegetCommonScalarType (ArrayRef< Value * > Bndl)
 Similar to tryGetCommonScalarType() but will assert that there is a common type.
 

Detailed Description

Definition at line 22 of file VecUtils.h.

Member Function Documentation

◆ areConsecutive() [1/2]

template<typename LoadOrStoreT >
static bool llvm::sandboxir::VecUtils::areConsecutive ( ArrayRef< Value * > &  Bndl,
ScalarEvolution SE,
const DataLayout DL 
)
inlinestatic

Definition at line 52 of file VecUtils.h.

References areConsecutive(), assert(), DL, and llvm::drop_begin().

◆ areConsecutive() [2/2]

template<typename LoadOrStoreT >
static bool llvm::sandboxir::VecUtils::areConsecutive ( LoadOrStoreT *  I1,
LoadOrStoreT *  I2,
ScalarEvolution SE,
const DataLayout DL 
)
inlinestatic

\Returns true if I1 and I2 are load/stores accessing consecutive memory addresses.

Definition at line 39 of file VecUtils.h.

References llvm::sandboxir::Utils::getNumBits(), and llvm::sandboxir::Utils::getPointerDiffInBytes().

Referenced by areConsecutive().

◆ getCommonScalarType()

static Type * llvm::sandboxir::VecUtils::getCommonScalarType ( ArrayRef< Value * >  Bndl)
inlinestatic

Similar to tryGetCommonScalarType() but will assert that there is a common type.

So this is faster in release builds as it won't iterate through the values.

Definition at line 129 of file VecUtils.h.

References assert(), getElementType(), llvm::sandboxir::Utils::getExpectedType(), and tryGetCommonScalarType().

◆ getElementType()

static Type * llvm::sandboxir::VecUtils::getElementType ( Type Ty)
inlinestatic

Returns Ty if scalar or its element type if vector.

Definition at line 32 of file VecUtils.h.

References llvm::sandboxir::Type::isVectorTy().

Referenced by getCommonScalarType(), and tryGetCommonScalarType().

◆ getLowest()

static Instruction * llvm::sandboxir::VecUtils::getLowest ( ArrayRef< Instruction * >  Instrs)
inlinestatic

◆ getNumElements()

static int llvm::sandboxir::VecUtils::getNumElements ( Type Ty)
inlinestatic

\Returns the number of elements in Ty.

That is the number of lanes if a fixed vector or 1 if scalar. ScalableVectors have unknown size and therefore are unsupported.

Definition at line 27 of file VecUtils.h.

References assert(), and llvm::sandboxir::Type::isVectorTy().

◆ getNumLanes() [1/3]

static unsigned llvm::sandboxir::VecUtils::getNumLanes ( ArrayRef< Value * >  Bndl)
inlinestatic

\Returns the total number of lanes across all values in Bndl.

Definition at line 86 of file VecUtils.h.

References getNumLanes().

◆ getNumLanes() [2/3]

static unsigned llvm::sandboxir::VecUtils::getNumLanes ( Type Ty)
inlinestatic

\Returns the number of vector lanes of Ty or 1 if not a vector.

NOTE: It asserts that Ty is a fixed vector type.

Definition at line 72 of file VecUtils.h.

References assert().

Referenced by getNumLanes().

◆ getNumLanes() [3/3]

static unsigned llvm::sandboxir::VecUtils::getNumLanes ( Value V)
inlinestatic

\Returns the expected vector lanes of V or 1 if not a vector.

NOTE: It asserts that V is a fixed vector.

Definition at line 81 of file VecUtils.h.

References llvm::sandboxir::Utils::getExpectedType(), and getNumLanes().

◆ getWideType()

static Type * llvm::sandboxir::VecUtils::getWideType ( Type ElemTy,
unsigned  NumElts 
)
inlinestatic

\Returns <NumElts x ElemTy>.

It works for both scalar and vector ElemTy.

Definition at line 95 of file VecUtils.h.

References llvm::sandboxir::FixedVectorType::get(), and llvm::sandboxir::Type::isVectorTy().

◆ tryGetCommonScalarType()

static Type * llvm::sandboxir::VecUtils::tryGetCommonScalarType ( ArrayRef< Value * >  Bndl)
inlinestatic

If all values in Bndl are of the same scalar type then return it, otherwise return nullptr.

Definition at line 113 of file VecUtils.h.

References llvm::drop_begin(), getElementType(), and llvm::sandboxir::Utils::getExpectedType().

Referenced by getCommonScalarType().


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