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 memset_pattern16(void *b, const void *pattern16, size_t len);
33 /// TargetLibraryInfo - This immutable pass captures information about what
34 /// library functions are available for the current target, and allows a
35 /// frontend to disable optimizations through -fno-builtin etc.
36 class TargetLibraryInfo : public ImmutablePass {
37 unsigned char AvailableArray[(LibFunc::NumLibFuncs+7)/8];
41 TargetLibraryInfo(const Triple &T);
43 /// has - This function is used by optimizations that want to match on or form
44 /// a given library function.
45 bool has(LibFunc::Func F) const {
46 return (AvailableArray[F/8] & (1 << (F&7))) != 0;
49 /// setUnavailable - this can be used by whatever sets up TargetLibraryInfo to
50 /// ban use of specific library functions.
51 void setUnavailable(LibFunc::Func F) {
52 AvailableArray[F/8] &= ~(1 << (F&7));
55 void setAvailable(LibFunc::Func F) {
56 AvailableArray[F/8] |= 1 << (F&7);
59 /// disableAllFunctions - This disables all builtins, which is used for
60 /// options like -fno-builtin.
61 void disableAllFunctions();
64 } // end namespace llvm