diff options
-rw-r--r-- | autoconf/configure.ac | 8 | ||||
-rwxr-xr-x | configure | 18 | ||||
-rw-r--r-- | include/llvm/Config/config.h.cmake | 3 | ||||
-rw-r--r-- | include/llvm/Config/config.h.in | 3 | ||||
-rw-r--r-- | include/llvm/Config/llvm-config.h.cmake | 3 | ||||
-rw-r--r-- | include/llvm/Config/llvm-config.h.in | 3 | ||||
-rw-r--r-- | include/llvm/Support/Host.h | 8 | ||||
-rw-r--r-- | lib/Support/Unix/Host.inc | 8 | ||||
-rw-r--r-- | lib/Support/Windows/Host.inc | 8 |
9 files changed, 61 insertions, 1 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 7b4bae7e71..a44b228334 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -464,6 +464,14 @@ 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 Check for the endianness of the target AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little])) @@ -1466,6 +1466,8 @@ 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-optimize-option Select the compiler options to use for optimized builds --with-extra-options Specify additional options to compile LLVM with @@ -4103,6 +4105,20 @@ 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 + + + { 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; } @@ -10606,7 +10622,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10609 "configure" +#line 10625 "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 5c72ad8a99..d91022829f 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -504,6 +504,9 @@ /* Installation directory for data files */ #cmakedefine LLVM_DATADIR "${LLVM_DATADIR}" +/* 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 2317823349..f147abbb5d 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -539,6 +539,9 @@ /* Installation directory for data files */ #undef LLVM_DATADIR +/* 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 80616ef950..be6338c40c 100644 --- a/include/llvm/Config/llvm-config.h.cmake +++ b/include/llvm/Config/llvm-config.h.cmake @@ -25,6 +25,9 @@ /* Installation directory for data files */ #cmakedefine LLVM_DATADIR "${LLVM_DATADIR}" +/* 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 a4fae5537a..18fdf3fe84 100644 --- a/include/llvm/Config/llvm-config.h.in +++ b/include/llvm/Config/llvm-config.h.in @@ -25,6 +25,9 @@ /* Installation directory for data files */ #undef LLVM_DATADIR +/* 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 28c4cc790f..192fbd4d64 100644 --- a/include/llvm/Support/Host.h +++ b/include/llvm/Support/Host.h @@ -46,6 +46,14 @@ 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(); + /// 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/Unix/Host.inc b/lib/Support/Unix/Host.inc index 726e2fbcf0..d272ac813d 100644 --- a/lib/Support/Unix/Host.inc +++ b/lib/Support/Unix/Host.inc @@ -61,3 +61,11 @@ std::string sys::getDefaultTargetTriple() { return Triple; } + +std::string sys::getDefaultTargetCpu() { + return LLVM_DEFAULT_TARGET_MCPU; +} + +bool sys::hasDefaultTargetCpu() { + return getDefaultTargetCpu() != ""; +} diff --git a/lib/Support/Windows/Host.inc b/lib/Support/Windows/Host.inc index 2e6d6f1903..ae7e9ef9ed 100644 --- a/lib/Support/Windows/Host.inc +++ b/lib/Support/Windows/Host.inc @@ -20,3 +20,11 @@ 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() != ""; +} |