summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoconf/configure.ac8
-rwxr-xr-xconfigure18
-rw-r--r--include/llvm/Config/config.h.in3
-rw-r--r--include/llvm/Support/Host.h8
-rw-r--r--lib/Support/Unix/Host.inc8
5 files changed, 44 insertions, 1 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index adcfa49465..61b95b5e37 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -446,6 +446,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]))
diff --git a/configure b/configure
index b3deee8d6a..7e4fad6b46 100755
--- a/configure
+++ b/configure
@@ -1457,6 +1457,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
@@ -4073,6 +4075,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; }
@@ -10535,7 +10551,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 10554 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in
index 950e66f275..1667216953 100644
--- a/include/llvm/Config/config.h.in
+++ b/include/llvm/Config/config.h.in
@@ -575,6 +575,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 9a4036a8af..748e5e2cdf 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() != "";
+}