LLVM: include/llvm/IR/RuntimeLibcalls.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef LLVM_IR_RUNTIME_LIBCALLS_H
17#define LLVM_IR_RUNTIME_LIBCALLS_H
18
31
32
33
34
35
36#define GET_RUNTIME_LIBCALL_ENUM
37#include "llvm/IR/RuntimeLibcalls.inc"
38
39namespace llvm {
40
44
48
50
52
53
55 return enum_seq(static_castRTLIB::Libcall\(0), RTLIB::UNKNOWN_LIBCALL);
56}
57
59 return enum_seq(static_castRTLIB::LibcallImpl\(1),
60 static_castRTLIB::LibcallImpl\(RTLIB::NumLibcallImpls));
61}
62
63
65public:
68 const std::array<uint64_t, (RTLIB::NumLibcallImpls + 63) / 64> &Src)
70};
71
72
74private:
75
77
78public:
80
82
89
91
93 ModuleAnalysisManager::Invalidator &);
94
95
97 if (CallImpl == RTLIB::Unsupported)
99 return StringRef(RuntimeLibcallImplNameTable.getCString(
100 RuntimeLibcallNameOffsetTable[CallImpl]),
101 RuntimeLibcallNameSizeTable[CallImpl]);
102 }
103
104
105
107 LibcallImplCallingConvs[Call] = CC;
108 }
109
110
112 return LibcallImplCallingConvs[Call];
113 }
114
115
117 return ImplToLibcall[Impl];
118 }
119
121 return AvailableLibcallImpls.count();
122 }
123
125 return AvailableLibcallImpls.test(Impl);
126 }
127
129 AvailableLibcallImpls.set(Impl);
130 }
131
132
133
134
135
136
137
138
141
142
143#define GET_LOOKUP_LIBCALL_IMPL_NAME_BODY
144#include "llvm/IR/RuntimeLibcalls.inc"
145 }
146
147
148
153 return Impl;
154 }
155
156 return RTLIB::Unsupported;
157 }
158
159
160
161
162 std::pair<FunctionType *, AttributeList>
164 RTLIB::LibcallImpl LibcallImpl) const;
165
166
167
169
170private:
172 lookupLibcallImplNameImpl(StringRef Name);
173
175 "default calling conv should be encoded as 0");
176
177
178
179 CallingConv::ID LibcallImplCallingConvs[RTLIB::NumLibcallImpls] = {};
180
181
182
183 LLVM_ABI static const char RuntimeLibcallImplNameTableStorage[];
185 LLVM_ABI static const uint16_t RuntimeLibcallNameOffsetTable[];
186 LLVM_ABI static const uint8_t RuntimeLibcallNameSizeTable[];
187
188
189 LLVM_ABI static const RTLIB::Libcall ImplToLibcall[RTLIB::NumLibcallImpls];
190
191
192
193
195 libcallImplNameHit(uint16_t NameOffsetEntry, uint16_t StrOffset);
196
197 static bool darwinHasSinCosStret(const Triple &TT) {
198 if (!TT.isOSDarwin())
199 return false;
200
201
203 return false;
204
205 if (TT.isMacOSX())
206 return !TT.isMacOSXVersionLT(10, 9) && TT.isArch64Bit();
207
208 if (TT.isiOS())
209 return !TT.isOSVersionLT(7, 0);
210
211 return true;
212 }
213
214 static bool darwinHasMemsetPattern(const Triple &TT) {
215
216
217 if (TT.isMacOSX())
218 return !TT.isMacOSXVersionLT(10, 5);
219 if (TT.isiOS())
220 return !TT.isOSVersionLT(3, 0);
221 return TT.isWatchOS();
222 }
223
224 static bool hasAEABILibcalls(const Triple &TT) {
225 return TT.isTargetAEABI() || TT.isTargetGNUAEABI() ||
226 TT.isTargetMuslAEABI() || TT.isOSFuchsia() || TT.isAndroid();
227 }
228
230 static bool isAAPCS_ABI(const Triple &TT, StringRef ABIName);
231
232 static bool darwinHasExp10(const Triple &TT);
233
234
235 static bool hasSinCos(const Triple &TT) {
236 return TT.isGNUEnvironment() || TT.isOSFuchsia() || TT.isAndroid();
237 }
238
239 static bool hasSinCos_f32_f64(const Triple &TT) {
240 return hasSinCos(TT) || TT.isPS();
241 }
242
243
244 void setTargetRuntimeLibcallSets(const Triple &TT,
247 StringRef ABIName);
248
249
250
253 StringRef ABIName);
254};
255
256}
257
258}
259
260#endif
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Atomic ordering constants.
This header defines various interfaces for pass management in LLVM.
Provides some synthesis utilities to produce sequences of values.
constexpr Bitset(const std::array< uint64_t,(NumBits+63)/64 > &B)
A parsed version of the target data layout string in and methods for querying it.
This is an important class for using LLVM in a threaded context.
Tracks which library functions to use for a particular subtarget.
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.
Manage a bitset representing the list of available libcalls for a module.
Definition RuntimeLibcalls.h:64
constexpr LibcallImplBitset(const std::array< uint64_t,(RTLIB::NumLibcallImpls+63)/64 > &Src)
Definition RuntimeLibcalls.h:67
constexpr LibcallImplBitset()=default
StringRef - Represent a constant reference to a string, i.e.
A table of densely packed, null-terminated strings indexed by offset.
Triple - Helper class for working with autoconf configuration names.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
static auto libcall_impls()
Definition RuntimeLibcalls.h:58
static auto libcalls()
Definition RuntimeLibcalls.h:54
This is an optimization pass for GlobalISel generic memory operations.
auto enum_seq(EnumT Begin, EnumT End)
Iterate over an enum type from Begin up to - but not including - End.
@ None
No exception support.
VectorLibrary
List of known vector-functions libraries.
static LLVM_ABI iota_range< RTLIB::LibcallImpl > lookupLibcallImplName(StringRef Name)
Check if a function name is a recognized runtime call of any kind.
Definition RuntimeLibcalls.h:140
CallingConv::ID getLibcallImplCallingConv(RTLIB::LibcallImpl Call) const
Get the CallingConv that should be used for the specified libcall.
Definition RuntimeLibcalls.h:111
unsigned getNumAvailableLibcallImpls() const
Definition RuntimeLibcalls.h:120
bool isAvailable(RTLIB::LibcallImpl Impl) const
Definition RuntimeLibcalls.h:124
std::pair< FunctionType *, AttributeList > getFunctionTy(LLVMContext &Ctx, const Triple &TT, const DataLayout &DL, RTLIB::LibcallImpl LibcallImpl) const
void setAvailable(RTLIB::LibcallImpl Impl)
Definition RuntimeLibcalls.h:128
static bool hasVectorMaskArgument(RTLIB::LibcallImpl Impl)
Returns true if the function has a vector mask argument, which is assumed to be the last argument.
LLVM_ABI RTLIB::LibcallImpl getSupportedLibcallImpl(StringRef FuncName) const
Check if this is valid libcall for the current module, otherwise RTLIB::Unsupported.
Definition RuntimeLibcalls.h:150
RuntimeLibcallsInfo()=default
static StringRef getLibcallImplName(RTLIB::LibcallImpl CallImpl)
Get the libcall routine name for the specified libcall implementation.
Definition RuntimeLibcalls.h:96
void setLibcallImplCallingConv(RTLIB::LibcallImpl Call, CallingConv::ID CC)
Set the CallingConv that should be used for the specified libcall implementation.
Definition RuntimeLibcalls.h:106
static RTLIB::Libcall getLibcallFromImpl(RTLIB::LibcallImpl Impl)
Return the libcall provided by Impl.
Definition RuntimeLibcalls.h:116
bool invalidate(Module &M, const PreservedAnalyses &PA, ModuleAnalysisManager::Invalidator &)
static constexpr bool is_iterable
Definition RuntimeLibcalls.h:46
static constexpr bool is_iterable
Definition RuntimeLibcalls.h:42