2011-02-18 21:50:34 +00:00
|
|
|
//===-- TargetLibraryInfo.cpp - Runtime library information ----------------==//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the TargetLibraryInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/Target/TargetLibraryInfo.h"
|
|
|
|
#include "llvm/ADT/Triple.h"
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
// Register the default implementation.
|
|
|
|
INITIALIZE_PASS(TargetLibraryInfo, "targetlibinfo",
|
|
|
|
"Target Library Information", false, true)
|
|
|
|
char TargetLibraryInfo::ID = 0;
|
|
|
|
|
2011-12-20 02:50:00 +00:00
|
|
|
void TargetLibraryInfo::anchor() { }
|
|
|
|
|
2011-11-17 01:27:36 +00:00
|
|
|
const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] =
|
|
|
|
{
|
2012-08-29 15:32:21 +00:00
|
|
|
"_ZdaPv",
|
|
|
|
"_ZdlPv",
|
|
|
|
"_Znaj",
|
|
|
|
"_ZnajRKSt9nothrow_t",
|
|
|
|
"_Znam",
|
|
|
|
"_ZnamRKSt9nothrow_t",
|
|
|
|
"_Znwj",
|
|
|
|
"_ZnwjRKSt9nothrow_t",
|
|
|
|
"_Znwm",
|
|
|
|
"_ZnwmRKSt9nothrow_t",
|
2012-08-03 04:06:22 +00:00
|
|
|
"__cxa_atexit",
|
|
|
|
"__cxa_guard_abort",
|
|
|
|
"__cxa_guard_acquire",
|
|
|
|
"__cxa_guard_release",
|
|
|
|
"__memcpy_chk",
|
2012-11-22 15:36:42 +00:00
|
|
|
"abs",
|
2011-11-30 19:19:00 +00:00
|
|
|
"acos",
|
|
|
|
"acosf",
|
2012-08-21 23:28:56 +00:00
|
|
|
"acosh",
|
|
|
|
"acoshf",
|
|
|
|
"acoshl",
|
2012-08-03 04:06:22 +00:00
|
|
|
"acosl",
|
2011-11-30 19:19:00 +00:00
|
|
|
"asin",
|
|
|
|
"asinf",
|
2012-08-21 23:28:56 +00:00
|
|
|
"asinh",
|
|
|
|
"asinhf",
|
|
|
|
"asinhl",
|
2012-08-03 04:06:22 +00:00
|
|
|
"asinl",
|
2011-11-30 19:19:00 +00:00
|
|
|
"atan",
|
2011-12-01 17:54:37 +00:00
|
|
|
"atan2",
|
|
|
|
"atan2f",
|
2012-08-03 04:06:22 +00:00
|
|
|
"atan2l",
|
|
|
|
"atanf",
|
2012-08-21 23:28:56 +00:00
|
|
|
"atanh",
|
|
|
|
"atanhf",
|
|
|
|
"atanhl",
|
2012-08-03 04:06:22 +00:00
|
|
|
"atanl",
|
2012-08-29 15:32:21 +00:00
|
|
|
"calloc",
|
2012-08-21 23:28:56 +00:00
|
|
|
"cbrt",
|
|
|
|
"cbrtf",
|
|
|
|
"cbrtl",
|
2011-11-30 19:19:00 +00:00
|
|
|
"ceil",
|
|
|
|
"ceilf",
|
2012-08-03 04:06:22 +00:00
|
|
|
"ceill",
|
2011-12-08 22:15:21 +00:00
|
|
|
"copysign",
|
|
|
|
"copysignf",
|
|
|
|
"copysignl",
|
2011-11-30 19:19:00 +00:00
|
|
|
"cos",
|
|
|
|
"cosf",
|
|
|
|
"cosh",
|
|
|
|
"coshf",
|
2012-08-03 04:06:22 +00:00
|
|
|
"coshl",
|
|
|
|
"cosl",
|
2011-11-30 19:19:00 +00:00
|
|
|
"exp",
|
2012-08-21 23:28:56 +00:00
|
|
|
"exp10",
|
|
|
|
"exp10f",
|
|
|
|
"exp10l",
|
2011-11-30 19:19:00 +00:00
|
|
|
"exp2",
|
|
|
|
"exp2f",
|
2012-08-03 04:06:22 +00:00
|
|
|
"exp2l",
|
|
|
|
"expf",
|
|
|
|
"expl",
|
2011-11-30 19:19:00 +00:00
|
|
|
"expm1",
|
2012-04-17 23:05:54 +00:00
|
|
|
"expm1f",
|
2012-08-03 04:06:22 +00:00
|
|
|
"expm1l",
|
2011-11-30 19:19:00 +00:00
|
|
|
"fabs",
|
|
|
|
"fabsf",
|
2012-08-03 04:06:22 +00:00
|
|
|
"fabsl",
|
2012-11-22 15:36:42 +00:00
|
|
|
"ffs",
|
|
|
|
"ffsl",
|
|
|
|
"ffsll",
|
2012-08-03 04:06:22 +00:00
|
|
|
"fiprintf",
|
2011-11-30 19:19:00 +00:00
|
|
|
"floor",
|
|
|
|
"floorf",
|
2012-08-03 04:06:22 +00:00
|
|
|
"floorl",
|
2011-12-01 17:54:37 +00:00
|
|
|
"fmod",
|
|
|
|
"fmodf",
|
2012-08-03 04:06:22 +00:00
|
|
|
"fmodl",
|
2012-11-22 15:36:42 +00:00
|
|
|
"fprintf",
|
2012-07-24 21:00:36 +00:00
|
|
|
"fputc",
|
2011-11-30 01:51:49 +00:00
|
|
|
"fputs",
|
2012-08-29 15:32:21 +00:00
|
|
|
"free",
|
2011-11-30 01:51:49 +00:00
|
|
|
"fwrite",
|
|
|
|
"iprintf",
|
2012-11-22 15:36:42 +00:00
|
|
|
"isascii",
|
|
|
|
"isdigit",
|
|
|
|
"labs",
|
|
|
|
"llabs",
|
2011-11-30 19:19:00 +00:00
|
|
|
"log",
|
|
|
|
"log10",
|
|
|
|
"log10f",
|
2012-08-03 04:06:22 +00:00
|
|
|
"log10l",
|
2011-11-30 19:19:00 +00:00
|
|
|
"log1p",
|
|
|
|
"log1pf",
|
2012-08-03 04:06:22 +00:00
|
|
|
"log1pl",
|
|
|
|
"log2",
|
|
|
|
"log2f",
|
|
|
|
"log2l",
|
2012-08-21 23:28:56 +00:00
|
|
|
"logb",
|
|
|
|
"logbf",
|
|
|
|
"logbl",
|
2012-08-03 04:06:22 +00:00
|
|
|
"logf",
|
|
|
|
"logl",
|
2012-08-29 15:32:21 +00:00
|
|
|
"malloc",
|
2012-07-24 21:00:36 +00:00
|
|
|
"memchr",
|
|
|
|
"memcmp",
|
2011-11-17 01:27:36 +00:00
|
|
|
"memcpy",
|
|
|
|
"memmove",
|
2011-11-30 01:51:49 +00:00
|
|
|
"memset",
|
2011-11-17 01:27:36 +00:00
|
|
|
"memset_pattern16",
|
2011-12-08 22:15:21 +00:00
|
|
|
"nearbyint",
|
|
|
|
"nearbyintf",
|
|
|
|
"nearbyintl",
|
2012-08-29 15:32:21 +00:00
|
|
|
"posix_memalign",
|
2011-11-30 19:19:00 +00:00
|
|
|
"pow",
|
|
|
|
"powf",
|
|
|
|
"powl",
|
2012-11-22 15:36:42 +00:00
|
|
|
"printf",
|
2012-07-24 21:00:36 +00:00
|
|
|
"putchar",
|
|
|
|
"puts",
|
2012-08-29 15:32:21 +00:00
|
|
|
"realloc",
|
|
|
|
"reallocf",
|
2011-12-08 22:15:21 +00:00
|
|
|
"rint",
|
|
|
|
"rintf",
|
|
|
|
"rintl",
|
2012-04-17 23:05:54 +00:00
|
|
|
"round",
|
|
|
|
"roundf",
|
|
|
|
"roundl",
|
2011-12-01 17:54:37 +00:00
|
|
|
"sin",
|
|
|
|
"sinf",
|
2011-12-01 18:26:19 +00:00
|
|
|
"sinh",
|
|
|
|
"sinhf",
|
2012-08-03 04:06:22 +00:00
|
|
|
"sinhl",
|
|
|
|
"sinl",
|
2011-12-01 18:26:19 +00:00
|
|
|
"siprintf",
|
2012-11-22 15:36:42 +00:00
|
|
|
"sprintf",
|
2011-11-29 23:57:10 +00:00
|
|
|
"sqrt",
|
2011-12-01 17:54:37 +00:00
|
|
|
"sqrtf",
|
2012-08-03 04:06:22 +00:00
|
|
|
"sqrtl",
|
2012-11-10 03:11:06 +00:00
|
|
|
"stpcpy",
|
2012-07-24 17:25:06 +00:00
|
|
|
"strcat",
|
2012-07-24 21:00:36 +00:00
|
|
|
"strchr",
|
2012-11-10 03:11:06 +00:00
|
|
|
"strcmp",
|
2012-07-24 17:25:06 +00:00
|
|
|
"strcpy",
|
2012-11-10 03:11:06 +00:00
|
|
|
"strcspn",
|
2012-08-29 15:32:21 +00:00
|
|
|
"strdup",
|
2012-07-24 17:25:06 +00:00
|
|
|
"strlen",
|
|
|
|
"strncat",
|
2012-07-24 21:00:36 +00:00
|
|
|
"strncmp",
|
2012-07-24 17:25:06 +00:00
|
|
|
"strncpy",
|
2012-08-29 15:32:21 +00:00
|
|
|
"strndup",
|
2012-07-24 17:25:06 +00:00
|
|
|
"strnlen",
|
2012-11-10 03:11:06 +00:00
|
|
|
"strpbrk",
|
|
|
|
"strrchr",
|
|
|
|
"strspn",
|
|
|
|
"strstr",
|
|
|
|
"strtod",
|
|
|
|
"strtof",
|
|
|
|
"strtol",
|
|
|
|
"strtold",
|
|
|
|
"strtoll",
|
|
|
|
"strtoul",
|
|
|
|
"strtoull",
|
2011-12-01 17:54:37 +00:00
|
|
|
"tan",
|
|
|
|
"tanf",
|
|
|
|
"tanh",
|
2011-12-08 22:15:21 +00:00
|
|
|
"tanhf",
|
2012-08-03 04:06:22 +00:00
|
|
|
"tanhl",
|
|
|
|
"tanl",
|
2012-11-22 15:36:42 +00:00
|
|
|
"toascii",
|
2011-12-08 22:15:21 +00:00
|
|
|
"trunc",
|
|
|
|
"truncf",
|
2012-08-29 15:32:21 +00:00
|
|
|
"truncl",
|
|
|
|
"valloc"
|
2011-11-17 01:27:36 +00:00
|
|
|
};
|
|
|
|
|
2011-02-18 21:50:34 +00:00
|
|
|
/// initialize - Initialize the set of available library functions based on the
|
|
|
|
/// specified target triple. This should be carefully written so that a missing
|
|
|
|
/// target triple gets a sane set of defaults.
|
2012-08-03 04:06:22 +00:00
|
|
|
static void initialize(TargetLibraryInfo &TLI, const Triple &T,
|
|
|
|
const char **StandardNames) {
|
2011-02-18 21:50:34 +00:00
|
|
|
initializeTargetLibraryInfoPass(*PassRegistry::getPassRegistry());
|
|
|
|
|
2012-08-03 04:06:22 +00:00
|
|
|
#ifndef NDEBUG
|
|
|
|
// Verify that the StandardNames array is in alphabetical order.
|
|
|
|
for (unsigned F = 1; F < LibFunc::NumLibFuncs; ++F) {
|
|
|
|
if (strcmp(StandardNames[F-1], StandardNames[F]) >= 0)
|
|
|
|
llvm_unreachable("TargetLibraryInfo function names must be sorted");
|
|
|
|
}
|
|
|
|
#endif // !NDEBUG
|
2011-02-18 21:50:34 +00:00
|
|
|
|
|
|
|
// memset_pattern16 is only available on iOS 3.0 and Mac OS/X 10.5 and later.
|
2011-04-20 00:14:25 +00:00
|
|
|
if (T.isMacOSX()) {
|
|
|
|
if (T.isMacOSXVersionLT(10, 5))
|
2011-04-19 20:44:08 +00:00
|
|
|
TLI.setUnavailable(LibFunc::memset_pattern16);
|
|
|
|
} else if (T.getOS() == Triple::IOS) {
|
|
|
|
if (T.isOSVersionLT(3, 0))
|
|
|
|
TLI.setUnavailable(LibFunc::memset_pattern16);
|
|
|
|
} else {
|
2011-02-18 21:50:34 +00:00
|
|
|
TLI.setUnavailable(LibFunc::memset_pattern16);
|
2011-04-19 20:44:08 +00:00
|
|
|
}
|
2011-03-03 13:17:51 +00:00
|
|
|
|
2011-11-17 01:27:36 +00:00
|
|
|
if (T.isMacOSX() && T.getArch() == Triple::x86 &&
|
|
|
|
!T.isMacOSXVersionLT(10, 7)) {
|
|
|
|
// x86-32 OSX has a scheme where fwrite and fputs (and some other functions
|
|
|
|
// we don't care about) have two versions; on recent OSX, the one we want
|
|
|
|
// has a $UNIX2003 suffix. The two implementations are identical except
|
|
|
|
// for the return value in some edge cases. However, we don't want to
|
|
|
|
// generate code that depends on the old symbols.
|
|
|
|
TLI.setAvailableWithName(LibFunc::fwrite, "fwrite$UNIX2003");
|
|
|
|
TLI.setAvailableWithName(LibFunc::fputs, "fputs$UNIX2003");
|
|
|
|
}
|
|
|
|
|
2011-06-09 11:11:45 +00:00
|
|
|
// iprintf and friends are only available on XCore and TCE.
|
|
|
|
if (T.getArch() != Triple::xcore && T.getArch() != Triple::tce) {
|
2011-03-03 13:17:51 +00:00
|
|
|
TLI.setUnavailable(LibFunc::iprintf);
|
2011-03-03 14:09:28 +00:00
|
|
|
TLI.setUnavailable(LibFunc::siprintf);
|
2011-03-03 14:20:22 +00:00
|
|
|
TLI.setUnavailable(LibFunc::fiprintf);
|
2011-03-03 14:09:28 +00:00
|
|
|
}
|
2012-04-17 23:05:54 +00:00
|
|
|
|
|
|
|
if (T.getOS() == Triple::Win32) {
|
|
|
|
// Win32 does not support long double
|
|
|
|
TLI.setUnavailable(LibFunc::acosl);
|
|
|
|
TLI.setUnavailable(LibFunc::asinl);
|
|
|
|
TLI.setUnavailable(LibFunc::atanl);
|
|
|
|
TLI.setUnavailable(LibFunc::atan2l);
|
|
|
|
TLI.setUnavailable(LibFunc::ceill);
|
|
|
|
TLI.setUnavailable(LibFunc::copysignl);
|
|
|
|
TLI.setUnavailable(LibFunc::cosl);
|
|
|
|
TLI.setUnavailable(LibFunc::coshl);
|
|
|
|
TLI.setUnavailable(LibFunc::expl);
|
|
|
|
TLI.setUnavailable(LibFunc::fabsf); // Win32 and Win64 both lack fabsf
|
|
|
|
TLI.setUnavailable(LibFunc::fabsl);
|
|
|
|
TLI.setUnavailable(LibFunc::floorl);
|
|
|
|
TLI.setUnavailable(LibFunc::fmodl);
|
|
|
|
TLI.setUnavailable(LibFunc::logl);
|
|
|
|
TLI.setUnavailable(LibFunc::powl);
|
|
|
|
TLI.setUnavailable(LibFunc::sinl);
|
|
|
|
TLI.setUnavailable(LibFunc::sinhl);
|
|
|
|
TLI.setUnavailable(LibFunc::sqrtl);
|
|
|
|
TLI.setUnavailable(LibFunc::tanl);
|
|
|
|
TLI.setUnavailable(LibFunc::tanhl);
|
|
|
|
|
|
|
|
// Win32 only has C89 math
|
2012-08-21 23:28:56 +00:00
|
|
|
TLI.setUnavailable(LibFunc::acosh);
|
|
|
|
TLI.setUnavailable(LibFunc::acoshf);
|
|
|
|
TLI.setUnavailable(LibFunc::acoshl);
|
|
|
|
TLI.setUnavailable(LibFunc::asinh);
|
|
|
|
TLI.setUnavailable(LibFunc::asinhf);
|
|
|
|
TLI.setUnavailable(LibFunc::asinhl);
|
|
|
|
TLI.setUnavailable(LibFunc::atanh);
|
|
|
|
TLI.setUnavailable(LibFunc::atanhf);
|
|
|
|
TLI.setUnavailable(LibFunc::atanhl);
|
|
|
|
TLI.setUnavailable(LibFunc::cbrt);
|
|
|
|
TLI.setUnavailable(LibFunc::cbrtf);
|
|
|
|
TLI.setUnavailable(LibFunc::cbrtl);
|
|
|
|
TLI.setUnavailable(LibFunc::exp10);
|
|
|
|
TLI.setUnavailable(LibFunc::exp10f);
|
|
|
|
TLI.setUnavailable(LibFunc::exp10l);
|
2012-04-17 23:05:54 +00:00
|
|
|
TLI.setUnavailable(LibFunc::exp2);
|
|
|
|
TLI.setUnavailable(LibFunc::exp2f);
|
|
|
|
TLI.setUnavailable(LibFunc::exp2l);
|
|
|
|
TLI.setUnavailable(LibFunc::expm1);
|
|
|
|
TLI.setUnavailable(LibFunc::expm1f);
|
|
|
|
TLI.setUnavailable(LibFunc::expm1l);
|
|
|
|
TLI.setUnavailable(LibFunc::log2);
|
|
|
|
TLI.setUnavailable(LibFunc::log2f);
|
|
|
|
TLI.setUnavailable(LibFunc::log2l);
|
|
|
|
TLI.setUnavailable(LibFunc::log1p);
|
|
|
|
TLI.setUnavailable(LibFunc::log1pf);
|
|
|
|
TLI.setUnavailable(LibFunc::log1pl);
|
2012-08-21 23:28:56 +00:00
|
|
|
TLI.setUnavailable(LibFunc::logb);
|
|
|
|
TLI.setUnavailable(LibFunc::logbf);
|
|
|
|
TLI.setUnavailable(LibFunc::logbl);
|
2012-04-17 23:05:54 +00:00
|
|
|
TLI.setUnavailable(LibFunc::nearbyint);
|
|
|
|
TLI.setUnavailable(LibFunc::nearbyintf);
|
|
|
|
TLI.setUnavailable(LibFunc::nearbyintl);
|
|
|
|
TLI.setUnavailable(LibFunc::rint);
|
|
|
|
TLI.setUnavailable(LibFunc::rintf);
|
|
|
|
TLI.setUnavailable(LibFunc::rintl);
|
|
|
|
TLI.setUnavailable(LibFunc::round);
|
|
|
|
TLI.setUnavailable(LibFunc::roundf);
|
|
|
|
TLI.setUnavailable(LibFunc::roundl);
|
|
|
|
TLI.setUnavailable(LibFunc::trunc);
|
|
|
|
TLI.setUnavailable(LibFunc::truncf);
|
|
|
|
TLI.setUnavailable(LibFunc::truncl);
|
|
|
|
|
|
|
|
// Win32 provides some C99 math with mangled names
|
|
|
|
TLI.setAvailableWithName(LibFunc::copysign, "_copysign");
|
|
|
|
|
|
|
|
if (T.getArch() == Triple::x86) {
|
|
|
|
// Win32 on x86 implements single-precision math functions as macros
|
|
|
|
TLI.setUnavailable(LibFunc::acosf);
|
|
|
|
TLI.setUnavailable(LibFunc::asinf);
|
|
|
|
TLI.setUnavailable(LibFunc::atanf);
|
|
|
|
TLI.setUnavailable(LibFunc::atan2f);
|
|
|
|
TLI.setUnavailable(LibFunc::ceilf);
|
|
|
|
TLI.setUnavailable(LibFunc::copysignf);
|
|
|
|
TLI.setUnavailable(LibFunc::cosf);
|
|
|
|
TLI.setUnavailable(LibFunc::coshf);
|
|
|
|
TLI.setUnavailable(LibFunc::expf);
|
|
|
|
TLI.setUnavailable(LibFunc::floorf);
|
|
|
|
TLI.setUnavailable(LibFunc::fmodf);
|
|
|
|
TLI.setUnavailable(LibFunc::logf);
|
|
|
|
TLI.setUnavailable(LibFunc::powf);
|
|
|
|
TLI.setUnavailable(LibFunc::sinf);
|
|
|
|
TLI.setUnavailable(LibFunc::sinhf);
|
|
|
|
TLI.setUnavailable(LibFunc::sqrtf);
|
|
|
|
TLI.setUnavailable(LibFunc::tanf);
|
|
|
|
TLI.setUnavailable(LibFunc::tanhf);
|
|
|
|
}
|
2012-11-10 03:11:06 +00:00
|
|
|
|
|
|
|
// Win32 does *not* provide stpcpy. It is provided on POSIX systems:
|
|
|
|
// http://pubs.opengroup.org/onlinepubs/9699919799/functions/stpcpy.html
|
|
|
|
TLI.setUnavailable(LibFunc::stpcpy);
|
2012-11-22 15:36:42 +00:00
|
|
|
|
|
|
|
// Win32 does *not* provide ffs. It is provided on POSIX systems:
|
|
|
|
// http://pubs.opengroup.org/onlinepubs/009695399/functions/ffs.html
|
|
|
|
TLI.setUnavailable(LibFunc::ffs);
|
|
|
|
|
|
|
|
// Win32 does *not* provide llabs. It is defined in ISO/IEC 9899:1999,
|
|
|
|
// but Visual C++ does not support it.
|
|
|
|
TLI.setUnavailable(LibFunc::llabs);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ffsl is available on at least Darwin, Mac OS X, iOS, FreeBSD, and
|
|
|
|
// Linux (GLIBC):
|
|
|
|
// http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/ffsl.3.html
|
|
|
|
// http://svn.freebsd.org/base/user/eri/pf45/head/lib/libc/string/ffsl.c
|
|
|
|
// http://www.gnu.org/software/gnulib/manual/html_node/ffsl.html
|
|
|
|
switch (T.getOS()) {
|
|
|
|
case Triple::Darwin:
|
|
|
|
case Triple::MacOSX:
|
|
|
|
case Triple::IOS:
|
|
|
|
case Triple::FreeBSD:
|
|
|
|
case Triple::Linux:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
TLI.setUnavailable(LibFunc::ffsl);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ffsll is available on at least FreeBSD and Linux (GLIBC):
|
|
|
|
// http://svn.freebsd.org/base/user/eri/pf45/head/lib/libc/string/ffsll.c
|
|
|
|
// http://www.gnu.org/software/gnulib/manual/html_node/ffsll.html
|
|
|
|
switch (T.getOS()) {
|
|
|
|
case Triple::FreeBSD:
|
|
|
|
case Triple::Linux:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
TLI.setUnavailable(LibFunc::ffsll);
|
2012-04-17 23:05:54 +00:00
|
|
|
}
|
2011-02-18 21:50:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TargetLibraryInfo::TargetLibraryInfo() : ImmutablePass(ID) {
|
|
|
|
// Default to everything being available.
|
|
|
|
memset(AvailableArray, -1, sizeof(AvailableArray));
|
|
|
|
|
2012-08-03 04:06:22 +00:00
|
|
|
initialize(*this, Triple(), StandardNames);
|
2011-02-18 21:50:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TargetLibraryInfo::TargetLibraryInfo(const Triple &T) : ImmutablePass(ID) {
|
|
|
|
// Default to everything being available.
|
|
|
|
memset(AvailableArray, -1, sizeof(AvailableArray));
|
|
|
|
|
2012-08-03 04:06:22 +00:00
|
|
|
initialize(*this, T, StandardNames);
|
2011-02-18 21:50:34 +00:00
|
|
|
}
|
2011-02-18 22:34:03 +00:00
|
|
|
|
2011-05-21 20:09:13 +00:00
|
|
|
TargetLibraryInfo::TargetLibraryInfo(const TargetLibraryInfo &TLI)
|
|
|
|
: ImmutablePass(ID) {
|
|
|
|
memcpy(AvailableArray, TLI.AvailableArray, sizeof(AvailableArray));
|
2011-11-17 01:27:36 +00:00
|
|
|
CustomNames = TLI.CustomNames;
|
2011-05-21 20:09:13 +00:00
|
|
|
}
|
|
|
|
|
2012-08-03 04:06:22 +00:00
|
|
|
bool TargetLibraryInfo::getLibFunc(StringRef funcName,
|
|
|
|
LibFunc::Func &F) const {
|
|
|
|
const char **Start = &StandardNames[0];
|
|
|
|
const char **End = &StandardNames[LibFunc::NumLibFuncs];
|
|
|
|
const char **I = std::lower_bound(Start, End, funcName);
|
|
|
|
if (I != End && *I == funcName) {
|
|
|
|
F = (LibFunc::Func)(I - Start);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2011-05-21 20:09:13 +00:00
|
|
|
|
2011-02-18 22:34:03 +00:00
|
|
|
/// disableAllFunctions - This disables all builtins, which is used for options
|
|
|
|
/// like -fno-builtin.
|
|
|
|
void TargetLibraryInfo::disableAllFunctions() {
|
|
|
|
memset(AvailableArray, 0, sizeof(AvailableArray));
|
|
|
|
}
|