LLVM 24.0.0git
llvm::TargetLibraryInfoImpl Class Reference

Implementation of the target library information. More...

#include "llvm/Analysis/TargetLibraryInfo.h"

Public Member Functions

 TargetLibraryInfoImpl ()=delete
LLVM_ABI TargetLibraryInfoImpl (const Triple &T, VectorLibrary VecLib=VectorLibrary::NoLibrary)
LLVM_ABI TargetLibraryInfoImpl (const TargetLibraryInfoImpl &TLI)
LLVM_ABI TargetLibraryInfoImpl (TargetLibraryInfoImpl &&TLI)
LLVM_ABI TargetLibraryInfoImploperator= (const TargetLibraryInfoImpl &TLI)
LLVM_ABI TargetLibraryInfoImploperator= (TargetLibraryInfoImpl &&TLI)
LLVM_ABI LibFunc getLibFunc (StringRef funcName) const
 Searches for a particular function name.
LLVM_ABI LibFunc getLibFunc (const Function &FDecl) const
 Searches for a particular function name, also checking that its type is valid for the library function matching that name.
LLVM_ABI LibFunc getLibFunc (unsigned int Opcode, Type *Ty) 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 VecDescgetVectorMappingInfo (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.
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

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 83 of file TargetLibraryInfo.h.

Constructor & Destructor Documentation

◆ TargetLibraryInfoImpl() [1/4]

llvm::TargetLibraryInfoImpl::TargetLibraryInfoImpl ( )
delete

◆ TargetLibraryInfoImpl() [2/4]

TargetLibraryInfoImpl::TargetLibraryInfoImpl ( const Triple & T,
VectorLibrary VecLib = VectorLibrary::NoLibrary )
explicit

Definition at line 899 of file TargetLibraryInfo.cpp.

References initialize(), and T.

◆ TargetLibraryInfoImpl() [3/4]

TargetLibraryInfoImpl::TargetLibraryInfoImpl ( const TargetLibraryInfoImpl & TLI)

Definition at line 907 of file TargetLibraryInfo.cpp.

References TargetLibraryInfoImpl().

◆ TargetLibraryInfoImpl() [4/4]

TargetLibraryInfoImpl::TargetLibraryInfoImpl ( TargetLibraryInfoImpl && TLI)

Definition at line 918 of file TargetLibraryInfo.cpp.

References llvm::move(), and TargetLibraryInfoImpl().

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

References llvm::append_range(), compareByScalarFnName(), compareByVectorFnName(), and llvm::sort().

Referenced by addVectorizableFunctionsFromVecLib().

◆ addVectorizableFunctionsFromVecLib()

◆ disableAllFunctions()

void TargetLibraryInfoImpl::disableAllFunctions ( )

Disables all builtins.

This can be used for options like -fno-builtin.

Definition at line 1219 of file TargetLibraryInfo.cpp.

Referenced by initializeLibCalls().

◆ getIntSize()

unsigned llvm::TargetLibraryInfoImpl::getIntSize ( ) const
inline

Get size of a C-level int or unsigned int, in bits.

Definition at line 245 of file TargetLibraryInfo.h.

◆ getLibFunc() [1/3]

LibFunc TargetLibraryInfoImpl::getLibFunc ( const Function & FDecl) const

Searches for a particular function name, also checking that its type is valid for the library function matching that name.

Returns the corresponding LibFunc if it is one of the known library functions, and NotLibFunc otherwise.

FDecl is assumed to have a parent Module when using this function.

Definition at line 1189 of file TargetLibraryInfo.cpp.

References assert(), llvm::Function::getFunctionType(), getLibFunc(), llvm::Value::getName(), llvm::GlobalValue::getParent(), and llvm::Function::isIntrinsic().

◆ getLibFunc() [2/3]

LibFunc TargetLibraryInfoImpl::getLibFunc ( StringRef funcName) const

Searches for a particular function name.

Returns the corresponding LibFunc if it is one of the known library functions, and NotLibFunc otherwise.

Definition at line 975 of file TargetLibraryInfo.cpp.

References buildIndexMap(), llvm::StringRef::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and sanitizeFunctionName().

Referenced by getLibFunc().

◆ getLibFunc() [3/3]

LibFunc TargetLibraryInfoImpl::getLibFunc ( unsigned int Opcode,
Type * Ty ) const

Searches for a function name using an Instruction Opcode.

Currently, only the frem instruction is supported.

Returns NotLibFunc if there is no matching library function.

Definition at line 1211 of file TargetLibraryInfo.cpp.

◆ getSizeTSize()

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

Returns the size of the size_t type in bits.

Definition at line 1446 of file TargetLibraryInfo.cpp.

◆ getVectorizedFunction()

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

References F, llvm::VecDesc::getVectorFnName(), getVectorMappingInfo(), and llvm::Masked.

Referenced by isFunctionVectorizable().

◆ getVectorMappingInfo()

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

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

Referenced by getVectorizedFunction().

◆ getWCharSize()

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

Returns the size of the wchar_t type in bytes.

This queries the 'wchar_size' metadata.

Definition at line 1439 of file TargetLibraryInfo.cpp.

References llvm::cast(), llvm::cast_or_null(), and llvm::Triple::getDefaultWCharSize().

◆ getWidestVF()

void TargetLibraryInfoImpl::getWidestVF ( StringRef ScalarF,
ElementCount & FixedVF,
ElementCount & Scalable ) const

◆ isCallingConvCCompatible() [1/2]

bool TargetLibraryInfoImpl::isCallingConvCCompatible ( CallBase * CI)
static

◆ isCallingConvCCompatible() [2/2]

bool TargetLibraryInfoImpl::isCallingConvCCompatible ( Function * Callee)
static

Definition at line 103 of file TargetLibraryInfo.cpp.

References F.

◆ isFunctionVectorizable() [1/2]

bool TargetLibraryInfoImpl::isFunctionVectorizable ( StringRef F) const

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

Definition at line 1397 of file TargetLibraryInfo.cpp.

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

◆ isFunctionVectorizable() [2/2]

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

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

Definition at line 191 of file TargetLibraryInfo.h.

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

◆ operator=() [1/2]

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

Definition at line 931 of file TargetLibraryInfo.cpp.

References TargetLibraryInfoImpl().

◆ operator=() [2/2]

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

Definition at line 942 of file TargetLibraryInfo.cpp.

References TargetLibraryInfoImpl().

◆ setAvailable()

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

Forces a function to be marked as available.

Definition at line 157 of file TargetLibraryInfo.h.

References F.

Referenced by initializeLibCalls().

◆ 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 163 of file TargetLibraryInfo.h.

References assert(), and F.

Referenced by initializeLibCalls().

◆ setIntSize()

void llvm::TargetLibraryInfoImpl::setIntSize ( unsigned Bits)
inline

Initialize the C-level size of an integer.

Definition at line 250 of file TargetLibraryInfo.h.

Referenced by initializeBase().

◆ 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 214 of file TargetLibraryInfo.h.

Referenced by initializeBase().

◆ 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 221 of file TargetLibraryInfo.h.

Referenced by initializeBase().

◆ 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 227 of file TargetLibraryInfo.h.

Referenced by initializeBase().

◆ setShouldSignExtI32Return()

void llvm::TargetLibraryInfoImpl::setShouldSignExtI32Return ( bool Val)
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 233 of file TargetLibraryInfo.h.

Referenced by initializeBase().

◆ setUnavailable()

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

Forces a function to be marked as unavailable.

Definition at line 152 of file TargetLibraryInfo.h.

References F.

Referenced by initializeLibCalls().

◆ TargetLibraryInfo

friend class TargetLibraryInfo
friend

Definition at line 84 of file TargetLibraryInfo.h.

References TargetLibraryInfo.

Referenced by TargetLibraryInfo.


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