LLVM  5.0.0
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::TargetLibraryInfoImpl Class Reference

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. More...
 

Static Public Member Functions

static unsigned getTargetWCharSize (const Triple &T)
 Returns size of the default wchar_t type on target T. More...
 

Friends

class TargetLibraryInfo
 

Detailed Description

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.

Member Enumeration Documentation

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.

Constructor & Destructor Documentation

TargetLibraryInfoImpl::TargetLibraryInfoImpl ( )

Definition at line 483 of file TargetLibraryInfo.cpp.

References initialize().

TargetLibraryInfoImpl::TargetLibraryInfoImpl ( const Triple &  T)
explicit

Definition at line 490 of file TargetLibraryInfo.cpp.

References initialize().

TargetLibraryInfoImpl::TargetLibraryInfoImpl ( const TargetLibraryInfoImpl &  TLI)

Definition at line 497 of file TargetLibraryInfo.cpp.

TargetLibraryInfoImpl::TargetLibraryInfoImpl ( TargetLibraryInfoImpl &&  TLI)

Definition at line 506 of file TargetLibraryInfo.cpp.

References llvm::sys::path::begin(), and llvm::sys::path::end().

Member Function Documentation

void TargetLibraryInfoImpl::addVectorizableFunctions ( ArrayRef< VecDesc >  Fns)

Add a set of scalar -> vector mappings, queryable via getVectorizedFunction and getScalarizedFunction.

Definition at line 1305 of file TargetLibraryInfo.cpp.

References llvm::ArrayRef< T >::begin(), compareByScalarFnName(), compareByVectorFnName(), llvm::ArrayRef< T >::end(), and llvm::parallel::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 1313 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 1285 of file TargetLibraryInfo.cpp.

Referenced by initialize().

bool TargetLibraryInfoImpl::getLibFunc ( StringRef  funcName,
LibFunc &  F 
) const

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 547 of file TargetLibraryInfo.cpp.

References llvm::StringRef::empty(), llvm::WebAssembly::End, I, llvm::NumLibFuncs, and sanitizeFunctionName().

Referenced by getLibFunc(), and llvm::TargetLibraryInfo::getLibFunc().

bool TargetLibraryInfoImpl::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.

If it is one of the known library functions, return true and set F to the corresponding value.

Definition at line 1277 of file TargetLibraryInfo.cpp.

References llvm::DL, F, llvm::Module::getDataLayout(), llvm::Function::getFunctionType(), getLibFunc(), llvm::Value::getName(), and llvm::GlobalValue::getParent().

StringRef TargetLibraryInfoImpl::getScalarizedFunction ( StringRef  F,
unsigned &  VF 
) const

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 1482 of file TargetLibraryInfo.cpp.

References compareWithVectorFnName(), llvm::StringRef::empty(), F, I, and sanitizeFunctionName().

Referenced by isFunctionScalarizable().

unsigned TargetLibraryInfoImpl::getTargetWCharSize ( const Triple &  T)
static

Returns size of the default wchar_t type on target T.

This is mostly intended to verify that the size in the frontend matches LLVM. All other queries should use getWCharSize() instead.

Definition at line 1522 of file TargetLibraryInfo.cpp.

References llvm::Triple::getArch(), llvm::Triple::isArch16Bit(), llvm::Triple::isOSWindows(), llvm::Triple::isPS4(), and llvm::Triple::xcore.

Referenced by getWCharSize().

StringRef TargetLibraryInfoImpl::getVectorizedFunction ( StringRef  F,
unsigned  VF 
) 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 1467 of file TargetLibraryInfo.cpp.

References compareWithScalarFnName(), llvm::StringRef::empty(), F, I, and sanitizeFunctionName().

Referenced by llvm::TargetLibraryInfo::getVectorizedFunction(), and isFunctionVectorizable().

unsigned TargetLibraryInfoImpl::getWCharSize ( const Module &  M) const

Returns the size of the wchar_t type in bytes.

Definition at line 1531 of file TargetLibraryInfo.cpp.

References llvm::Module::getModuleFlag(), llvm::Module::getTargetTriple(), and getTargetWCharSize().

Referenced by llvm::TargetLibraryInfo::getWCharSize().

bool llvm::TargetLibraryInfoImpl::isFunctionScalarizable ( StringRef  F,
unsigned &  VF 
) const
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.

References llvm::StringRef::empty(), and getScalarizedFunction().

bool llvm::TargetLibraryInfoImpl::isFunctionVectorizable ( StringRef  F,
unsigned  VF 
) const
inline

Return true if the function F has a vector equivalent with vectorization factor VF.

Definition at line 152 of file TargetLibraryInfo.h.

References llvm::StringRef::empty(), and getVectorizedFunction().

Referenced by llvm::TargetLibraryInfo::isFunctionVectorizable().

bool TargetLibraryInfoImpl::isFunctionVectorizable ( StringRef  F) const

Return true if the function F has a vector equivalent with any vectorization factor.

Definition at line 1456 of file TargetLibraryInfo.cpp.

References compareWithScalarFnName(), llvm::StringRef::empty(), I, and sanitizeFunctionName().

TargetLibraryInfoImpl & TargetLibraryInfoImpl::operator= ( const TargetLibraryInfoImpl &  TLI)

Definition at line 517 of file TargetLibraryInfo.cpp.

TargetLibraryInfoImpl & TargetLibraryInfoImpl::operator= ( TargetLibraryInfoImpl &&  TLI)

Definition at line 526 of file TargetLibraryInfo.cpp.

References llvm::sys::path::begin(), and llvm::sys::path::end().

void llvm::TargetLibraryInfoImpl::setAvailable ( LibFunc  F)
inline

Forces a function to be marked as available.

Definition at line 121 of file TargetLibraryInfo.h.

Referenced by initialize().

void llvm::TargetLibraryInfoImpl::setAvailableWithName ( LibFunc  F,
StringRef  Name 
)
inline

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(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), F, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and Name.

Referenced by initialize().

void llvm::TargetLibraryInfoImpl::setShouldExtI32Param ( bool  Val)
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().

void llvm::TargetLibraryInfoImpl::setShouldExtI32Return ( bool  Val)
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().

void llvm::TargetLibraryInfoImpl::setShouldSignExtI32Param ( bool  Val)
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().

void llvm::TargetLibraryInfoImpl::setUnavailable ( LibFunc  F)
inline

Forces a function to be marked as unavailable.

Definition at line 116 of file TargetLibraryInfo.h.

Referenced by initialize().

Friends And Related Function Documentation

friend class TargetLibraryInfo
friend

Definition at line 48 of file TargetLibraryInfo.h.


The documentation for this class was generated from the following files: