LLVM 24.0.0git
llvm::RTLIB::RuntimeLibcallsInfo Struct Reference

A simple container for information about the supported runtime calls. More...

#include "llvm/IR/RuntimeLibcalls.h"

Public Member Functions

 RuntimeLibcallsInfo ()=default
LLVM_ABI RuntimeLibcallsInfo (const Triple &TT, ExceptionHandling ExceptionModel=ExceptionHandling::Default, FloatABI::ABIType FloatABI=FloatABI::Default, std::optional< LongDoubleFormat > LDblFormat=std::nullopt, StringRef ABIName="", VectorLibrary VecLib=VectorLibrary::NoLibrary)
LLVM_ABI RuntimeLibcallsInfo (const Module &M, StringRef ABIName="", VectorLibrary VecLib=VectorLibrary::NoLibrary)
LLVM_ABI bool invalidate (Module &M, const PreservedAnalyses &PA, ModuleAnalysisManager::Invalidator &)
void setLibcallImplCallingConv (RTLIB::LibcallImpl Call, CallingConv::ID CC)
 Set the CallingConv that should be used for the specified libcall implementation.
CallingConv::ID getLibcallImplCallingConv (RTLIB::LibcallImpl Call) const
 Get the CallingConv that should be used for the specified libcall.
LLVM_ABI RTLIB::Libcall getLibcallFromImpl (RTLIB::LibcallImpl Impl) const
 Return the libcall provided by Impl.
unsigned getNumAvailableLibcallImpls () const
bool isAvailable (RTLIB::LibcallImpl Impl) const
void setAvailable (RTLIB::LibcallImpl Impl)
void setUnavailable (RTLIB::LibcallImpl Impl)
RTLIB::LibcallImpl getSupportedLibcallImpl (StringRef FuncName) const
 Check if this is valid libcall for the current module, otherwise RTLIB::Unsupported.
LLVM_ABI std::pair< FunctionType *, AttributeList > getDefaultFunctionTy (LLVMContext &Ctx, const Triple &TT, const DataLayout &DL, RTLIB::LibcallImpl LibcallImpl) const
 Get the C-type function signature of the Libcall if provided, and convert it to IR FunctionType and Attributes.
LLVM_ABI std::pair< FunctionType *, AttributeList > getFunctionTy (LLVMContext &Ctx, const Triple &TT, const DataLayout &DL, RTLIB::LibcallImpl LibcallImpl) const
LLVM_ABI Type * getVariableType (LLVMContext &Ctx, const Triple &TT, const DataLayout &DL, RTLIB::LibcallImpl LibcallImpl) const
LLVM_ABI FunctionCallee getOrInsertLibcallDecl (Module &M, RTLIB::LibcallImpl LibcallImpl) const
LLVM_ABI GlobalValue * getOrInsertImplGlobal (Module &M, RTLIB::LibcallImpl LibcallImpl) const

Static Public Member Functions

static StringRef getLibcallImplName (RTLIB::LibcallImpl CallImpl)
 Get the libcall routine name for the specified libcall implementation.
static LLVM_ABI RTLIB::Libcall getLibcallForIntrinsic (Intrinsic::ID ID, FunctionType *FTy)
 Return the runtime libcall that the floating-point math intrinsic ID may be lowered to, or RTLIB::UNKNOWN_LIBCALL if there is no such mapping.
static LLVM_ABI ArrayRef< RTLIB::RuntimeLibrary > getDefaultRuntimeLibraries (const Triple &TT)
 Return the runtime libraries enabled by default for TT.
static iota_range< RTLIB::LibcallImpl > lookupLibcallImplName (StringRef Name)
 Check if a function name is a recognized runtime call of any kind.
static unsigned getIntSize (const Triple &TT)
 Get size of a C-level int or unsigned int, in bits.
static LLVM_ABI void initExtensionsForTriple (bool &ShouldExtI32Param, bool &ShouldExtI32Return, bool &ShouldSignExtI32Param, bool &ShouldSignExtI32Return, const Triple &T)
 Determine the extension attributes needed for i32 parameters and returns corresponding to C-level int or unsigned int on T.
static LLVM_ABI void initBoolExtensionsForTriple (bool &ShouldZExtBoolParam, bool &ShouldZExtBoolReturn, const Triple &T)
 Determine whether bool parameters and returns need zeroext on T.
static bool isVariable (RTLIB::LibcallImpl LibcallImpl)
static bool isThreadLocalVariable (RTLIB::LibcallImpl LibcallImpl)
static LLVM_ABI RTLIB::Libcall getUnmaskedVectorLibcall (RTLIB::Libcall LC)
 Return the unmasked variant of the masked vector libcall LC, or RTLIB::UNKNOWN_LIBCALL if LC is not a masked vector libcall.
static LLVM_ABI RTLIB::Libcall getMaskedVectorLibcall (RTLIB::Libcall LC)
 Return the masked variant of the vector libcall LC, or RTLIB::UNKNOWN_LIBCALL if LC has no masked variant.
static bool hasVectorMaskArgument (RTLIB::LibcallImpl Impl)
 Returns true if the function has a vector mask argument, which is assumed to be the last argument.

Friends

class llvm::LibcallLoweringInfo

Detailed Description

A simple container for information about the supported runtime calls.

Definition at line 81 of file RuntimeLibcalls.h.

Constructor & Destructor Documentation

◆ RuntimeLibcallsInfo() [1/3]

llvm::RTLIB::RuntimeLibcallsInfo::RuntimeLibcallsInfo ( )
default

◆ RuntimeLibcallsInfo() [2/3]

RuntimeLibcallsInfo::RuntimeLibcallsInfo ( const Triple & TT,
ExceptionHandling ExceptionModel = ExceptionHandling::Default,
FloatABI::ABIType FloatABI = FloatABI::Default,
std::optional< LongDoubleFormat > LDblFormat = std::nullopt,
StringRef ABIName = "",
VectorLibrary VecLib = VectorLibrary::NoLibrary )
explicit

Definition at line 57 of file RuntimeLibcalls.cpp.

References llvm::Default, getVectorRuntimeLibrary(), and llvm::NoLibrary.

◆ RuntimeLibcallsInfo() [3/3]

RuntimeLibcallsInfo::RuntimeLibcallsInfo ( const Module & M,
StringRef ABIName = "",
VectorLibrary VecLib = VectorLibrary::NoLibrary )
explicit

Definition at line 77 of file RuntimeLibcalls.cpp.

References RuntimeLibcallsInfo().

Member Function Documentation

◆ getDefaultFunctionTy()

std::pair< FunctionType *, AttributeList > RuntimeLibcallsInfo::getDefaultFunctionTy ( LLVMContext & Ctx,
const Triple & TT,
const DataLayout & DL,
RTLIB::LibcallImpl LibcallImpl ) const

◆ getDefaultRuntimeLibraries()

LLVM_ABI ArrayRef< RTLIB::RuntimeLibrary > llvm::RTLIB::RuntimeLibcallsInfo::getDefaultRuntimeLibraries ( const Triple & TT)
static

Return the runtime libraries enabled by default for TT.

◆ getFunctionTy()

◆ getIntSize()

unsigned llvm::RTLIB::RuntimeLibcallsInfo::getIntSize ( const Triple & TT)
inlinestatic

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

Definition at line 190 of file RuntimeLibcalls.h.

Referenced by getIntSize().

◆ getLibcallForIntrinsic()

LLVM_ABI RTLIB::Libcall llvm::RTLIB::RuntimeLibcallsInfo::getLibcallForIntrinsic ( Intrinsic::ID ID,
FunctionType * FTy )
static

Return the runtime libcall that the floating-point math intrinsic ID may be lowered to, or RTLIB::UNKNOWN_LIBCALL if there is no such mapping.

FTy must be the intrinsic's call signature.

References LLVM_ABI.

◆ getLibcallFromImpl()

LLVM_ABI RTLIB::Libcall llvm::RTLIB::RuntimeLibcallsInfo::getLibcallFromImpl ( RTLIB::LibcallImpl Impl) const

Return the libcall provided by Impl.

References LLVM_ABI.

◆ getLibcallImplCallingConv()

CallingConv::ID llvm::RTLIB::RuntimeLibcallsInfo::getLibcallImplCallingConv ( RTLIB::LibcallImpl Call) const
inline

Get the CallingConv that should be used for the specified libcall.

Definition at line 128 of file RuntimeLibcalls.h.

References Call.

Referenced by getOrInsertLibcallDecl().

◆ getLibcallImplName()

◆ getMaskedVectorLibcall()

LLVM_ABI RTLIB::Libcall llvm::RTLIB::RuntimeLibcallsInfo::getMaskedVectorLibcall ( RTLIB::Libcall LC)
static

Return the masked variant of the vector libcall LC, or RTLIB::UNKNOWN_LIBCALL if LC has no masked variant.

References LLVM_ABI.

Referenced by llvm::LibcallLoweringInfo::getVectorLibcallImplOrMasked().

◆ getNumAvailableLibcallImpls()

unsigned llvm::RTLIB::RuntimeLibcallsInfo::getNumAvailableLibcallImpls ( ) const
inline

Definition at line 146 of file RuntimeLibcalls.h.

Referenced by llvm::lto::LTO::getRuntimeLibcallSymbols().

◆ getOrInsertImplGlobal()

GlobalValue * RuntimeLibcallsInfo::getOrInsertImplGlobal ( Module & M,
RTLIB::LibcallImpl LibcallImpl ) const
Returns
the global for the variable LibcallImpl in M. If M does not contain a global with its name, a global variable is inserted with the type and thread local mode of LibcallImpl.

Definition at line 527 of file RuntimeLibcalls.cpp.

References assert(), llvm::GlobalValue::ExternalLinkage, getLibcallImplName(), getVariableType(), llvm::GlobalValue::InitialExecTLSModel, isThreadLocalVariable(), isVariable(), and llvm::GlobalValue::NotThreadLocal.

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

◆ getOrInsertLibcallDecl()

FunctionCallee RuntimeLibcallsInfo::getOrInsertLibcallDecl ( Module & M,
RTLIB::LibcallImpl LibcallImpl ) const
Returns
the declaration of LibcallImpl in M. If M does not contain a global with its name, a function is inserted with the signature, attributes and calling convention of LibcallImpl. If the signature is unknown, the function is declared as void(...).

Definition at line 502 of file RuntimeLibcalls.cpp.

References assert(), llvm::Function::Create(), DL, llvm::GlobalValue::ExternalLinkage, F, llvm::FunctionType::get(), getFunctionTy(), getLibcallImplCallingConv(), getLibcallImplName(), llvm::Type::getVoidTy(), and isVariable().

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

◆ getSupportedLibcallImpl()

RTLIB::LibcallImpl llvm::RTLIB::RuntimeLibcallsInfo::getSupportedLibcallImpl ( StringRef FuncName) const
inline

Check if this is valid libcall for the current module, otherwise RTLIB::Unsupported.

Definition at line 179 of file RuntimeLibcalls.h.

References isAvailable(), and lookupLibcallImplName().

Referenced by llvm::lto::InputFile::Symbol::isLibcall().

◆ getUnmaskedVectorLibcall()

LLVM_ABI RTLIB::Libcall llvm::RTLIB::RuntimeLibcallsInfo::getUnmaskedVectorLibcall ( RTLIB::Libcall LC)
static

Return the unmasked variant of the masked vector libcall LC, or RTLIB::UNKNOWN_LIBCALL if LC is not a masked vector libcall.

References LLVM_ABI.

Referenced by hasVectorMaskArgument().

◆ getVariableType()

Type * RuntimeLibcallsInfo::getVariableType ( LLVMContext & Ctx,
const Triple & TT,
const DataLayout & DL,
RTLIB::LibcallImpl LibcallImpl ) const
Returns
the value type of LibcallImpl if it is a global variable rather than a function, or nullptr otherwise.

Definition at line 492 of file RuntimeLibcalls.cpp.

References convertToIRType(), and DL.

Referenced by getOrInsertImplGlobal().

◆ hasVectorMaskArgument()

bool llvm::RTLIB::RuntimeLibcallsInfo::hasVectorMaskArgument ( RTLIB::LibcallImpl Impl)
inlinestatic

Returns true if the function has a vector mask argument, which is assumed to be the last argument.

Definition at line 263 of file RuntimeLibcalls.h.

References getUnmaskedVectorLibcall().

Referenced by llvm::TargetLowering::expandMultipleResultFPLibCall().

◆ initBoolExtensionsForTriple()

void RuntimeLibcallsInfo::initBoolExtensionsForTriple ( bool & ShouldZExtBoolParam,
bool & ShouldZExtBoolReturn,
const Triple & T )
static

Determine whether bool parameters and returns need zeroext on T.

Definition at line 193 of file RuntimeLibcalls.cpp.

References shouldZExtBool(), and T.

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

◆ initExtensionsForTriple()

void RuntimeLibcallsInfo::initExtensionsForTriple ( bool & ShouldExtI32Param,
bool & ShouldExtI32Return,
bool & ShouldSignExtI32Param,
bool & ShouldSignExtI32Return,
const Triple & T )
static

Determine the extension attributes needed for i32 parameters and returns corresponding to C-level int or unsigned int on T.

Definition at line 179 of file RuntimeLibcalls.cpp.

References shouldExtI32(), shouldSignExtI32Param(), shouldSignExtI32Return(), and T.

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

◆ invalidate()

bool RTLIB::RuntimeLibcallsInfo::invalidate ( Module & M,
const PreservedAnalyses & PA,
ModuleAnalysisManager::Invalidator &  )

Definition at line 41 of file RuntimeLibcallInfo.cpp.

References llvm::PreservedAnalyses::getChecker().

◆ isAvailable()

bool llvm::RTLIB::RuntimeLibcallsInfo::isAvailable ( RTLIB::LibcallImpl Impl) const
inline

◆ isThreadLocalVariable()

bool llvm::RTLIB::RuntimeLibcallsInfo::isThreadLocalVariable ( RTLIB::LibcallImpl LibcallImpl)
inlinestatic
Returns
true if LibcallImpl is a thread local variable.

Definition at line 248 of file RuntimeLibcalls.h.

Referenced by getOrInsertImplGlobal().

◆ isVariable()

bool llvm::RTLIB::RuntimeLibcallsInfo::isVariable ( RTLIB::LibcallImpl LibcallImpl)
inlinestatic
Returns
true if LibcallImpl is a global variable rather than a function.

Definition at line 242 of file RuntimeLibcalls.h.

Referenced by getOrInsertImplGlobal(), getOrInsertLibcallDecl(), and llvm::DeclareRuntimeLibcallsPass::run().

◆ lookupLibcallImplName()

iota_range< RTLIB::LibcallImpl > llvm::RTLIB::RuntimeLibcallsInfo::lookupLibcallImplName ( StringRef Name)
inlinestatic

Check if a function name is a recognized runtime call of any kind.

This does not consider if this call is available for any current compilation, just that it is a known call somewhere. This returns the set of all LibcallImpls which match the name; multiple implementations with the same name may exist but differ in interpretation based on the target context.

Generated by tablegen.

Definition at line 170 of file RuntimeLibcalls.h.

Referenced by getSupportedLibcallImpl(), and isMips16HardFloatLibcall().

◆ setAvailable()

void llvm::RTLIB::RuntimeLibcallsInfo::setAvailable ( RTLIB::LibcallImpl Impl)
inline

Definition at line 154 of file RuntimeLibcalls.h.

◆ setLibcallImplCallingConv()

void llvm::RTLIB::RuntimeLibcallsInfo::setLibcallImplCallingConv ( RTLIB::LibcallImpl Call,
CallingConv::ID CC )
inline

Set the CallingConv that should be used for the specified libcall implementation.

Definition at line 123 of file RuntimeLibcalls.h.

References Call, and CC.

◆ setUnavailable()

void llvm::RTLIB::RuntimeLibcallsInfo::setUnavailable ( RTLIB::LibcallImpl Impl)
inline

Definition at line 158 of file RuntimeLibcalls.h.

◆ llvm::LibcallLoweringInfo

friend class llvm::LibcallLoweringInfo
friend

Definition at line 89 of file RuntimeLibcalls.h.


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