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