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