15#ifndef LLVM_ANALYSIS_LIBCALLLOWERINGINFO_H
16#define LLVM_ANALYSIS_LIBCALLLOWERINGINFO_H
32 RTLIB::LibcallImpl LibcallImpls[RTLIB::UNKNOWN_LIBCALL + 1] = {
61 return LibcallImpls[
Call];
66 LibcallImpls[
Call] = Impl;
72 return RTLCI.LibcallImplCallingConvs[LibcallImpls[
Call]];
77 return RTLCI.LibcallImplCallingConvs[
Call];
84 if (Memcpy == RTLIB::Unsupported) {
101 mutable LibcallLoweringMap LoweringMap;
116 operator bool()
const {
return RTLCI !=
nullptr; }
119 ModuleAnalysisManager::Invalidator &);
124 template <
typename KeyT>
128 return getLibcallLoweringForKey(
static_cast<const void *
>(
Key),
133 const LibcallLoweringInfo &getLibcallLoweringForKey(
136 auto It = LoweringMap.
find(
Key);
137 if (It != LoweringMap.
end())
This file defines the DenseMap class.
iterator find(const_arg_type_t< KeyT > Val)
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&...Args)
Tracks which library functions to use for a particular subtarget or function.
const RTLIB::RuntimeLibcallsInfo & getRuntimeLibcallsInfo() const
CallingConv::ID getLibcallImplCallingConv(RTLIB::LibcallImpl Call) const
Get the CallingConv that should be used for the specified libcall.
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const
function_ref< void(LibcallLoweringInfo &)> ApplyContextRulesFn
Callback applying the caller's context-specific (e.g.
RTLIB::LibcallImpl getLibcallImpl(RTLIB::Libcall Call) const
Return the lowering's selection of implementation call for Call.
LLVM_ABI LibcallLoweringInfo(const RTLIB::RuntimeLibcallsInfo &RTLCI, ApplyContextRulesFn ApplyContextRules={})
Construct the lowering info from the module-level RTLCI, seeding the default implementation for every...
void setLibcallImpl(RTLIB::Libcall Call, RTLIB::LibcallImpl Impl)
Remap the default libcall routine name for the specified libcall.
RTLIB::LibcallImpl getMemcpyImpl() const
Return a function impl compatible with RTLIB::MEMCPY, or RTLIB::Unsupported if fully unsupported.
ModuleLibcallLoweringInfo Result
LLVM_ABI Result run(Module &M, ModuleAnalysisManager &)
Records a mapping from an opaque lowering context to its LibcallLoweringInfo.
void init(const RTLIB::RuntimeLibcallsInfo *RT)
ModuleLibcallLoweringInfo()=default
const LibcallLoweringInfo & getLibcallLowering(const KeyT *Key, LibcallLoweringInfo::ApplyContextRulesFn ApplyContextRules={}) const
Return the LibcallLoweringInfo for the context identified by Key, creating it (via ApplyContextRules)...
ModuleLibcallLoweringInfo(RTLIB::RuntimeLibcallsInfo &RTLCI)
LLVM_ABI bool invalidate(Module &, const PreservedAnalyses &, ModuleAnalysisManager::Invalidator &)
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
constexpr const char * data() const
Get a pointer to the start of the string (which may not be null terminated).
An efficient, type-erasing, non-owning reference to a callable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
A simple container for information about the supported runtime calls.
static StringRef getLibcallImplName(RTLIB::LibcallImpl CallImpl)
Get the libcall routine name for the specified libcall implementation.