LLVM 18.0.0git
|
Functions | |
std::optional< VFInfo > | tryDemangleForVFABI (StringRef MangledName, const CallInst &CI) |
Function to construct a VFInfo out of a mangled names in the following format: | |
VFParamKind | getVFParamKindFromString (const StringRef Token) |
Retrieve the VFParamKind from a string token. | |
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. | |
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" |
void llvm::VFABI::getVectorVariantNames | ( | const CallInst & | CI, |
SmallVectorImpl< std::string > & | VariantMappings | ||
) |
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 1459 of file VectorUtils.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::dbgs(), llvm::StringRef::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::CallBase::getFnAttr(), llvm::Module::getFunction(), llvm::Instruction::getModule(), llvm::Attribute::getValueAsString(), Info, LLVM_DEBUG, MappingsAttrName, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::StringRef::split(), and tryDemangleForVFABI().
Referenced by addMappingsFromTLI().
VFParamKind llvm::VFABI::getVFParamKindFromString | ( | const StringRef | Token | ) |
Retrieve the VFParamKind
from a string token.
Definition at line 499 of file VFABIDemangling.cpp.
References llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Default(), and llvm_unreachable.
Overwrite the Vector Function ABI variants attribute with the names provide in VariantMappings
.
Definition at line 332 of file ModuleUtils.cpp.
References llvm::CallBase::addFnAttr(), assert(), llvm::dbgs(), llvm::ArrayRef< T >::empty(), llvm::StringRef::empty(), llvm::Attribute::get(), llvm::Instruction::getModule(), LLVM_DEBUG, llvm::SmallVectorTemplateBase< T, bool >::pop_back(), llvm::SmallString< InternalLen >::str(), and tryDemangleForVFABI().
Referenced by addMappingsFromTLI().
std::optional< VFInfo > llvm::VFABI::tryDemangleForVFABI | ( | StringRef | MangledName, |
const CallInst & | CI | ||
) |
Function to construct a VFInfo out of a mangled names in the following format:
<VFABI_name>{(<redirection>)}
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 <isa> from now on). The <VFABI_name> is in the following format:
ZGV<isa><mask><vlen><parameters><scalarname>[(<redirection>)]
This methods support demangling rules for the following <isa>:
MangledName | -> input string in the format ZGV<isa><mask><vlen><parameters><scalarname>[(<redirection>)]. |
CI | -> A call to 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 371 of file VFABIDemangling.cpp.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::StringRef::consume_back(), llvm::StringRef::consume_front(), llvm::count_if(), llvm::SmallVectorBase< Size_T >::empty(), llvm::StringRef::empty(), llvm::ElementCount::getFixed(), llvm::CallBase::getFunctionType(), llvm::StringRef::ltrim(), llvm::VFParameter::ParamKind, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), and llvm::StringRef::take_while().
Referenced by getVectorVariantNames(), and setVectorVariantNames().
LLVM Internal VFABI ISA token for vector functions.
Definition at line 147 of file VectorUtils.h.
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 154 of file VectorUtils.h.
Definition at line 189 of file VectorUtils.h.
Referenced by getVectorVariantNames().