diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | autoconf/configure.ac | 47 | ||||
-rwxr-xr-x | configure | 94 | ||||
-rw-r--r-- | include/llvm/Config/config.h.cmake | 15 | ||||
-rw-r--r-- | include/llvm/Config/config.h.in | 15 | ||||
-rw-r--r-- | include/llvm/Config/llvm-config.h.cmake | 15 | ||||
-rw-r--r-- | include/llvm/Config/llvm-config.h.in | 15 | ||||
-rw-r--r-- | include/llvm/Support/Host.h | 41 | ||||
-rw-r--r-- | lib/Support/Triple.cpp | 26 | ||||
-rw-r--r-- | lib/Support/Unix/Host.inc | 40 | ||||
-rw-r--r-- | lib/Support/Windows/Host.inc | 40 |
11 files changed, 346 insertions, 6 deletions
@@ -99,6 +99,10 @@ ifneq ($(ONLY_TOOLS),) DIRS := $(filter-out unittests, $(DIRS)) endif +ifneq ($(NO_UNITTESTS),) + DIRS := $(filter-out unittests, $(DIRS)) +endif + # If we're cross-compiling, build the build-hosted tools first ifeq ($(LLVM_CROSS_COMPILING),1) all:: cross-compile-build-tools diff --git a/autoconf/configure.ac b/autoconf/configure.ac index adcfa49465..13baa3e492 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -446,6 +446,53 @@ fi AC_SUBST(HOST_ARCH,$host_arch) +dnl Default cpu (-mcpu=cpu) to use to all compiler invocations +AC_ARG_WITH(default-cpu, + AS_HELP_STRING([--with-default-cpu], + [Add by default -mcpu=cpu to all compiler invocations.]),, + with_default_cpu="") +AC_DEFINE_UNQUOTED([LLVM_DEFAULT_TARGET_MCPU],"$with_default_cpu", + [Default cpu (-mcpu=cpu) to use to all compiler invocations.]) + +dnl Default float abi to use to all compiler invocations +AC_ARG_WITH(default-float, + AS_HELP_STRING([--with-default-float], + [Default float abi to use to all compiler invocations.]),, + with_default_float="") +AC_DEFINE_UNQUOTED([LLVM_DEFAULT_TARGET_FLOAT],"$with_default_float", + [Default float abi to use to all compiler invocations.]) + +dnl Default FPU to use to all compiler invocations, in case of hard float +AC_ARG_WITH(default-float, + AS_HELP_STRING([--with-default-fpu], + [Default FPU to use to all compiler invocations, in case of hard float.]),, + with_default_fpu="") +AC_DEFINE_UNQUOTED([LLVM_DEFAULT_TARGET_FPU],"$with_default_fpu", + [Default FPU to use to all compiler invocations, in case of hard float.]) + +dnl Default hash-style to use to all linker invocations. +AC_ARG_WITH(default-hash-style, + AC_ARG_WITH(default-hash-style, + [Default hash-style to use to all linker invocations: gnu, sysv or both.]),, + with_default_hash_style="") +if test "x$with_default_hash_style" != "x" ; then + case "$with_default_hash_style" in + gnu|sysv|both);; + *) + AC_MSG_ERROR([Invalid --with-default-hash-style. Use "sysv", "gnu" or "both"]);; + esac + AC_DEFINE_UNQUOTED([LLVM_DEFAULT_TARGET_HASHSTYLE],"$with_default_hash_style", + [Default hash-style to use to all linker invocations.]) +fi + +dnl Default cpu (-mabi=abi) to use to all compiler invocations +AC_ARG_WITH(default-abi, + AS_HELP_STRING([--with-default-abi], + [Add by default -mabi=abi (if --with-default-abi=abi) to all compiler invocations.]),, + with_default_abi="") +AC_DEFINE_UNQUOTED([LLVM_DEFAULT_TARGET_ABI],"$with_default_abi", + [Add by default -mabi=abi to all compiler invocations.]) + dnl Check for the endianness of the target AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little])) @@ -1457,6 +1457,16 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-default-cpu Add by default -mcpu=cpu to all compiler + invocations. + --with-default-float Default float abi to use to all compiler + invocations. + --with-default-fpu Default FPU to use to all compiler invocations, in + case of hard float. + +Default hash-style to use to all linker invocations: gnu + --with-default-abi Add by default -mabi=abi (if --with-default-abi=abi) + to all compiler invocations. --with-optimize-option Select the compiler options to use for optimized builds --with-extra-options Specify additional options to compile LLVM with @@ -4073,6 +4083,88 @@ HOST_ARCH=$host_arch +# Check whether --with-default-cpu was given. +if test "${with_default_cpu+set}" = set; then + withval=$with_default_cpu; +else + with_default_cpu="" +fi + + +cat >>confdefs.h <<_ACEOF +#define LLVM_DEFAULT_TARGET_MCPU "$with_default_cpu" +_ACEOF + + + +# Check whether --with-default-float was given. +if test "${with_default_float+set}" = set; then + withval=$with_default_float; +else + with_default_float="" +fi + + +cat >>confdefs.h <<_ACEOF +#define LLVM_DEFAULT_TARGET_FLOAT "$with_default_float" +_ACEOF + + + +# Check whether --with-default-float was given. +if test "${with_default_float+set}" = set; then + withval=$with_default_float; +else + with_default_fpu="" +fi + + +cat >>confdefs.h <<_ACEOF +#define LLVM_DEFAULT_TARGET_FPU "$with_default_fpu" +_ACEOF + + + +# Check whether --with-default-hash-style was given. +if test "${with_default_hash_style+set}" = set; then + withval=$with_default_hash_style; sysv or both. +# Check whether --with-default-hash-style was given. +if test "${with_default_hash_style+set}" = set; then + withval=$with_default_hash_style; +fi + +fi + +if test "x$with_default_hash_style" != "x" ; then + case "$with_default_hash_style" in + gnu|sysv|both);; + *) + { { echo "$as_me:$LINENO: error: Invalid --with-default-hash-style. Use \"sysv\", \"gnu\" or \"both\"" >&5 +echo "$as_me: error: Invalid --with-default-hash-style. Use \"sysv\", \"gnu\" or \"both\"" >&2;} + { (exit 1); exit 1; }; };; + esac + +cat >>confdefs.h <<_ACEOF +#define LLVM_DEFAULT_TARGET_HASHSTYLE "$with_default_hash_style" +_ACEOF + +fi + + +# Check whether --with-default-abi was given. +if test "${with_default_abi+set}" = set; then + withval=$with_default_abi; +else + with_default_abi="" +fi + + +cat >>confdefs.h <<_ACEOF +#define LLVM_DEFAULT_TARGET_ABI "$with_default_abi" +_ACEOF + + + { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } @@ -10535,7 +10627,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10538 "configure" +#line 10630 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index 32d192e455..397df37a07 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -570,6 +570,21 @@ /* Installation directory for data files */ #cmakedefine LLVM_DATADIR "${LLVM_DATADIR}" +/* Add by default -mabi=abi to all compiler invocations. */ +#cmakedefine LLVM_DEFAULT_TARGET_ABI "${LLVM_DEFAULT_TARGET_ABI}" + +/* Default float abi to use to all compiler invocations. */ +#cmakedefine LLVM_DEFAULT_TARGET_FLOAT "${LLVM_DEFAULT_TARGET_FLOAT}" + +/* Default FPU to use to all compiler invocations, in case of hard float. */ +#cmakedefine LLVM_DEFAULT_TARGET_FPU "${LLVM_DEFAULT_TARGET_FPU}" + +/* Default hash-style to use to all linker invocations. */ +#cmakedefine LLVM_DEFAULT_TARGET_HASHSTYLE "${LLVM_DEFAULT_TARGET_HASHSTYLE}" + +/* Default cpu (-mcpu=cpu) to use to all compiler invocations. */ +#cmakedefine LLVM_DEFAULT_TARGET_MCPU "${LLVM_DEFAULT_TARGET_MCPU}" + /* Target triple LLVM will generate code for by default */ #cmakedefine LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 950e66f275..a5bb4b4abd 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -575,6 +575,21 @@ /* Installation directory for data files */ #undef LLVM_DATADIR +/* Add by default -mabi=abi to all compiler invocations. */ +#undef LLVM_DEFAULT_TARGET_ABI + +/* Default float abi to use to all compiler invocations. */ +#undef LLVM_DEFAULT_TARGET_FLOAT + +/* Default FPU to use to all compiler invocations, in case of hard float. */ +#undef LLVM_DEFAULT_TARGET_FPU + +/* Default hash-style to use to all linker invocations. */ +#undef LLVM_DEFAULT_TARGET_HASHSTYLE + +/* Default cpu (-mcpu=cpu) to use to all compiler invocations. */ +#undef LLVM_DEFAULT_TARGET_MCPU + /* Target triple LLVM will generate code for by default */ #undef LLVM_DEFAULT_TARGET_TRIPLE diff --git a/include/llvm/Config/llvm-config.h.cmake b/include/llvm/Config/llvm-config.h.cmake index c6f2bef210..e03722486b 100644 --- a/include/llvm/Config/llvm-config.h.cmake +++ b/include/llvm/Config/llvm-config.h.cmake @@ -25,6 +25,21 @@ /* Installation directory for data files */ #cmakedefine LLVM_DATADIR "${LLVM_DATADIR}" +/* Add by default -mabi=abi to all compiler invocations. */ +#cmakedefine LLVM_DEFAULT_TARGET_ABI "${LLVM_DEFAULT_TARGET_ABI}" + +/* Default float abi to use to all compiler invocations. */ +#cmakedefine LLVM_DEFAULT_TARGET_FLOAT "${LLVM_DEFAULT_TARGET_FLOAT}" + +/* Default FPU to use to all compiler invocations, in case of hard float. */ +#cmakedefine LLVM_DEFAULT_TARGET_FPU "${LLVM_DEFAULT_TARGET_FPU}" + +/* Default hash-style to use to all linker invocations. */ +#cmakedefine LLVM_DEFAULT_TARGET_HASHSTYLE "${LLVM_DEFAULT_TARGET_HASHSTYLE}" + +/* Default cpu (-mcpu=cpu) to use to all compiler invocations. */ +#cmakedefine LLVM_DEFAULT_TARGET_MCPU "${LLVM_DEFAULT_TARGET_MCPU}" + /* Target triple LLVM will generate code for by default */ #cmakedefine LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" diff --git a/include/llvm/Config/llvm-config.h.in b/include/llvm/Config/llvm-config.h.in index a5209fa9b2..0b3f328310 100644 --- a/include/llvm/Config/llvm-config.h.in +++ b/include/llvm/Config/llvm-config.h.in @@ -25,6 +25,21 @@ /* Installation directory for data files */ #undef LLVM_DATADIR +/* Add by default -mabi=abi to all compiler invocations. */ +#undef LLVM_DEFAULT_TARGET_ABI + +/* Default float abi to use to all compiler invocations. */ +#undef LLVM_DEFAULT_TARGET_FLOAT + +/* Default FPU to use to all compiler invocations, in case of hard float. */ +#undef LLVM_DEFAULT_TARGET_FPU + +/* Default hash-style to use to all linker invocations. */ +#undef LLVM_DEFAULT_TARGET_HASHSTYLE + +/* Default cpu (-mcpu=cpu) to use to all compiler invocations. */ +#undef LLVM_DEFAULT_TARGET_MCPU + /* Target triple LLVM will generate code for by default */ #undef LLVM_DEFAULT_TARGET_TRIPLE diff --git a/include/llvm/Support/Host.h b/include/llvm/Support/Host.h index 9a4036a8af..ab52671861 100644 --- a/include/llvm/Support/Host.h +++ b/include/llvm/Support/Host.h @@ -46,6 +46,47 @@ namespace sys { /// CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM std::string getDefaultTargetTriple(); + /// getDefaultTargetCpu() - Return the default target cpu for which the + /// compiler is configured to generate code for (ie. -mcpu), or "" if empty. + std::string getDefaultTargetCpu(); + + /// hasDefaultTargetCpu() - Return true if the compiler was configured to + /// generate by default code for a given target cpu and false otherwise. + bool hasDefaultTargetCpu(); + + /// getDefaultTargetFloat() - Return the default target float abi for which + /// the compiler is configured to generate code for, or "" if empty. + std::string getDefaultTargetFloat(); + + /// hasDefaultTargetFloat() - Return true if the compiler was configured to + /// generate by default code for a given floating point abi and false + /// otherwise. + bool hasDefaultTargetFloat(); + + /// getDefaultTargetFpu() - Return the default target FPU for which the + /// compiler is configured to generate code for, or "" if empty. + std::string getDefaultTargetFpu(); + + /// hasDefaultTargetFpu() - Return true if the compiler was configured to + /// generate by default code for a given FPU and false otherwise. + bool hasDefaultTargetFpu(); + + /// getDefaultTargetHashStyle() - Return the default target hash-style for + /// which the compiler is configured to generated for, or "" if empty. + std::string getDefaultTargetHashStyle(); + + /// hasDefaultTargetHashStyle() - Return true if the compiler was configured + /// to generate by default code with a given hash-style and false otherwise. + bool hasDefaultTargetHashStyle(); + + /// getDefaultTargetAbi() - Return the default target ABI for which the + /// compiler is configured to generate code for, or "" if empty. + std::string getDefaultTargetAbi(); + + /// hasDefaultTargetAbi() - Return true if the compiler was configured to + /// generate code for a given ABI and false otherwise. + bool hasDefaultTargetAbi(); + /// getProcessTriple() - Return an appropriate target triple for generating /// code to be loaded into the current process, e.g. when using the JIT. std::string getProcessTriple(); diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index 412e34ccc5..c9729b5412 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -160,10 +160,22 @@ Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) { return StringSwitch<Triple::ArchType>(Name) .Case("aarch64", aarch64) .Case("arm", arm) + .Case("armeb", arm) + .Case("armel", arm) .Case("mips", mips) .Case("mipsel", mipsel) + .Case("mipsisa32", mips) + .Case("mipsisa32el", mipsel) + .Case("mipsisa32r2", mips) + .Case("mipsisa32r2el", mipsel) .Case("mips64", mips64) .Case("mips64el", mips64el) + .Case("mipsisa64", mips64) + .Case("mipsisa64el", mips64el) + .Case("mipsisa64r2", mips64) + .Case("mipsisa64r2el", mips64el) + .Case("mips64octeon", mips64) + .Case("mips64octeonel", mips64el) .Case("msp430", msp430) .Case("ppc64", ppc64) .Case("ppc32", ppc) @@ -224,17 +236,17 @@ static Triple::ArchType parseArch(StringRef ArchName) { .Cases("powerpc64", "ppu", Triple::ppc64) .Case("mblaze", Triple::mblaze) .Case("aarch64", Triple::aarch64) - .Cases("arm", "xscale", Triple::arm) + .Cases("arm", "armeb", "armel", "xscale", Triple::arm) // FIXME: It would be good to replace these with explicit names for all the // various suffixes supported. .StartsWith("armv", Triple::arm) .Case("thumb", Triple::thumb) .StartsWith("thumbv", Triple::thumb) .Case("msp430", Triple::msp430) - .Cases("mips", "mipseb", "mipsallegrex", Triple::mips) - .Cases("mipsel", "mipsallegrexel", Triple::mipsel) - .Cases("mips64", "mips64eb", Triple::mips64) - .Case("mips64el", Triple::mips64el) + .Cases("mips", "mipseb", "mipsisa32", "mipsisa32r2", "mipsallegrex", Triple::mips) + .Cases("mipsel", "mipsisa32el", "mipsisa32r2el", "mipsallegrexel", Triple::mipsel) + .Cases("mips64", "mips64eb", "mipsisa64", "mipsisa64r2", "mips64octeon", Triple::mips64) + .Cases("mips64el", "mipsisa64el", "mipsisa64r2el", "mips64octeonel", Triple::mips64el) .Case("r600", Triple::r600) .Case("hexagon", Triple::hexagon) .Case("s390x", Triple::systemz) @@ -295,8 +307,12 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { .StartsWith("eabi", Triple::EABI) .StartsWith("gnueabihf", Triple::GNUEABIHF) .StartsWith("gnueabi", Triple::GNUEABI) + .StartsWith("uclibceabi", Triple::GNUEABI) + .StartsWith("musleabi", Triple::GNUEABI) .StartsWith("gnux32", Triple::GNUX32) .StartsWith("gnu", Triple::GNU) + .StartsWith("uclibc", Triple::GNU) + .StartsWith("musl", Triple::GNU) .StartsWith("macho", Triple::MachO) .StartsWith("android", Triple::Android) .StartsWith("elf", Triple::ELF) diff --git a/lib/Support/Unix/Host.inc b/lib/Support/Unix/Host.inc index 726e2fbcf0..28828eb83c 100644 --- a/lib/Support/Unix/Host.inc +++ b/lib/Support/Unix/Host.inc @@ -61,3 +61,43 @@ std::string sys::getDefaultTargetTriple() { return Triple; } + +std::string sys::getDefaultTargetCpu() { + return LLVM_DEFAULT_TARGET_MCPU; +} + +bool sys::hasDefaultTargetCpu() { + return getDefaultTargetCpu() != ""; +} + +std::string sys::getDefaultTargetFloat() { + return LLVM_DEFAULT_TARGET_FLOAT; +} + +bool sys::hasDefaultTargetFloat() { + return getDefaultTargetFloat() != ""; +} + +std::string sys::getDefaultTargetFpu() { + return LLVM_DEFAULT_TARGET_FPU; +} + +bool sys::hasDefaultTargetFpu() { + return getDefaultTargetFpu() != ""; +} + +std::string sys::getDefaultTargetHashStyle() { + return LLVM_DEFAULT_TARGET_HASHSTYLE; +} + +bool sys::hasDefaultTargetHashStyle() { + return getDefaultTargetHashStyle() != ""; +} + +std::string sys::getDefaultTargetAbi() { + return LLVM_DEFAULT_TARGET_ABI; +} + +bool sys::hasDefaultTargetAbi() { + return getDefaultTargetAbi() != ""; +} diff --git a/lib/Support/Windows/Host.inc b/lib/Support/Windows/Host.inc index 2e6d6f1903..1933bf7e87 100644 --- a/lib/Support/Windows/Host.inc +++ b/lib/Support/Windows/Host.inc @@ -20,3 +20,43 @@ using namespace llvm; std::string sys::getDefaultTargetTriple() { return LLVM_DEFAULT_TARGET_TRIPLE; } + +std::string sys::getDefaultTargetCpu() { + return LLVM_DEFAULT_TARGET_MCPU; +} + +bool sys::hasDefaultTargetCpu() { + return getDefaultTargetCpu() != ""; +} + +std::string sys::getDefaultTargetFloat() { + return LLVM_DEFAULT_TARGET_FLOAT; +} + +bool sys::hasDefaultTargetFloat() { + return getDefaultTargetFloat() != ""; +} + +std::string sys::getDefaultTargetFpu() { + return LLVM_DEFAULT_TARGET_FPU; +} + +bool sys::hasDefaultTargetFpu() { + return getDefaultTargetFpu() != ""; +} + +std::string sys::getDefaultTargetHashStyle() { + return LLVM_DEFAULT_TARGET_HASHSTYLE; +} + +bool sys::hasDefaultTargetHashStyle() { + return getDefaultTargetHashStyle() != ""; +} + +std::string sys::getDefaultTargetAbi() { + return LLVM_DEFAULT_TARGET_ABI; +} + +bool sys::hasDefaultTargetAbi() { + return getDefaultTargetAbi() != ""; +} |