LLVM: llvm::VFABI Namespace Reference (original) (raw)

Functions
LLVM_ABI std::optional< VFInfo > tryDemangleForVFABI (StringRef MangledName, const FunctionType *FTy)
Function to construct a VFInfo out of a mangled names in the following format:
LLVM_ABI VFParamKind getVFParamKindFromString (const StringRef Token)
Retrieve the VFParamKind from a string token.
LLVM_ABI void getVectorVariantNames (const CallInst &CI, SmallVectorImpl< std::string > &VariantMappings)
Populates a set of strings representing the Vector Function ABI variants associated to the CallInst CI.
LLVM_ABI FunctionType * createFunctionType (const VFInfo &Info, const FunctionType *ScalarFTy)
Constructs a FunctionType by applying vector function information to the type of a matching scalar function.
LLVM_ABI void setVectorVariantNames (CallInst *CI, ArrayRef< std::string > VariantMappings)
Overwrite the Vector Function ABI variants attribute with the names provide in VariantMappings.
Variables
static constexpr char const * _LLVM_ = "_LLVM_"
LLVM Internal VFABI ISA token for vector functions.
static constexpr char const * _LLVM_Scalarize_ = "_LLVM_Scalarize_"
Prefix for internal name redirection for vector function that tells the compiler to scalarize the call using the scalar name of the function.
static constexpr char const * MappingsAttrName = "vector-function-abi-variant"

createFunctionType()

Constructs a FunctionType by applying vector function information to the type of a matching scalar function.

Parameters

Info gets the vectorization factor (VF) and the VFParamKind of the parameters.
ScalarFTy gets the Type information of parameters, as it is not stored in Info.

Returns

a pointer to a newly created vector FunctionType

Definition at line 556 of file VFABIDemangler.cpp.

References llvm::FunctionType::get(), llvm::VectorType::get(), llvm::Type::getContext(), llvm::Type::getInt1Ty(), llvm::FunctionType::getParamType(), llvm::FunctionType::getReturnType(), llvm::GlobalPredicate, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::toVectorizedTy(), and llvm::Vector.

Referenced by addVariantDeclaration(), and replaceWithCallToVeclib().

getVectorVariantNames()

Populates a set of strings representing the Vector Function ABI variants associated to the CallInst CI.

If the CI does not contain the vector-function-abi-variant attribute, we return without populating VariantMappings, i.e. callers of getVectorVariantNames need not check for the presence of the attribute (see InjectTLIMappings).

Definition at line 535 of file VFABIDemangler.cpp.

References llvm::dbgs(), llvm::StringRef::empty(), llvm::from_range, llvm::CallBase::getFnAttr(), llvm::Module::getFunction(), llvm::CallBase::getFunctionType(), llvm::Instruction::getModule(), llvm::Attribute::getValueAsString(), LLVM_DEBUG, MappingsAttrName, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::StringRef::split(), and tryDemangleForVFABI().

Referenced by addMappingsFromTLI().

getVFParamKindFromString()

Retrieve the VFParamKind from a string token.

Definition at line 512 of file VFABIDemangler.cpp.

References llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Default(), llvm_unreachable, llvm::OMP_Linear, llvm::OMP_LinearPos, llvm::OMP_LinearRef, llvm::OMP_LinearRefPos, llvm::OMP_LinearUVal, llvm::OMP_LinearUValPos, llvm::OMP_LinearVal, llvm::OMP_LinearValPos, llvm::OMP_Uniform, llvm::Unknown, and llvm::Vector.

Referenced by tryParseCompileTimeLinearToken(), and tryParseLinearTokenWithRuntimeStep().

setVectorVariantNames()

void llvm::VFABI::setVectorVariantNames ( CallInst * CI,
ArrayRef< std::string > VariantMappings )

Overwrite the Vector Function ABI variants attribute with the names provide in VariantMappings.

Definition at line 582 of file VFABIDemangler.cpp.

References llvm::CallBase::addFnAttr(), assert(), llvm::dbgs(), llvm::ArrayRef< T >::empty(), llvm::StringRef::empty(), llvm::Attribute::get(), llvm::CallBase::getFunctionType(), llvm::Instruction::getModule(), LLVM_DEBUG, MappingsAttrName, llvm::SmallVectorTemplateBase< T, bool >::pop_back(), llvm::SmallString< InternalLen >::str(), and tryDemangleForVFABI().

Referenced by addMappingsFromTLI().

tryDemangleForVFABI()

Function to construct a VFInfo out of a mangled names in the following format:

<VFABI_name>{()}

where <VFABI_name> is the name of the vector function, mangled according to the rules described in the Vector Function ABI of the target vector extension (or from now on). The <VFABI_name> is in the following format:

ZGV[()]

This methods support demangling rules for the following :

Parameters

MangledName -> input string in the format ZGV[()].
FTy -> FunctionType of the scalar function which we're trying to find a vectorized variant for. This is required to determine the vectorization factor for scalable vectors, since the mangled name doesn't encode that; it needs to be derived from the widest element types of vector arguments or return values.

Definition at line 379 of file VFABIDemangler.cpp.

References assert(), llvm::StringRef::consume_back(), llvm::StringRef::consume_front(), llvm::count_if(), llvm::StringRef::empty(), llvm::ElementCount::getFixed(), llvm::FunctionType::getNumParams(), getScalableECFromSignature(), llvm::GlobalPredicate, llvm::LLVM, llvm::StringRef::ltrim(), llvm::VFParameter::ParamKind, llvm::StringRef::take_while(), tryParseAlign(), tryParseISA(), tryParseMask(), tryParseParameter(), and tryParseVLEN().

Referenced by addVariantDeclaration(), getVectorVariantNames(), replaceWithCallToVeclib(), and setVectorVariantNames().

_LLVM_

_LLVM_Scalarize_

char const* llvm::VFABI::_LLVM_Scalarize_ = "_LLVM_Scalarize_" staticconstexpr

Prefix for internal name redirection for vector function that tells the compiler to scalarize the call using the scalar name of the function.

For example, a mangled name like _ZGV_LLVM_N2v_foo(_LLVM_Scalarize_foo) would tell the vectorizer to vectorize the scalar call foo, and to scalarize it once vectorization is done.

Definition at line 156 of file VFABIDemangler.h.

MappingsAttrName