/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/lib/Analysis/TargetLibraryInfo.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | //===-- TargetLibraryInfo.cpp - Runtime library information ----------------==// |
2 | | // |
3 | | // The LLVM Compiler Infrastructure |
4 | | // |
5 | | // This file is distributed under the University of Illinois Open Source |
6 | | // License. See LICENSE.TXT for details. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | // |
10 | | // This file implements the TargetLibraryInfo class. |
11 | | // |
12 | | //===----------------------------------------------------------------------===// |
13 | | |
14 | | #include "llvm/Analysis/TargetLibraryInfo.h" |
15 | | #include "llvm/ADT/Triple.h" |
16 | | #include "llvm/IR/Constants.h" |
17 | | #include "llvm/Support/CommandLine.h" |
18 | | using namespace llvm; |
19 | | |
20 | | static cl::opt<TargetLibraryInfoImpl::VectorLibrary> ClVectorLibrary( |
21 | | "vector-library", cl::Hidden, cl::desc("Vector functions library"), |
22 | | cl::init(TargetLibraryInfoImpl::NoLibrary), |
23 | | cl::values(clEnumValN(TargetLibraryInfoImpl::NoLibrary, "none", |
24 | | "No vector functions library"), |
25 | | clEnumValN(TargetLibraryInfoImpl::Accelerate, "Accelerate", |
26 | | "Accelerate framework"), |
27 | | clEnumValN(TargetLibraryInfoImpl::SVML, "SVML", |
28 | | "Intel SVML library"))); |
29 | | |
30 | | StringRef const TargetLibraryInfoImpl::StandardNames[LibFunc::NumLibFuncs] = { |
31 | | #define TLI_DEFINE_STRING |
32 | | #include "llvm/Analysis/TargetLibraryInfo.def" |
33 | | }; |
34 | | |
35 | 64.5k | static bool hasSinCosPiStret(const Triple &T) { |
36 | 64.5k | // Only Darwin variants have _stret versions of combined trig functions. |
37 | 64.5k | if (!T.isOSDarwin()) |
38 | 26.6k | return false; |
39 | 37.9k | |
40 | 37.9k | // The ABI is rather complicated on x86, so don't do anything special there. |
41 | 37.9k | if (37.9k T.getArch() == Triple::x8637.9k ) |
42 | 1.93k | return false; |
43 | 35.9k | |
44 | 35.9k | if (35.9k T.isMacOSX() && 35.9k T.isMacOSXVersionLT(10, 9)7.21k ) |
45 | 3.82k | return false; |
46 | 32.1k | |
47 | 32.1k | if (32.1k T.isiOS() && 32.1k T.isOSVersionLT(7, 0)28.7k ) |
48 | 2.52k | return false; |
49 | 29.6k | |
50 | 29.6k | return true; |
51 | 29.6k | } |
52 | | |
53 | | /// initialize - Initialize the set of available library functions based on the |
54 | | /// specified target triple. This should be carefully written so that a missing |
55 | | /// target triple gets a sane set of defaults. |
56 | | static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, |
57 | 65.1k | ArrayRef<StringRef> StandardNames) { |
58 | 65.1k | // Verify that the StandardNames array is in alphabetical order. |
59 | 65.1k | assert(std::is_sorted(StandardNames.begin(), StandardNames.end(), |
60 | 65.1k | [](StringRef LHS, StringRef RHS) { |
61 | 65.1k | return LHS < RHS; |
62 | 65.1k | }) && |
63 | 65.1k | "TargetLibraryInfoImpl function names must be sorted"); |
64 | 65.1k | |
65 | 65.1k | bool ShouldExtI32Param = false, ShouldExtI32Return = false, |
66 | 65.1k | ShouldSignExtI32Param = false; |
67 | 65.1k | // PowerPC64, Sparc64, SystemZ need signext/zeroext on i32 parameters and |
68 | 65.1k | // returns corresponding to C-level ints and unsigned ints. |
69 | 65.1k | if (T.getArch() == Triple::ppc64 || 65.1k T.getArch() == Triple::ppc64le64.3k || |
70 | 65.1k | T.getArch() == Triple::sparcv963.7k || T.getArch() == Triple::systemz63.7k ) { |
71 | 2.27k | ShouldExtI32Param = true; |
72 | 2.27k | ShouldExtI32Return = true; |
73 | 2.27k | } |
74 | 65.1k | // Mips, on the other hand, needs signext on i32 parameters corresponding |
75 | 65.1k | // to both signed and unsigned ints. |
76 | 65.1k | if (T.getArch() == Triple::mips || 65.1k T.getArch() == Triple::mipsel65.0k || |
77 | 65.1k | T.getArch() == Triple::mips6464.9k || T.getArch() == Triple::mips64el64.8k ) { |
78 | 362 | ShouldSignExtI32Param = true; |
79 | 362 | } |
80 | 65.1k | TLI.setShouldExtI32Param(ShouldExtI32Param); |
81 | 65.1k | TLI.setShouldExtI32Return(ShouldExtI32Return); |
82 | 65.1k | TLI.setShouldSignExtI32Param(ShouldSignExtI32Param); |
83 | 65.1k | |
84 | 65.1k | if (T.getArch() == Triple::r600 || |
85 | 65.1k | T.getArch() == Triple::amdgcn65.1k ) { |
86 | 564 | TLI.setUnavailable(LibFunc_ldexp); |
87 | 564 | TLI.setUnavailable(LibFunc_ldexpf); |
88 | 564 | TLI.setUnavailable(LibFunc_ldexpl); |
89 | 564 | TLI.setUnavailable(LibFunc_exp10); |
90 | 564 | TLI.setUnavailable(LibFunc_exp10f); |
91 | 564 | TLI.setUnavailable(LibFunc_exp10l); |
92 | 564 | TLI.setUnavailable(LibFunc_log10); |
93 | 564 | TLI.setUnavailable(LibFunc_log10f); |
94 | 564 | TLI.setUnavailable(LibFunc_log10l); |
95 | 564 | } |
96 | 65.1k | |
97 | 65.1k | // There are no library implementations of mempcy and memset for AMD gpus and |
98 | 65.1k | // these can be difficult to lower in the backend. |
99 | 65.1k | if (T.getArch() == Triple::r600 || |
100 | 65.1k | T.getArch() == Triple::amdgcn65.1k ) { |
101 | 564 | TLI.setUnavailable(LibFunc_memcpy); |
102 | 564 | TLI.setUnavailable(LibFunc_memset); |
103 | 564 | TLI.setUnavailable(LibFunc_memset_pattern16); |
104 | 564 | return; |
105 | 564 | } |
106 | 64.5k | |
107 | 64.5k | // memset_pattern16 is only available on iOS 3.0 and Mac OS X 10.5 and later. |
108 | 64.5k | // All versions of watchOS support it. |
109 | 64.5k | if (64.5k T.isMacOSX()64.5k ) { |
110 | 8.75k | if (T.isMacOSXVersionLT(10, 5)) |
111 | 1.84k | TLI.setUnavailable(LibFunc_memset_pattern16); |
112 | 64.5k | } else if (55.8k T.isiOS()55.8k ) { |
113 | 29.1k | if (T.isOSVersionLT(3, 0)) |
114 | 417 | TLI.setUnavailable(LibFunc_memset_pattern16); |
115 | 55.8k | } else if (26.6k !T.isWatchOS()26.6k ) { |
116 | 26.6k | TLI.setUnavailable(LibFunc_memset_pattern16); |
117 | 26.6k | } |
118 | 64.5k | |
119 | 64.5k | if (!hasSinCosPiStret(T)64.5k ) { |
120 | 34.9k | TLI.setUnavailable(LibFunc_sinpi); |
121 | 34.9k | TLI.setUnavailable(LibFunc_sinpif); |
122 | 34.9k | TLI.setUnavailable(LibFunc_cospi); |
123 | 34.9k | TLI.setUnavailable(LibFunc_cospif); |
124 | 34.9k | TLI.setUnavailable(LibFunc_sincospi_stret); |
125 | 34.9k | TLI.setUnavailable(LibFunc_sincospif_stret); |
126 | 34.9k | } |
127 | 64.5k | |
128 | 64.5k | if (T.isMacOSX() && 64.5k T.getArch() == Triple::x868.75k && |
129 | 64.5k | !T.isMacOSXVersionLT(10, 7)1.53k ) { |
130 | 543 | // x86-32 OSX has a scheme where fwrite and fputs (and some other functions |
131 | 543 | // we don't care about) have two versions; on recent OSX, the one we want |
132 | 543 | // has a $UNIX2003 suffix. The two implementations are identical except |
133 | 543 | // for the return value in some edge cases. However, we don't want to |
134 | 543 | // generate code that depends on the old symbols. |
135 | 543 | TLI.setAvailableWithName(LibFunc_fwrite, "fwrite$UNIX2003"); |
136 | 543 | TLI.setAvailableWithName(LibFunc_fputs, "fputs$UNIX2003"); |
137 | 543 | } |
138 | 64.5k | |
139 | 64.5k | // iprintf and friends are only available on XCore and TCE. |
140 | 64.5k | if (T.getArch() != Triple::xcore && 64.5k T.getArch() != Triple::tce64.5k ) { |
141 | 64.5k | TLI.setUnavailable(LibFunc_iprintf); |
142 | 64.5k | TLI.setUnavailable(LibFunc_siprintf); |
143 | 64.5k | TLI.setUnavailable(LibFunc_fiprintf); |
144 | 64.5k | } |
145 | 64.5k | |
146 | 64.5k | if (T.isOSWindows() && 64.5k !T.isOSCygMing()1.20k ) { |
147 | 1.06k | // Win32 does not support long double |
148 | 1.06k | TLI.setUnavailable(LibFunc_acosl); |
149 | 1.06k | TLI.setUnavailable(LibFunc_asinl); |
150 | 1.06k | TLI.setUnavailable(LibFunc_atanl); |
151 | 1.06k | TLI.setUnavailable(LibFunc_atan2l); |
152 | 1.06k | TLI.setUnavailable(LibFunc_ceill); |
153 | 1.06k | TLI.setUnavailable(LibFunc_copysignl); |
154 | 1.06k | TLI.setUnavailable(LibFunc_cosl); |
155 | 1.06k | TLI.setUnavailable(LibFunc_coshl); |
156 | 1.06k | TLI.setUnavailable(LibFunc_expl); |
157 | 1.06k | TLI.setUnavailable(LibFunc_fabsf); // Win32 and Win64 both lack fabsf |
158 | 1.06k | TLI.setUnavailable(LibFunc_fabsl); |
159 | 1.06k | TLI.setUnavailable(LibFunc_floorl); |
160 | 1.06k | TLI.setUnavailable(LibFunc_fmaxl); |
161 | 1.06k | TLI.setUnavailable(LibFunc_fminl); |
162 | 1.06k | TLI.setUnavailable(LibFunc_fmodl); |
163 | 1.06k | TLI.setUnavailable(LibFunc_frexpl); |
164 | 1.06k | TLI.setUnavailable(LibFunc_ldexpf); |
165 | 1.06k | TLI.setUnavailable(LibFunc_ldexpl); |
166 | 1.06k | TLI.setUnavailable(LibFunc_logl); |
167 | 1.06k | TLI.setUnavailable(LibFunc_modfl); |
168 | 1.06k | TLI.setUnavailable(LibFunc_powl); |
169 | 1.06k | TLI.setUnavailable(LibFunc_sinl); |
170 | 1.06k | TLI.setUnavailable(LibFunc_sinhl); |
171 | 1.06k | TLI.setUnavailable(LibFunc_sqrtl); |
172 | 1.06k | TLI.setUnavailable(LibFunc_tanl); |
173 | 1.06k | TLI.setUnavailable(LibFunc_tanhl); |
174 | 1.06k | |
175 | 1.06k | // Win32 only has C89 math |
176 | 1.06k | TLI.setUnavailable(LibFunc_acosh); |
177 | 1.06k | TLI.setUnavailable(LibFunc_acoshf); |
178 | 1.06k | TLI.setUnavailable(LibFunc_acoshl); |
179 | 1.06k | TLI.setUnavailable(LibFunc_asinh); |
180 | 1.06k | TLI.setUnavailable(LibFunc_asinhf); |
181 | 1.06k | TLI.setUnavailable(LibFunc_asinhl); |
182 | 1.06k | TLI.setUnavailable(LibFunc_atanh); |
183 | 1.06k | TLI.setUnavailable(LibFunc_atanhf); |
184 | 1.06k | TLI.setUnavailable(LibFunc_atanhl); |
185 | 1.06k | TLI.setUnavailable(LibFunc_cbrt); |
186 | 1.06k | TLI.setUnavailable(LibFunc_cbrtf); |
187 | 1.06k | TLI.setUnavailable(LibFunc_cbrtl); |
188 | 1.06k | TLI.setUnavailable(LibFunc_exp2); |
189 | 1.06k | TLI.setUnavailable(LibFunc_exp2f); |
190 | 1.06k | TLI.setUnavailable(LibFunc_exp2l); |
191 | 1.06k | TLI.setUnavailable(LibFunc_expm1); |
192 | 1.06k | TLI.setUnavailable(LibFunc_expm1f); |
193 | 1.06k | TLI.setUnavailable(LibFunc_expm1l); |
194 | 1.06k | TLI.setUnavailable(LibFunc_log2); |
195 | 1.06k | TLI.setUnavailable(LibFunc_log2f); |
196 | 1.06k | TLI.setUnavailable(LibFunc_log2l); |
197 | 1.06k | TLI.setUnavailable(LibFunc_log1p); |
198 | 1.06k | TLI.setUnavailable(LibFunc_log1pf); |
199 | 1.06k | TLI.setUnavailable(LibFunc_log1pl); |
200 | 1.06k | TLI.setUnavailable(LibFunc_logb); |
201 | 1.06k | TLI.setUnavailable(LibFunc_logbf); |
202 | 1.06k | TLI.setUnavailable(LibFunc_logbl); |
203 | 1.06k | TLI.setUnavailable(LibFunc_nearbyint); |
204 | 1.06k | TLI.setUnavailable(LibFunc_nearbyintf); |
205 | 1.06k | TLI.setUnavailable(LibFunc_nearbyintl); |
206 | 1.06k | TLI.setUnavailable(LibFunc_rint); |
207 | 1.06k | TLI.setUnavailable(LibFunc_rintf); |
208 | 1.06k | TLI.setUnavailable(LibFunc_rintl); |
209 | 1.06k | TLI.setUnavailable(LibFunc_round); |
210 | 1.06k | TLI.setUnavailable(LibFunc_roundf); |
211 | 1.06k | TLI.setUnavailable(LibFunc_roundl); |
212 | 1.06k | TLI.setUnavailable(LibFunc_trunc); |
213 | 1.06k | TLI.setUnavailable(LibFunc_truncf); |
214 | 1.06k | TLI.setUnavailable(LibFunc_truncl); |
215 | 1.06k | |
216 | 1.06k | // Win32 provides some C99 math with mangled names |
217 | 1.06k | TLI.setAvailableWithName(LibFunc_copysign, "_copysign"); |
218 | 1.06k | |
219 | 1.06k | if (T.getArch() == Triple::x861.06k ) { |
220 | 446 | // Win32 on x86 implements single-precision math functions as macros |
221 | 446 | TLI.setUnavailable(LibFunc_acosf); |
222 | 446 | TLI.setUnavailable(LibFunc_asinf); |
223 | 446 | TLI.setUnavailable(LibFunc_atanf); |
224 | 446 | TLI.setUnavailable(LibFunc_atan2f); |
225 | 446 | TLI.setUnavailable(LibFunc_ceilf); |
226 | 446 | TLI.setUnavailable(LibFunc_copysignf); |
227 | 446 | TLI.setUnavailable(LibFunc_cosf); |
228 | 446 | TLI.setUnavailable(LibFunc_coshf); |
229 | 446 | TLI.setUnavailable(LibFunc_expf); |
230 | 446 | TLI.setUnavailable(LibFunc_floorf); |
231 | 446 | TLI.setUnavailable(LibFunc_fminf); |
232 | 446 | TLI.setUnavailable(LibFunc_fmaxf); |
233 | 446 | TLI.setUnavailable(LibFunc_fmodf); |
234 | 446 | TLI.setUnavailable(LibFunc_logf); |
235 | 446 | TLI.setUnavailable(LibFunc_log10f); |
236 | 446 | TLI.setUnavailable(LibFunc_modff); |
237 | 446 | TLI.setUnavailable(LibFunc_powf); |
238 | 446 | TLI.setUnavailable(LibFunc_sinf); |
239 | 446 | TLI.setUnavailable(LibFunc_sinhf); |
240 | 446 | TLI.setUnavailable(LibFunc_sqrtf); |
241 | 446 | TLI.setUnavailable(LibFunc_tanf); |
242 | 446 | TLI.setUnavailable(LibFunc_tanhf); |
243 | 446 | } |
244 | 1.06k | |
245 | 1.06k | // These definitions are due to math-finite.h header on Linux |
246 | 1.06k | TLI.setUnavailable(LibFunc_acos_finite); |
247 | 1.06k | TLI.setUnavailable(LibFunc_acosf_finite); |
248 | 1.06k | TLI.setUnavailable(LibFunc_acosl_finite); |
249 | 1.06k | TLI.setUnavailable(LibFunc_acosh_finite); |
250 | 1.06k | TLI.setUnavailable(LibFunc_acoshf_finite); |
251 | 1.06k | TLI.setUnavailable(LibFunc_acoshl_finite); |
252 | 1.06k | TLI.setUnavailable(LibFunc_asin_finite); |
253 | 1.06k | TLI.setUnavailable(LibFunc_asinf_finite); |
254 | 1.06k | TLI.setUnavailable(LibFunc_asinl_finite); |
255 | 1.06k | TLI.setUnavailable(LibFunc_atan2_finite); |
256 | 1.06k | TLI.setUnavailable(LibFunc_atan2f_finite); |
257 | 1.06k | TLI.setUnavailable(LibFunc_atan2l_finite); |
258 | 1.06k | TLI.setUnavailable(LibFunc_atanh_finite); |
259 | 1.06k | TLI.setUnavailable(LibFunc_atanhf_finite); |
260 | 1.06k | TLI.setUnavailable(LibFunc_atanhl_finite); |
261 | 1.06k | TLI.setUnavailable(LibFunc_cosh_finite); |
262 | 1.06k | TLI.setUnavailable(LibFunc_coshf_finite); |
263 | 1.06k | TLI.setUnavailable(LibFunc_coshl_finite); |
264 | 1.06k | TLI.setUnavailable(LibFunc_exp10_finite); |
265 | 1.06k | TLI.setUnavailable(LibFunc_exp10f_finite); |
266 | 1.06k | TLI.setUnavailable(LibFunc_exp10l_finite); |
267 | 1.06k | TLI.setUnavailable(LibFunc_exp2_finite); |
268 | 1.06k | TLI.setUnavailable(LibFunc_exp2f_finite); |
269 | 1.06k | TLI.setUnavailable(LibFunc_exp2l_finite); |
270 | 1.06k | TLI.setUnavailable(LibFunc_exp_finite); |
271 | 1.06k | TLI.setUnavailable(LibFunc_expf_finite); |
272 | 1.06k | TLI.setUnavailable(LibFunc_expl_finite); |
273 | 1.06k | TLI.setUnavailable(LibFunc_log10_finite); |
274 | 1.06k | TLI.setUnavailable(LibFunc_log10f_finite); |
275 | 1.06k | TLI.setUnavailable(LibFunc_log10l_finite); |
276 | 1.06k | TLI.setUnavailable(LibFunc_log2_finite); |
277 | 1.06k | TLI.setUnavailable(LibFunc_log2f_finite); |
278 | 1.06k | TLI.setUnavailable(LibFunc_log2l_finite); |
279 | 1.06k | TLI.setUnavailable(LibFunc_log_finite); |
280 | 1.06k | TLI.setUnavailable(LibFunc_logf_finite); |
281 | 1.06k | TLI.setUnavailable(LibFunc_logl_finite); |
282 | 1.06k | TLI.setUnavailable(LibFunc_pow_finite); |
283 | 1.06k | TLI.setUnavailable(LibFunc_powf_finite); |
284 | 1.06k | TLI.setUnavailable(LibFunc_powl_finite); |
285 | 1.06k | TLI.setUnavailable(LibFunc_sinh_finite); |
286 | 1.06k | TLI.setUnavailable(LibFunc_sinhf_finite); |
287 | 1.06k | TLI.setUnavailable(LibFunc_sinhl_finite); |
288 | 1.06k | |
289 | 1.06k | // Win32 does *not* provide provide these functions, but they are |
290 | 1.06k | // generally available on POSIX-compliant systems: |
291 | 1.06k | TLI.setUnavailable(LibFunc_access); |
292 | 1.06k | TLI.setUnavailable(LibFunc_bcmp); |
293 | 1.06k | TLI.setUnavailable(LibFunc_bcopy); |
294 | 1.06k | TLI.setUnavailable(LibFunc_bzero); |
295 | 1.06k | TLI.setUnavailable(LibFunc_chmod); |
296 | 1.06k | TLI.setUnavailable(LibFunc_chown); |
297 | 1.06k | TLI.setUnavailable(LibFunc_closedir); |
298 | 1.06k | TLI.setUnavailable(LibFunc_ctermid); |
299 | 1.06k | TLI.setUnavailable(LibFunc_fdopen); |
300 | 1.06k | TLI.setUnavailable(LibFunc_ffs); |
301 | 1.06k | TLI.setUnavailable(LibFunc_fileno); |
302 | 1.06k | TLI.setUnavailable(LibFunc_flockfile); |
303 | 1.06k | TLI.setUnavailable(LibFunc_fseeko); |
304 | 1.06k | TLI.setUnavailable(LibFunc_fstat); |
305 | 1.06k | TLI.setUnavailable(LibFunc_fstatvfs); |
306 | 1.06k | TLI.setUnavailable(LibFunc_ftello); |
307 | 1.06k | TLI.setUnavailable(LibFunc_ftrylockfile); |
308 | 1.06k | TLI.setUnavailable(LibFunc_funlockfile); |
309 | 1.06k | TLI.setUnavailable(LibFunc_getc_unlocked); |
310 | 1.06k | TLI.setUnavailable(LibFunc_getitimer); |
311 | 1.06k | TLI.setUnavailable(LibFunc_getlogin_r); |
312 | 1.06k | TLI.setUnavailable(LibFunc_getpwnam); |
313 | 1.06k | TLI.setUnavailable(LibFunc_gettimeofday); |
314 | 1.06k | TLI.setUnavailable(LibFunc_htonl); |
315 | 1.06k | TLI.setUnavailable(LibFunc_htons); |
316 | 1.06k | TLI.setUnavailable(LibFunc_lchown); |
317 | 1.06k | TLI.setUnavailable(LibFunc_lstat); |
318 | 1.06k | TLI.setUnavailable(LibFunc_memccpy); |
319 | 1.06k | TLI.setUnavailable(LibFunc_mkdir); |
320 | 1.06k | TLI.setUnavailable(LibFunc_ntohl); |
321 | 1.06k | TLI.setUnavailable(LibFunc_ntohs); |
322 | 1.06k | TLI.setUnavailable(LibFunc_open); |
323 | 1.06k | TLI.setUnavailable(LibFunc_opendir); |
324 | 1.06k | TLI.setUnavailable(LibFunc_pclose); |
325 | 1.06k | TLI.setUnavailable(LibFunc_popen); |
326 | 1.06k | TLI.setUnavailable(LibFunc_pread); |
327 | 1.06k | TLI.setUnavailable(LibFunc_pwrite); |
328 | 1.06k | TLI.setUnavailable(LibFunc_read); |
329 | 1.06k | TLI.setUnavailable(LibFunc_readlink); |
330 | 1.06k | TLI.setUnavailable(LibFunc_realpath); |
331 | 1.06k | TLI.setUnavailable(LibFunc_rmdir); |
332 | 1.06k | TLI.setUnavailable(LibFunc_setitimer); |
333 | 1.06k | TLI.setUnavailable(LibFunc_stat); |
334 | 1.06k | TLI.setUnavailable(LibFunc_statvfs); |
335 | 1.06k | TLI.setUnavailable(LibFunc_stpcpy); |
336 | 1.06k | TLI.setUnavailable(LibFunc_stpncpy); |
337 | 1.06k | TLI.setUnavailable(LibFunc_strcasecmp); |
338 | 1.06k | TLI.setUnavailable(LibFunc_strncasecmp); |
339 | 1.06k | TLI.setUnavailable(LibFunc_times); |
340 | 1.06k | TLI.setUnavailable(LibFunc_uname); |
341 | 1.06k | TLI.setUnavailable(LibFunc_unlink); |
342 | 1.06k | TLI.setUnavailable(LibFunc_unsetenv); |
343 | 1.06k | TLI.setUnavailable(LibFunc_utime); |
344 | 1.06k | TLI.setUnavailable(LibFunc_utimes); |
345 | 1.06k | TLI.setUnavailable(LibFunc_write); |
346 | 1.06k | |
347 | 1.06k | // Win32 does *not* provide provide these functions, but they are |
348 | 1.06k | // specified by C99: |
349 | 1.06k | TLI.setUnavailable(LibFunc_atoll); |
350 | 1.06k | TLI.setUnavailable(LibFunc_frexpf); |
351 | 1.06k | TLI.setUnavailable(LibFunc_llabs); |
352 | 1.06k | } |
353 | 64.5k | |
354 | 64.5k | switch (T.getOS()) { |
355 | 4.49k | case Triple::MacOSX: |
356 | 4.49k | // exp10 and exp10f are not available on OS X until 10.9 and iOS until 7.0 |
357 | 4.49k | // and their names are __exp10 and __exp10f. exp10l is not available on |
358 | 4.49k | // OS X or iOS. |
359 | 4.49k | TLI.setUnavailable(LibFunc_exp10l); |
360 | 4.49k | if (T.isMacOSXVersionLT(10, 9)4.49k ) { |
361 | 1.96k | TLI.setUnavailable(LibFunc_exp10); |
362 | 1.96k | TLI.setUnavailable(LibFunc_exp10f); |
363 | 4.49k | } else { |
364 | 2.53k | TLI.setAvailableWithName(LibFunc_exp10, "__exp10"); |
365 | 2.53k | TLI.setAvailableWithName(LibFunc_exp10f, "__exp10f"); |
366 | 2.53k | } |
367 | 4.49k | break; |
368 | 29.1k | case Triple::IOS: |
369 | 29.1k | case Triple::TvOS: |
370 | 29.1k | case Triple::WatchOS: |
371 | 29.1k | TLI.setUnavailable(LibFunc_exp10l); |
372 | 29.1k | if (!T.isWatchOS() && 29.1k (T.isOSVersionLT(7, 0) || |
373 | 26.4k | (T.isOSVersionLT(9, 0) && |
374 | 1.41k | (T.getArch() == Triple::x86 || |
375 | 29.1k | T.getArch() == Triple::x86_641.20k )))) { |
376 | 3.12k | TLI.setUnavailable(LibFunc_exp10); |
377 | 3.12k | TLI.setUnavailable(LibFunc_exp10f); |
378 | 29.1k | } else { |
379 | 26.0k | TLI.setAvailableWithName(LibFunc_exp10, "__exp10"); |
380 | 26.0k | TLI.setAvailableWithName(LibFunc_exp10f, "__exp10f"); |
381 | 26.0k | } |
382 | 29.1k | break; |
383 | 6.98k | case Triple::Linux: |
384 | 6.98k | // exp10, exp10f, exp10l is available on Linux (GLIBC) but are extremely |
385 | 6.98k | // buggy prior to glibc version 2.18. Until this version is widely deployed |
386 | 6.98k | // or we have a reasonable detection strategy, we cannot use exp10 reliably |
387 | 6.98k | // on Linux. |
388 | 6.98k | // |
389 | 6.98k | // Fall through to disable all of them. |
390 | 6.98k | LLVM_FALLTHROUGH; |
391 | 30.9k | default: |
392 | 30.9k | TLI.setUnavailable(LibFunc_exp10); |
393 | 30.9k | TLI.setUnavailable(LibFunc_exp10f); |
394 | 30.9k | TLI.setUnavailable(LibFunc_exp10l); |
395 | 64.5k | } |
396 | 64.5k | |
397 | 64.5k | // ffsl is available on at least Darwin, Mac OS X, iOS, FreeBSD, and |
398 | 64.5k | // Linux (GLIBC): |
399 | 64.5k | // http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/ffsl.3.html |
400 | 64.5k | // http://svn.freebsd.org/base/head/lib/libc/string/ffsl.c |
401 | 64.5k | // http://www.gnu.org/software/gnulib/manual/html_node/ffsl.html |
402 | 64.5k | switch (T.getOS()) { |
403 | 44.9k | case Triple::Darwin: |
404 | 44.9k | case Triple::MacOSX: |
405 | 44.9k | case Triple::IOS: |
406 | 44.9k | case Triple::TvOS: |
407 | 44.9k | case Triple::WatchOS: |
408 | 44.9k | case Triple::FreeBSD: |
409 | 44.9k | case Triple::Linux: |
410 | 44.9k | break; |
411 | 19.5k | default: |
412 | 19.5k | TLI.setUnavailable(LibFunc_ffsl); |
413 | 64.5k | } |
414 | 64.5k | |
415 | 64.5k | // ffsll is available on at least FreeBSD and Linux (GLIBC): |
416 | 64.5k | // http://svn.freebsd.org/base/head/lib/libc/string/ffsll.c |
417 | 64.5k | // http://www.gnu.org/software/gnulib/manual/html_node/ffsll.html |
418 | 64.5k | switch (T.getOS()) { |
419 | 44.9k | case Triple::Darwin: |
420 | 44.9k | case Triple::MacOSX: |
421 | 44.9k | case Triple::IOS: |
422 | 44.9k | case Triple::TvOS: |
423 | 44.9k | case Triple::WatchOS: |
424 | 44.9k | case Triple::FreeBSD: |
425 | 44.9k | case Triple::Linux: |
426 | 44.9k | break; |
427 | 19.5k | default: |
428 | 19.5k | TLI.setUnavailable(LibFunc_ffsll); |
429 | 64.5k | } |
430 | 64.5k | |
431 | 64.5k | // The following functions are available on at least FreeBSD: |
432 | 64.5k | // http://svn.freebsd.org/base/head/lib/libc/string/fls.c |
433 | 64.5k | // http://svn.freebsd.org/base/head/lib/libc/string/flsl.c |
434 | 64.5k | // http://svn.freebsd.org/base/head/lib/libc/string/flsll.c |
435 | 64.5k | if (64.5k !T.isOSFreeBSD()64.5k ) { |
436 | 64.5k | TLI.setUnavailable(LibFunc_fls); |
437 | 64.5k | TLI.setUnavailable(LibFunc_flsl); |
438 | 64.5k | TLI.setUnavailable(LibFunc_flsll); |
439 | 64.5k | } |
440 | 64.5k | |
441 | 64.5k | // The following functions are available on at least Linux: |
442 | 64.5k | if (!T.isOSLinux()64.5k ) { |
443 | 57.5k | TLI.setUnavailable(LibFunc_dunder_strdup); |
444 | 57.5k | TLI.setUnavailable(LibFunc_dunder_strtok_r); |
445 | 57.5k | TLI.setUnavailable(LibFunc_dunder_isoc99_scanf); |
446 | 57.5k | TLI.setUnavailable(LibFunc_dunder_isoc99_sscanf); |
447 | 57.5k | TLI.setUnavailable(LibFunc_under_IO_getc); |
448 | 57.5k | TLI.setUnavailable(LibFunc_under_IO_putc); |
449 | 57.5k | TLI.setUnavailable(LibFunc_memalign); |
450 | 57.5k | TLI.setUnavailable(LibFunc_fopen64); |
451 | 57.5k | TLI.setUnavailable(LibFunc_fseeko64); |
452 | 57.5k | TLI.setUnavailable(LibFunc_fstat64); |
453 | 57.5k | TLI.setUnavailable(LibFunc_fstatvfs64); |
454 | 57.5k | TLI.setUnavailable(LibFunc_ftello64); |
455 | 57.5k | TLI.setUnavailable(LibFunc_lstat64); |
456 | 57.5k | TLI.setUnavailable(LibFunc_open64); |
457 | 57.5k | TLI.setUnavailable(LibFunc_stat64); |
458 | 57.5k | TLI.setUnavailable(LibFunc_statvfs64); |
459 | 57.5k | TLI.setUnavailable(LibFunc_tmpfile64); |
460 | 57.5k | } |
461 | 64.5k | |
462 | 64.5k | // As currently implemented in clang, NVPTX code has no standard library to |
463 | 64.5k | // speak of. Headers provide a standard-ish library implementation, but many |
464 | 64.5k | // of the signatures are wrong -- for example, many libm functions are not |
465 | 64.5k | // extern "C". |
466 | 64.5k | // |
467 | 64.5k | // libdevice, an IR library provided by nvidia, is linked in by the front-end, |
468 | 64.5k | // but only used functions are provided to llvm. Moreover, most of the |
469 | 64.5k | // functions in libdevice don't map precisely to standard library functions. |
470 | 64.5k | // |
471 | 64.5k | // FIXME: Having no standard library prevents e.g. many fastmath |
472 | 64.5k | // optimizations, so this situation should be fixed. |
473 | 64.5k | if (T.isNVPTX()64.5k ) { |
474 | 177 | TLI.disableAllFunctions(); |
475 | 177 | TLI.setAvailable(LibFunc_nvvm_reflect); |
476 | 64.5k | } else { |
477 | 64.4k | TLI.setUnavailable(LibFunc_nvvm_reflect); |
478 | 64.4k | } |
479 | 65.1k | |
480 | 65.1k | TLI.addVectorizableFunctionsFromVecLib(ClVectorLibrary); |
481 | 65.1k | } |
482 | | |
483 | 1.45k | TargetLibraryInfoImpl::TargetLibraryInfoImpl() { |
484 | 1.45k | // Default to everything being available. |
485 | 1.45k | memset(AvailableArray, -1, sizeof(AvailableArray)); |
486 | 1.45k | |
487 | 1.45k | initialize(*this, Triple(), StandardNames); |
488 | 1.45k | } |
489 | | |
490 | 63.6k | TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T) { |
491 | 63.6k | // Default to everything being available. |
492 | 63.6k | memset(AvailableArray, -1, sizeof(AvailableArray)); |
493 | 63.6k | |
494 | 63.6k | initialize(*this, T, StandardNames); |
495 | 63.6k | } |
496 | | |
497 | | TargetLibraryInfoImpl::TargetLibraryInfoImpl(const TargetLibraryInfoImpl &TLI) |
498 | | : CustomNames(TLI.CustomNames), ShouldExtI32Param(TLI.ShouldExtI32Param), |
499 | | ShouldExtI32Return(TLI.ShouldExtI32Return), |
500 | 84.7k | ShouldSignExtI32Param(TLI.ShouldSignExtI32Param) { |
501 | 84.7k | memcpy(AvailableArray, TLI.AvailableArray, sizeof(AvailableArray)); |
502 | 84.7k | VectorDescs = TLI.VectorDescs; |
503 | 84.7k | ScalarDescs = TLI.ScalarDescs; |
504 | 84.7k | } |
505 | | |
506 | | TargetLibraryInfoImpl::TargetLibraryInfoImpl(TargetLibraryInfoImpl &&TLI) |
507 | | : CustomNames(std::move(TLI.CustomNames)), |
508 | | ShouldExtI32Param(TLI.ShouldExtI32Param), |
509 | | ShouldExtI32Return(TLI.ShouldExtI32Return), |
510 | 108 | ShouldSignExtI32Param(TLI.ShouldSignExtI32Param) { |
511 | 108 | std::move(std::begin(TLI.AvailableArray), std::end(TLI.AvailableArray), |
512 | 108 | AvailableArray); |
513 | 108 | VectorDescs = TLI.VectorDescs; |
514 | 108 | ScalarDescs = TLI.ScalarDescs; |
515 | 108 | } |
516 | | |
517 | 0 | TargetLibraryInfoImpl &TargetLibraryInfoImpl::operator=(const TargetLibraryInfoImpl &TLI) { |
518 | 0 | CustomNames = TLI.CustomNames; |
519 | 0 | ShouldExtI32Param = TLI.ShouldExtI32Param; |
520 | 0 | ShouldExtI32Return = TLI.ShouldExtI32Return; |
521 | 0 | ShouldSignExtI32Param = TLI.ShouldSignExtI32Param; |
522 | 0 | memcpy(AvailableArray, TLI.AvailableArray, sizeof(AvailableArray)); |
523 | 0 | return *this; |
524 | 0 | } |
525 | | |
526 | 0 | TargetLibraryInfoImpl &TargetLibraryInfoImpl::operator=(TargetLibraryInfoImpl &&TLI) { |
527 | 0 | CustomNames = std::move(TLI.CustomNames); |
528 | 0 | ShouldExtI32Param = TLI.ShouldExtI32Param; |
529 | 0 | ShouldExtI32Return = TLI.ShouldExtI32Return; |
530 | 0 | ShouldSignExtI32Param = TLI.ShouldSignExtI32Param; |
531 | 0 | std::move(std::begin(TLI.AvailableArray), std::end(TLI.AvailableArray), |
532 | 0 | AvailableArray); |
533 | 0 | return *this; |
534 | 0 | } |
535 | | |
536 | 100M | static StringRef sanitizeFunctionName(StringRef funcName) { |
537 | 100M | // Filter out empty names and names containing null bytes, those can't be in |
538 | 100M | // our table. |
539 | 100M | if (funcName.empty() || 100M funcName.find('\0') != StringRef::npos100M ) |
540 | 38 | return StringRef(); |
541 | 100M | |
542 | 100M | // Check for \01 prefix that is used to mangle __asm declarations and |
543 | 100M | // strip it if present. |
544 | 100M | return GlobalValue::dropLLVMManglingEscape(funcName); |
545 | 100M | } |
546 | | |
547 | | bool TargetLibraryInfoImpl::getLibFunc(StringRef funcName, |
548 | 100M | LibFunc &F) const { |
549 | 100M | StringRef const *Start = &StandardNames[0]; |
550 | 100M | StringRef const *End = &StandardNames[NumLibFuncs]; |
551 | 100M | |
552 | 100M | funcName = sanitizeFunctionName(funcName); |
553 | 100M | if (funcName.empty()) |
554 | 38 | return false; |
555 | 100M | |
556 | 100M | StringRef const *I = std::lower_bound( |
557 | 891M | Start, End, funcName, [](StringRef LHS, StringRef RHS) { |
558 | 891M | return LHS < RHS; |
559 | 891M | }); |
560 | 100M | if (I != End && 100M *I == funcName100M ) { |
561 | 24.6M | F = (LibFunc)(I - Start); |
562 | 24.6M | return true; |
563 | 24.6M | } |
564 | 76.1M | return false; |
565 | 76.1M | } |
566 | | |
567 | | bool TargetLibraryInfoImpl::isValidProtoForLibFunc(const FunctionType &FTy, |
568 | | LibFunc F, |
569 | 9.32M | const DataLayout *DL) const { |
570 | 9.32M | LLVMContext &Ctx = FTy.getContext(); |
571 | 9.32M | Type *PCharTy = Type::getInt8PtrTy(Ctx); |
572 | 9.32M | Type *SizeTTy = DL ? DL->getIntPtrType(Ctx, /*AS=*/0)9.32M : nullptr0 ; |
573 | 996k | auto IsSizeTTy = [SizeTTy](Type *Ty) { |
574 | 996k | return SizeTTy ? Ty == SizeTTy996k : Ty->isIntegerTy()0 ; |
575 | 996k | }; |
576 | 9.32M | unsigned NumParams = FTy.getNumParams(); |
577 | 9.32M | |
578 | 9.32M | switch (F) { |
579 | 264k | case LibFunc_strlen: |
580 | 264k | return (NumParams == 1 && FTy.getParamType(0)->isPointerTy() && |
581 | 264k | FTy.getReturnType()->isIntegerTy()); |
582 | 9.32M | |
583 | 27.4k | case LibFunc_strchr: |
584 | 27.4k | case LibFunc_strrchr: |
585 | 27.4k | return (NumParams == 2 && FTy.getReturnType()->isPointerTy() && |
586 | 27.4k | FTy.getParamType(0) == FTy.getReturnType() && |
587 | 27.4k | FTy.getParamType(1)->isIntegerTy()); |
588 | 27.4k | |
589 | 2.19k | case LibFunc_strtol: |
590 | 2.19k | case LibFunc_strtod: |
591 | 2.19k | case LibFunc_strtof: |
592 | 2.19k | case LibFunc_strtoul: |
593 | 2.19k | case LibFunc_strtoll: |
594 | 2.19k | case LibFunc_strtold: |
595 | 2.19k | case LibFunc_strtoull: |
596 | 2.07k | return ((NumParams == 2 || NumParams == 3) && |
597 | 2.17k | FTy.getParamType(0)->isPointerTy() && |
598 | 2.17k | FTy.getParamType(1)->isPointerTy()); |
599 | 5.86k | case LibFunc_strcat: |
600 | 5.85k | return (NumParams == 2 && FTy.getReturnType()->isPointerTy() && |
601 | 5.85k | FTy.getParamType(0) == FTy.getReturnType() && |
602 | 5.86k | FTy.getParamType(1) == FTy.getReturnType()); |
603 | 2.19k | |
604 | 48 | case LibFunc_strncat: |
605 | 45 | return (NumParams == 3 && FTy.getReturnType()->isPointerTy() && |
606 | 45 | FTy.getParamType(0) == FTy.getReturnType() && |
607 | 41 | FTy.getParamType(1) == FTy.getReturnType() && |
608 | 48 | FTy.getParamType(2)->isIntegerTy()); |
609 | 2.19k | |
610 | 64.8k | case LibFunc_strcpy_chk: |
611 | 64.8k | case LibFunc_stpcpy_chk: |
612 | 64.8k | --NumParams; |
613 | 64.8k | if (!IsSizeTTy(FTy.getParamType(NumParams))) |
614 | 2 | return false; |
615 | 64.8k | LLVM_FALLTHROUGH64.8k ; |
616 | 89.2k | case LibFunc_strcpy: |
617 | 89.2k | case LibFunc_stpcpy: |
618 | 89.2k | return (NumParams == 2 && FTy.getReturnType() == FTy.getParamType(0) && |
619 | 89.2k | FTy.getParamType(0) == FTy.getParamType(1) && |
620 | 89.2k | FTy.getParamType(0) == PCharTy); |
621 | 89.2k | |
622 | 19.3k | case LibFunc_strncpy_chk: |
623 | 19.3k | case LibFunc_stpncpy_chk: |
624 | 19.3k | --NumParams; |
625 | 19.3k | if (!IsSizeTTy(FTy.getParamType(NumParams))) |
626 | 2 | return false; |
627 | 19.3k | LLVM_FALLTHROUGH19.3k ; |
628 | 28.4k | case LibFunc_strncpy: |
629 | 28.4k | case LibFunc_stpncpy: |
630 | 28.4k | return (NumParams == 3 && FTy.getReturnType() == FTy.getParamType(0) && |
631 | 28.4k | FTy.getParamType(0) == FTy.getParamType(1) && |
632 | 28.4k | FTy.getParamType(0) == PCharTy && |
633 | 28.4k | FTy.getParamType(2)->isIntegerTy()); |
634 | 28.4k | |
635 | 9 | case LibFunc_strxfrm: |
636 | 6 | return (NumParams == 3 && FTy.getParamType(0)->isPointerTy() && |
637 | 9 | FTy.getParamType(1)->isPointerTy()); |
638 | 28.4k | |
639 | 611k | case LibFunc_strcmp: |
640 | 611k | return (NumParams == 2 && FTy.getReturnType()->isIntegerTy(32) && |
641 | 611k | FTy.getParamType(0)->isPointerTy() && |
642 | 611k | FTy.getParamType(0) == FTy.getParamType(1)); |
643 | 28.4k | |
644 | 48.3k | case LibFunc_strncmp: |
645 | 48.3k | return (NumParams == 3 && FTy.getReturnType()->isIntegerTy(32) && |
646 | 48.3k | FTy.getParamType(0)->isPointerTy() && |
647 | 48.3k | FTy.getParamType(0) == FTy.getParamType(1) && |
648 | 48.3k | FTy.getParamType(2)->isIntegerTy()); |
649 | 28.4k | |
650 | 1.16k | case LibFunc_strspn: |
651 | 1.16k | case LibFunc_strcspn: |
652 | 1.16k | return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() && |
653 | 1.16k | FTy.getParamType(0) == FTy.getParamType(1) && |
654 | 1.16k | FTy.getReturnType()->isIntegerTy()); |
655 | 1.16k | |
656 | 13.6k | case LibFunc_strcoll: |
657 | 13.6k | case LibFunc_strcasecmp: |
658 | 13.6k | case LibFunc_strncasecmp: |
659 | 13.6k | return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() && |
660 | 13.6k | FTy.getParamType(1)->isPointerTy()); |
661 | 13.6k | |
662 | 7.00k | case LibFunc_strstr: |
663 | 7.00k | return (NumParams == 2 && FTy.getReturnType()->isPointerTy() && |
664 | 7.00k | FTy.getParamType(0)->isPointerTy() && |
665 | 7.00k | FTy.getParamType(1)->isPointerTy()); |
666 | 13.6k | |
667 | 412 | case LibFunc_strpbrk: |
668 | 409 | return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() && |
669 | 409 | FTy.getReturnType() == FTy.getParamType(0) && |
670 | 412 | FTy.getParamType(0) == FTy.getParamType(1)); |
671 | 13.6k | |
672 | 2.32k | case LibFunc_strtok: |
673 | 2.32k | case LibFunc_strtok_r: |
674 | 2.32k | return (NumParams >= 2 && FTy.getParamType(1)->isPointerTy()); |
675 | 5.72k | case LibFunc_scanf: |
676 | 5.72k | case LibFunc_setbuf: |
677 | 5.72k | case LibFunc_setvbuf: |
678 | 5.71k | return (NumParams >= 1 && FTy.getParamType(0)->isPointerTy()); |
679 | 663 | case LibFunc_strdup: |
680 | 663 | case LibFunc_strndup: |
681 | 657 | return (NumParams >= 1 && FTy.getReturnType()->isPointerTy() && |
682 | 657 | FTy.getParamType(0)->isPointerTy()); |
683 | 40.6k | case LibFunc_sscanf: |
684 | 40.6k | case LibFunc_stat: |
685 | 40.6k | case LibFunc_statvfs: |
686 | 40.6k | case LibFunc_siprintf: |
687 | 40.6k | case LibFunc_sprintf: |
688 | 40.6k | return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() && |
689 | 40.6k | FTy.getParamType(1)->isPointerTy()); |
690 | 369 | case LibFunc_snprintf: |
691 | 366 | return (NumParams == 3 && FTy.getParamType(0)->isPointerTy() && |
692 | 369 | FTy.getParamType(2)->isPointerTy()); |
693 | 9 | case LibFunc_setitimer: |
694 | 6 | return (NumParams == 3 && FTy.getParamType(1)->isPointerTy() && |
695 | 9 | FTy.getParamType(2)->isPointerTy()); |
696 | 9 | case LibFunc_system: |
697 | 9 | return (NumParams == 1 && FTy.getParamType(0)->isPointerTy()); |
698 | 53.7k | case LibFunc_malloc: |
699 | 53.7k | return (NumParams == 1 && FTy.getReturnType()->isPointerTy()); |
700 | 33.3k | case LibFunc_memcmp: |
701 | 33.3k | return (NumParams == 3 && FTy.getReturnType()->isIntegerTy(32) && |
702 | 33.3k | FTy.getParamType(0)->isPointerTy() && |
703 | 33.3k | FTy.getParamType(1)->isPointerTy()); |
704 | 40.6k | |
705 | 4.10k | case LibFunc_memchr: |
706 | 4.10k | case LibFunc_memrchr: |
707 | 4.09k | return (NumParams == 3 && FTy.getReturnType()->isPointerTy() && |
708 | 4.09k | FTy.getReturnType() == FTy.getParamType(0) && |
709 | 4.09k | FTy.getParamType(1)->isIntegerTy(32) && |
710 | 4.09k | IsSizeTTy(FTy.getParamType(2))); |
711 | 193 | case LibFunc_modf: |
712 | 193 | case LibFunc_modff: |
713 | 193 | case LibFunc_modfl: |
714 | 184 | return (NumParams >= 2 && FTy.getParamType(1)->isPointerTy()); |
715 | 193 | |
716 | 235k | case LibFunc_memcpy_chk: |
717 | 235k | case LibFunc_memmove_chk: |
718 | 235k | --NumParams; |
719 | 235k | if (!IsSizeTTy(FTy.getParamType(NumParams))) |
720 | 2 | return false; |
721 | 235k | LLVM_FALLTHROUGH235k ; |
722 | 269k | case LibFunc_memcpy: |
723 | 269k | case LibFunc_mempcpy: |
724 | 269k | case LibFunc_memmove: |
725 | 269k | return (NumParams == 3 && FTy.getReturnType() == FTy.getParamType(0) && |
726 | 269k | FTy.getParamType(0)->isPointerTy() && |
727 | 269k | FTy.getParamType(1)->isPointerTy() && |
728 | 269k | IsSizeTTy(FTy.getParamType(2))); |
729 | 269k | |
730 | 171k | case LibFunc_memset_chk: |
731 | 171k | --NumParams; |
732 | 171k | if (!IsSizeTTy(FTy.getParamType(NumParams))) |
733 | 10 | return false; |
734 | 170k | LLVM_FALLTHROUGH170k ; |
735 | 176k | case LibFunc_memset: |
736 | 176k | return (NumParams == 3 && FTy.getReturnType() == FTy.getParamType(0) && |
737 | 176k | FTy.getParamType(0)->isPointerTy() && |
738 | 176k | FTy.getParamType(1)->isIntegerTy() && |
739 | 176k | IsSizeTTy(FTy.getParamType(2))); |
740 | 170k | |
741 | 9 | case LibFunc_memccpy: |
742 | 9 | return (NumParams >= 2 && FTy.getParamType(1)->isPointerTy()); |
743 | 8 | case LibFunc_memalign: |
744 | 8 | return (FTy.getReturnType()->isPointerTy()); |
745 | 55.7k | case LibFunc_realloc: |
746 | 55.7k | case LibFunc_reallocf: |
747 | 55.7k | return (NumParams == 2 && FTy.getReturnType() == PCharTy && |
748 | 55.7k | FTy.getParamType(0) == FTy.getReturnType() && |
749 | 55.7k | IsSizeTTy(FTy.getParamType(1))); |
750 | 13 | case LibFunc_read: |
751 | 13 | return (NumParams == 3 && FTy.getParamType(1)->isPointerTy()); |
752 | 9.77k | case LibFunc_rewind: |
753 | 9.77k | case LibFunc_rmdir: |
754 | 9.77k | case LibFunc_remove: |
755 | 9.77k | case LibFunc_realpath: |
756 | 9.76k | return (NumParams >= 1 && FTy.getParamType(0)->isPointerTy()); |
757 | 952 | case LibFunc_rename: |
758 | 949 | return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() && |
759 | 952 | FTy.getParamType(1)->isPointerTy()); |
760 | 237 | case LibFunc_readlink: |
761 | 234 | return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() && |
762 | 237 | FTy.getParamType(1)->isPointerTy()); |
763 | 11.1k | case LibFunc_write: |
764 | 11.1k | return (NumParams == 3 && FTy.getParamType(1)->isPointerTy()); |
765 | 922 | case LibFunc_bcopy: |
766 | 922 | case LibFunc_bcmp: |
767 | 916 | return (NumParams == 3 && FTy.getParamType(0)->isPointerTy() && |
768 | 916 | FTy.getParamType(1)->isPointerTy()); |
769 | 9 | case LibFunc_bzero: |
770 | 9 | return (NumParams == 2 && FTy.getParamType(0)->isPointerTy()); |
771 | 8.50k | case LibFunc_calloc: |
772 | 8.50k | return (NumParams == 2 && FTy.getReturnType()->isPointerTy()); |
773 | 922 | |
774 | 3.73M | case LibFunc_atof: |
775 | 3.73M | case LibFunc_atoi: |
776 | 3.73M | case LibFunc_atol: |
777 | 3.73M | case LibFunc_atoll: |
778 | 3.73M | case LibFunc_ferror: |
779 | 3.73M | case LibFunc_getenv: |
780 | 3.73M | case LibFunc_getpwnam: |
781 | 3.73M | case LibFunc_iprintf: |
782 | 3.73M | case LibFunc_pclose: |
783 | 3.73M | case LibFunc_perror: |
784 | 3.73M | case LibFunc_printf: |
785 | 3.73M | case LibFunc_puts: |
786 | 3.73M | case LibFunc_uname: |
787 | 3.73M | case LibFunc_under_IO_getc: |
788 | 3.73M | case LibFunc_unlink: |
789 | 3.73M | case LibFunc_unsetenv: |
790 | 3.73M | return (NumParams == 1 && FTy.getParamType(0)->isPointerTy()); |
791 | 3.73M | |
792 | 880k | case LibFunc_access: |
793 | 880k | case LibFunc_chmod: |
794 | 880k | case LibFunc_chown: |
795 | 880k | case LibFunc_clearerr: |
796 | 880k | case LibFunc_closedir: |
797 | 880k | case LibFunc_ctermid: |
798 | 880k | case LibFunc_fclose: |
799 | 880k | case LibFunc_feof: |
800 | 880k | case LibFunc_fflush: |
801 | 880k | case LibFunc_fgetc: |
802 | 880k | case LibFunc_fileno: |
803 | 880k | case LibFunc_flockfile: |
804 | 880k | case LibFunc_free: |
805 | 880k | case LibFunc_fseek: |
806 | 880k | case LibFunc_fseeko64: |
807 | 880k | case LibFunc_fseeko: |
808 | 880k | case LibFunc_fsetpos: |
809 | 880k | case LibFunc_ftell: |
810 | 880k | case LibFunc_ftello64: |
811 | 880k | case LibFunc_ftello: |
812 | 880k | case LibFunc_ftrylockfile: |
813 | 880k | case LibFunc_funlockfile: |
814 | 880k | case LibFunc_getc: |
815 | 880k | case LibFunc_getc_unlocked: |
816 | 880k | case LibFunc_getlogin_r: |
817 | 880k | case LibFunc_mkdir: |
818 | 880k | case LibFunc_mktime: |
819 | 880k | case LibFunc_times: |
820 | 880k | return (NumParams != 0 && FTy.getParamType(0)->isPointerTy()); |
821 | 880k | |
822 | 25.2k | case LibFunc_fopen: |
823 | 25.2k | return (NumParams == 2 && FTy.getReturnType()->isPointerTy() && |
824 | 25.2k | FTy.getParamType(0)->isPointerTy() && |
825 | 25.2k | FTy.getParamType(1)->isPointerTy()); |
826 | 9 | case LibFunc_fdopen: |
827 | 6 | return (NumParams == 2 && FTy.getReturnType()->isPointerTy() && |
828 | 9 | FTy.getParamType(1)->isPointerTy()); |
829 | 67.6k | case LibFunc_fputc: |
830 | 67.6k | case LibFunc_fstat: |
831 | 67.6k | case LibFunc_frexp: |
832 | 67.6k | case LibFunc_frexpf: |
833 | 67.6k | case LibFunc_frexpl: |
834 | 67.6k | case LibFunc_fstatvfs: |
835 | 67.6k | return (NumParams == 2 && FTy.getParamType(1)->isPointerTy()); |
836 | 39.5k | case LibFunc_fgets: |
837 | 39.5k | return (NumParams == 3 && FTy.getParamType(0)->isPointerTy() && |
838 | 39.5k | FTy.getParamType(2)->isPointerTy()); |
839 | 21.9k | case LibFunc_fread: |
840 | 21.9k | return (NumParams == 4 && FTy.getParamType(0)->isPointerTy() && |
841 | 21.9k | FTy.getParamType(3)->isPointerTy()); |
842 | 507k | case LibFunc_fwrite: |
843 | 507k | return (NumParams == 4 && FTy.getReturnType()->isIntegerTy() && |
844 | 507k | FTy.getParamType(0)->isPointerTy() && |
845 | 507k | FTy.getParamType(1)->isIntegerTy() && |
846 | 507k | FTy.getParamType(2)->isIntegerTy() && |
847 | 507k | FTy.getParamType(3)->isPointerTy()); |
848 | 14.3k | case LibFunc_fputs: |
849 | 14.3k | return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() && |
850 | 14.3k | FTy.getParamType(1)->isPointerTy()); |
851 | 725k | case LibFunc_fscanf: |
852 | 725k | case LibFunc_fiprintf: |
853 | 725k | case LibFunc_fprintf: |
854 | 725k | return (NumParams >= 2 && FTy.getReturnType()->isIntegerTy() && |
855 | 725k | FTy.getParamType(0)->isPointerTy() && |
856 | 725k | FTy.getParamType(1)->isPointerTy()); |
857 | 189 | case LibFunc_fgetpos: |
858 | 186 | return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() && |
859 | 189 | FTy.getParamType(1)->isPointerTy()); |
860 | 5.01k | case LibFunc_getchar: |
861 | 5.01k | return (NumParams == 0 && FTy.getReturnType()->isIntegerTy()); |
862 | 175 | case LibFunc_gets: |
863 | 175 | return (NumParams == 1 && FTy.getParamType(0) == PCharTy); |
864 | 9 | case LibFunc_getitimer: |
865 | 9 | return (NumParams == 2 && FTy.getParamType(1)->isPointerTy()); |
866 | 16.9k | case LibFunc_ungetc: |
867 | 16.9k | return (NumParams == 2 && FTy.getParamType(1)->isPointerTy()); |
868 | 928 | case LibFunc_utime: |
869 | 928 | case LibFunc_utimes: |
870 | 922 | return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() && |
871 | 922 | FTy.getParamType(1)->isPointerTy()); |
872 | 81.6k | case LibFunc_putc: |
873 | 81.6k | return (NumParams == 2 && FTy.getParamType(1)->isPointerTy()); |
874 | 18 | case LibFunc_pread: |
875 | 18 | case LibFunc_pwrite: |
876 | 12 | return (NumParams == 4 && FTy.getParamType(1)->isPointerTy()); |
877 | 9 | case LibFunc_popen: |
878 | 6 | return (NumParams == 2 && FTy.getReturnType()->isPointerTy() && |
879 | 6 | FTy.getParamType(0)->isPointerTy() && |
880 | 9 | FTy.getParamType(1)->isPointerTy()); |
881 | 9 | case LibFunc_vscanf: |
882 | 9 | return (NumParams == 2 && FTy.getParamType(1)->isPointerTy()); |
883 | 9 | case LibFunc_vsscanf: |
884 | 6 | return (NumParams == 3 && FTy.getParamType(1)->isPointerTy() && |
885 | 9 | FTy.getParamType(2)->isPointerTy()); |
886 | 9 | case LibFunc_vfscanf: |
887 | 6 | return (NumParams == 3 && FTy.getParamType(1)->isPointerTy() && |
888 | 9 | FTy.getParamType(2)->isPointerTy()); |
889 | 16 | case LibFunc_valloc: |
890 | 16 | return (FTy.getReturnType()->isPointerTy()); |
891 | 13 | case LibFunc_vprintf: |
892 | 13 | return (NumParams == 2 && FTy.getParamType(0)->isPointerTy()); |
893 | 2.07k | case LibFunc_vfprintf: |
894 | 2.07k | case LibFunc_vsprintf: |
895 | 2.06k | return (NumParams == 3 && FTy.getParamType(0)->isPointerTy() && |
896 | 2.06k | FTy.getParamType(1)->isPointerTy()); |
897 | 9 | case LibFunc_vsnprintf: |
898 | 6 | return (NumParams == 4 && FTy.getParamType(0)->isPointerTy() && |
899 | 9 | FTy.getParamType(2)->isPointerTy()); |
900 | 22.2k | case LibFunc_open: |
901 | 22.2k | return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy()); |
902 | 9 | case LibFunc_opendir: |
903 | 6 | return (NumParams == 1 && FTy.getReturnType()->isPointerTy() && |
904 | 9 | FTy.getParamType(0)->isPointerTy()); |
905 | 230 | case LibFunc_tmpfile: |
906 | 230 | return (FTy.getReturnType()->isPointerTy()); |
907 | 5 | case LibFunc_htonl: |
908 | 5 | case LibFunc_ntohl: |
909 | 3 | return (NumParams == 1 && FTy.getReturnType()->isIntegerTy(32) && |
910 | 3 | FTy.getReturnType() == FTy.getParamType(0)); |
911 | 4 | case LibFunc_htons: |
912 | 4 | case LibFunc_ntohs: |
913 | 2 | return (NumParams == 1 && FTy.getReturnType()->isIntegerTy(16) && |
914 | 2 | FTy.getReturnType() == FTy.getParamType(0)); |
915 | 9 | case LibFunc_lstat: |
916 | 6 | return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() && |
917 | 9 | FTy.getParamType(1)->isPointerTy()); |
918 | 9 | case LibFunc_lchown: |
919 | 9 | return (NumParams == 3 && FTy.getParamType(0)->isPointerTy()); |
920 | 16.7k | case LibFunc_qsort: |
921 | 16.7k | return (NumParams == 4 && FTy.getParamType(3)->isPointerTy()); |
922 | 3 | case LibFunc_dunder_strdup: |
923 | 3 | case LibFunc_dunder_strndup: |
924 | 2 | return (NumParams >= 1 && FTy.getReturnType()->isPointerTy() && |
925 | 2 | FTy.getParamType(0)->isPointerTy()); |
926 | 1 | case LibFunc_dunder_strtok_r: |
927 | 1 | return (NumParams == 3 && FTy.getParamType(1)->isPointerTy()); |
928 | 1 | case LibFunc_under_IO_putc: |
929 | 1 | return (NumParams == 2 && FTy.getParamType(1)->isPointerTy()); |
930 | 1 | case LibFunc_dunder_isoc99_scanf: |
931 | 1 | return (NumParams >= 1 && FTy.getParamType(0)->isPointerTy()); |
932 | 25 | case LibFunc_stat64: |
933 | 25 | case LibFunc_lstat64: |
934 | 25 | case LibFunc_statvfs64: |
935 | 18 | return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() && |
936 | 18 | FTy.getParamType(1)->isPointerTy()); |
937 | 1 | case LibFunc_dunder_isoc99_sscanf: |
938 | 1 | return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() && |
939 | 1 | FTy.getParamType(1)->isPointerTy()); |
940 | 1 | case LibFunc_fopen64: |
941 | 1 | return (NumParams == 2 && FTy.getReturnType()->isPointerTy() && |
942 | 1 | FTy.getParamType(0)->isPointerTy() && |
943 | 1 | FTy.getParamType(1)->isPointerTy()); |
944 | 8 | case LibFunc_tmpfile64: |
945 | 8 | return (FTy.getReturnType()->isPointerTy()); |
946 | 16 | case LibFunc_fstat64: |
947 | 16 | case LibFunc_fstatvfs64: |
948 | 12 | return (NumParams == 2 && FTy.getParamType(1)->isPointerTy()); |
949 | 8 | case LibFunc_open64: |
950 | 8 | return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy()); |
951 | 22.3k | case LibFunc_gettimeofday: |
952 | 22.3k | return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() && |
953 | 22.3k | FTy.getParamType(1)->isPointerTy()); |
954 | 16 | |
955 | 16 | // new(unsigned int); |
956 | 8.09k | case LibFunc_Znwj: |
957 | 8.09k | // new(unsigned long); |
958 | 8.09k | case LibFunc_Znwm: |
959 | 8.09k | // new[](unsigned int); |
960 | 8.09k | case LibFunc_Znaj: |
961 | 8.09k | // new[](unsigned long); |
962 | 8.09k | case LibFunc_Znam: |
963 | 8.09k | // new(unsigned int); |
964 | 8.09k | case LibFunc_msvc_new_int: |
965 | 8.09k | // new(unsigned long long); |
966 | 8.09k | case LibFunc_msvc_new_longlong: |
967 | 8.09k | // new[](unsigned int); |
968 | 8.09k | case LibFunc_msvc_new_array_int: |
969 | 8.09k | // new[](unsigned long long); |
970 | 8.09k | case LibFunc_msvc_new_array_longlong: |
971 | 8.08k | return (NumParams == 1 && FTy.getReturnType()->isPointerTy()); |
972 | 8.09k | |
973 | 8.09k | // new(unsigned int, nothrow); |
974 | 16 | case LibFunc_ZnwjRKSt9nothrow_t: |
975 | 16 | // new(unsigned long, nothrow); |
976 | 16 | case LibFunc_ZnwmRKSt9nothrow_t: |
977 | 16 | // new[](unsigned int, nothrow); |
978 | 16 | case LibFunc_ZnajRKSt9nothrow_t: |
979 | 16 | // new[](unsigned long, nothrow); |
980 | 16 | case LibFunc_ZnamRKSt9nothrow_t: |
981 | 16 | // new(unsigned int, nothrow); |
982 | 16 | case LibFunc_msvc_new_int_nothrow: |
983 | 16 | // new(unsigned long long, nothrow); |
984 | 16 | case LibFunc_msvc_new_longlong_nothrow: |
985 | 16 | // new[](unsigned int, nothrow); |
986 | 16 | case LibFunc_msvc_new_array_int_nothrow: |
987 | 16 | // new[](unsigned long long, nothrow); |
988 | 16 | case LibFunc_msvc_new_array_longlong_nothrow: |
989 | 8 | return (NumParams == 2 && FTy.getReturnType()->isPointerTy()); |
990 | 16 | |
991 | 16 | // void operator delete[](void*); |
992 | 293k | case LibFunc_ZdaPv: |
993 | 293k | // void operator delete(void*); |
994 | 293k | case LibFunc_ZdlPv: |
995 | 293k | // void operator delete[](void*); |
996 | 293k | case LibFunc_msvc_delete_array_ptr32: |
997 | 293k | // void operator delete[](void*); |
998 | 293k | case LibFunc_msvc_delete_array_ptr64: |
999 | 293k | // void operator delete(void*); |
1000 | 293k | case LibFunc_msvc_delete_ptr32: |
1001 | 293k | // void operator delete(void*); |
1002 | 293k | case LibFunc_msvc_delete_ptr64: |
1003 | 293k | return (NumParams == 1 && FTy.getParamType(0)->isPointerTy()); |
1004 | 293k | |
1005 | 293k | // void operator delete[](void*, nothrow); |
1006 | 33 | case LibFunc_ZdaPvRKSt9nothrow_t: |
1007 | 33 | // void operator delete[](void*, unsigned int); |
1008 | 33 | case LibFunc_ZdaPvj: |
1009 | 33 | // void operator delete[](void*, unsigned long); |
1010 | 33 | case LibFunc_ZdaPvm: |
1011 | 33 | // void operator delete(void*, nothrow); |
1012 | 33 | case LibFunc_ZdlPvRKSt9nothrow_t: |
1013 | 33 | // void operator delete(void*, unsigned int); |
1014 | 33 | case LibFunc_ZdlPvj: |
1015 | 33 | // void operator delete(void*, unsigned long); |
1016 | 33 | case LibFunc_ZdlPvm: |
1017 | 33 | // void operator delete[](void*, unsigned int); |
1018 | 33 | case LibFunc_msvc_delete_array_ptr32_int: |
1019 | 33 | // void operator delete[](void*, nothrow); |
1020 | 33 | case LibFunc_msvc_delete_array_ptr32_nothrow: |
1021 | 33 | // void operator delete[](void*, unsigned long long); |
1022 | 33 | case LibFunc_msvc_delete_array_ptr64_longlong: |
1023 | 33 | // void operator delete[](void*, nothrow); |
1024 | 33 | case LibFunc_msvc_delete_array_ptr64_nothrow: |
1025 | 33 | // void operator delete(void*, unsigned int); |
1026 | 33 | case LibFunc_msvc_delete_ptr32_int: |
1027 | 33 | // void operator delete(void*, nothrow); |
1028 | 33 | case LibFunc_msvc_delete_ptr32_nothrow: |
1029 | 33 | // void operator delete(void*, unsigned long long); |
1030 | 33 | case LibFunc_msvc_delete_ptr64_longlong: |
1031 | 33 | // void operator delete(void*, nothrow); |
1032 | 33 | case LibFunc_msvc_delete_ptr64_nothrow: |
1033 | 19 | return (NumParams == 2 && FTy.getParamType(0)->isPointerTy()); |
1034 | 33 | |
1035 | 556k | case LibFunc_memset_pattern16: |
1036 | 556k | return (!FTy.isVarArg() && NumParams == 3 && |
1037 | 556k | FTy.getParamType(0)->isPointerTy() && |
1038 | 556k | FTy.getParamType(1)->isPointerTy() && |
1039 | 556k | FTy.getParamType(2)->isIntegerTy()); |
1040 | 33 | |
1041 | 38.5k | case LibFunc_cxa_guard_abort: |
1042 | 38.5k | case LibFunc_cxa_guard_acquire: |
1043 | 38.5k | case LibFunc_cxa_guard_release: |
1044 | 38.5k | case LibFunc_nvvm_reflect: |
1045 | 38.5k | return (NumParams == 1 && FTy.getParamType(0)->isPointerTy()); |
1046 | 38.5k | |
1047 | 38 | case LibFunc_sincospi_stret: |
1048 | 38 | case LibFunc_sincospif_stret: |
1049 | 38 | return (NumParams == 1 && FTy.getParamType(0)->isFloatingPointTy()); |
1050 | 38 | |
1051 | 275k | case LibFunc_acos: |
1052 | 275k | case LibFunc_acos_finite: |
1053 | 275k | case LibFunc_acosf: |
1054 | 275k | case LibFunc_acosf_finite: |
1055 | 275k | case LibFunc_acosh: |
1056 | 275k | case LibFunc_acosh_finite: |
1057 | 275k | case LibFunc_acoshf: |
1058 | 275k | case LibFunc_acoshf_finite: |
1059 | 275k | case LibFunc_acoshl: |
1060 | 275k | case LibFunc_acoshl_finite: |
1061 | 275k | case LibFunc_acosl: |
1062 | 275k | case LibFunc_acosl_finite: |
1063 | 275k | case LibFunc_asin: |
1064 | 275k | case LibFunc_asin_finite: |
1065 | 275k | case LibFunc_asinf: |
1066 | 275k | case LibFunc_asinf_finite: |
1067 | 275k | case LibFunc_asinh: |
1068 | 275k | case LibFunc_asinhf: |
1069 | 275k | case LibFunc_asinhl: |
1070 | 275k | case LibFunc_asinl: |
1071 | 275k | case LibFunc_asinl_finite: |
1072 | 275k | case LibFunc_atan: |
1073 | 275k | case LibFunc_atanf: |
1074 | 275k | case LibFunc_atanh: |
1075 | 275k | case LibFunc_atanh_finite: |
1076 | 275k | case LibFunc_atanhf: |
1077 | 275k | case LibFunc_atanhf_finite: |
1078 | 275k | case LibFunc_atanhl: |
1079 | 275k | case LibFunc_atanhl_finite: |
1080 | 275k | case LibFunc_atanl: |
1081 | 275k | case LibFunc_cbrt: |
1082 | 275k | case LibFunc_cbrtf: |
1083 | 275k | case LibFunc_cbrtl: |
1084 | 275k | case LibFunc_ceil: |
1085 | 275k | case LibFunc_ceilf: |
1086 | 275k | case LibFunc_ceill: |
1087 | 275k | case LibFunc_cos: |
1088 | 275k | case LibFunc_cosf: |
1089 | 275k | case LibFunc_cosh: |
1090 | 275k | case LibFunc_cosh_finite: |
1091 | 275k | case LibFunc_coshf: |
1092 | 275k | case LibFunc_coshf_finite: |
1093 | 275k | case LibFunc_coshl: |
1094 | 275k | case LibFunc_coshl_finite: |
1095 | 275k | case LibFunc_cosl: |
1096 | 275k | case LibFunc_exp10: |
1097 | 275k | case LibFunc_exp10_finite: |
1098 | 275k | case LibFunc_exp10f: |
1099 | 275k | case LibFunc_exp10f_finite: |
1100 | 275k | case LibFunc_exp10l: |
1101 | 275k | case LibFunc_exp10l_finite: |
1102 | 275k | case LibFunc_exp2: |
1103 | 275k | case LibFunc_exp2_finite: |
1104 | 275k | case LibFunc_exp2f: |
1105 | 275k | case LibFunc_exp2f_finite: |
1106 | 275k | case LibFunc_exp2l: |
1107 | 275k | case LibFunc_exp2l_finite: |
1108 | 275k | case LibFunc_exp: |
1109 | 275k | case LibFunc_exp_finite: |
1110 | 275k | case LibFunc_expf: |
1111 | 275k | case LibFunc_expf_finite: |
1112 | 275k | case LibFunc_expl: |
1113 | 275k | case LibFunc_expl_finite: |
1114 | 275k | case LibFunc_expm1: |
1115 | 275k | case LibFunc_expm1f: |
1116 | 275k | case LibFunc_expm1l: |
1117 | 275k | case LibFunc_fabs: |
1118 | 275k | case LibFunc_fabsf: |
1119 | 275k | case LibFunc_fabsl: |
1120 | 275k | case LibFunc_floor: |
1121 | 275k | case LibFunc_floorf: |
1122 | 275k | case LibFunc_floorl: |
1123 | 275k | case LibFunc_log10: |
1124 | 275k | case LibFunc_log10_finite: |
1125 | 275k | case LibFunc_log10f: |
1126 | 275k | case LibFunc_log10f_finite: |
1127 | 275k | case LibFunc_log10l: |
1128 | 275k | case LibFunc_log10l_finite: |
1129 | 275k | case LibFunc_log1p: |
1130 | 275k | case LibFunc_log1pf: |
1131 | 275k | case LibFunc_log1pl: |
1132 | 275k | case LibFunc_log2: |
1133 | 275k | case LibFunc_log2_finite: |
1134 | 275k | case LibFunc_log2f: |
1135 | 275k | case LibFunc_log2f_finite: |
1136 | 275k | case LibFunc_log2l: |
1137 | 275k | case LibFunc_log2l_finite: |
1138 | 275k | case LibFunc_log: |
1139 | 275k | case LibFunc_log_finite: |
1140 | 275k | case LibFunc_logb: |
1141 | 275k | case LibFunc_logbf: |
1142 | 275k | case LibFunc_logbl: |
1143 | 275k | case LibFunc_logf: |
1144 | 275k | case LibFunc_logf_finite: |
1145 | 275k | case LibFunc_logl: |
1146 | 275k | case LibFunc_logl_finite: |
1147 | 275k | case LibFunc_nearbyint: |
1148 | 275k | case LibFunc_nearbyintf: |
1149 | 275k | case LibFunc_nearbyintl: |
1150 | 275k | case LibFunc_rint: |
1151 | 275k | case LibFunc_rintf: |
1152 | 275k | case LibFunc_rintl: |
1153 | 275k | case LibFunc_round: |
1154 | 275k | case LibFunc_roundf: |
1155 | 275k | case LibFunc_roundl: |
1156 | 275k | case LibFunc_sin: |
1157 | 275k | case LibFunc_sinf: |
1158 | 275k | case LibFunc_sinh: |
1159 | 275k | case LibFunc_sinh_finite: |
1160 | 275k | case LibFunc_sinhf: |
1161 | 275k | case LibFunc_sinhf_finite: |
1162 | 275k | case LibFunc_sinhl: |
1163 | 275k | case LibFunc_sinhl_finite: |
1164 | 275k | case LibFunc_sinl: |
1165 | 275k | case LibFunc_sqrt: |
1166 | 275k | case LibFunc_sqrt_finite: |
1167 | 275k | case LibFunc_sqrtf: |
1168 | 275k | case LibFunc_sqrtf_finite: |
1169 | 275k | case LibFunc_sqrtl: |
1170 | 275k | case LibFunc_sqrtl_finite: |
1171 | 275k | case LibFunc_tan: |
1172 | 275k | case LibFunc_tanf: |
1173 | 275k | case LibFunc_tanh: |
1174 | 275k | case LibFunc_tanhf: |
1175 | 275k | case LibFunc_tanhl: |
1176 | 275k | case LibFunc_tanl: |
1177 | 275k | case LibFunc_trunc: |
1178 | 275k | case LibFunc_truncf: |
1179 | 275k | case LibFunc_truncl: |
1180 | 275k | return (NumParams == 1 && FTy.getReturnType()->isFloatingPointTy() && |
1181 | 275k | FTy.getReturnType() == FTy.getParamType(0)); |
1182 | 275k | |
1183 | 21.8k | case LibFunc_atan2: |
1184 | 21.8k | case LibFunc_atan2_finite: |
1185 | 21.8k | case LibFunc_atan2f: |
1186 | 21.8k | case LibFunc_atan2f_finite: |
1187 | 21.8k | case LibFunc_atan2l: |
1188 | 21.8k | case LibFunc_atan2l_finite: |
1189 | 21.8k | case LibFunc_fmin: |
1190 | 21.8k | case LibFunc_fminf: |
1191 | 21.8k | case LibFunc_fminl: |
1192 | 21.8k | case LibFunc_fmax: |
1193 | 21.8k | case LibFunc_fmaxf: |
1194 | 21.8k | case LibFunc_fmaxl: |
1195 | 21.8k | case LibFunc_fmod: |
1196 | 21.8k | case LibFunc_fmodf: |
1197 | 21.8k | case LibFunc_fmodl: |
1198 | 21.8k | case LibFunc_copysign: |
1199 | 21.8k | case LibFunc_copysignf: |
1200 | 21.8k | case LibFunc_copysignl: |
1201 | 21.8k | case LibFunc_pow: |
1202 | 21.8k | case LibFunc_pow_finite: |
1203 | 21.8k | case LibFunc_powf: |
1204 | 21.8k | case LibFunc_powf_finite: |
1205 | 21.8k | case LibFunc_powl: |
1206 | 21.8k | case LibFunc_powl_finite: |
1207 | 21.7k | return (NumParams == 2 && FTy.getReturnType()->isFloatingPointTy() && |
1208 | 21.7k | FTy.getReturnType() == FTy.getParamType(0) && |
1209 | 21.7k | FTy.getReturnType() == FTy.getParamType(1)); |
1210 | 21.8k | |
1211 | 4.01k | case LibFunc_ldexp: |
1212 | 4.01k | case LibFunc_ldexpf: |
1213 | 4.01k | case LibFunc_ldexpl: |
1214 | 4.00k | return (NumParams == 2 && FTy.getReturnType()->isFloatingPointTy() && |
1215 | 4.00k | FTy.getReturnType() == FTy.getParamType(0) && |
1216 | 4.00k | FTy.getParamType(1)->isIntegerTy(32)); |
1217 | 4.01k | |
1218 | 427 | case LibFunc_ffs: |
1219 | 427 | case LibFunc_ffsl: |
1220 | 427 | case LibFunc_ffsll: |
1221 | 427 | case LibFunc_fls: |
1222 | 427 | case LibFunc_flsl: |
1223 | 427 | case LibFunc_flsll: |
1224 | 414 | return (NumParams == 1 && FTy.getReturnType()->isIntegerTy(32) && |
1225 | 414 | FTy.getParamType(0)->isIntegerTy()); |
1226 | 427 | |
1227 | 110k | case LibFunc_isdigit: |
1228 | 110k | case LibFunc_isascii: |
1229 | 110k | case LibFunc_toascii: |
1230 | 110k | case LibFunc_putchar: |
1231 | 110k | return (NumParams == 1 && FTy.getReturnType()->isIntegerTy(32) && |
1232 | 110k | FTy.getReturnType() == FTy.getParamType(0)); |
1233 | 110k | |
1234 | 362 | case LibFunc_abs: |
1235 | 362 | case LibFunc_labs: |
1236 | 362 | case LibFunc_llabs: |
1237 | 353 | return (NumParams == 1 && FTy.getReturnType()->isIntegerTy() && |
1238 | 353 | FTy.getReturnType() == FTy.getParamType(0)); |
1239 | 362 | |
1240 | 20.2k | case LibFunc_cxa_atexit: |
1241 | 20.2k | return (NumParams == 3 && FTy.getReturnType()->isIntegerTy() && |
1242 | 20.2k | FTy.getParamType(0)->isPointerTy() && |
1243 | 20.2k | FTy.getParamType(1)->isPointerTy() && |
1244 | 20.2k | FTy.getParamType(2)->isPointerTy()); |
1245 | 362 | |
1246 | 92 | case LibFunc_sinpi: |
1247 | 92 | case LibFunc_cospi: |
1248 | 88 | return (NumParams == 1 && FTy.getReturnType()->isDoubleTy() && |
1249 | 88 | FTy.getReturnType() == FTy.getParamType(0)); |
1250 | 92 | |
1251 | 70 | case LibFunc_sinpif: |
1252 | 70 | case LibFunc_cospif: |
1253 | 66 | return (NumParams == 1 && FTy.getReturnType()->isFloatTy() && |
1254 | 66 | FTy.getReturnType() == FTy.getParamType(0)); |
1255 | 70 | |
1256 | 19 | case LibFunc_strnlen: |
1257 | 16 | return (NumParams == 2 && FTy.getReturnType() == FTy.getParamType(1) && |
1258 | 16 | FTy.getParamType(0) == PCharTy && |
1259 | 19 | FTy.getParamType(1) == SizeTTy); |
1260 | 70 | |
1261 | 28.4k | case LibFunc_posix_memalign: |
1262 | 28.4k | return (NumParams == 3 && FTy.getReturnType()->isIntegerTy(32) && |
1263 | 28.4k | FTy.getParamType(0)->isPointerTy() && |
1264 | 28.4k | FTy.getParamType(1) == SizeTTy28.4k && FTy.getParamType(2) == SizeTTy28.4k ); |
1265 | 70 | |
1266 | 335 | case LibFunc_wcslen: |
1267 | 332 | return (NumParams == 1 && FTy.getParamType(0)->isPointerTy() && |
1268 | 335 | FTy.getReturnType()->isIntegerTy()); |
1269 | 70 | |
1270 | 0 | case LibFunc::NumLibFuncs: |
1271 | 0 | break; |
1272 | 0 | } |
1273 | 0 |
|
1274 | 0 | llvm_unreachable0 ("Invalid libfunc"); |
1275 | 0 | } |
1276 | | |
1277 | | bool TargetLibraryInfoImpl::getLibFunc(const Function &FDecl, |
1278 | 33.8M | LibFunc &F) const { |
1279 | 33.8M | const DataLayout *DL = |
1280 | 18.4E | FDecl.getParent() ? &FDecl.getParent()->getDataLayout()33.8M : nullptr18.4E ; |
1281 | 33.8M | return getLibFunc(FDecl.getName(), F) && |
1282 | 9.32M | isValidProtoForLibFunc(*FDecl.getFunctionType(), F, DL); |
1283 | 33.8M | } |
1284 | | |
1285 | 6.23k | void TargetLibraryInfoImpl::disableAllFunctions() { |
1286 | 6.23k | memset(AvailableArray, 0, sizeof(AvailableArray)); |
1287 | 6.23k | } |
1288 | | |
1289 | 1.30k | static bool compareByScalarFnName(const VecDesc &LHS, const VecDesc &RHS) { |
1290 | 1.30k | return LHS.ScalarFnName < RHS.ScalarFnName; |
1291 | 1.30k | } |
1292 | | |
1293 | 1.05k | static bool compareByVectorFnName(const VecDesc &LHS, const VecDesc &RHS) { |
1294 | 1.05k | return LHS.VectorFnName < RHS.VectorFnName; |
1295 | 1.05k | } |
1296 | | |
1297 | 1.47k | static bool compareWithScalarFnName(const VecDesc &LHS, StringRef S) { |
1298 | 1.47k | return LHS.ScalarFnName < S; |
1299 | 1.47k | } |
1300 | | |
1301 | 0 | static bool compareWithVectorFnName(const VecDesc &LHS, StringRef S) { |
1302 | 0 | return LHS.VectorFnName < S; |
1303 | 0 | } |
1304 | | |
1305 | 3 | void TargetLibraryInfoImpl::addVectorizableFunctions(ArrayRef<VecDesc> Fns) { |
1306 | 3 | VectorDescs.insert(VectorDescs.end(), Fns.begin(), Fns.end()); |
1307 | 3 | std::sort(VectorDescs.begin(), VectorDescs.end(), compareByScalarFnName); |
1308 | 3 | |
1309 | 3 | ScalarDescs.insert(ScalarDescs.end(), Fns.begin(), Fns.end()); |
1310 | 3 | std::sort(ScalarDescs.begin(), ScalarDescs.end(), compareByVectorFnName); |
1311 | 3 | } |
1312 | | |
1313 | | void TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib( |
1314 | 64.5k | enum VectorLibrary VecLib) { |
1315 | 64.5k | switch (VecLib) { |
1316 | 1 | case Accelerate: { |
1317 | 1 | const VecDesc VecFuncs[] = { |
1318 | 1 | // Floating-Point Arithmetic and Auxiliary Functions |
1319 | 1 | {"ceilf", "vceilf", 4}, |
1320 | 1 | {"fabsf", "vfabsf", 4}, |
1321 | 1 | {"llvm.fabs.f32", "vfabsf", 4}, |
1322 | 1 | {"floorf", "vfloorf", 4}, |
1323 | 1 | {"sqrtf", "vsqrtf", 4}, |
1324 | 1 | {"llvm.sqrt.f32", "vsqrtf", 4}, |
1325 | 1 | |
1326 | 1 | // Exponential and Logarithmic Functions |
1327 | 1 | {"expf", "vexpf", 4}, |
1328 | 1 | {"llvm.exp.f32", "vexpf", 4}, |
1329 | 1 | {"expm1f", "vexpm1f", 4}, |
1330 | 1 | {"logf", "vlogf", 4}, |
1331 | 1 | {"llvm.log.f32", "vlogf", 4}, |
1332 | 1 | {"log1pf", "vlog1pf", 4}, |
1333 | 1 | {"log10f", "vlog10f", 4}, |
1334 | 1 | {"llvm.log10.f32", "vlog10f", 4}, |
1335 | 1 | {"logbf", "vlogbf", 4}, |
1336 | 1 | |
1337 | 1 | // Trigonometric Functions |
1338 | 1 | {"sinf", "vsinf", 4}, |
1339 | 1 | {"llvm.sin.f32", "vsinf", 4}, |
1340 | 1 | {"cosf", "vcosf", 4}, |
1341 | 1 | {"llvm.cos.f32", "vcosf", 4}, |
1342 | 1 | {"tanf", "vtanf", 4}, |
1343 | 1 | {"asinf", "vasinf", 4}, |
1344 | 1 | {"acosf", "vacosf", 4}, |
1345 | 1 | {"atanf", "vatanf", 4}, |
1346 | 1 | |
1347 | 1 | // Hyperbolic Functions |
1348 | 1 | {"sinhf", "vsinhf", 4}, |
1349 | 1 | {"coshf", "vcoshf", 4}, |
1350 | 1 | {"tanhf", "vtanhf", 4}, |
1351 | 1 | {"asinhf", "vasinhf", 4}, |
1352 | 1 | {"acoshf", "vacoshf", 4}, |
1353 | 1 | {"atanhf", "vatanhf", 4}, |
1354 | 1 | }; |
1355 | 1 | addVectorizableFunctions(VecFuncs); |
1356 | 1 | break; |
1357 | 64.5k | } |
1358 | 2 | case SVML: { |
1359 | 2 | const VecDesc VecFuncs[] = { |
1360 | 2 | {"sin", "__svml_sin2", 2}, |
1361 | 2 | {"sin", "__svml_sin4", 4}, |
1362 | 2 | {"sin", "__svml_sin8", 8}, |
1363 | 2 | |
1364 | 2 | {"sinf", "__svml_sinf4", 4}, |
1365 | 2 | {"sinf", "__svml_sinf8", 8}, |
1366 | 2 | {"sinf", "__svml_sinf16", 16}, |
1367 | 2 | |
1368 | 2 | {"cos", "__svml_cos2", 2}, |
1369 | 2 | {"cos", "__svml_cos4", 4}, |
1370 | 2 | {"cos", "__svml_cos8", 8}, |
1371 | 2 | |
1372 | 2 | {"cosf", "__svml_cosf4", 4}, |
1373 | 2 | {"cosf", "__svml_cosf8", 8}, |
1374 | 2 | {"cosf", "__svml_cosf16", 16}, |
1375 | 2 | |
1376 | 2 | {"pow", "__svml_pow2", 2}, |
1377 | 2 | {"pow", "__svml_pow4", 4}, |
1378 | 2 | {"pow", "__svml_pow8", 8}, |
1379 | 2 | |
1380 | 2 | {"powf", "__svml_powf4", 4}, |
1381 | 2 | {"powf", "__svml_powf8", 8}, |
1382 | 2 | {"powf", "__svml_powf16", 16}, |
1383 | 2 | |
1384 | 2 | { "__pow_finite", "__svml_pow2", 2 }, |
1385 | 2 | { "__pow_finite", "__svml_pow4", 4 }, |
1386 | 2 | { "__pow_finite", "__svml_pow8", 8 }, |
1387 | 2 | |
1388 | 2 | { "__powf_finite", "__svml_powf4", 4 }, |
1389 | 2 | { "__powf_finite", "__svml_powf8", 8 }, |
1390 | 2 | { "__powf_finite", "__svml_powf16", 16 }, |
1391 | 2 | |
1392 | 2 | {"llvm.pow.f64", "__svml_pow2", 2}, |
1393 | 2 | {"llvm.pow.f64", "__svml_pow4", 4}, |
1394 | 2 | {"llvm.pow.f64", "__svml_pow8", 8}, |
1395 | 2 | |
1396 | 2 | {"llvm.pow.f32", "__svml_powf4", 4}, |
1397 | 2 | {"llvm.pow.f32", "__svml_powf8", 8}, |
1398 | 2 | {"llvm.pow.f32", "__svml_powf16", 16}, |
1399 | 2 | |
1400 | 2 | {"exp", "__svml_exp2", 2}, |
1401 | 2 | {"exp", "__svml_exp4", 4}, |
1402 | 2 | {"exp", "__svml_exp8", 8}, |
1403 | 2 | |
1404 | 2 | {"expf", "__svml_expf4", 4}, |
1405 | 2 | {"expf", "__svml_expf8", 8}, |
1406 | 2 | {"expf", "__svml_expf16", 16}, |
1407 | 2 | |
1408 | 2 | { "__exp_finite", "__svml_exp2", 2 }, |
1409 | 2 | { "__exp_finite", "__svml_exp4", 4 }, |
1410 | 2 | { "__exp_finite", "__svml_exp8", 8 }, |
1411 | 2 | |
1412 | 2 | { "__expf_finite", "__svml_expf4", 4 }, |
1413 | 2 | { "__expf_finite", "__svml_expf8", 8 }, |
1414 | 2 | { "__expf_finite", "__svml_expf16", 16 }, |
1415 | 2 | |
1416 | 2 | {"llvm.exp.f64", "__svml_exp2", 2}, |
1417 | 2 | {"llvm.exp.f64", "__svml_exp4", 4}, |
1418 | 2 | {"llvm.exp.f64", "__svml_exp8", 8}, |
1419 | 2 | |
1420 | 2 | {"llvm.exp.f32", "__svml_expf4", 4}, |
1421 | 2 | {"llvm.exp.f32", "__svml_expf8", 8}, |
1422 | 2 | {"llvm.exp.f32", "__svml_expf16", 16}, |
1423 | 2 | |
1424 | 2 | {"log", "__svml_log2", 2}, |
1425 | 2 | {"log", "__svml_log4", 4}, |
1426 | 2 | {"log", "__svml_log8", 8}, |
1427 | 2 | |
1428 | 2 | {"logf", "__svml_logf4", 4}, |
1429 | 2 | {"logf", "__svml_logf8", 8}, |
1430 | 2 | {"logf", "__svml_logf16", 16}, |
1431 | 2 | |
1432 | 2 | { "__log_finite", "__svml_log2", 2 }, |
1433 | 2 | { "__log_finite", "__svml_log4", 4 }, |
1434 | 2 | { "__log_finite", "__svml_log8", 8 }, |
1435 | 2 | |
1436 | 2 | { "__logf_finite", "__svml_logf4", 4 }, |
1437 | 2 | { "__logf_finite", "__svml_logf8", 8 }, |
1438 | 2 | { "__logf_finite", "__svml_logf16", 16 }, |
1439 | 2 | |
1440 | 2 | {"llvm.log.f64", "__svml_log2", 2}, |
1441 | 2 | {"llvm.log.f64", "__svml_log4", 4}, |
1442 | 2 | {"llvm.log.f64", "__svml_log8", 8}, |
1443 | 2 | |
1444 | 2 | {"llvm.log.f32", "__svml_logf4", 4}, |
1445 | 2 | {"llvm.log.f32", "__svml_logf8", 8}, |
1446 | 2 | {"llvm.log.f32", "__svml_logf16", 16}, |
1447 | 2 | }; |
1448 | 2 | addVectorizableFunctions(VecFuncs); |
1449 | 2 | break; |
1450 | 64.5k | } |
1451 | 64.5k | case NoLibrary: |
1452 | 64.5k | break; |
1453 | 64.5k | } |
1454 | 64.5k | } |
1455 | | |
1456 | 54.9k | bool TargetLibraryInfoImpl::isFunctionVectorizable(StringRef funcName) const { |
1457 | 54.9k | funcName = sanitizeFunctionName(funcName); |
1458 | 54.9k | if (funcName.empty()) |
1459 | 0 | return false; |
1460 | 54.9k | |
1461 | 54.9k | std::vector<VecDesc>::const_iterator I = std::lower_bound( |
1462 | 54.9k | VectorDescs.begin(), VectorDescs.end(), funcName, |
1463 | 54.9k | compareWithScalarFnName); |
1464 | 28 | return I != VectorDescs.end() && StringRef(I->ScalarFnName) == funcName; |
1465 | 54.9k | } |
1466 | | |
1467 | | StringRef TargetLibraryInfoImpl::getVectorizedFunction(StringRef F, |
1468 | 1.01k | unsigned VF) const { |
1469 | 1.01k | F = sanitizeFunctionName(F); |
1470 | 1.01k | if (F.empty()) |
1471 | 0 | return F; |
1472 | 1.01k | std::vector<VecDesc>::const_iterator I = std::lower_bound( |
1473 | 1.01k | VectorDescs.begin(), VectorDescs.end(), F, compareWithScalarFnName); |
1474 | 1.15k | while (I != VectorDescs.end() && 1.15k StringRef(I->ScalarFnName) == F384 ) { |
1475 | 326 | if (I->VectorizationFactor == VF) |
1476 | 188 | return I->VectorFnName; |
1477 | 138 | ++I; |
1478 | 138 | } |
1479 | 829 | return StringRef(); |
1480 | 1.01k | } |
1481 | | |
1482 | | StringRef TargetLibraryInfoImpl::getScalarizedFunction(StringRef F, |
1483 | 0 | unsigned &VF) const { |
1484 | 0 | F = sanitizeFunctionName(F); |
1485 | 0 | if (F.empty()) |
1486 | 0 | return F; |
1487 | 0 |
|
1488 | 0 | std::vector<VecDesc>::const_iterator I = std::lower_bound( |
1489 | 0 | ScalarDescs.begin(), ScalarDescs.end(), F, compareWithVectorFnName); |
1490 | 0 | if (I == VectorDescs.end() || 0 StringRef(I->VectorFnName) != F0 ) |
1491 | 0 | return StringRef(); |
1492 | 0 | VF = I->VectorizationFactor; |
1493 | 0 | return I->ScalarFnName; |
1494 | 0 | } |
1495 | | |
1496 | | TargetLibraryInfo TargetLibraryAnalysis::run(Module &M, |
1497 | 242 | ModuleAnalysisManager &) { |
1498 | 242 | if (PresetInfoImpl) |
1499 | 19 | return TargetLibraryInfo(*PresetInfoImpl); |
1500 | 223 | |
1501 | 223 | return TargetLibraryInfo(lookupInfoImpl(Triple(M.getTargetTriple()))); |
1502 | 223 | } |
1503 | | |
1504 | | TargetLibraryInfo TargetLibraryAnalysis::run(Function &F, |
1505 | 1.84k | FunctionAnalysisManager &) { |
1506 | 1.84k | if (PresetInfoImpl) |
1507 | 197 | return TargetLibraryInfo(*PresetInfoImpl); |
1508 | 1.64k | |
1509 | 1.64k | return TargetLibraryInfo( |
1510 | 1.64k | lookupInfoImpl(Triple(F.getParent()->getTargetTriple()))); |
1511 | 1.64k | } |
1512 | | |
1513 | 1.86k | TargetLibraryInfoImpl &TargetLibraryAnalysis::lookupInfoImpl(const Triple &T) { |
1514 | 1.86k | std::unique_ptr<TargetLibraryInfoImpl> &Impl = |
1515 | 1.86k | Impls[T.normalize()]; |
1516 | 1.86k | if (!Impl) |
1517 | 739 | Impl.reset(new TargetLibraryInfoImpl(T)); |
1518 | 1.86k | |
1519 | 1.86k | return *Impl; |
1520 | 1.86k | } |
1521 | | |
1522 | 99 | unsigned TargetLibraryInfoImpl::getWCharSize(const Module &M) const { |
1523 | 99 | if (auto *ShortWChar = cast_or_null<ConstantAsMetadata>( |
1524 | 99 | M.getModuleFlag("wchar_size"))) |
1525 | 98 | return cast<ConstantInt>(ShortWChar->getValue())->getZExtValue(); |
1526 | 1 | return 0; |
1527 | 1 | } |
1528 | | |
1529 | | TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass() |
1530 | 1.41k | : ImmutablePass(ID), TLIImpl(), TLI(TLIImpl) { |
1531 | 1.41k | initializeTargetLibraryInfoWrapperPassPass(*PassRegistry::getPassRegistry()); |
1532 | 1.41k | } |
1533 | | |
1534 | | TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass(const Triple &T) |
1535 | 0 | : ImmutablePass(ID), TLIImpl(T), TLI(TLIImpl) { |
1536 | 0 | initializeTargetLibraryInfoWrapperPassPass(*PassRegistry::getPassRegistry()); |
1537 | 0 | } |
1538 | | |
1539 | | TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass( |
1540 | | const TargetLibraryInfoImpl &TLIImpl) |
1541 | 84.6k | : ImmutablePass(ID), TLIImpl(TLIImpl), TLI(this->TLIImpl) { |
1542 | 84.6k | initializeTargetLibraryInfoWrapperPassPass(*PassRegistry::getPassRegistry()); |
1543 | 84.6k | } |
1544 | | |
1545 | | AnalysisKey TargetLibraryAnalysis::Key; |
1546 | | |
1547 | | // Register the basic pass. |
1548 | | INITIALIZE_PASS(TargetLibraryInfoWrapperPass, "targetlibinfo", |
1549 | | "Target Library Information", false, true) |
1550 | | char TargetLibraryInfoWrapperPass::ID = 0; |
1551 | | |
1552 | 0 | void TargetLibraryInfoWrapperPass::anchor() {} |