LLVM API Documentation
00001 //===-- llvm/Target/TargetLibraryInfo.h - Library information ---*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 00010 #ifndef LLVM_TARGET_TARGETLIBRARYINFO_H 00011 #define LLVM_TARGET_TARGETLIBRARYINFO_H 00012 00013 #include "llvm/ADT/DenseMap.h" 00014 #include "llvm/Pass.h" 00015 00016 namespace llvm { 00017 class Triple; 00018 00019 namespace LibFunc { 00020 enum Func { 00021 /// int _IO_getc(_IO_FILE * __fp); 00022 under_IO_getc, 00023 /// int _IO_putc(int __c, _IO_FILE * __fp); 00024 under_IO_putc, 00025 /// void operator delete[](void*); 00026 ZdaPv, 00027 /// void operator delete(void*); 00028 ZdlPv, 00029 /// void *new[](unsigned int); 00030 Znaj, 00031 /// void *new[](unsigned int, nothrow); 00032 ZnajRKSt9nothrow_t, 00033 /// void *new[](unsigned long); 00034 Znam, 00035 /// void *new[](unsigned long, nothrow); 00036 ZnamRKSt9nothrow_t, 00037 /// void *new(unsigned int); 00038 Znwj, 00039 /// void *new(unsigned int, nothrow); 00040 ZnwjRKSt9nothrow_t, 00041 /// void *new(unsigned long); 00042 Znwm, 00043 /// void *new(unsigned long, nothrow); 00044 ZnwmRKSt9nothrow_t, 00045 /// int __cxa_atexit(void (*f)(void *), void *p, void *d); 00046 cxa_atexit, 00047 /// void __cxa_guard_abort(guard_t *guard); 00048 /// guard_t is int64_t in Itanium ABI or int32_t on ARM eabi. 00049 cxa_guard_abort, 00050 /// int __cxa_guard_acquire(guard_t *guard); 00051 cxa_guard_acquire, 00052 /// void __cxa_guard_release(guard_t *guard); 00053 cxa_guard_release, 00054 /// int __isoc99_scanf (const char *format, ...) 00055 dunder_isoc99_scanf, 00056 /// int __isoc99_sscanf(const char *s, const char *format, ...) 00057 dunder_isoc99_sscanf, 00058 /// void *__memcpy_chk(void *s1, const void *s2, size_t n, size_t s1size); 00059 memcpy_chk, 00060 /// char * __strdup(const char *s); 00061 dunder_strdup, 00062 /// char *__strndup(const char *s, size_t n); 00063 dunder_strndup, 00064 /// char * __strtok_r(char *s, const char *delim, char **save_ptr); 00065 dunder_strtok_r, 00066 /// int abs(int j); 00067 abs, 00068 /// int access(const char *path, int amode); 00069 access, 00070 /// double acos(double x); 00071 acos, 00072 /// float acosf(float x); 00073 acosf, 00074 /// double acosh(double x); 00075 acosh, 00076 /// float acoshf(float x); 00077 acoshf, 00078 /// long double acoshl(long double x); 00079 acoshl, 00080 /// long double acosl(long double x); 00081 acosl, 00082 /// double asin(double x); 00083 asin, 00084 /// float asinf(float x); 00085 asinf, 00086 /// double asinh(double x); 00087 asinh, 00088 /// float asinhf(float x); 00089 asinhf, 00090 /// long double asinhl(long double x); 00091 asinhl, 00092 /// long double asinl(long double x); 00093 asinl, 00094 /// double atan(double x); 00095 atan, 00096 /// double atan2(double y, double x); 00097 atan2, 00098 /// float atan2f(float y, float x); 00099 atan2f, 00100 /// long double atan2l(long double y, long double x); 00101 atan2l, 00102 /// float atanf(float x); 00103 atanf, 00104 /// double atanh(double x); 00105 atanh, 00106 /// float atanhf(float x); 00107 atanhf, 00108 /// long double atanhl(long double x); 00109 atanhl, 00110 /// long double atanl(long double x); 00111 atanl, 00112 /// double atof(const char *str); 00113 atof, 00114 /// int atoi(const char *str); 00115 atoi, 00116 /// long atol(const char *str); 00117 atol, 00118 /// long long atoll(const char *nptr); 00119 atoll, 00120 /// int bcmp(const void *s1, const void *s2, size_t n); 00121 bcmp, 00122 /// void bcopy(const void *s1, void *s2, size_t n); 00123 bcopy, 00124 /// void bzero(void *s, size_t n); 00125 bzero, 00126 /// void *calloc(size_t count, size_t size); 00127 calloc, 00128 /// double cbrt(double x); 00129 cbrt, 00130 /// float cbrtf(float x); 00131 cbrtf, 00132 /// long double cbrtl(long double x); 00133 cbrtl, 00134 /// double ceil(double x); 00135 ceil, 00136 /// float ceilf(float x); 00137 ceilf, 00138 /// long double ceill(long double x); 00139 ceill, 00140 /// int chmod(const char *path, mode_t mode); 00141 chmod, 00142 /// int chown(const char *path, uid_t owner, gid_t group); 00143 chown, 00144 /// void clearerr(FILE *stream); 00145 clearerr, 00146 /// int closedir(DIR *dirp); 00147 closedir, 00148 /// double copysign(double x, double y); 00149 copysign, 00150 /// float copysignf(float x, float y); 00151 copysignf, 00152 /// long double copysignl(long double x, long double y); 00153 copysignl, 00154 /// double cos(double x); 00155 cos, 00156 /// float cosf(float x); 00157 cosf, 00158 /// double cosh(double x); 00159 cosh, 00160 /// float coshf(float x); 00161 coshf, 00162 /// long double coshl(long double x); 00163 coshl, 00164 /// long double cosl(long double x); 00165 cosl, 00166 /// char *ctermid(char *s); 00167 ctermid, 00168 /// double exp(double x); 00169 exp, 00170 /// double exp10(double x); 00171 exp10, 00172 /// float exp10f(float x); 00173 exp10f, 00174 /// long double exp10l(long double x); 00175 exp10l, 00176 /// double exp2(double x); 00177 exp2, 00178 /// float exp2f(float x); 00179 exp2f, 00180 /// long double exp2l(long double x); 00181 exp2l, 00182 /// float expf(float x); 00183 expf, 00184 /// long double expl(long double x); 00185 expl, 00186 /// double expm1(double x); 00187 expm1, 00188 /// float expm1f(float x); 00189 expm1f, 00190 /// long double expm1l(long double x); 00191 expm1l, 00192 /// double fabs(double x); 00193 fabs, 00194 /// float fabsf(float x); 00195 fabsf, 00196 /// long double fabsl(long double x); 00197 fabsl, 00198 /// int fclose(FILE *stream); 00199 fclose, 00200 /// FILE *fdopen(int fildes, const char *mode); 00201 fdopen, 00202 /// int feof(FILE *stream); 00203 feof, 00204 /// int ferror(FILE *stream); 00205 ferror, 00206 /// int fflush(FILE *stream); 00207 fflush, 00208 /// int ffs(int i); 00209 ffs, 00210 /// int ffsl(long int i); 00211 ffsl, 00212 /// int ffsll(long long int i); 00213 ffsll, 00214 /// int fgetc(FILE *stream); 00215 fgetc, 00216 /// int fgetpos(FILE *stream, fpos_t *pos); 00217 fgetpos, 00218 /// char *fgets(char *s, int n, FILE *stream); 00219 fgets, 00220 /// int fileno(FILE *stream); 00221 fileno, 00222 /// int fiprintf(FILE *stream, const char *format, ...); 00223 fiprintf, 00224 /// void flockfile(FILE *file); 00225 flockfile, 00226 /// double floor(double x); 00227 floor, 00228 /// float floorf(float x); 00229 floorf, 00230 /// long double floorl(long double x); 00231 floorl, 00232 /// double fmod(double x, double y); 00233 fmod, 00234 /// float fmodf(float x, float y); 00235 fmodf, 00236 /// long double fmodl(long double x, long double y); 00237 fmodl, 00238 /// FILE *fopen(const char *filename, const char *mode); 00239 fopen, 00240 /// FILE *fopen64(const char *filename, const char *opentype) 00241 fopen64, 00242 /// int fprintf(FILE *stream, const char *format, ...); 00243 fprintf, 00244 /// int fputc(int c, FILE *stream); 00245 fputc, 00246 /// int fputs(const char *s, FILE *stream); 00247 fputs, 00248 /// size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream); 00249 fread, 00250 /// void free(void *ptr); 00251 free, 00252 /// double frexp(double num, int *exp); 00253 frexp, 00254 /// float frexpf(float num, int *exp); 00255 frexpf, 00256 /// long double frexpl(long double num, int *exp); 00257 frexpl, 00258 /// int fscanf(FILE *stream, const char *format, ... ); 00259 fscanf, 00260 /// int fseek(FILE *stream, long offset, int whence); 00261 fseek, 00262 /// int fseeko(FILE *stream, off_t offset, int whence); 00263 fseeko, 00264 /// int fseeko64(FILE *stream, off64_t offset, int whence) 00265 fseeko64, 00266 /// int fsetpos(FILE *stream, const fpos_t *pos); 00267 fsetpos, 00268 /// int fstat(int fildes, struct stat *buf); 00269 fstat, 00270 /// int fstat64(int filedes, struct stat64 *buf) 00271 fstat64, 00272 /// int fstatvfs(int fildes, struct statvfs *buf); 00273 fstatvfs, 00274 /// int fstatvfs64(int fildes, struct statvfs64 *buf); 00275 fstatvfs64, 00276 /// long ftell(FILE *stream); 00277 ftell, 00278 /// off_t ftello(FILE *stream); 00279 ftello, 00280 /// off64_t ftello64(FILE *stream) 00281 ftello64, 00282 /// int ftrylockfile(FILE *file); 00283 ftrylockfile, 00284 /// void funlockfile(FILE *file); 00285 funlockfile, 00286 /// size_t fwrite(const void *ptr, size_t size, size_t nitems, 00287 /// FILE *stream); 00288 fwrite, 00289 /// int getc(FILE *stream); 00290 getc, 00291 /// int getc_unlocked(FILE *stream); 00292 getc_unlocked, 00293 /// int getchar(void); 00294 getchar, 00295 /// char *getenv(const char *name); 00296 getenv, 00297 /// int getitimer(int which, struct itimerval *value); 00298 getitimer, 00299 /// int getlogin_r(char *name, size_t namesize); 00300 getlogin_r, 00301 /// struct passwd *getpwnam(const char *name); 00302 getpwnam, 00303 /// char *gets(char *s); 00304 gets, 00305 /// uint32_t htonl(uint32_t hostlong); 00306 htonl, 00307 /// uint16_t htons(uint16_t hostshort); 00308 htons, 00309 /// int iprintf(const char *format, ...); 00310 iprintf, 00311 /// int isascii(int c); 00312 isascii, 00313 /// int isdigit(int c); 00314 isdigit, 00315 /// long int labs(long int j); 00316 labs, 00317 /// int lchown(const char *path, uid_t owner, gid_t group); 00318 lchown, 00319 /// long long int llabs(long long int j); 00320 llabs, 00321 /// double log(double x); 00322 log, 00323 /// double log10(double x); 00324 log10, 00325 /// float log10f(float x); 00326 log10f, 00327 /// long double log10l(long double x); 00328 log10l, 00329 /// double log1p(double x); 00330 log1p, 00331 /// float log1pf(float x); 00332 log1pf, 00333 /// long double log1pl(long double x); 00334 log1pl, 00335 /// double log2(double x); 00336 log2, 00337 /// float log2f(float x); 00338 log2f, 00339 /// double long double log2l(long double x); 00340 log2l, 00341 /// double logb(double x); 00342 logb, 00343 /// float logbf(float x); 00344 logbf, 00345 /// long double logbl(long double x); 00346 logbl, 00347 /// float logf(float x); 00348 logf, 00349 /// long double logl(long double x); 00350 logl, 00351 /// int lstat(const char *path, struct stat *buf); 00352 lstat, 00353 /// int lstat64(const char *path, struct stat64 *buf); 00354 lstat64, 00355 /// void *malloc(size_t size); 00356 malloc, 00357 /// void *memalign(size_t boundary, size_t size); 00358 memalign, 00359 /// void *memccpy(void *s1, const void *s2, int c, size_t n); 00360 memccpy, 00361 /// void *memchr(const void *s, int c, size_t n); 00362 memchr, 00363 /// int memcmp(const void *s1, const void *s2, size_t n); 00364 memcmp, 00365 /// void *memcpy(void *s1, const void *s2, size_t n); 00366 memcpy, 00367 /// void *memmove(void *s1, const void *s2, size_t n); 00368 memmove, 00369 // void *memrchr(const void *s, int c, size_t n); 00370 memrchr, 00371 /// void *memset(void *b, int c, size_t len); 00372 memset, 00373 /// void memset_pattern16(void *b, const void *pattern16, size_t len); 00374 memset_pattern16, 00375 /// int mkdir(const char *path, mode_t mode); 00376 mkdir, 00377 /// time_t mktime(struct tm *timeptr); 00378 mktime, 00379 /// double modf(double x, double *iptr); 00380 modf, 00381 /// float modff(float, float *iptr); 00382 modff, 00383 /// long double modfl(long double value, long double *iptr); 00384 modfl, 00385 /// double nearbyint(double x); 00386 nearbyint, 00387 /// float nearbyintf(float x); 00388 nearbyintf, 00389 /// long double nearbyintl(long double x); 00390 nearbyintl, 00391 /// uint32_t ntohl(uint32_t netlong); 00392 ntohl, 00393 /// uint16_t ntohs(uint16_t netshort); 00394 ntohs, 00395 /// int open(const char *path, int oflag, ... ); 00396 open, 00397 /// int open64(const char *filename, int flags[, mode_t mode]) 00398 open64, 00399 /// DIR *opendir(const char *dirname); 00400 opendir, 00401 /// int pclose(FILE *stream); 00402 pclose, 00403 /// void perror(const char *s); 00404 perror, 00405 /// FILE *popen(const char *command, const char *mode); 00406 popen, 00407 /// int posix_memalign(void **memptr, size_t alignment, size_t size); 00408 posix_memalign, 00409 /// double pow(double x, double y); 00410 pow, 00411 /// float powf(float x, float y); 00412 powf, 00413 /// long double powl(long double x, long double y); 00414 powl, 00415 /// ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset); 00416 pread, 00417 /// int printf(const char *format, ...); 00418 printf, 00419 /// int putc(int c, FILE *stream); 00420 putc, 00421 /// int putchar(int c); 00422 putchar, 00423 /// int puts(const char *s); 00424 puts, 00425 /// ssize_t pwrite(int fildes, const void *buf, size_t nbyte, 00426 /// off_t offset); 00427 pwrite, 00428 /// void qsort(void *base, size_t nel, size_t width, 00429 /// int (*compar)(const void *, const void *)); 00430 qsort, 00431 /// ssize_t read(int fildes, void *buf, size_t nbyte); 00432 read, 00433 /// ssize_t readlink(const char *path, char *buf, size_t bufsize); 00434 readlink, 00435 /// void *realloc(void *ptr, size_t size); 00436 realloc, 00437 /// void *reallocf(void *ptr, size_t size); 00438 reallocf, 00439 /// char *realpath(const char *file_name, char *resolved_name); 00440 realpath, 00441 /// int remove(const char *path); 00442 remove, 00443 /// int rename(const char *old, const char *new); 00444 rename, 00445 /// void rewind(FILE *stream); 00446 rewind, 00447 /// double rint(double x); 00448 rint, 00449 /// float rintf(float x); 00450 rintf, 00451 /// long double rintl(long double x); 00452 rintl, 00453 /// int rmdir(const char *path); 00454 rmdir, 00455 /// double round(double x); 00456 round, 00457 /// float roundf(float x); 00458 roundf, 00459 /// long double roundl(long double x); 00460 roundl, 00461 /// int scanf(const char *restrict format, ... ); 00462 scanf, 00463 /// void setbuf(FILE *stream, char *buf); 00464 setbuf, 00465 /// int setitimer(int which, const struct itimerval *value, 00466 /// struct itimerval *ovalue); 00467 setitimer, 00468 /// int setvbuf(FILE *stream, char *buf, int type, size_t size); 00469 setvbuf, 00470 /// double sin(double x); 00471 sin, 00472 /// float sinf(float x); 00473 sinf, 00474 /// double sinh(double x); 00475 sinh, 00476 /// float sinhf(float x); 00477 sinhf, 00478 /// long double sinhl(long double x); 00479 sinhl, 00480 /// long double sinl(long double x); 00481 sinl, 00482 /// int siprintf(char *str, const char *format, ...); 00483 siprintf, 00484 /// int snprintf(char *s, size_t n, const char *format, ...); 00485 snprintf, 00486 /// int sprintf(char *str, const char *format, ...); 00487 sprintf, 00488 /// double sqrt(double x); 00489 sqrt, 00490 /// float sqrtf(float x); 00491 sqrtf, 00492 /// long double sqrtl(long double x); 00493 sqrtl, 00494 /// int sscanf(const char *s, const char *format, ... ); 00495 sscanf, 00496 /// int stat(const char *path, struct stat *buf); 00497 stat, 00498 /// int stat64(const char *path, struct stat64 *buf); 00499 stat64, 00500 /// int statvfs(const char *path, struct statvfs *buf); 00501 statvfs, 00502 /// int statvfs64(const char *path, struct statvfs64 *buf) 00503 statvfs64, 00504 /// char *stpcpy(char *s1, const char *s2); 00505 stpcpy, 00506 /// char *stpncpy(char *s1, const char *s2, size_t n); 00507 stpncpy, 00508 /// int strcasecmp(const char *s1, const char *s2); 00509 strcasecmp, 00510 /// char *strcat(char *s1, const char *s2); 00511 strcat, 00512 /// char *strchr(const char *s, int c); 00513 strchr, 00514 /// int strcmp(const char *s1, const char *s2); 00515 strcmp, 00516 /// int strcoll(const char *s1, const char *s2); 00517 strcoll, 00518 /// char *strcpy(char *s1, const char *s2); 00519 strcpy, 00520 /// size_t strcspn(const char *s1, const char *s2); 00521 strcspn, 00522 /// char *strdup(const char *s1); 00523 strdup, 00524 /// size_t strlen(const char *s); 00525 strlen, 00526 /// int strncasecmp(const char *s1, const char *s2, size_t n); 00527 strncasecmp, 00528 /// char *strncat(char *s1, const char *s2, size_t n); 00529 strncat, 00530 /// int strncmp(const char *s1, const char *s2, size_t n); 00531 strncmp, 00532 /// char *strncpy(char *s1, const char *s2, size_t n); 00533 strncpy, 00534 /// char *strndup(const char *s1, size_t n); 00535 strndup, 00536 /// size_t strnlen(const char *s, size_t maxlen); 00537 strnlen, 00538 /// char *strpbrk(const char *s1, const char *s2); 00539 strpbrk, 00540 /// char *strrchr(const char *s, int c); 00541 strrchr, 00542 /// size_t strspn(const char *s1, const char *s2); 00543 strspn, 00544 /// char *strstr(const char *s1, const char *s2); 00545 strstr, 00546 /// double strtod(const char *nptr, char **endptr); 00547 strtod, 00548 /// float strtof(const char *nptr, char **endptr); 00549 strtof, 00550 // char *strtok(char *s1, const char *s2); 00551 strtok, 00552 // char *strtok_r(char *s, const char *sep, char **lasts); 00553 strtok_r, 00554 /// long int strtol(const char *nptr, char **endptr, int base); 00555 strtol, 00556 /// long double strtold(const char *nptr, char **endptr); 00557 strtold, 00558 /// long long int strtoll(const char *nptr, char **endptr, int base); 00559 strtoll, 00560 /// unsigned long int strtoul(const char *nptr, char **endptr, int base); 00561 strtoul, 00562 /// unsigned long long int strtoull(const char *nptr, char **endptr, 00563 /// int base); 00564 strtoull, 00565 /// size_t strxfrm(char *s1, const char *s2, size_t n); 00566 strxfrm, 00567 /// int system(const char *command); 00568 system, 00569 /// double tan(double x); 00570 tan, 00571 /// float tanf(float x); 00572 tanf, 00573 /// double tanh(double x); 00574 tanh, 00575 /// float tanhf(float x); 00576 tanhf, 00577 /// long double tanhl(long double x); 00578 tanhl, 00579 /// long double tanl(long double x); 00580 tanl, 00581 /// clock_t times(struct tms *buffer); 00582 times, 00583 /// FILE *tmpfile(void); 00584 tmpfile, 00585 /// FILE *tmpfile64(void) 00586 tmpfile64, 00587 /// int toascii(int c); 00588 toascii, 00589 /// double trunc(double x); 00590 trunc, 00591 /// float truncf(float x); 00592 truncf, 00593 /// long double truncl(long double x); 00594 truncl, 00595 /// int uname(struct utsname *name); 00596 uname, 00597 /// int ungetc(int c, FILE *stream); 00598 ungetc, 00599 /// int unlink(const char *path); 00600 unlink, 00601 /// int unsetenv(const char *name); 00602 unsetenv, 00603 /// int utime(const char *path, const struct utimbuf *times); 00604 utime, 00605 /// int utimes(const char *path, const struct timeval times[2]); 00606 utimes, 00607 /// void *valloc(size_t size); 00608 valloc, 00609 /// int vfprintf(FILE *stream, const char *format, va_list ap); 00610 vfprintf, 00611 /// int vfscanf(FILE *stream, const char *format, va_list arg); 00612 vfscanf, 00613 /// int vprintf(const char *restrict format, va_list ap); 00614 vprintf, 00615 /// int vscanf(const char *format, va_list arg); 00616 vscanf, 00617 /// int vsnprintf(char *s, size_t n, const char *format, va_list ap); 00618 vsnprintf, 00619 /// int vsprintf(char *s, const char *format, va_list ap); 00620 vsprintf, 00621 /// int vsscanf(const char *s, const char *format, va_list arg); 00622 vsscanf, 00623 /// ssize_t write(int fildes, const void *buf, size_t nbyte); 00624 write, 00625 00626 NumLibFuncs 00627 }; 00628 } 00629 00630 /// TargetLibraryInfo - This immutable pass captures information about what 00631 /// library functions are available for the current target, and allows a 00632 /// frontend to disable optimizations through -fno-builtin etc. 00633 class TargetLibraryInfo : public ImmutablePass { 00634 virtual void anchor(); 00635 unsigned char AvailableArray[(LibFunc::NumLibFuncs+3)/4]; 00636 llvm::DenseMap<unsigned, std::string> CustomNames; 00637 static const char* StandardNames[LibFunc::NumLibFuncs]; 00638 00639 enum AvailabilityState { 00640 StandardName = 3, // (memset to all ones) 00641 CustomName = 1, 00642 Unavailable = 0 // (memset to all zeros) 00643 }; 00644 void setState(LibFunc::Func F, AvailabilityState State) { 00645 AvailableArray[F/4] &= ~(3 << 2*(F&3)); 00646 AvailableArray[F/4] |= State << 2*(F&3); 00647 } 00648 AvailabilityState getState(LibFunc::Func F) const { 00649 return static_cast<AvailabilityState>((AvailableArray[F/4] >> 2*(F&3)) & 3); 00650 } 00651 00652 public: 00653 static char ID; 00654 TargetLibraryInfo(); 00655 TargetLibraryInfo(const Triple &T); 00656 explicit TargetLibraryInfo(const TargetLibraryInfo &TLI); 00657 00658 /// getLibFunc - Search for a particular function name. If it is one of the 00659 /// known library functions, return true and set F to the corresponding value. 00660 bool getLibFunc(StringRef funcName, LibFunc::Func &F) const; 00661 00662 /// has - This function is used by optimizations that want to match on or form 00663 /// a given library function. 00664 bool has(LibFunc::Func F) const { 00665 return getState(F) != Unavailable; 00666 } 00667 00668 /// hasOptimizedCodeGen - Return true if the function is both available as 00669 /// a builtin and a candidate for optimized code generation. 00670 bool hasOptimizedCodeGen(LibFunc::Func F) const { 00671 if (getState(F) == Unavailable) 00672 return false; 00673 switch (F) { 00674 default: break; 00675 case LibFunc::copysign: case LibFunc::copysignf: case LibFunc::copysignl: 00676 case LibFunc::fabs: case LibFunc::fabsf: case LibFunc::fabsl: 00677 case LibFunc::sin: case LibFunc::sinf: case LibFunc::sinl: 00678 case LibFunc::cos: case LibFunc::cosf: case LibFunc::cosl: 00679 case LibFunc::sqrt: case LibFunc::sqrtf: case LibFunc::sqrtl: 00680 case LibFunc::floor: case LibFunc::floorf: case LibFunc::floorl: 00681 case LibFunc::nearbyint: case LibFunc::nearbyintf: case LibFunc::nearbyintl: 00682 case LibFunc::ceil: case LibFunc::ceilf: case LibFunc::ceill: 00683 case LibFunc::rint: case LibFunc::rintf: case LibFunc::rintl: 00684 case LibFunc::trunc: case LibFunc::truncf: case LibFunc::truncl: 00685 case LibFunc::log2: case LibFunc::log2f: case LibFunc::log2l: 00686 case LibFunc::exp2: case LibFunc::exp2f: case LibFunc::exp2l: 00687 case LibFunc::memcmp: 00688 return true; 00689 } 00690 return false; 00691 } 00692 00693 StringRef getName(LibFunc::Func F) const { 00694 AvailabilityState State = getState(F); 00695 if (State == Unavailable) 00696 return StringRef(); 00697 if (State == StandardName) 00698 return StandardNames[F]; 00699 assert(State == CustomName); 00700 return CustomNames.find(F)->second; 00701 } 00702 00703 /// setUnavailable - this can be used by whatever sets up TargetLibraryInfo to 00704 /// ban use of specific library functions. 00705 void setUnavailable(LibFunc::Func F) { 00706 setState(F, Unavailable); 00707 } 00708 00709 void setAvailable(LibFunc::Func F) { 00710 setState(F, StandardName); 00711 } 00712 00713 void setAvailableWithName(LibFunc::Func F, StringRef Name) { 00714 if (StandardNames[F] != Name) { 00715 setState(F, CustomName); 00716 CustomNames[F] = Name; 00717 assert(CustomNames.find(F) != CustomNames.end()); 00718 } else { 00719 setState(F, StandardName); 00720 } 00721 } 00722 00723 /// disableAllFunctions - This disables all builtins, which is used for 00724 /// options like -fno-builtin. 00725 void disableAllFunctions(); 00726 }; 00727 00728 } // end namespace llvm 00729 00730 #endif