|
LLVM 22.0.0git
|
Implementation of the target library information. More...
#include "llvm/Analysis/TargetLibraryInfo.h"
Public Member Functions | |
| TargetLibraryInfoImpl ()=delete | |
| LLVM_ABI | TargetLibraryInfoImpl (const Triple &T) |
| LLVM_ABI | TargetLibraryInfoImpl (const TargetLibraryInfoImpl &TLI) |
| LLVM_ABI | TargetLibraryInfoImpl (TargetLibraryInfoImpl &&TLI) |
| LLVM_ABI TargetLibraryInfoImpl & | operator= (const TargetLibraryInfoImpl &TLI) |
| LLVM_ABI TargetLibraryInfoImpl & | operator= (TargetLibraryInfoImpl &&TLI) |
| LLVM_ABI bool | getLibFunc (StringRef funcName, LibFunc &F) const |
| Searches for a particular function name. | |
| LLVM_ABI bool | getLibFunc (const Function &FDecl, LibFunc &F) const |
| Searches for a particular function name, also checking that its type is valid for the library function matching that name. | |
| LLVM_ABI bool | getLibFunc (unsigned int Opcode, Type *Ty, LibFunc &F) const |
Searches for a function name using an Instruction Opcode. | |
| void | setUnavailable (LibFunc F) |
| Forces a function to be marked as unavailable. | |
| void | setAvailable (LibFunc F) |
| Forces a function to be marked as available. | |
| void | setAvailableWithName (LibFunc F, StringRef Name) |
| Forces a function to be marked as available and provide an alternate name that must be used. | |
| LLVM_ABI void | disableAllFunctions () |
| Disables all builtins. | |
| LLVM_ABI void | addVectorizableFunctions (ArrayRef< VecDesc > Fns) |
| Add a set of scalar -> vector mappings, queryable via getVectorizedFunction and getScalarizedFunction. | |
| LLVM_ABI void | addVectorizableFunctionsFromVecLib (enum VectorLibrary VecLib, const llvm::Triple &TargetTriple) |
| Calls addVectorizableFunctions with a known preset of functions for the given vector library. | |
| bool | isFunctionVectorizable (StringRef F, const ElementCount &VF) const |
| Return true if the function F has a vector equivalent with vectorization factor VF. | |
| LLVM_ABI bool | isFunctionVectorizable (StringRef F) const |
| Return true if the function F has a vector equivalent with any vectorization factor. | |
| LLVM_ABI StringRef | getVectorizedFunction (StringRef F, const ElementCount &VF, bool Masked) const |
| Return the name of the equivalent of F, vectorized with factor VF. | |
| LLVM_ABI const VecDesc * | getVectorMappingInfo (StringRef F, const ElementCount &VF, bool Masked) const |
| Return a pointer to a VecDesc object holding all info for scalar to vector mappings in TLI for the equivalent of F, vectorized with factor VF. | |
| void | setShouldExtI32Param (bool Val) |
| Set to true iff i32 parameters to library functions should have signext or zeroext attributes if they correspond to C-level int or unsigned int, respectively. | |
| void | setShouldExtI32Return (bool Val) |
| Set to true iff i32 results from library functions should have signext or zeroext attributes if they correspond to C-level int or unsigned int, respectively. | |
| void | setShouldSignExtI32Param (bool Val) |
| Set to true iff i32 parameters to library functions should have signext attribute if they correspond to C-level int or unsigned int. | |
| void | setShouldSignExtI32Return (bool Val) |
| Set to true iff i32 results from library functions should have signext attribute if they correspond to C-level int or unsigned int. | |
| LLVM_ABI unsigned | getWCharSize (const Module &M) const |
| Returns the size of the wchar_t type in bytes or 0 if the size is unknown. | |
| LLVM_ABI unsigned | getSizeTSize (const Module &M) const |
| Returns the size of the size_t type in bits. | |
| unsigned | getIntSize () const |
| Get size of a C-level int or unsigned int, in bits. | |
| void | setIntSize (unsigned Bits) |
| Initialize the C-level size of an integer. | |
| LLVM_ABI void | getWidestVF (StringRef ScalarF, ElementCount &FixedVF, ElementCount &Scalable) const |
| Returns the largest vectorization factor used in the list of vector functions. | |
Static Public Member Functions | |
| static LLVM_ABI bool | isCallingConvCCompatible (CallBase *CI) |
| Returns true if call site / callee has cdecl-compatible calling conventions. | |
| static LLVM_ABI bool | isCallingConvCCompatible (Function *Callee) |
Friends | |
| class | TargetLibraryInfo |
Implementation of the target library information.
This class constructs tables that hold the target library information and make it available. However, it is somewhat expensive to compute and only depends on the triple. So users typically interact with the TargetLibraryInfo wrapper below.
Definition at line 87 of file TargetLibraryInfo.h.
|
delete |
References F, LLVM_ABI, T, and TargetLibraryInfoImpl().
Referenced by operator=(), operator=(), TargetLibraryInfoImpl(), TargetLibraryInfoImpl(), and TargetLibraryInfoImpl().
Definition at line 939 of file TargetLibraryInfo.cpp.
References initialize(), and T.
| TargetLibraryInfoImpl::TargetLibraryInfoImpl | ( | const TargetLibraryInfoImpl & | TLI | ) |
Definition at line 946 of file TargetLibraryInfo.cpp.
References TargetLibraryInfoImpl().
| TargetLibraryInfoImpl::TargetLibraryInfoImpl | ( | TargetLibraryInfoImpl && | TLI | ) |
Definition at line 957 of file TargetLibraryInfo.cpp.
References llvm::move(), and TargetLibraryInfoImpl().
Add a set of scalar -> vector mappings, queryable via getVectorizedFunction and getScalarizedFunction.
Definition at line 1278 of file TargetLibraryInfo.cpp.
References llvm::append_range(), compareByScalarFnName(), compareByVectorFnName(), and llvm::sort().
Referenced by addVectorizableFunctionsFromVecLib().
| void TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib | ( | enum VectorLibrary | VecLib, |
| const llvm::Triple & | TargetTriple ) |
Calls addVectorizableFunctions with a known preset of functions for the given vector library.
Definition at line 1370 of file TargetLibraryInfo.cpp.
References llvm::Triple::aarch64, llvm::Triple::aarch64_be, llvm::Accelerate, addVectorizableFunctions(), llvm::AMDLIBM, llvm::ArmPL, llvm::DarwinLibSystemM, llvm::Triple::getArch(), llvm::LIBMVEC, llvm::MASSV, llvm::NoLibrary, llvm::Triple::riscv64, llvm::SLEEFGNUABI, llvm::SVML, VecFuncs_Accelerate, VecFuncs_AMDLIBM, VecFuncs_ArmPL, VecFuncs_DarwinLibSystemM, VecFuncs_LIBMVEC_AARCH64, VecFuncs_LIBMVEC_X86, VecFuncs_MASSV, VecFuncs_SLEEFGNUABI_VF2, VecFuncs_SLEEFGNUABI_VF4, VecFuncs_SLEEFGNUABI_VFScalable, VecFuncs_SLEEFGNUABI_VFScalableRISCV, VecFuncs_SVML, llvm::Triple::x86, and llvm::Triple::x86_64.
Referenced by llvm::driver::createTLII(), and initializeLibCalls().
| void TargetLibraryInfoImpl::disableAllFunctions | ( | ) |
Disables all builtins.
This can be used for options like -fno-builtin.
Definition at line 1262 of file TargetLibraryInfo.cpp.
Referenced by initializeLibCalls().
|
inline |
Get size of a C-level int or unsigned int, in bits.
Definition at line 242 of file TargetLibraryInfo.h.
Searches for a particular function name, also checking that its type is valid for the library function matching that name.
If it is one of the known library functions, return true and set F to the corresponding value.
FDecl is assumed to have a parent Module when using this function.
Definition at line 1231 of file TargetLibraryInfo.cpp.
References assert(), F, llvm::Function::getFunctionType(), getLibFunc(), llvm::Value::getName(), llvm::GlobalValue::getParent(), llvm::Function::isIntrinsic(), and llvm::NotLibFunc.
Searches for a particular function name.
If it is one of the known library functions, return true and set F to the corresponding value.
Definition at line 1014 of file TargetLibraryInfo.cpp.
References buildIndexMap(), llvm::StringRef::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), F, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and sanitizeFunctionName().
Referenced by getLibFunc().
Searches for a function name using an Instruction Opcode.
Currently, only the frem instruction is supported.
Definition at line 1252 of file TargetLibraryInfo.cpp.
References F.
Returns the size of the size_t type in bits.
Definition at line 1489 of file TargetLibraryInfo.cpp.
| StringRef TargetLibraryInfoImpl::getVectorizedFunction | ( | StringRef | F, |
| const ElementCount & | VF, | ||
| bool | Masked ) const |
Return the name of the equivalent of F, vectorized with factor VF.
If no such mapping exists, return the empty string.
Definition at line 1450 of file TargetLibraryInfo.cpp.
References F, llvm::VecDesc::getVectorFnName(), getVectorMappingInfo(), and llvm::Masked.
Referenced by isFunctionVectorizable().
| const VecDesc * TargetLibraryInfoImpl::getVectorMappingInfo | ( | StringRef | F, |
| const ElementCount & | VF, | ||
| bool | Masked ) const |
Return a pointer to a VecDesc object holding all info for scalar to vector mappings in TLI for the equivalent of F, vectorized with factor VF.
If no such mapping exists, return nullpointer.
Definition at line 1460 of file TargetLibraryInfo.cpp.
References compareWithScalarFnName(), F, I, llvm::lower_bound(), llvm::Masked, and sanitizeFunctionName().
Referenced by getVectorizedFunction().
Returns the size of the wchar_t type in bytes or 0 if the size is unknown.
This queries the 'wchar_size' metadata.
Definition at line 1482 of file TargetLibraryInfo.cpp.
References llvm::cast(), and llvm::cast_or_null().
| void TargetLibraryInfoImpl::getWidestVF | ( | StringRef | ScalarF, |
| ElementCount & | FixedVF, | ||
| ElementCount & | Scalable ) const |
Returns the largest vectorization factor used in the list of vector functions.
Definition at line 1525 of file TargetLibraryInfo.cpp.
References compareWithScalarFnName(), llvm::StringRef::empty(), llvm::ElementCount::getFixed(), llvm::ElementCount::getScalable(), I, llvm::details::FixedOrScalableQuantity< ElementCount, unsigned >::isKnownGT(), llvm::lower_bound(), and sanitizeFunctionName().
Returns true if call site / callee has cdecl-compatible calling conventions.
Definition at line 130 of file TargetLibraryInfo.cpp.
References llvm::CallBase::getCallingConv(), llvm::CallBase::getFunctionType(), llvm::Instruction::getModule(), and llvm::Module::getTargetTriple().
Referenced by llvm::FortifiedLibCallSimplifier::optimizeCall(), and llvm::LibCallSimplifier::optimizeCall().
Definition at line 136 of file TargetLibraryInfo.cpp.
References F.
Return true if the function F has a vector equivalent with any vectorization factor.
Definition at line 1440 of file TargetLibraryInfo.cpp.
References compareWithScalarFnName(), llvm::StringRef::empty(), I, llvm::lower_bound(), and sanitizeFunctionName().
|
inline |
Return true if the function F has a vector equivalent with vectorization factor VF.
Definition at line 188 of file TargetLibraryInfo.h.
References llvm::StringRef::empty(), F, and getVectorizedFunction().
| TargetLibraryInfoImpl & TargetLibraryInfoImpl::operator= | ( | const TargetLibraryInfoImpl & | TLI | ) |
Definition at line 970 of file TargetLibraryInfo.cpp.
References TargetLibraryInfoImpl().
| TargetLibraryInfoImpl & TargetLibraryInfoImpl::operator= | ( | TargetLibraryInfoImpl && | TLI | ) |
Definition at line 981 of file TargetLibraryInfo.cpp.
References TargetLibraryInfoImpl().
|
inline |
Forces a function to be marked as available.
Definition at line 155 of file TargetLibraryInfo.h.
References F.
Referenced by initializeLibCalls().
Forces a function to be marked as available and provide an alternate name that must be used.
Definition at line 161 of file TargetLibraryInfo.h.
Referenced by initializeLibCalls().
|
inline |
Initialize the C-level size of an integer.
Definition at line 247 of file TargetLibraryInfo.h.
Referenced by initializeBase().
|
inline |
Set to true iff i32 parameters to library functions should have signext or zeroext attributes if they correspond to C-level int or unsigned int, respectively.
Definition at line 211 of file TargetLibraryInfo.h.
Referenced by initializeBase().
|
inline |
Set to true iff i32 results from library functions should have signext or zeroext attributes if they correspond to C-level int or unsigned int, respectively.
Definition at line 218 of file TargetLibraryInfo.h.
Referenced by initializeBase().
|
inline |
Set to true iff i32 parameters to library functions should have signext attribute if they correspond to C-level int or unsigned int.
Definition at line 224 of file TargetLibraryInfo.h.
Referenced by initializeBase().
|
inline |
Set to true iff i32 results from library functions should have signext attribute if they correspond to C-level int or unsigned int.
Definition at line 230 of file TargetLibraryInfo.h.
Referenced by initializeBase().
|
inline |
Forces a function to be marked as unavailable.
Definition at line 150 of file TargetLibraryInfo.h.
References F.
Referenced by initializeLibCalls().
|
friend |
Definition at line 88 of file TargetLibraryInfo.h.
References LLVM_ABI, llvm::NumLibFuncs, and TargetLibraryInfo.
Referenced by TargetLibraryInfo.