LLVM  11.0.0git
Functions | Variables
llvm::VFABI Namespace Reference

Functions

Optional< VFInfotryDemangleForVFABI (StringRef MangledName, const Module &M)
 Function to construct a VFInfo out of a mangled names in the following format: More...
 
std::string mangleTLIVectorName (StringRef VectorName, StringRef ScalarName, unsigned numArgs, unsigned VF)
 This routine mangles the given VectorName according to the LangRef specification for vector-function-abi-variant attribute and is specific to the TLI mappings. More...
 
VFParamKind getVFParamKindFromString (const StringRef Token)
 Retrieve the VFParamKind from a string token. More...
 
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. More...
 
void setVectorVariantNames (CallInst *CI, const SmallVector< std::string, 8 > &VariantMappings)
 Overwrite the Vector Function ABI variants attribute with the names provide in VariantMappings. More...
 

Variables

static constexpr char const_LLVM_ = "_LLVM_"
 LLVM Internal VFABI ISA token for vector functions. More...
 
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. More...
 
static constexpr char constMappingsAttrName = "vector-function-abi-variant"
 

Function Documentation

◆ getVectorVariantNames()

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 1284 of file VectorUtils.cpp.

References assert(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::dbgs(), llvm::StringRef::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::AttributeList::FunctionIndex, llvm::CallBase::getAttribute(), llvm::Module::getFunction(), llvm::Instruction::getModule(), llvm::Optional< T >::getValue(), llvm::Attribute::getValueAsString(), llvm::Optional< T >::hasValue(), Info, LLVM_DEBUG, MappingsAttrName, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::StringRef::split(), tryDemangleForVFABI(), and llvm::VFInfo::VectorName.

Referenced by addMappingsFromTLI().

◆ getVFParamKindFromString()

VFParamKind llvm::VFABI::getVFParamKindFromString ( const StringRef  Token)

◆ mangleTLIVectorName()

std::string llvm::VFABI::mangleTLIVectorName ( StringRef  VectorName,
StringRef  ScalarName,
unsigned  numArgs,
unsigned  VF 
)

This routine mangles the given VectorName according to the LangRef specification for vector-function-abi-variant attribute and is specific to the TLI mappings.

It is the responsibility of the caller to make sure that this is only used if all parameters in the vector function are vector type. This returned string holds scalar-to-vector mapping: ZGV<isa><mask><vlen><vparams><scalarname>(<vectorname>)

where:

<isa> = "_LLVM_" <mask> = "N". Note: TLI does not support masked interfaces. <vlen> = Number of concurrent lanes, stored in the VectorizationFactor field of the VecDesc struct. <vparams> = "v", as many as are the numArgs. <scalarname> = the name of the scalar function. <vectorname> = the name of the vector function.

Definition at line 1272 of file VectorUtils.cpp.

References _LLVM_, I, and llvm::raw_svector_ostream::str().

Referenced by addMappingsFromTLI().

◆ setVectorVariantNames()

void llvm::VFABI::setVectorVariantNames ( CallInst CI,
const SmallVector< std::string, 8 > &  VariantMappings 
)

◆ tryDemangleForVFABI()

Optional< VFInfo > llvm::VFABI::tryDemangleForVFABI ( StringRef  MangledName,
const Module M 
)

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>:

Parameters
MangledName-> input string in the format ZGV<isa><mask><vlen><parameters><scalarname>[(<redirection>)].
M-> Module used to retrieve informations about the vector function that are not possible to retrieve from the mangled name. At the moment, this parameter is needed only to retrieve the Vectorization Factor of scalable vector functions from their respective IR declarations.

Definition at line 319 of file VFABIDemangling.cpp.

References assert(), llvm::SmallVectorTemplateCommon< T >::back(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::StringRef::consume_back(), llvm::StringRef::consume_front(), llvm::count_if(), llvm::SmallVectorBase< SmallVectorSizeType< T > >::empty(), llvm::StringRef::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::Error, F(), llvm::Module::getFunction(), llvm::Function::getFunctionType(), llvm::GlobalPredicate, llvm::tgtok::In, IsMasked(), llvm::LLVM, llvm::StringRef::ltrim(), llvm::ElementCount::Min, llvm::None, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::SmallVectorBase< SmallVectorSizeType< T > >::size(), and llvm::StringRef::take_while().

Referenced by getVectorVariantNames(), and setVectorVariantNames().

Variable Documentation

◆ _LLVM_

constexpr char const* llvm::VFABI::_LLVM_ = "_LLVM_"
static

LLVM Internal VFABI ISA token for vector functions.

Definition at line 139 of file VectorUtils.h.

Referenced by mangleTLIVectorName().

◆ _LLVM_Scalarize_

constexpr char const* llvm::VFABI::_LLVM_Scalarize_ = "_LLVM_Scalarize_"
static

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 146 of file VectorUtils.h.

◆ MappingsAttrName

constexpr char const* llvm::VFABI::MappingsAttrName = "vector-function-abi-variant"
static

Definition at line 199 of file VectorUtils.h.

Referenced by getVectorVariantNames(), and setVectorVariantNames().