LLVM: include/llvm/CodeGen/LibcallLoweringInfo.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_CODEGEN_LIBCALLLOWERINGINFO_H
10#define LLVM_CODEGEN_LIBCALLLOWERINGINFO_H
11
15
16namespace llvm {
17
20
21
23private:
25
26 RTLIB::LibcallImpl LibcallImpls[RTLIB::UNKNOWN_LIBCALL + 1] = {
27 RTLIB::Unsupported};
28
29public:
32
36
37
38
44
45
47 return LibcallImpls[Call];
48 }
49
50
52 LibcallImpls[Call] = Impl;
53 }
54
55
56
58 return RTLCI.LibcallImplCallingConvs[LibcallImpls[Call]];
59 }
60
61
64 return RTLCI.LibcallImplCallingConvs[Call];
65 }
66
67
68
70 RTLIB::LibcallImpl Memcpy = getLibcallImpl(RTLIB::MEMCPY);
71 if (Memcpy == RTLIB::Unsupported) {
72
74 }
75
76 return Memcpy;
77 }
78};
79
80
82private:
83 using LibcallLoweringMap =
85 mutable LibcallLoweringMap LoweringMap;
87
88public:
92
94
96 RTLCI = nullptr;
97 LoweringMap.clear();
98 }
99
101 ModuleAnalysisManager::Invalidator &);
102
105 return LoweringMap.try_emplace(&Subtarget, *RTLCI, Subtarget).first->second;
106 }
107};
108
111private:
114
116
117public:
119
121};
122
125
126public:
129
132 return Result.getLibcallLowering(Subtarget);
133 }
134
138
139 bool doInitialization(Module &M) override;
140 void getAnalysisUsage(AnalysisUsage &AU) const override;
141 void releaseMemory() override;
142};
143
144}
145
146#endif
This file defines the DenseMap class.
Represent the analysis usage information of a pass.
const LibcallLoweringInfo & getLibcallLowering(const TargetSubtargetInfo &Subtarget) const
Definition LibcallLoweringInfo.h:131
static char ID
Definition LibcallLoweringInfo.h:127
LibcallLoweringInfoWrapper()
const LibcallLoweringModuleAnalysisResult & getResult() const
Definition LibcallLoweringInfo.h:135
Tracks which library functions to use for a particular subtarget.
Definition LibcallLoweringInfo.h:22
const RTLIB::RuntimeLibcallsInfo & getRuntimeLibcallsInfo() const
Definition LibcallLoweringInfo.h:33
LLVM_ABI LibcallLoweringInfo(const RTLIB::RuntimeLibcallsInfo &RTLCI, const TargetSubtargetInfo &Subtarget)
LLVM_ABI void setLibcallImpl(RTLIB::Libcall Call, RTLIB::LibcallImpl Impl)
Rename the default libcall routine name for the specified libcall.
Definition LibcallLoweringInfo.h:51
LLVM_ABI CallingConv::ID getLibcallImplCallingConv(RTLIB::LibcallImpl Call) const
Get the CallingConv that should be used for the specified libcall.
Definition LibcallLoweringInfo.h:63
LLVM_ABI const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
Definition LibcallLoweringInfo.h:39
RTLIB::LibcallImpl getMemcpyImpl() const
Return a function impl compatible with RTLIB::MEMCPY, or RTLIB::Unsupported if fully unsupported.
Definition LibcallLoweringInfo.h:69
LLVM_ABI RTLIB::LibcallImpl getLibcallImpl(RTLIB::Libcall Call) const
Return the lowering's selection of implementation call for Call.
Definition LibcallLoweringInfo.h:46
LLVM_ABI CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const
Definition LibcallLoweringInfo.h:57
Record a mapping from subtarget to LibcallLoweringInfo.
Definition LibcallLoweringInfo.h:81
LibcallLoweringModuleAnalysisResult()=default
void init(const RTLIB::RuntimeLibcallsInfo *RT)
Definition LibcallLoweringInfo.h:93
void clear()
Definition LibcallLoweringInfo.h:95
const LibcallLoweringInfo & getLibcallLowering(const TargetSubtargetInfo &Subtarget) const
Definition LibcallLoweringInfo.h:104
LibcallLoweringModuleAnalysisResult(RTLIB::RuntimeLibcallsInfo &RTLCI)
Definition LibcallLoweringInfo.h:90
LLVM_ABI bool invalidate(Module &, const PreservedAnalyses &, ModuleAnalysisManager::Invalidator &)
LibcallLoweringModuleAnalysisResult Result
Definition LibcallLoweringInfo.h:118
LLVM_ABI Result run(Module &M, ModuleAnalysisManager &)
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
data - Get a pointer to the start of the string (which may not be null terminated).
Primary interface to the complete machine description for the target machine.
TargetSubtargetInfo - Generic base class for all target subtargets.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
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.