LLVM 19.0.0git
|
Provides information about what library functions are available for the current target. More...
#include "llvm/Analysis/TargetLibraryInfo.h"
Public Member Functions | |
TargetLibraryInfo (const TargetLibraryInfoImpl &Impl, std::optional< const Function * > F=std::nullopt) | |
TargetLibraryInfo (const TargetLibraryInfo &TLI)=default | |
TargetLibraryInfo (TargetLibraryInfo &&TLI) | |
TargetLibraryInfo & | operator= (const TargetLibraryInfo &TLI)=default |
TargetLibraryInfo & | operator= (TargetLibraryInfo &&TLI) |
bool | areInlineCompatible (const TargetLibraryInfo &CalleeTLI, bool AllowCallerSuperset) const |
Determine whether a callee with the given TLI can be inlined into caller with this TLI, based on 'nobuiltin' attributes. | |
bool | isValidProtoForLibFunc (const FunctionType &FTy, LibFunc F, const Module &M) const |
Return true if the function type FTy is valid for the library function F, regardless of whether the function is available. | |
bool | getLibFunc (StringRef funcName, LibFunc &F) const |
Searches for a particular function name. | |
bool | getLibFunc (const Function &FDecl, LibFunc &F) const |
bool | getLibFunc (const CallBase &CB, LibFunc &F) const |
If a callbase does not have the 'nobuiltin' attribute, return if the called function is a known library function and set F to that function. | |
bool | getLibFunc (unsigned int Opcode, Type *Ty, LibFunc &F) const |
Searches for a function name using an Instruction Opcode . | |
void | disableAllFunctions () LLVM_ATTRIBUTE_UNUSED |
Disables all builtins. | |
void | setUnavailable (LibFunc F) LLVM_ATTRIBUTE_UNUSED |
Forces a function to be marked as unavailable. | |
TargetLibraryInfoImpl::AvailabilityState | getState (LibFunc F) const |
bool | has (LibFunc F) const |
Tests whether a library function is available. | |
bool | isFunctionVectorizable (StringRef F, const ElementCount &VF) const |
bool | isFunctionVectorizable (StringRef F) const |
StringRef | getVectorizedFunction (StringRef F, const ElementCount &VF, bool Masked=false) const |
const VecDesc * | getVectorMappingInfo (StringRef F, const ElementCount &VF, bool Masked) const |
bool | hasOptimizedCodeGen (LibFunc F) const |
Tests if the function is both available and a candidate for optimized code generation. | |
StringRef | getName (LibFunc F) const |
Attribute::AttrKind | getExtAttrForI32Param (bool Signed=true) const |
Attribute::AttrKind | getExtAttrForI32Return (bool Signed=true) const |
AttributeList | getAttrList (LLVMContext *C, ArrayRef< unsigned > ArgNos, bool Signed, bool Ret=false, AttributeList AL=AttributeList()) const |
unsigned | getWCharSize (const Module &M) const |
Returns the size of the wchar_t type in bytes or 0 if the size is unknown. | |
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. | |
bool | invalidate (Module &, const PreservedAnalyses &, ModuleAnalysisManager::Invalidator &) |
Handle invalidation from the pass manager. | |
bool | invalidate (Function &, const PreservedAnalyses &, FunctionAnalysisManager::Invalidator &) |
void | getWidestVF (StringRef ScalarF, ElementCount &FixedVF, ElementCount &ScalableVF) const |
Returns the largest vectorization factor used in the list of vector functions. | |
bool | isKnownVectorFunctionInLibrary (StringRef F) const |
Check if the function "F" is listed in a library known to LLVM. | |
Static Public Member Functions | |
static void | initExtensionsForTriple (bool &ShouldExtI32Param, bool &ShouldExtI32Return, bool &ShouldSignExtI32Param, bool &ShouldSignExtI32Return, const Triple &T) |
static Attribute::AttrKind | getExtAttrForI32Param (const Triple &T, bool Signed=true) |
static Attribute::AttrKind | getExtAttrForI32Return (const Triple &T, bool Signed=true) |
Friends | |
class | TargetLibraryAnalysis |
class | TargetLibraryInfoWrapperPass |
Provides information about what library functions are available for the current target.
This both allows optimizations to handle them specially and frontends to disable such optimizations through -fno-builtin etc.
Definition at line 281 of file TargetLibraryInfo.h.
|
inlineexplicit |
Definition at line 293 of file TargetLibraryInfo.h.
References disableAllFunctions(), F, getLibFunc(), and setUnavailable().
|
default |
|
inline |
Definition at line 318 of file TargetLibraryInfo.h.
|
inline |
Determine whether a callee with the given TLI can be inlined into caller with this TLI, based on 'nobuiltin' attributes.
When requested, allow inlining into a caller with a superset of the callee's nobuiltin attributes, which is conservatively correct.
Definition at line 331 of file TargetLibraryInfo.h.
References B.
|
inline |
Disables all builtins.
This can be used for options like -fno-builtin.
Definition at line 377 of file TargetLibraryInfo.h.
References llvm::BitVector::set().
Referenced by TargetLibraryInfo().
|
inline |
Definition at line 545 of file TargetLibraryInfo.h.
References llvm::CallingConv::C, and Signed.
|
inline |
Definition at line 507 of file TargetLibraryInfo.h.
References Signed.
|
inlinestatic |
Definition at line 497 of file TargetLibraryInfo.h.
References initExtensionsForTriple(), and Signed.
|
inline |
Definition at line 537 of file TargetLibraryInfo.h.
References Signed.
|
inlinestatic |
Definition at line 527 of file TargetLibraryInfo.h.
References initExtensionsForTriple(), and Signed.
|
inline |
Get size of a C-level int or unsigned int, in bits.
Definition at line 566 of file TargetLibraryInfo.h.
References llvm::TargetLibraryInfoImpl::getIntSize().
Referenced by getIntTy().
If a callbase does not have the 'nobuiltin' attribute, return if the called function is a known library function and set F to that function.
Definition at line 363 of file TargetLibraryInfo.h.
References F, llvm::CallBase::getCalledFunction(), getLibFunc(), and llvm::CallBase::isNoBuiltin().
Definition at line 357 of file TargetLibraryInfo.h.
References F, and llvm::TargetLibraryInfoImpl::getLibFunc().
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 353 of file TargetLibraryInfo.h.
References F, and llvm::TargetLibraryInfoImpl::getLibFunc().
Referenced by llvm::callsGCLeafFunction(), llvm::MemoryOpRemark::canHandle(), llvm::ConstantFoldCall(), llvm::emitBinaryFloatFnCall(), llvm::emitUnaryFloatFnCall(), foldSqrt(), getAllocationDataForFunction(), llvm::getAllocationFamily(), llvm::TargetTransformInfo::getArithmeticInstrCost(), llvm::MemoryLocation::getForArgument(), llvm::getFreedOperand(), llvm::getIntrinsicForCallSite(), getLibFunc(), llvm::inferNonMandatoryLibFuncAttrs(), insertSinCosCall(), isAllocSiteRemovable(), isIntrinsicOrLFToBeTailCalled(), isKnownLibFunction(), llvm::isLibFuncEmittable(), llvm::isMathLibCallNoop(), llvm::maybeMarkSanitizerLibraryCallNoBuiltin(), llvm::FortifiedLibCallSimplifier::optimizeCall(), llvm::LibCallSimplifier::optimizeCall(), optimizeCall(), replaceWithCallToVeclib(), runPartiallyInlineLibCalls(), llvm::FastISel::selectInstruction(), TargetLibraryInfo(), and llvm::InstCombinerImpl::visitFree().
|
inline |
Searches for a function name using an Instruction Opcode
.
Currently, only the frem instruction is supported.
Definition at line 370 of file TargetLibraryInfo.h.
References F, and llvm::TargetLibraryInfoImpl::getLibFunc().
Definition at line 445 of file TargetLibraryInfo.h.
References assert(), F, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and getState().
Referenced by llvm::emitCalloc(), llvm::emitFPutC(), llvm::emitFPutS(), llvm::emitFWrite(), llvm::emitHotColdNew(), llvm::emitHotColdNewAligned(), llvm::emitHotColdNewAlignedNoThrow(), llvm::emitHotColdNewNoThrow(), emitLibCall(), llvm::emitMalloc(), llvm::emitPutChar(), llvm::emitPutS(), llvm::TargetTransformInfo::getArithmeticInstrCost(), llvm::getFloatFn(), llvm::getOrInsertLibFunc(), llvm::isLibFuncEmittable(), and replaceWithCallToVeclib().
Returns the size of the size_t type in bits.
Definition at line 563 of file TargetLibraryInfo.h.
References llvm::TargetLibraryInfoImpl::getSizeTSize().
Referenced by getSizeTTy().
|
inline |
Definition at line 386 of file TargetLibraryInfo.h.
References F.
Referenced by getName(), has(), and hasOptimizedCodeGen().
|
inline |
Definition at line 402 of file TargetLibraryInfo.h.
References F, and llvm::TargetLibraryInfoImpl::getVectorizedFunction().
|
inline |
Definition at line 406 of file TargetLibraryInfo.h.
References F, and llvm::TargetLibraryInfoImpl::getVectorMappingInfo().
Referenced by addMappingsFromTLI(), and replaceWithCallToVeclib().
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 558 of file TargetLibraryInfo.h.
References llvm::TargetLibraryInfoImpl::getWCharSize().
|
inline |
Returns the largest vectorization factor used in the list of vector functions.
Definition at line 584 of file TargetLibraryInfo.h.
References llvm::TargetLibraryInfoImpl::getWidestVF().
Referenced by addMappingsFromTLI(), and llvm::isTLIScalarize().
Tests whether a library function is available.
Definition at line 393 of file TargetLibraryInfo.h.
References F, and getState().
Referenced by llvm::callsGCLeafFunction(), llvm::MemoryOpRemark::canHandle(), getAllocationDataForFunction(), llvm::getAllocationFamily(), llvm::MemoryLocation::getForArgument(), llvm::getFreedOperand(), llvm::getOrInsertLibFunc(), llvm::inferNonMandatoryLibFuncAttrs(), isAllocSiteRemovable(), llvm::isLibFuncEmittable(), runPartiallyInlineLibCalls(), and llvm::InstCombinerImpl::visitFree().
Tests if the function is both available and a candidate for optimized code generation.
Definition at line 413 of file TargetLibraryInfo.h.
References F, and getState().
Referenced by llvm::maybeMarkSanitizerLibraryCallNoBuiltin(), and llvm::FastISel::selectInstruction().
|
inlinestatic |
Definition at line 455 of file TargetLibraryInfo.h.
References llvm::Triple::sparcv9, and llvm::Triple::systemz.
Referenced by getExtAttrForI32Param(), getExtAttrForI32Return(), and initialize().
|
inline |
Definition at line 578 of file TargetLibraryInfo.h.
|
inline |
Handle invalidation from the pass manager.
If we try to invalidate this info, just return false. It cannot become invalid even if the module or function changes.
Definition at line 574 of file TargetLibraryInfo.h.
Definition at line 399 of file TargetLibraryInfo.h.
References F, and llvm::TargetLibraryInfoImpl::isFunctionVectorizable().
|
inline |
Definition at line 396 of file TargetLibraryInfo.h.
References F, and llvm::TargetLibraryInfoImpl::isFunctionVectorizable().
Referenced by addMappingsFromTLI(), llvm::TargetTransformInfo::getArithmeticInstrCost(), isKnownVectorFunctionInLibrary(), and llvm::isTLIScalarize().
Check if the function "F" is listed in a library known to LLVM.
Definition at line 590 of file TargetLibraryInfo.h.
References isFunctionVectorizable().
Referenced by isKnownLibFunction().
|
inline |
Return true if the function type FTy is valid for the library function F, regardless of whether the function is available.
Definition at line 344 of file TargetLibraryInfo.h.
References F.
Referenced by llvm::isLibFuncEmittable().
|
default |
|
inline |
Definition at line 321 of file TargetLibraryInfo.h.
|
inline |
Forces a function to be marked as unavailable.
Definition at line 382 of file TargetLibraryInfo.h.
References F, and llvm::BitVector::set().
Referenced by TargetLibraryInfo().
|
friend |
Definition at line 282 of file TargetLibraryInfo.h.
|
friend |
Definition at line 283 of file TargetLibraryInfo.h.