LLVM
8.0.1
|
Implementation of the target library information. More...
#include "llvm/Analysis/TargetLibraryInfo.h"
Public Types | |
enum | VectorLibrary { NoLibrary, Accelerate, SVML } |
List of known vector-functions libraries. More... | |
Public Member Functions | |
TargetLibraryInfoImpl () | |
TargetLibraryInfoImpl (const Triple &T) | |
TargetLibraryInfoImpl (const TargetLibraryInfoImpl &TLI) | |
TargetLibraryInfoImpl (TargetLibraryInfoImpl &&TLI) | |
TargetLibraryInfoImpl & | operator= (const TargetLibraryInfoImpl &TLI) |
TargetLibraryInfoImpl & | operator= (TargetLibraryInfoImpl &&TLI) |
bool | getLibFunc (StringRef funcName, LibFunc &F) const |
Searches for a particular function name. More... | |
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. More... | |
void | setUnavailable (LibFunc F) |
Forces a function to be marked as unavailable. More... | |
void | setAvailable (LibFunc F) |
Forces a function to be marked as available. More... | |
void | setAvailableWithName (LibFunc F, StringRef Name) |
Forces a function to be marked as available and provide an alternate name that must be used. More... | |
void | disableAllFunctions () |
Disables all builtins. More... | |
void | addVectorizableFunctions (ArrayRef< VecDesc > Fns) |
Add a set of scalar -> vector mappings, queryable via getVectorizedFunction and getScalarizedFunction. More... | |
void | addVectorizableFunctionsFromVecLib (enum VectorLibrary VecLib) |
Calls addVectorizableFunctions with a known preset of functions for the given vector library. More... | |
bool | isFunctionVectorizable (StringRef F, unsigned VF) const |
Return true if the function F has a vector equivalent with vectorization factor VF. More... | |
bool | isFunctionVectorizable (StringRef F) const |
Return true if the function F has a vector equivalent with any vectorization factor. More... | |
StringRef | getVectorizedFunction (StringRef F, unsigned VF) const |
Return the name of the equivalent of F, vectorized with factor VF. More... | |
bool | isFunctionScalarizable (StringRef F, unsigned &VF) const |
Return true if the function F has a scalar equivalent, and set VF to be the vectorization factor. More... | |
StringRef | getScalarizedFunction (StringRef F, unsigned &VF) const |
Return the name of the equivalent of F, scalarized. More... | |
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. More... | |
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. More... | |
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. More... | |
unsigned | getWCharSize (const Module &M) const |
Returns the size of the wchar_t type in bytes or 0 if the size is unknown. More... | |
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 47 of file TargetLibraryInfo.h.
List of known vector-functions libraries.
The vector-functions library defines, which functions are vectorizable and with which factor. The library can be specified by either frontend, or a commandline option, and then used by addVectorizableFunctionsFromVecLib for filling up the tables of vectorizable functions.
Enumerator | |
---|---|
NoLibrary | |
Accelerate | |
SVML |
Definition at line 87 of file TargetLibraryInfo.h.
TargetLibraryInfoImpl::TargetLibraryInfoImpl | ( | ) |
Definition at line 540 of file TargetLibraryInfo.cpp.
References initialize(), and llvm::Intrinsic::memset.
Referenced by llvm::TargetLibraryAnalysis::run().
Definition at line 547 of file TargetLibraryInfo.cpp.
References initialize(), and llvm::Intrinsic::memset.
TargetLibraryInfoImpl::TargetLibraryInfoImpl | ( | const TargetLibraryInfoImpl & | TLI | ) |
Definition at line 554 of file TargetLibraryInfo.cpp.
References llvm::Intrinsic::memcpy.
TargetLibraryInfoImpl::TargetLibraryInfoImpl | ( | TargetLibraryInfoImpl && | TLI | ) |
Definition at line 563 of file TargetLibraryInfo.cpp.
References llvm::sys::path::begin(), and llvm::sys::path::end().
Add a set of scalar -> vector mappings, queryable via getVectorizedFunction and getScalarizedFunction.
Definition at line 1440 of file TargetLibraryInfo.cpp.
References llvm::ArrayRef< T >::begin(), compareByScalarFnName(), compareByVectorFnName(), llvm::ArrayRef< T >::end(), and llvm::sort().
Referenced by addVectorizableFunctionsFromVecLib().
void TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib | ( | enum VectorLibrary | VecLib | ) |
Calls addVectorizableFunctions with a known preset of functions for the given vector library.
Definition at line 1448 of file TargetLibraryInfo.cpp.
References Accelerate, addVectorizableFunctions(), NoLibrary, and SVML.
Referenced by initialize().
void TargetLibraryInfoImpl::disableAllFunctions | ( | ) |
Disables all builtins.
This can be used for options like -fno-builtin.
Definition at line 1420 of file TargetLibraryInfo.cpp.
References llvm::Intrinsic::memset.
Referenced by initialize().
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 604 of file TargetLibraryInfo.cpp.
Referenced by getLibFunc(), and llvm::TargetLibraryInfo::getLibFunc().
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.
Definition at line 1412 of file TargetLibraryInfo.cpp.
References F(), llvm::Module::getDataLayout(), llvm::Function::getFunctionType(), getLibFunc(), llvm::Value::getName(), and llvm::GlobalValue::getParent().
Return the name of the equivalent of F, scalarized.
If no such mapping exists, return the empty string.
Set VF to the vectorization factor.
Definition at line 1633 of file TargetLibraryInfo.cpp.
References compareWithVectorFnName(), llvm::StringRef::empty(), F(), I, llvm::lower_bound(), and sanitizeFunctionName().
Return the name of the equivalent of F, vectorized with factor VF.
If no such mapping exists, return the empty string.
Definition at line 1618 of file TargetLibraryInfo.cpp.
References compareWithScalarFnName(), llvm::StringRef::empty(), F(), I, llvm::lower_bound(), and sanitizeFunctionName().
Referenced by llvm::TargetLibraryInfo::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 1673 of file TargetLibraryInfo.cpp.
References llvm::Module::getModuleFlag().
Referenced by llvm::TargetLibraryInfo::getWCharSize().
|
inline |
Return true if the function F has a scalar equivalent, and set VF to be the vectorization factor.
Definition at line 166 of file TargetLibraryInfo.h.
Return true if the function F has a vector equivalent with vectorization factor VF.
Definition at line 152 of file TargetLibraryInfo.h.
References F().
Referenced by llvm::TargetLibraryInfo::isFunctionVectorizable().
Return true if the function F has a vector equivalent with any vectorization factor.
Definition at line 1607 of file TargetLibraryInfo.cpp.
References compareWithScalarFnName(), llvm::StringRef::empty(), I, llvm::lower_bound(), and sanitizeFunctionName().
TargetLibraryInfoImpl & TargetLibraryInfoImpl::operator= | ( | const TargetLibraryInfoImpl & | TLI | ) |
Definition at line 574 of file TargetLibraryInfo.cpp.
References llvm::Intrinsic::memcpy.
TargetLibraryInfoImpl & TargetLibraryInfoImpl::operator= | ( | TargetLibraryInfoImpl && | TLI | ) |
Definition at line 583 of file TargetLibraryInfo.cpp.
References llvm::sys::path::begin(), and llvm::sys::path::end().
|
inline |
Forces a function to be marked as available.
Definition at line 121 of file TargetLibraryInfo.h.
Referenced by initialize().
Forces a function to be marked as available and provide an alternate name that must be used.
Definition at line 127 of file TargetLibraryInfo.h.
References assert(), F(), and Name.
Referenced by initialize().
|
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 179 of file TargetLibraryInfo.h.
Referenced by initialize().
|
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 186 of file TargetLibraryInfo.h.
Referenced by initialize().
|
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 192 of file TargetLibraryInfo.h.
Referenced by initialize().
|
inline |
Forces a function to be marked as unavailable.
Definition at line 116 of file TargetLibraryInfo.h.
Referenced by initialize().
|
friend |
Definition at line 48 of file TargetLibraryInfo.h.
Referenced by llvm::TargetLibraryAnalysis::run().