1*f4a2713aSLionel Sambuc //===-- TargetLibraryInfo.cpp - Runtime library information ----------------==// 2*f4a2713aSLionel Sambuc // 3*f4a2713aSLionel Sambuc // The LLVM Compiler Infrastructure 4*f4a2713aSLionel Sambuc // 5*f4a2713aSLionel Sambuc // This file is distributed under the University of Illinois Open Source 6*f4a2713aSLionel Sambuc // License. See LICENSE.TXT for details. 7*f4a2713aSLionel Sambuc // 8*f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===// 9*f4a2713aSLionel Sambuc // 10*f4a2713aSLionel Sambuc // This file implements the TargetLibraryInfo class. 11*f4a2713aSLionel Sambuc // 12*f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===// 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc #include "llvm/Target/TargetLibraryInfo.h" 15*f4a2713aSLionel Sambuc #include "llvm/ADT/Triple.h" 16*f4a2713aSLionel Sambuc using namespace llvm; 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc // Register the default implementation. 19*f4a2713aSLionel Sambuc INITIALIZE_PASS(TargetLibraryInfo, "targetlibinfo", 20*f4a2713aSLionel Sambuc "Target Library Information", false, true) 21*f4a2713aSLionel Sambuc char TargetLibraryInfo::ID = 0; 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc void TargetLibraryInfo::anchor() { } 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] = 26*f4a2713aSLionel Sambuc { 27*f4a2713aSLionel Sambuc "_IO_getc", 28*f4a2713aSLionel Sambuc "_IO_putc", 29*f4a2713aSLionel Sambuc "_ZdaPv", 30*f4a2713aSLionel Sambuc "_ZdaPvRKSt9nothrow_t", 31*f4a2713aSLionel Sambuc "_ZdlPv", 32*f4a2713aSLionel Sambuc "_ZdlPvRKSt9nothrow_t", 33*f4a2713aSLionel Sambuc "_Znaj", 34*f4a2713aSLionel Sambuc "_ZnajRKSt9nothrow_t", 35*f4a2713aSLionel Sambuc "_Znam", 36*f4a2713aSLionel Sambuc "_ZnamRKSt9nothrow_t", 37*f4a2713aSLionel Sambuc "_Znwj", 38*f4a2713aSLionel Sambuc "_ZnwjRKSt9nothrow_t", 39*f4a2713aSLionel Sambuc "_Znwm", 40*f4a2713aSLionel Sambuc "_ZnwmRKSt9nothrow_t", 41*f4a2713aSLionel Sambuc "__cospi", 42*f4a2713aSLionel Sambuc "__cospif", 43*f4a2713aSLionel Sambuc "__cxa_atexit", 44*f4a2713aSLionel Sambuc "__cxa_guard_abort", 45*f4a2713aSLionel Sambuc "__cxa_guard_acquire", 46*f4a2713aSLionel Sambuc "__cxa_guard_release", 47*f4a2713aSLionel Sambuc "__isoc99_scanf", 48*f4a2713aSLionel Sambuc "__isoc99_sscanf", 49*f4a2713aSLionel Sambuc "__memcpy_chk", 50*f4a2713aSLionel Sambuc "__sincospi_stret", 51*f4a2713aSLionel Sambuc "__sincospi_stretf", 52*f4a2713aSLionel Sambuc "__sinpi", 53*f4a2713aSLionel Sambuc "__sinpif", 54*f4a2713aSLionel Sambuc "__sqrt_finite", 55*f4a2713aSLionel Sambuc "__sqrtf_finite", 56*f4a2713aSLionel Sambuc "__sqrtl_finite", 57*f4a2713aSLionel Sambuc "__strdup", 58*f4a2713aSLionel Sambuc "__strndup", 59*f4a2713aSLionel Sambuc "__strtok_r", 60*f4a2713aSLionel Sambuc "abs", 61*f4a2713aSLionel Sambuc "access", 62*f4a2713aSLionel Sambuc "acos", 63*f4a2713aSLionel Sambuc "acosf", 64*f4a2713aSLionel Sambuc "acosh", 65*f4a2713aSLionel Sambuc "acoshf", 66*f4a2713aSLionel Sambuc "acoshl", 67*f4a2713aSLionel Sambuc "acosl", 68*f4a2713aSLionel Sambuc "asin", 69*f4a2713aSLionel Sambuc "asinf", 70*f4a2713aSLionel Sambuc "asinh", 71*f4a2713aSLionel Sambuc "asinhf", 72*f4a2713aSLionel Sambuc "asinhl", 73*f4a2713aSLionel Sambuc "asinl", 74*f4a2713aSLionel Sambuc "atan", 75*f4a2713aSLionel Sambuc "atan2", 76*f4a2713aSLionel Sambuc "atan2f", 77*f4a2713aSLionel Sambuc "atan2l", 78*f4a2713aSLionel Sambuc "atanf", 79*f4a2713aSLionel Sambuc "atanh", 80*f4a2713aSLionel Sambuc "atanhf", 81*f4a2713aSLionel Sambuc "atanhl", 82*f4a2713aSLionel Sambuc "atanl", 83*f4a2713aSLionel Sambuc "atof", 84*f4a2713aSLionel Sambuc "atoi", 85*f4a2713aSLionel Sambuc "atol", 86*f4a2713aSLionel Sambuc "atoll", 87*f4a2713aSLionel Sambuc "bcmp", 88*f4a2713aSLionel Sambuc "bcopy", 89*f4a2713aSLionel Sambuc "bzero", 90*f4a2713aSLionel Sambuc "calloc", 91*f4a2713aSLionel Sambuc "cbrt", 92*f4a2713aSLionel Sambuc "cbrtf", 93*f4a2713aSLionel Sambuc "cbrtl", 94*f4a2713aSLionel Sambuc "ceil", 95*f4a2713aSLionel Sambuc "ceilf", 96*f4a2713aSLionel Sambuc "ceill", 97*f4a2713aSLionel Sambuc "chmod", 98*f4a2713aSLionel Sambuc "chown", 99*f4a2713aSLionel Sambuc "clearerr", 100*f4a2713aSLionel Sambuc "closedir", 101*f4a2713aSLionel Sambuc "copysign", 102*f4a2713aSLionel Sambuc "copysignf", 103*f4a2713aSLionel Sambuc "copysignl", 104*f4a2713aSLionel Sambuc "cos", 105*f4a2713aSLionel Sambuc "cosf", 106*f4a2713aSLionel Sambuc "cosh", 107*f4a2713aSLionel Sambuc "coshf", 108*f4a2713aSLionel Sambuc "coshl", 109*f4a2713aSLionel Sambuc "cosl", 110*f4a2713aSLionel Sambuc "ctermid", 111*f4a2713aSLionel Sambuc "exp", 112*f4a2713aSLionel Sambuc "exp10", 113*f4a2713aSLionel Sambuc "exp10f", 114*f4a2713aSLionel Sambuc "exp10l", 115*f4a2713aSLionel Sambuc "exp2", 116*f4a2713aSLionel Sambuc "exp2f", 117*f4a2713aSLionel Sambuc "exp2l", 118*f4a2713aSLionel Sambuc "expf", 119*f4a2713aSLionel Sambuc "expl", 120*f4a2713aSLionel Sambuc "expm1", 121*f4a2713aSLionel Sambuc "expm1f", 122*f4a2713aSLionel Sambuc "expm1l", 123*f4a2713aSLionel Sambuc "fabs", 124*f4a2713aSLionel Sambuc "fabsf", 125*f4a2713aSLionel Sambuc "fabsl", 126*f4a2713aSLionel Sambuc "fclose", 127*f4a2713aSLionel Sambuc "fdopen", 128*f4a2713aSLionel Sambuc "feof", 129*f4a2713aSLionel Sambuc "ferror", 130*f4a2713aSLionel Sambuc "fflush", 131*f4a2713aSLionel Sambuc "ffs", 132*f4a2713aSLionel Sambuc "ffsl", 133*f4a2713aSLionel Sambuc "ffsll", 134*f4a2713aSLionel Sambuc "fgetc", 135*f4a2713aSLionel Sambuc "fgetpos", 136*f4a2713aSLionel Sambuc "fgets", 137*f4a2713aSLionel Sambuc "fileno", 138*f4a2713aSLionel Sambuc "fiprintf", 139*f4a2713aSLionel Sambuc "flockfile", 140*f4a2713aSLionel Sambuc "floor", 141*f4a2713aSLionel Sambuc "floorf", 142*f4a2713aSLionel Sambuc "floorl", 143*f4a2713aSLionel Sambuc "fmod", 144*f4a2713aSLionel Sambuc "fmodf", 145*f4a2713aSLionel Sambuc "fmodl", 146*f4a2713aSLionel Sambuc "fopen", 147*f4a2713aSLionel Sambuc "fopen64", 148*f4a2713aSLionel Sambuc "fprintf", 149*f4a2713aSLionel Sambuc "fputc", 150*f4a2713aSLionel Sambuc "fputs", 151*f4a2713aSLionel Sambuc "fread", 152*f4a2713aSLionel Sambuc "free", 153*f4a2713aSLionel Sambuc "frexp", 154*f4a2713aSLionel Sambuc "frexpf", 155*f4a2713aSLionel Sambuc "frexpl", 156*f4a2713aSLionel Sambuc "fscanf", 157*f4a2713aSLionel Sambuc "fseek", 158*f4a2713aSLionel Sambuc "fseeko", 159*f4a2713aSLionel Sambuc "fseeko64", 160*f4a2713aSLionel Sambuc "fsetpos", 161*f4a2713aSLionel Sambuc "fstat", 162*f4a2713aSLionel Sambuc "fstat64", 163*f4a2713aSLionel Sambuc "fstatvfs", 164*f4a2713aSLionel Sambuc "fstatvfs64", 165*f4a2713aSLionel Sambuc "ftell", 166*f4a2713aSLionel Sambuc "ftello", 167*f4a2713aSLionel Sambuc "ftello64", 168*f4a2713aSLionel Sambuc "ftrylockfile", 169*f4a2713aSLionel Sambuc "funlockfile", 170*f4a2713aSLionel Sambuc "fwrite", 171*f4a2713aSLionel Sambuc "getc", 172*f4a2713aSLionel Sambuc "getc_unlocked", 173*f4a2713aSLionel Sambuc "getchar", 174*f4a2713aSLionel Sambuc "getenv", 175*f4a2713aSLionel Sambuc "getitimer", 176*f4a2713aSLionel Sambuc "getlogin_r", 177*f4a2713aSLionel Sambuc "getpwnam", 178*f4a2713aSLionel Sambuc "gets", 179*f4a2713aSLionel Sambuc "gettimeofday", 180*f4a2713aSLionel Sambuc "htonl", 181*f4a2713aSLionel Sambuc "htons", 182*f4a2713aSLionel Sambuc "iprintf", 183*f4a2713aSLionel Sambuc "isascii", 184*f4a2713aSLionel Sambuc "isdigit", 185*f4a2713aSLionel Sambuc "labs", 186*f4a2713aSLionel Sambuc "lchown", 187*f4a2713aSLionel Sambuc "llabs", 188*f4a2713aSLionel Sambuc "log", 189*f4a2713aSLionel Sambuc "log10", 190*f4a2713aSLionel Sambuc "log10f", 191*f4a2713aSLionel Sambuc "log10l", 192*f4a2713aSLionel Sambuc "log1p", 193*f4a2713aSLionel Sambuc "log1pf", 194*f4a2713aSLionel Sambuc "log1pl", 195*f4a2713aSLionel Sambuc "log2", 196*f4a2713aSLionel Sambuc "log2f", 197*f4a2713aSLionel Sambuc "log2l", 198*f4a2713aSLionel Sambuc "logb", 199*f4a2713aSLionel Sambuc "logbf", 200*f4a2713aSLionel Sambuc "logbl", 201*f4a2713aSLionel Sambuc "logf", 202*f4a2713aSLionel Sambuc "logl", 203*f4a2713aSLionel Sambuc "lstat", 204*f4a2713aSLionel Sambuc "lstat64", 205*f4a2713aSLionel Sambuc "malloc", 206*f4a2713aSLionel Sambuc "memalign", 207*f4a2713aSLionel Sambuc "memccpy", 208*f4a2713aSLionel Sambuc "memchr", 209*f4a2713aSLionel Sambuc "memcmp", 210*f4a2713aSLionel Sambuc "memcpy", 211*f4a2713aSLionel Sambuc "memmove", 212*f4a2713aSLionel Sambuc "memrchr", 213*f4a2713aSLionel Sambuc "memset", 214*f4a2713aSLionel Sambuc "memset_pattern16", 215*f4a2713aSLionel Sambuc "mkdir", 216*f4a2713aSLionel Sambuc "mktime", 217*f4a2713aSLionel Sambuc "modf", 218*f4a2713aSLionel Sambuc "modff", 219*f4a2713aSLionel Sambuc "modfl", 220*f4a2713aSLionel Sambuc "nearbyint", 221*f4a2713aSLionel Sambuc "nearbyintf", 222*f4a2713aSLionel Sambuc "nearbyintl", 223*f4a2713aSLionel Sambuc "ntohl", 224*f4a2713aSLionel Sambuc "ntohs", 225*f4a2713aSLionel Sambuc "open", 226*f4a2713aSLionel Sambuc "open64", 227*f4a2713aSLionel Sambuc "opendir", 228*f4a2713aSLionel Sambuc "pclose", 229*f4a2713aSLionel Sambuc "perror", 230*f4a2713aSLionel Sambuc "popen", 231*f4a2713aSLionel Sambuc "posix_memalign", 232*f4a2713aSLionel Sambuc "pow", 233*f4a2713aSLionel Sambuc "powf", 234*f4a2713aSLionel Sambuc "powl", 235*f4a2713aSLionel Sambuc "pread", 236*f4a2713aSLionel Sambuc "printf", 237*f4a2713aSLionel Sambuc "putc", 238*f4a2713aSLionel Sambuc "putchar", 239*f4a2713aSLionel Sambuc "puts", 240*f4a2713aSLionel Sambuc "pwrite", 241*f4a2713aSLionel Sambuc "qsort", 242*f4a2713aSLionel Sambuc "read", 243*f4a2713aSLionel Sambuc "readlink", 244*f4a2713aSLionel Sambuc "realloc", 245*f4a2713aSLionel Sambuc "reallocf", 246*f4a2713aSLionel Sambuc "realpath", 247*f4a2713aSLionel Sambuc "remove", 248*f4a2713aSLionel Sambuc "rename", 249*f4a2713aSLionel Sambuc "rewind", 250*f4a2713aSLionel Sambuc "rint", 251*f4a2713aSLionel Sambuc "rintf", 252*f4a2713aSLionel Sambuc "rintl", 253*f4a2713aSLionel Sambuc "rmdir", 254*f4a2713aSLionel Sambuc "round", 255*f4a2713aSLionel Sambuc "roundf", 256*f4a2713aSLionel Sambuc "roundl", 257*f4a2713aSLionel Sambuc "scanf", 258*f4a2713aSLionel Sambuc "setbuf", 259*f4a2713aSLionel Sambuc "setitimer", 260*f4a2713aSLionel Sambuc "setvbuf", 261*f4a2713aSLionel Sambuc "sin", 262*f4a2713aSLionel Sambuc "sinf", 263*f4a2713aSLionel Sambuc "sinh", 264*f4a2713aSLionel Sambuc "sinhf", 265*f4a2713aSLionel Sambuc "sinhl", 266*f4a2713aSLionel Sambuc "sinl", 267*f4a2713aSLionel Sambuc "siprintf", 268*f4a2713aSLionel Sambuc "snprintf", 269*f4a2713aSLionel Sambuc "sprintf", 270*f4a2713aSLionel Sambuc "sqrt", 271*f4a2713aSLionel Sambuc "sqrtf", 272*f4a2713aSLionel Sambuc "sqrtl", 273*f4a2713aSLionel Sambuc "sscanf", 274*f4a2713aSLionel Sambuc "stat", 275*f4a2713aSLionel Sambuc "stat64", 276*f4a2713aSLionel Sambuc "statvfs", 277*f4a2713aSLionel Sambuc "statvfs64", 278*f4a2713aSLionel Sambuc "stpcpy", 279*f4a2713aSLionel Sambuc "stpncpy", 280*f4a2713aSLionel Sambuc "strcasecmp", 281*f4a2713aSLionel Sambuc "strcat", 282*f4a2713aSLionel Sambuc "strchr", 283*f4a2713aSLionel Sambuc "strcmp", 284*f4a2713aSLionel Sambuc "strcoll", 285*f4a2713aSLionel Sambuc "strcpy", 286*f4a2713aSLionel Sambuc "strcspn", 287*f4a2713aSLionel Sambuc "strdup", 288*f4a2713aSLionel Sambuc "strlen", 289*f4a2713aSLionel Sambuc "strncasecmp", 290*f4a2713aSLionel Sambuc "strncat", 291*f4a2713aSLionel Sambuc "strncmp", 292*f4a2713aSLionel Sambuc "strncpy", 293*f4a2713aSLionel Sambuc "strndup", 294*f4a2713aSLionel Sambuc "strnlen", 295*f4a2713aSLionel Sambuc "strpbrk", 296*f4a2713aSLionel Sambuc "strrchr", 297*f4a2713aSLionel Sambuc "strspn", 298*f4a2713aSLionel Sambuc "strstr", 299*f4a2713aSLionel Sambuc "strtod", 300*f4a2713aSLionel Sambuc "strtof", 301*f4a2713aSLionel Sambuc "strtok", 302*f4a2713aSLionel Sambuc "strtok_r", 303*f4a2713aSLionel Sambuc "strtol", 304*f4a2713aSLionel Sambuc "strtold", 305*f4a2713aSLionel Sambuc "strtoll", 306*f4a2713aSLionel Sambuc "strtoul", 307*f4a2713aSLionel Sambuc "strtoull", 308*f4a2713aSLionel Sambuc "strxfrm", 309*f4a2713aSLionel Sambuc "system", 310*f4a2713aSLionel Sambuc "tan", 311*f4a2713aSLionel Sambuc "tanf", 312*f4a2713aSLionel Sambuc "tanh", 313*f4a2713aSLionel Sambuc "tanhf", 314*f4a2713aSLionel Sambuc "tanhl", 315*f4a2713aSLionel Sambuc "tanl", 316*f4a2713aSLionel Sambuc "times", 317*f4a2713aSLionel Sambuc "tmpfile", 318*f4a2713aSLionel Sambuc "tmpfile64", 319*f4a2713aSLionel Sambuc "toascii", 320*f4a2713aSLionel Sambuc "trunc", 321*f4a2713aSLionel Sambuc "truncf", 322*f4a2713aSLionel Sambuc "truncl", 323*f4a2713aSLionel Sambuc "uname", 324*f4a2713aSLionel Sambuc "ungetc", 325*f4a2713aSLionel Sambuc "unlink", 326*f4a2713aSLionel Sambuc "unsetenv", 327*f4a2713aSLionel Sambuc "utime", 328*f4a2713aSLionel Sambuc "utimes", 329*f4a2713aSLionel Sambuc "valloc", 330*f4a2713aSLionel Sambuc "vfprintf", 331*f4a2713aSLionel Sambuc "vfscanf", 332*f4a2713aSLionel Sambuc "vprintf", 333*f4a2713aSLionel Sambuc "vscanf", 334*f4a2713aSLionel Sambuc "vsnprintf", 335*f4a2713aSLionel Sambuc "vsprintf", 336*f4a2713aSLionel Sambuc "vsscanf", 337*f4a2713aSLionel Sambuc "write" 338*f4a2713aSLionel Sambuc }; 339*f4a2713aSLionel Sambuc 340*f4a2713aSLionel Sambuc static bool hasSinCosPiStret(const Triple &T) { 341*f4a2713aSLionel Sambuc // Only Darwin variants have _stret versions of combined trig functions. 342*f4a2713aSLionel Sambuc if (!T.isMacOSX() && T.getOS() != Triple::IOS) 343*f4a2713aSLionel Sambuc return false; 344*f4a2713aSLionel Sambuc 345*f4a2713aSLionel Sambuc // The ABI is rather complicated on x86, so don't do anything special there. 346*f4a2713aSLionel Sambuc if (T.getArch() == Triple::x86) 347*f4a2713aSLionel Sambuc return false; 348*f4a2713aSLionel Sambuc 349*f4a2713aSLionel Sambuc if (T.isMacOSX() && T.isMacOSXVersionLT(10, 9)) 350*f4a2713aSLionel Sambuc return false; 351*f4a2713aSLionel Sambuc 352*f4a2713aSLionel Sambuc if (T.getOS() == Triple::IOS && T.isOSVersionLT(7, 0)) 353*f4a2713aSLionel Sambuc return false; 354*f4a2713aSLionel Sambuc 355*f4a2713aSLionel Sambuc return true; 356*f4a2713aSLionel Sambuc } 357*f4a2713aSLionel Sambuc 358*f4a2713aSLionel Sambuc /// initialize - Initialize the set of available library functions based on the 359*f4a2713aSLionel Sambuc /// specified target triple. This should be carefully written so that a missing 360*f4a2713aSLionel Sambuc /// target triple gets a sane set of defaults. 361*f4a2713aSLionel Sambuc static void initialize(TargetLibraryInfo &TLI, const Triple &T, 362*f4a2713aSLionel Sambuc const char **StandardNames) { 363*f4a2713aSLionel Sambuc initializeTargetLibraryInfoPass(*PassRegistry::getPassRegistry()); 364*f4a2713aSLionel Sambuc 365*f4a2713aSLionel Sambuc #ifndef NDEBUG 366*f4a2713aSLionel Sambuc // Verify that the StandardNames array is in alphabetical order. 367*f4a2713aSLionel Sambuc for (unsigned F = 1; F < LibFunc::NumLibFuncs; ++F) { 368*f4a2713aSLionel Sambuc if (strcmp(StandardNames[F-1], StandardNames[F]) >= 0) 369*f4a2713aSLionel Sambuc llvm_unreachable("TargetLibraryInfo function names must be sorted"); 370*f4a2713aSLionel Sambuc } 371*f4a2713aSLionel Sambuc #endif // !NDEBUG 372*f4a2713aSLionel Sambuc 373*f4a2713aSLionel Sambuc // memset_pattern16 is only available on iOS 3.0 and Mac OS/X 10.5 and later. 374*f4a2713aSLionel Sambuc if (T.isMacOSX()) { 375*f4a2713aSLionel Sambuc if (T.isMacOSXVersionLT(10, 5)) 376*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::memset_pattern16); 377*f4a2713aSLionel Sambuc } else if (T.isiOS()) { 378*f4a2713aSLionel Sambuc if (T.isOSVersionLT(3, 0)) 379*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::memset_pattern16); 380*f4a2713aSLionel Sambuc } else { 381*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::memset_pattern16); 382*f4a2713aSLionel Sambuc } 383*f4a2713aSLionel Sambuc 384*f4a2713aSLionel Sambuc if (!hasSinCosPiStret(T)) { 385*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::sinpi); 386*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::sinpif); 387*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::cospi); 388*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::cospif); 389*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::sincospi_stret); 390*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::sincospi_stretf); 391*f4a2713aSLionel Sambuc } 392*f4a2713aSLionel Sambuc 393*f4a2713aSLionel Sambuc if (T.isMacOSX() && T.getArch() == Triple::x86 && 394*f4a2713aSLionel Sambuc !T.isMacOSXVersionLT(10, 7)) { 395*f4a2713aSLionel Sambuc // x86-32 OSX has a scheme where fwrite and fputs (and some other functions 396*f4a2713aSLionel Sambuc // we don't care about) have two versions; on recent OSX, the one we want 397*f4a2713aSLionel Sambuc // has a $UNIX2003 suffix. The two implementations are identical except 398*f4a2713aSLionel Sambuc // for the return value in some edge cases. However, we don't want to 399*f4a2713aSLionel Sambuc // generate code that depends on the old symbols. 400*f4a2713aSLionel Sambuc TLI.setAvailableWithName(LibFunc::fwrite, "fwrite$UNIX2003"); 401*f4a2713aSLionel Sambuc TLI.setAvailableWithName(LibFunc::fputs, "fputs$UNIX2003"); 402*f4a2713aSLionel Sambuc } 403*f4a2713aSLionel Sambuc 404*f4a2713aSLionel Sambuc // iprintf and friends are only available on XCore and TCE. 405*f4a2713aSLionel Sambuc if (T.getArch() != Triple::xcore && T.getArch() != Triple::tce) { 406*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::iprintf); 407*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::siprintf); 408*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fiprintf); 409*f4a2713aSLionel Sambuc } 410*f4a2713aSLionel Sambuc 411*f4a2713aSLionel Sambuc if (T.getOS() == Triple::Win32) { 412*f4a2713aSLionel Sambuc // Win32 does not support long double 413*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::acosl); 414*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::asinl); 415*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::atanl); 416*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::atan2l); 417*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::ceill); 418*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::copysignl); 419*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::cosl); 420*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::coshl); 421*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::expl); 422*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fabsf); // Win32 and Win64 both lack fabsf 423*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fabsl); 424*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::floorl); 425*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fmodl); 426*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::frexpl); 427*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::logl); 428*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::modfl); 429*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::powl); 430*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::sinl); 431*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::sinhl); 432*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::sqrtl); 433*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::tanl); 434*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::tanhl); 435*f4a2713aSLionel Sambuc 436*f4a2713aSLionel Sambuc // Win32 only has C89 math 437*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::acosh); 438*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::acoshf); 439*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::acoshl); 440*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::asinh); 441*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::asinhf); 442*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::asinhl); 443*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::atanh); 444*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::atanhf); 445*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::atanhl); 446*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::cbrt); 447*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::cbrtf); 448*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::cbrtl); 449*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::exp10); 450*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::exp10f); 451*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::exp10l); 452*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::exp2); 453*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::exp2f); 454*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::exp2l); 455*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::expm1); 456*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::expm1f); 457*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::expm1l); 458*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::log2); 459*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::log2f); 460*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::log2l); 461*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::log1p); 462*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::log1pf); 463*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::log1pl); 464*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::logb); 465*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::logbf); 466*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::logbl); 467*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::nearbyint); 468*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::nearbyintf); 469*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::nearbyintl); 470*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::rint); 471*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::rintf); 472*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::rintl); 473*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::round); 474*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::roundf); 475*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::roundl); 476*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::trunc); 477*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::truncf); 478*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::truncl); 479*f4a2713aSLionel Sambuc 480*f4a2713aSLionel Sambuc // Win32 provides some C99 math with mangled names 481*f4a2713aSLionel Sambuc TLI.setAvailableWithName(LibFunc::copysign, "_copysign"); 482*f4a2713aSLionel Sambuc 483*f4a2713aSLionel Sambuc if (T.getArch() == Triple::x86) { 484*f4a2713aSLionel Sambuc // Win32 on x86 implements single-precision math functions as macros 485*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::acosf); 486*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::asinf); 487*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::atanf); 488*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::atan2f); 489*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::ceilf); 490*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::copysignf); 491*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::cosf); 492*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::coshf); 493*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::expf); 494*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::floorf); 495*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fmodf); 496*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::logf); 497*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::powf); 498*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::sinf); 499*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::sinhf); 500*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::sqrtf); 501*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::tanf); 502*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::tanhf); 503*f4a2713aSLionel Sambuc } 504*f4a2713aSLionel Sambuc 505*f4a2713aSLionel Sambuc // Win32 does *not* provide provide these functions, but they are 506*f4a2713aSLionel Sambuc // generally available on POSIX-compliant systems: 507*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::access); 508*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::bcmp); 509*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::bcopy); 510*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::bzero); 511*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::chmod); 512*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::chown); 513*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::closedir); 514*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::ctermid); 515*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fdopen); 516*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::ffs); 517*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fileno); 518*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::flockfile); 519*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fseeko); 520*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fstat); 521*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fstatvfs); 522*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::ftello); 523*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::ftrylockfile); 524*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::funlockfile); 525*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::getc_unlocked); 526*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::getitimer); 527*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::getlogin_r); 528*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::getpwnam); 529*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::gettimeofday); 530*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::htonl); 531*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::htons); 532*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::lchown); 533*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::lstat); 534*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::memccpy); 535*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::mkdir); 536*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::ntohl); 537*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::ntohs); 538*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::open); 539*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::opendir); 540*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::pclose); 541*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::popen); 542*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::pread); 543*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::pwrite); 544*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::read); 545*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::readlink); 546*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::realpath); 547*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::rmdir); 548*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::setitimer); 549*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::stat); 550*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::statvfs); 551*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::stpcpy); 552*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::stpncpy); 553*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::strcasecmp); 554*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::strncasecmp); 555*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::times); 556*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::uname); 557*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::unlink); 558*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::unsetenv); 559*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::utime); 560*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::utimes); 561*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::write); 562*f4a2713aSLionel Sambuc 563*f4a2713aSLionel Sambuc // Win32 does *not* provide provide these functions, but they are 564*f4a2713aSLionel Sambuc // specified by C99: 565*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::atoll); 566*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::frexpf); 567*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::llabs); 568*f4a2713aSLionel Sambuc } 569*f4a2713aSLionel Sambuc 570*f4a2713aSLionel Sambuc // ffsl is available on at least Darwin, Mac OS X, iOS, FreeBSD, and 571*f4a2713aSLionel Sambuc // Linux (GLIBC): 572*f4a2713aSLionel Sambuc // http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/ffsl.3.html 573*f4a2713aSLionel Sambuc // http://svn.freebsd.org/base/user/eri/pf45/head/lib/libc/string/ffsl.c 574*f4a2713aSLionel Sambuc // http://www.gnu.org/software/gnulib/manual/html_node/ffsl.html 575*f4a2713aSLionel Sambuc switch (T.getOS()) { 576*f4a2713aSLionel Sambuc case Triple::Darwin: 577*f4a2713aSLionel Sambuc case Triple::MacOSX: 578*f4a2713aSLionel Sambuc case Triple::IOS: 579*f4a2713aSLionel Sambuc case Triple::FreeBSD: 580*f4a2713aSLionel Sambuc case Triple::Linux: 581*f4a2713aSLionel Sambuc break; 582*f4a2713aSLionel Sambuc default: 583*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::ffsl); 584*f4a2713aSLionel Sambuc } 585*f4a2713aSLionel Sambuc 586*f4a2713aSLionel Sambuc // ffsll is available on at least FreeBSD and Linux (GLIBC): 587*f4a2713aSLionel Sambuc // http://svn.freebsd.org/base/user/eri/pf45/head/lib/libc/string/ffsll.c 588*f4a2713aSLionel Sambuc // http://www.gnu.org/software/gnulib/manual/html_node/ffsll.html 589*f4a2713aSLionel Sambuc switch (T.getOS()) { 590*f4a2713aSLionel Sambuc case Triple::FreeBSD: 591*f4a2713aSLionel Sambuc case Triple::Linux: 592*f4a2713aSLionel Sambuc break; 593*f4a2713aSLionel Sambuc default: 594*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::ffsll); 595*f4a2713aSLionel Sambuc } 596*f4a2713aSLionel Sambuc 597*f4a2713aSLionel Sambuc // The following functions are available on at least Linux: 598*f4a2713aSLionel Sambuc if (!T.isOSLinux()) { 599*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::dunder_strdup); 600*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::dunder_strtok_r); 601*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::dunder_isoc99_scanf); 602*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::dunder_isoc99_sscanf); 603*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::under_IO_getc); 604*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::under_IO_putc); 605*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::memalign); 606*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fopen64); 607*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fseeko64); 608*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fstat64); 609*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::fstatvfs64); 610*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::ftello64); 611*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::lstat64); 612*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::open64); 613*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::stat64); 614*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::statvfs64); 615*f4a2713aSLionel Sambuc TLI.setUnavailable(LibFunc::tmpfile64); 616*f4a2713aSLionel Sambuc } 617*f4a2713aSLionel Sambuc } 618*f4a2713aSLionel Sambuc 619*f4a2713aSLionel Sambuc 620*f4a2713aSLionel Sambuc TargetLibraryInfo::TargetLibraryInfo() : ImmutablePass(ID) { 621*f4a2713aSLionel Sambuc // Default to everything being available. 622*f4a2713aSLionel Sambuc memset(AvailableArray, -1, sizeof(AvailableArray)); 623*f4a2713aSLionel Sambuc 624*f4a2713aSLionel Sambuc initialize(*this, Triple(), StandardNames); 625*f4a2713aSLionel Sambuc } 626*f4a2713aSLionel Sambuc 627*f4a2713aSLionel Sambuc TargetLibraryInfo::TargetLibraryInfo(const Triple &T) : ImmutablePass(ID) { 628*f4a2713aSLionel Sambuc // Default to everything being available. 629*f4a2713aSLionel Sambuc memset(AvailableArray, -1, sizeof(AvailableArray)); 630*f4a2713aSLionel Sambuc 631*f4a2713aSLionel Sambuc initialize(*this, T, StandardNames); 632*f4a2713aSLionel Sambuc } 633*f4a2713aSLionel Sambuc 634*f4a2713aSLionel Sambuc TargetLibraryInfo::TargetLibraryInfo(const TargetLibraryInfo &TLI) 635*f4a2713aSLionel Sambuc : ImmutablePass(ID) { 636*f4a2713aSLionel Sambuc memcpy(AvailableArray, TLI.AvailableArray, sizeof(AvailableArray)); 637*f4a2713aSLionel Sambuc CustomNames = TLI.CustomNames; 638*f4a2713aSLionel Sambuc } 639*f4a2713aSLionel Sambuc 640*f4a2713aSLionel Sambuc namespace { 641*f4a2713aSLionel Sambuc struct StringComparator { 642*f4a2713aSLionel Sambuc /// Compare two strings and return true if LHS is lexicographically less than 643*f4a2713aSLionel Sambuc /// RHS. Requires that RHS doesn't contain any zero bytes. 644*f4a2713aSLionel Sambuc bool operator()(const char *LHS, StringRef RHS) const { 645*f4a2713aSLionel Sambuc // Compare prefixes with strncmp. If prefixes match we know that LHS is 646*f4a2713aSLionel Sambuc // greater or equal to RHS as RHS can't contain any '\0'. 647*f4a2713aSLionel Sambuc return std::strncmp(LHS, RHS.data(), RHS.size()) < 0; 648*f4a2713aSLionel Sambuc } 649*f4a2713aSLionel Sambuc 650*f4a2713aSLionel Sambuc // Provided for compatibility with MSVC's debug mode. 651*f4a2713aSLionel Sambuc bool operator()(StringRef LHS, const char *RHS) const { return LHS < RHS; } 652*f4a2713aSLionel Sambuc bool operator()(StringRef LHS, StringRef RHS) const { return LHS < RHS; } 653*f4a2713aSLionel Sambuc bool operator()(const char *LHS, const char *RHS) const { 654*f4a2713aSLionel Sambuc return std::strcmp(LHS, RHS) < 0; 655*f4a2713aSLionel Sambuc } 656*f4a2713aSLionel Sambuc }; 657*f4a2713aSLionel Sambuc } 658*f4a2713aSLionel Sambuc 659*f4a2713aSLionel Sambuc bool TargetLibraryInfo::getLibFunc(StringRef funcName, 660*f4a2713aSLionel Sambuc LibFunc::Func &F) const { 661*f4a2713aSLionel Sambuc const char **Start = &StandardNames[0]; 662*f4a2713aSLionel Sambuc const char **End = &StandardNames[LibFunc::NumLibFuncs]; 663*f4a2713aSLionel Sambuc 664*f4a2713aSLionel Sambuc // Filter out empty names and names containing null bytes, those can't be in 665*f4a2713aSLionel Sambuc // our table. 666*f4a2713aSLionel Sambuc if (funcName.empty() || funcName.find('\0') != StringRef::npos) 667*f4a2713aSLionel Sambuc return false; 668*f4a2713aSLionel Sambuc 669*f4a2713aSLionel Sambuc // Check for \01 prefix that is used to mangle __asm declarations and 670*f4a2713aSLionel Sambuc // strip it if present. 671*f4a2713aSLionel Sambuc if (funcName.front() == '\01') 672*f4a2713aSLionel Sambuc funcName = funcName.substr(1); 673*f4a2713aSLionel Sambuc const char **I = std::lower_bound(Start, End, funcName, StringComparator()); 674*f4a2713aSLionel Sambuc if (I != End && *I == funcName) { 675*f4a2713aSLionel Sambuc F = (LibFunc::Func)(I - Start); 676*f4a2713aSLionel Sambuc return true; 677*f4a2713aSLionel Sambuc } 678*f4a2713aSLionel Sambuc return false; 679*f4a2713aSLionel Sambuc } 680*f4a2713aSLionel Sambuc 681*f4a2713aSLionel Sambuc /// disableAllFunctions - This disables all builtins, which is used for options 682*f4a2713aSLionel Sambuc /// like -fno-builtin. 683*f4a2713aSLionel Sambuc void TargetLibraryInfo::disableAllFunctions() { 684*f4a2713aSLionel Sambuc memset(AvailableArray, 0, sizeof(AvailableArray)); 685*f4a2713aSLionel Sambuc } 686