1 //===-- llvm/Target/TargetLibraryInfo.h - Library information ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_TARGET_TARGETLIBRARYINFO_H
11 #define LLVM_TARGET_TARGETLIBRARYINFO_H
13 #include "llvm/Pass.h"
20 /// void *memset(void *b, int c, size_t len);
23 // void *memcpy(void *s1, const void *s2, size_t n);
26 // void *memmove(void *s1, const void *s2, size_t n);
29 /// void memset_pattern16(void *b, const void *pattern16, size_t len);
32 /// int iprintf(const char *format, ...);
35 /// int siprintf(char *str, const char *format, ...);
38 /// int fiprintf(FILE *stream, const char *format, ...);
45 /// TargetLibraryInfo - This immutable pass captures information about what
46 /// library functions are available for the current target, and allows a
47 /// frontend to disable optimizations through -fno-builtin etc.
48 class TargetLibraryInfo : public ImmutablePass {
49 unsigned char AvailableArray[(LibFunc::NumLibFuncs+7)/8];
53 TargetLibraryInfo(const Triple &T);
54 explicit TargetLibraryInfo(const TargetLibraryInfo &TLI);
56 /// has - This function is used by optimizations that want to match on or form
57 /// a given library function.
58 bool has(LibFunc::Func F) const {
59 return (AvailableArray[F/8] & (1 << (F&7))) != 0;
62 /// setUnavailable - this can be used by whatever sets up TargetLibraryInfo to
63 /// ban use of specific library functions.
64 void setUnavailable(LibFunc::Func F) {
65 AvailableArray[F/8] &= ~(1 << (F&7));
68 void setAvailable(LibFunc::Func F) {
69 AvailableArray[F/8] |= 1 << (F&7);
72 /// disableAllFunctions - This disables all builtins, which is used for
73 /// options like -fno-builtin.
74 void disableAllFunctions();
77 } // end namespace llvm