1//===-- llvm/Target/TargetLibraryInfo.h - Library information ---*- C++ -*-===// 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#ifndef LLVM_TARGET_TARGETLIBRARYINFO_H 11#define LLVM_TARGET_TARGETLIBRARYINFO_H 12 13#include "llvm/ADT/DenseMap.h" 14#include "llvm/Pass.h" 15 16namespace llvm { 17 class Triple; 18 19 namespace LibFunc { 20 enum Func { 21 /// int _IO_getc(_IO_FILE * __fp); 22 under_IO_getc, 23 /// int _IO_putc(int __c, _IO_FILE * __fp); 24 under_IO_putc, 25 /// void operator delete[](void*); 26 ZdaPv, 27 /// void operator delete[](void*, nothrow); 28 ZdaPvRKSt9nothrow_t, 29 /// void operator delete(void*); 30 ZdlPv, 31 /// void operator delete(void*, nothrow); 32 ZdlPvRKSt9nothrow_t, 33 /// void *new[](unsigned int); 34 Znaj, 35 /// void *new[](unsigned int, nothrow); 36 ZnajRKSt9nothrow_t, 37 /// void *new[](unsigned long); 38 Znam, 39 /// void *new[](unsigned long, nothrow); 40 ZnamRKSt9nothrow_t, 41 /// void *new(unsigned int); 42 Znwj, 43 /// void *new(unsigned int, nothrow); 44 ZnwjRKSt9nothrow_t, 45 /// void *new(unsigned long); 46 Znwm, 47 /// void *new(unsigned long, nothrow); 48 ZnwmRKSt9nothrow_t, 49 /// double __cospi(double x); 50 cospi, 51 /// float __cospif(float x); 52 cospif, 53 /// int __cxa_atexit(void (*f)(void *), void *p, void *d); 54 cxa_atexit, 55 /// void __cxa_guard_abort(guard_t *guard); 56 /// guard_t is int64_t in Itanium ABI or int32_t on ARM eabi. 57 cxa_guard_abort, 58 /// int __cxa_guard_acquire(guard_t *guard); 59 cxa_guard_acquire, 60 /// void __cxa_guard_release(guard_t *guard); 61 cxa_guard_release, 62 /// int __isoc99_scanf (const char *format, ...) 63 dunder_isoc99_scanf, 64 /// int __isoc99_sscanf(const char *s, const char *format, ...) 65 dunder_isoc99_sscanf, 66 /// void *__memcpy_chk(void *s1, const void *s2, size_t n, size_t s1size); 67 memcpy_chk, 68 /// double __sincospi_stret(double x); 69 sincospi_stret, 70 /// float __sincospi_stretf(float x); 71 sincospi_stretf, 72 /// double __sinpi(double x); 73 sinpi, 74 /// float __sinpif(float x); 75 sinpif, 76 /// double __sqrt_finite(double x); 77 sqrt_finite, 78 /// float __sqrt_finite(float x); 79 sqrtf_finite, 80 /// long double __sqrt_finite(long double x); 81 sqrtl_finite, 82 /// char * __strdup(const char *s); 83 dunder_strdup, 84 /// char *__strndup(const char *s, size_t n); 85 dunder_strndup, 86 /// char * __strtok_r(char *s, const char *delim, char **save_ptr); 87 dunder_strtok_r, 88 /// int abs(int j); 89 abs, 90 /// int access(const char *path, int amode); 91 access, 92 /// double acos(double x); 93 acos, 94 /// float acosf(float x); 95 acosf, 96 /// double acosh(double x); 97 acosh, 98 /// float acoshf(float x); 99 acoshf, 100 /// long double acoshl(long double x); 101 acoshl, 102 /// long double acosl(long double x); 103 acosl, 104 /// double asin(double x); 105 asin, 106 /// float asinf(float x); 107 asinf, 108 /// double asinh(double x); 109 asinh, 110 /// float asinhf(float x); 111 asinhf, 112 /// long double asinhl(long double x); 113 asinhl, 114 /// long double asinl(long double x); 115 asinl, 116 /// double atan(double x); 117 atan, 118 /// double atan2(double y, double x); 119 atan2, 120 /// float atan2f(float y, float x); 121 atan2f, 122 /// long double atan2l(long double y, long double x); 123 atan2l, 124 /// float atanf(float x); 125 atanf, 126 /// double atanh(double x); 127 atanh, 128 /// float atanhf(float x); 129 atanhf, 130 /// long double atanhl(long double x); 131 atanhl, 132 /// long double atanl(long double x); 133 atanl, 134 /// double atof(const char *str); 135 atof, 136 /// int atoi(const char *str); 137 atoi, 138 /// long atol(const char *str); 139 atol, 140 /// long long atoll(const char *nptr); 141 atoll, 142 /// int bcmp(const void *s1, const void *s2, size_t n); 143 bcmp, 144 /// void bcopy(const void *s1, void *s2, size_t n); 145 bcopy, 146 /// void bzero(void *s, size_t n); 147 bzero, 148 /// void *calloc(size_t count, size_t size); 149 calloc, 150 /// double cbrt(double x); 151 cbrt, 152 /// float cbrtf(float x); 153 cbrtf, 154 /// long double cbrtl(long double x); 155 cbrtl, 156 /// double ceil(double x); 157 ceil, 158 /// float ceilf(float x); 159 ceilf, 160 /// long double ceill(long double x); 161 ceill, 162 /// int chmod(const char *path, mode_t mode); 163 chmod, 164 /// int chown(const char *path, uid_t owner, gid_t group); 165 chown, 166 /// void clearerr(FILE *stream); 167 clearerr, 168 /// int closedir(DIR *dirp); 169 closedir, 170 /// double copysign(double x, double y); 171 copysign, 172 /// float copysignf(float x, float y); 173 copysignf, 174 /// long double copysignl(long double x, long double y); 175 copysignl, 176 /// double cos(double x); 177 cos, 178 /// float cosf(float x); 179 cosf, 180 /// double cosh(double x); 181 cosh, 182 /// float coshf(float x); 183 coshf, 184 /// long double coshl(long double x); 185 coshl, 186 /// long double cosl(long double x); 187 cosl, 188 /// char *ctermid(char *s); 189 ctermid, 190 /// double exp(double x); 191 exp, 192 /// double exp10(double x); 193 exp10, 194 /// float exp10f(float x); 195 exp10f, 196 /// long double exp10l(long double x); 197 exp10l, 198 /// double exp2(double x); 199 exp2, 200 /// float exp2f(float x); 201 exp2f, 202 /// long double exp2l(long double x); 203 exp2l, 204 /// float expf(float x); 205 expf, 206 /// long double expl(long double x); 207 expl, 208 /// double expm1(double x); 209 expm1, 210 /// float expm1f(float x); 211 expm1f, 212 /// long double expm1l(long double x); 213 expm1l, 214 /// double fabs(double x); 215 fabs, 216 /// float fabsf(float x); 217 fabsf, 218 /// long double fabsl(long double x); 219 fabsl, 220 /// int fclose(FILE *stream); 221 fclose, 222 /// FILE *fdopen(int fildes, const char *mode); 223 fdopen, 224 /// int feof(FILE *stream); 225 feof, 226 /// int ferror(FILE *stream); 227 ferror, 228 /// int fflush(FILE *stream); 229 fflush, 230 /// int ffs(int i); 231 ffs, 232 /// int ffsl(long int i); 233 ffsl, 234 /// int ffsll(long long int i); 235 ffsll, 236 /// int fgetc(FILE *stream); 237 fgetc, 238 /// int fgetpos(FILE *stream, fpos_t *pos); 239 fgetpos, 240 /// char *fgets(char *s, int n, FILE *stream); 241 fgets, 242 /// int fileno(FILE *stream); 243 fileno, 244 /// int fiprintf(FILE *stream, const char *format, ...); 245 fiprintf, 246 /// void flockfile(FILE *file); 247 flockfile, 248 /// double floor(double x); 249 floor, 250 /// float floorf(float x); 251 floorf, 252 /// long double floorl(long double x); 253 floorl, 254 /// double fmod(double x, double y); 255 fmod, 256 /// float fmodf(float x, float y); 257 fmodf, 258 /// long double fmodl(long double x, long double y); 259 fmodl, 260 /// FILE *fopen(const char *filename, const char *mode); 261 fopen, 262 /// FILE *fopen64(const char *filename, const char *opentype) 263 fopen64, 264 /// int fprintf(FILE *stream, const char *format, ...); 265 fprintf, 266 /// int fputc(int c, FILE *stream); 267 fputc, 268 /// int fputs(const char *s, FILE *stream); 269 fputs, 270 /// size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream); 271 fread, 272 /// void free(void *ptr); 273 free, 274 /// double frexp(double num, int *exp); 275 frexp, 276 /// float frexpf(float num, int *exp); 277 frexpf, 278 /// long double frexpl(long double num, int *exp); 279 frexpl, 280 /// int fscanf(FILE *stream, const char *format, ... ); 281 fscanf, 282 /// int fseek(FILE *stream, long offset, int whence); 283 fseek, 284 /// int fseeko(FILE *stream, off_t offset, int whence); 285 fseeko, 286 /// int fseeko64(FILE *stream, off64_t offset, int whence) 287 fseeko64, 288 /// int fsetpos(FILE *stream, const fpos_t *pos); 289 fsetpos, 290 /// int fstat(int fildes, struct stat *buf); 291 fstat, 292 /// int fstat64(int filedes, struct stat64 *buf) 293 fstat64, 294 /// int fstatvfs(int fildes, struct statvfs *buf); 295 fstatvfs, 296 /// int fstatvfs64(int fildes, struct statvfs64 *buf); 297 fstatvfs64, 298 /// long ftell(FILE *stream); 299 ftell, 300 /// off_t ftello(FILE *stream); 301 ftello, 302 /// off64_t ftello64(FILE *stream) 303 ftello64, 304 /// int ftrylockfile(FILE *file); 305 ftrylockfile, 306 /// void funlockfile(FILE *file); 307 funlockfile, 308 /// size_t fwrite(const void *ptr, size_t size, size_t nitems, 309 /// FILE *stream); 310 fwrite, 311 /// int getc(FILE *stream); 312 getc, 313 /// int getc_unlocked(FILE *stream); 314 getc_unlocked, 315 /// int getchar(void); 316 getchar, 317 /// char *getenv(const char *name); 318 getenv, 319 /// int getitimer(int which, struct itimerval *value); 320 getitimer, 321 /// int getlogin_r(char *name, size_t namesize); 322 getlogin_r, 323 /// struct passwd *getpwnam(const char *name); 324 getpwnam, 325 /// char *gets(char *s); 326 gets, 327 /// int gettimeofday(struct timeval *tp, void *tzp); 328 gettimeofday, 329 /// uint32_t htonl(uint32_t hostlong); 330 htonl, 331 /// uint16_t htons(uint16_t hostshort); 332 htons, 333 /// int iprintf(const char *format, ...); 334 iprintf, 335 /// int isascii(int c); 336 isascii, 337 /// int isdigit(int c); 338 isdigit, 339 /// long int labs(long int j); 340 labs, 341 /// int lchown(const char *path, uid_t owner, gid_t group); 342 lchown, 343 /// long long int llabs(long long int j); 344 llabs, 345 /// double log(double x); 346 log, 347 /// double log10(double x); 348 log10, 349 /// float log10f(float x); 350 log10f, 351 /// long double log10l(long double x); 352 log10l, 353 /// double log1p(double x); 354 log1p, 355 /// float log1pf(float x); 356 log1pf, 357 /// long double log1pl(long double x); 358 log1pl, 359 /// double log2(double x); 360 log2, 361 /// float log2f(float x); 362 log2f, 363 /// double long double log2l(long double x); 364 log2l, 365 /// double logb(double x); 366 logb, 367 /// float logbf(float x); 368 logbf, 369 /// long double logbl(long double x); 370 logbl, 371 /// float logf(float x); 372 logf, 373 /// long double logl(long double x); 374 logl, 375 /// int lstat(const char *path, struct stat *buf); 376 lstat, 377 /// int lstat64(const char *path, struct stat64 *buf); 378 lstat64, 379 /// void *malloc(size_t size); 380 malloc, 381 /// void *memalign(size_t boundary, size_t size); 382 memalign, 383 /// void *memccpy(void *s1, const void *s2, int c, size_t n); 384 memccpy, 385 /// void *memchr(const void *s, int c, size_t n); 386 memchr, 387 /// int memcmp(const void *s1, const void *s2, size_t n); 388 memcmp, 389 /// void *memcpy(void *s1, const void *s2, size_t n); 390 memcpy, 391 /// void *memmove(void *s1, const void *s2, size_t n); 392 memmove, 393 // void *memrchr(const void *s, int c, size_t n); 394 memrchr, 395 /// void *memset(void *b, int c, size_t len); 396 memset, 397 /// void memset_pattern16(void *b, const void *pattern16, size_t len); 398 memset_pattern16, 399 /// int mkdir(const char *path, mode_t mode); 400 mkdir, 401 /// time_t mktime(struct tm *timeptr); 402 mktime, 403 /// double modf(double x, double *iptr); 404 modf, 405 /// float modff(float, float *iptr); 406 modff, 407 /// long double modfl(long double value, long double *iptr); 408 modfl, 409 /// double nearbyint(double x); 410 nearbyint, 411 /// float nearbyintf(float x); 412 nearbyintf, 413 /// long double nearbyintl(long double x); 414 nearbyintl, 415 /// uint32_t ntohl(uint32_t netlong); 416 ntohl, 417 /// uint16_t ntohs(uint16_t netshort); 418 ntohs, 419 /// int open(const char *path, int oflag, ... ); 420 open, 421 /// int open64(const char *filename, int flags[, mode_t mode]) 422 open64, 423 /// DIR *opendir(const char *dirname); 424 opendir, 425 /// int pclose(FILE *stream); 426 pclose, 427 /// void perror(const char *s); 428 perror, 429 /// FILE *popen(const char *command, const char *mode); 430 popen, 431 /// int posix_memalign(void **memptr, size_t alignment, size_t size); 432 posix_memalign, 433 /// double pow(double x, double y); 434 pow, 435 /// float powf(float x, float y); 436 powf, 437 /// long double powl(long double x, long double y); 438 powl, 439 /// ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset); 440 pread, 441 /// int printf(const char *format, ...); 442 printf, 443 /// int putc(int c, FILE *stream); 444 putc, 445 /// int putchar(int c); 446 putchar, 447 /// int puts(const char *s); 448 puts, 449 /// ssize_t pwrite(int fildes, const void *buf, size_t nbyte, 450 /// off_t offset); 451 pwrite, 452 /// void qsort(void *base, size_t nel, size_t width, 453 /// int (*compar)(const void *, const void *)); 454 qsort, 455 /// ssize_t read(int fildes, void *buf, size_t nbyte); 456 read, 457 /// ssize_t readlink(const char *path, char *buf, size_t bufsize); 458 readlink, 459 /// void *realloc(void *ptr, size_t size); 460 realloc, 461 /// void *reallocf(void *ptr, size_t size); 462 reallocf, 463 /// char *realpath(const char *file_name, char *resolved_name); 464 realpath, 465 /// int remove(const char *path); 466 remove, 467 /// int rename(const char *old, const char *new); 468 rename, 469 /// void rewind(FILE *stream); 470 rewind, 471 /// double rint(double x); 472 rint, 473 /// float rintf(float x); 474 rintf, 475 /// long double rintl(long double x); 476 rintl, 477 /// int rmdir(const char *path); 478 rmdir, 479 /// double round(double x); 480 round, 481 /// float roundf(float x); 482 roundf, 483 /// long double roundl(long double x); 484 roundl, 485 /// int scanf(const char *restrict format, ... ); 486 scanf, 487 /// void setbuf(FILE *stream, char *buf); 488 setbuf, 489 /// int setitimer(int which, const struct itimerval *value, 490 /// struct itimerval *ovalue); 491 setitimer, 492 /// int setvbuf(FILE *stream, char *buf, int type, size_t size); 493 setvbuf, 494 /// double sin(double x); 495 sin, 496 /// float sinf(float x); 497 sinf, 498 /// double sinh(double x); 499 sinh, 500 /// float sinhf(float x); 501 sinhf, 502 /// long double sinhl(long double x); 503 sinhl, 504 /// long double sinl(long double x); 505 sinl, 506 /// int siprintf(char *str, const char *format, ...); 507 siprintf, 508 /// int snprintf(char *s, size_t n, const char *format, ...); 509 snprintf, 510 /// int sprintf(char *str, const char *format, ...); 511 sprintf, 512 /// double sqrt(double x); 513 sqrt, 514 /// float sqrtf(float x); 515 sqrtf, 516 /// long double sqrtl(long double x); 517 sqrtl, 518 /// int sscanf(const char *s, const char *format, ... ); 519 sscanf, 520 /// int stat(const char *path, struct stat *buf); 521 stat, 522 /// int stat64(const char *path, struct stat64 *buf); 523 stat64, 524 /// int statvfs(const char *path, struct statvfs *buf); 525 statvfs, 526 /// int statvfs64(const char *path, struct statvfs64 *buf) 527 statvfs64, 528 /// char *stpcpy(char *s1, const char *s2); 529 stpcpy, 530 /// char *stpncpy(char *s1, const char *s2, size_t n); 531 stpncpy, 532 /// int strcasecmp(const char *s1, const char *s2); 533 strcasecmp, 534 /// char *strcat(char *s1, const char *s2); 535 strcat, 536 /// char *strchr(const char *s, int c); 537 strchr, 538 /// int strcmp(const char *s1, const char *s2); 539 strcmp, 540 /// int strcoll(const char *s1, const char *s2); 541 strcoll, 542 /// char *strcpy(char *s1, const char *s2); 543 strcpy, 544 /// size_t strcspn(const char *s1, const char *s2); 545 strcspn, 546 /// char *strdup(const char *s1); 547 strdup, 548 /// size_t strlen(const char *s); 549 strlen, 550 /// int strncasecmp(const char *s1, const char *s2, size_t n); 551 strncasecmp, 552 /// char *strncat(char *s1, const char *s2, size_t n); 553 strncat, 554 /// int strncmp(const char *s1, const char *s2, size_t n); 555 strncmp, 556 /// char *strncpy(char *s1, const char *s2, size_t n); 557 strncpy, 558 /// char *strndup(const char *s1, size_t n); 559 strndup, 560 /// size_t strnlen(const char *s, size_t maxlen); 561 strnlen, 562 /// char *strpbrk(const char *s1, const char *s2); 563 strpbrk, 564 /// char *strrchr(const char *s, int c); 565 strrchr, 566 /// size_t strspn(const char *s1, const char *s2); 567 strspn, 568 /// char *strstr(const char *s1, const char *s2); 569 strstr, 570 /// double strtod(const char *nptr, char **endptr); 571 strtod, 572 /// float strtof(const char *nptr, char **endptr); 573 strtof, 574 // char *strtok(char *s1, const char *s2); 575 strtok, 576 // char *strtok_r(char *s, const char *sep, char **lasts); 577 strtok_r, 578 /// long int strtol(const char *nptr, char **endptr, int base); 579 strtol, 580 /// long double strtold(const char *nptr, char **endptr); 581 strtold, 582 /// long long int strtoll(const char *nptr, char **endptr, int base); 583 strtoll, 584 /// unsigned long int strtoul(const char *nptr, char **endptr, int base); 585 strtoul, 586 /// unsigned long long int strtoull(const char *nptr, char **endptr, 587 /// int base); 588 strtoull, 589 /// size_t strxfrm(char *s1, const char *s2, size_t n); 590 strxfrm, 591 /// int system(const char *command); 592 system, 593 /// double tan(double x); 594 tan, 595 /// float tanf(float x); 596 tanf, 597 /// double tanh(double x); 598 tanh, 599 /// float tanhf(float x); 600 tanhf, 601 /// long double tanhl(long double x); 602 tanhl, 603 /// long double tanl(long double x); 604 tanl, 605 /// clock_t times(struct tms *buffer); 606 times, 607 /// FILE *tmpfile(void); 608 tmpfile, 609 /// FILE *tmpfile64(void) 610 tmpfile64, 611 /// int toascii(int c); 612 toascii, 613 /// double trunc(double x); 614 trunc, 615 /// float truncf(float x); 616 truncf, 617 /// long double truncl(long double x); 618 truncl, 619 /// int uname(struct utsname *name); 620 uname, 621 /// int ungetc(int c, FILE *stream); 622 ungetc, 623 /// int unlink(const char *path); 624 unlink, 625 /// int unsetenv(const char *name); 626 unsetenv, 627 /// int utime(const char *path, const struct utimbuf *times); 628 utime, 629 /// int utimes(const char *path, const struct timeval times[2]); 630 utimes, 631 /// void *valloc(size_t size); 632 valloc, 633 /// int vfprintf(FILE *stream, const char *format, va_list ap); 634 vfprintf, 635 /// int vfscanf(FILE *stream, const char *format, va_list arg); 636 vfscanf, 637 /// int vprintf(const char *restrict format, va_list ap); 638 vprintf, 639 /// int vscanf(const char *format, va_list arg); 640 vscanf, 641 /// int vsnprintf(char *s, size_t n, const char *format, va_list ap); 642 vsnprintf, 643 /// int vsprintf(char *s, const char *format, va_list ap); 644 vsprintf, 645 /// int vsscanf(const char *s, const char *format, va_list arg); 646 vsscanf, 647 /// ssize_t write(int fildes, const void *buf, size_t nbyte); 648 write, 649 650 NumLibFuncs 651 }; 652 } 653 654/// TargetLibraryInfo - This immutable pass captures information about what 655/// library functions are available for the current target, and allows a 656/// frontend to disable optimizations through -fno-builtin etc. 657class TargetLibraryInfo : public ImmutablePass { 658 virtual void anchor(); 659 unsigned char AvailableArray[(LibFunc::NumLibFuncs+3)/4]; 660 llvm::DenseMap<unsigned, std::string> CustomNames; 661 static const char* StandardNames[LibFunc::NumLibFuncs]; 662 663 enum AvailabilityState { 664 StandardName = 3, // (memset to all ones) 665 CustomName = 1, 666 Unavailable = 0 // (memset to all zeros) 667 }; 668 void setState(LibFunc::Func F, AvailabilityState State) { 669 AvailableArray[F/4] &= ~(3 << 2*(F&3)); 670 AvailableArray[F/4] |= State << 2*(F&3); 671 } 672 AvailabilityState getState(LibFunc::Func F) const { 673 return static_cast<AvailabilityState>((AvailableArray[F/4] >> 2*(F&3)) & 3); 674 } 675 676public: 677 static char ID; 678 TargetLibraryInfo(); 679 TargetLibraryInfo(const Triple &T); 680 explicit TargetLibraryInfo(const TargetLibraryInfo &TLI); 681 682 /// getLibFunc - Search for a particular function name. If it is one of the 683 /// known library functions, return true and set F to the corresponding value. 684 bool getLibFunc(StringRef funcName, LibFunc::Func &F) const; 685 686 /// has - This function is used by optimizations that want to match on or form 687 /// a given library function. 688 bool has(LibFunc::Func F) const { 689 return getState(F) != Unavailable; 690 } 691 692 /// hasOptimizedCodeGen - Return true if the function is both available as 693 /// a builtin and a candidate for optimized code generation. 694 bool hasOptimizedCodeGen(LibFunc::Func F) const { 695 if (getState(F) == Unavailable) 696 return false; 697 switch (F) { 698 default: break; 699 case LibFunc::copysign: case LibFunc::copysignf: case LibFunc::copysignl: 700 case LibFunc::fabs: case LibFunc::fabsf: case LibFunc::fabsl: 701 case LibFunc::sin: case LibFunc::sinf: case LibFunc::sinl: 702 case LibFunc::cos: case LibFunc::cosf: case LibFunc::cosl: 703 case LibFunc::sqrt: case LibFunc::sqrtf: case LibFunc::sqrtl: 704 case LibFunc::sqrt_finite: case LibFunc::sqrtf_finite: 705 case LibFunc::sqrtl_finite: 706 case LibFunc::floor: case LibFunc::floorf: case LibFunc::floorl: 707 case LibFunc::nearbyint: case LibFunc::nearbyintf: case LibFunc::nearbyintl: 708 case LibFunc::ceil: case LibFunc::ceilf: case LibFunc::ceill: 709 case LibFunc::rint: case LibFunc::rintf: case LibFunc::rintl: 710 case LibFunc::round: case LibFunc::roundf: case LibFunc::roundl: 711 case LibFunc::trunc: case LibFunc::truncf: case LibFunc::truncl: 712 case LibFunc::log2: case LibFunc::log2f: case LibFunc::log2l: 713 case LibFunc::exp2: case LibFunc::exp2f: case LibFunc::exp2l: 714 case LibFunc::memcmp: case LibFunc::strcmp: case LibFunc::strcpy: 715 case LibFunc::stpcpy: case LibFunc::strlen: case LibFunc::strnlen: 716 case LibFunc::memchr: 717 return true; 718 } 719 return false; 720 } 721 722 StringRef getName(LibFunc::Func F) const { 723 AvailabilityState State = getState(F); 724 if (State == Unavailable) 725 return StringRef(); 726 if (State == StandardName) 727 return StandardNames[F]; 728 assert(State == CustomName); 729 return CustomNames.find(F)->second; 730 } 731 732 /// setUnavailable - this can be used by whatever sets up TargetLibraryInfo to 733 /// ban use of specific library functions. 734 void setUnavailable(LibFunc::Func F) { 735 setState(F, Unavailable); 736 } 737 738 void setAvailable(LibFunc::Func F) { 739 setState(F, StandardName); 740 } 741 742 void setAvailableWithName(LibFunc::Func F, StringRef Name) { 743 if (StandardNames[F] != Name) { 744 setState(F, CustomName); 745 CustomNames[F] = Name; 746 assert(CustomNames.find(F) != CustomNames.end()); 747 } else { 748 setState(F, StandardName); 749 } 750 } 751 752 /// disableAllFunctions - This disables all builtins, which is used for 753 /// options like -fno-builtin. 754 void disableAllFunctions(); 755}; 756 757} // end namespace llvm 758 759#endif 760