LLVM  8.0.1
Public Types | 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)
 
TargetLibraryInfoImploperator= (const TargetLibraryInfoImpl &TLI)
 
TargetLibraryInfoImploperator= (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
 

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

◆ VectorLibrary

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() [1/4]

TargetLibraryInfoImpl::TargetLibraryInfoImpl ( )

Definition at line 540 of file TargetLibraryInfo.cpp.

References initialize(), and llvm::Intrinsic::memset.

Referenced by llvm::TargetLibraryAnalysis::run().

◆ TargetLibraryInfoImpl() [2/4]

TargetLibraryInfoImpl::TargetLibraryInfoImpl ( const Triple T)
explicit

Definition at line 547 of file TargetLibraryInfo.cpp.

References initialize(), and llvm::Intrinsic::memset.

◆ TargetLibraryInfoImpl() [3/4]

TargetLibraryInfoImpl::TargetLibraryInfoImpl ( const TargetLibraryInfoImpl TLI)

Definition at line 554 of file TargetLibraryInfo.cpp.

References llvm::Intrinsic::memcpy.

◆ TargetLibraryInfoImpl() [4/4]

TargetLibraryInfoImpl::TargetLibraryInfoImpl ( TargetLibraryInfoImpl &&  TLI)

Definition at line 563 of file TargetLibraryInfo.cpp.

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

Member Function Documentation

◆ addVectorizableFunctions()

void TargetLibraryInfoImpl::addVectorizableFunctions ( ArrayRef< VecDesc Fns)

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().

◆ 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().

◆ disableAllFunctions()

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().

◆ getLibFunc() [1/2]

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

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

◆ getLibFunc() [2/2]

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

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

◆ getScalarizedFunction()

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

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

◆ getVectorizedFunction()

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

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

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

◆ getWCharSize()

unsigned TargetLibraryInfoImpl::getWCharSize ( const Module M) const

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().

◆ isFunctionScalarizable()

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.

◆ isFunctionVectorizable() [1/2]

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 F().

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

◆ isFunctionVectorizable() [2/2]

bool TargetLibraryInfoImpl::isFunctionVectorizable ( StringRef  F) const

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().

◆ operator=() [1/2]

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

Definition at line 574 of file TargetLibraryInfo.cpp.

References llvm::Intrinsic::memcpy.

◆ operator=() [2/2]

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

Definition at line 583 of file TargetLibraryInfo.cpp.

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

◆ setAvailable()

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().

◆ setAvailableWithName()

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(), F(), and Name.

Referenced by initialize().

◆ setShouldExtI32Param()

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().

◆ setShouldExtI32Return()

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().

◆ setShouldSignExtI32Param()

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().

◆ setUnavailable()

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

◆ TargetLibraryInfo

friend class TargetLibraryInfo
friend

Definition at line 48 of file TargetLibraryInfo.h.

Referenced by llvm::TargetLibraryAnalysis::run().


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