Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

730 lines
22 KiB

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