[llvm-commits] [llvm] r147542 - in /llvm/trunk: autoconf/configure.ac cmake/config-ix.cmake configure include/llvm/Config/config.h.cmake include/llvm/Config/config.h.in include/llvm/Config/llvm-config.h.cmake include/llvm/Config/llvm-config.h.in include/llvm/Support/Host.h lib/Support/CommandLine.cpp lib/Support/TargetRegistry.cpp lib/Support/Unix/Host.inc lib/Support/Windows/Host.inc projects/sample/autoconf/configure.ac projects/sample/configure
Sebastian Pop
spop at codeaurora.org
Wed Jan 4 11:47:23 PST 2012
Author: spop
Date: Wed Jan 4 13:47:22 2012
New Revision: 147542
URL: http://llvm.org/viewvc/llvm-project?rev=147542&view=rev
Log:
use getHostTriple instead of getDefaultTargetTriple in getClosestTargetForJIT
Get back getHostTriple.
For JIT compilation, use the host triple instead of the default
target: this fixes some JIT testcases that used to fail when the
compiler has been configured as a cross compiler.
Modified:
llvm/trunk/autoconf/configure.ac
llvm/trunk/cmake/config-ix.cmake
llvm/trunk/configure
llvm/trunk/include/llvm/Config/config.h.cmake
llvm/trunk/include/llvm/Config/config.h.in
llvm/trunk/include/llvm/Config/llvm-config.h.cmake
llvm/trunk/include/llvm/Config/llvm-config.h.in
llvm/trunk/include/llvm/Support/Host.h
llvm/trunk/lib/Support/CommandLine.cpp
llvm/trunk/lib/Support/TargetRegistry.cpp
llvm/trunk/lib/Support/Unix/Host.inc
llvm/trunk/lib/Support/Windows/Host.inc
llvm/trunk/projects/sample/autoconf/configure.ac
llvm/trunk/projects/sample/configure
Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Wed Jan 4 13:47:22 2012
@@ -1484,6 +1484,8 @@
[Installation directory for man pages])
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
[Time at which LLVM was configured])
+AC_DEFINE_UNQUOTED(LLVM_HOST_TRIPLE, "$host",
+ [Host triple LLVM will run on])
AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target",
[Target triple LLVM will generate code for by default])
Modified: llvm/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/cmake/config-ix.cmake (original)
+++ llvm/trunk/cmake/config-ix.cmake Wed Jan 4 13:47:22 2012
@@ -288,13 +288,16 @@
check_cxx_compiler_flag("-Wno-variadic-macros" SUPPORTS_NO_VARIADIC_MACROS_FLAG)
include(GetTargetTriple)
+get_target_triple(LLVM_HOST_TRIPLE)
get_target_triple(LLVM_DEFAULT_TARGET_TRIPLE)
+set(HOST_TRIPLE "${LLVM_HOST_TRIPLE}")
set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
# Determine the native architecture.
string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
if( LLVM_NATIVE_ARCH STREQUAL "host" )
+ string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_HOST_TRIPLE})
string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_DEFAULT_TARGET_TRIPLE})
endif ()
Modified: llvm/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/configure (original)
+++ llvm/trunk/configure Wed Jan 4 13:47:22 2012
@@ -20913,6 +20913,11 @@
cat >>confdefs.h <<_ACEOF
+#define LLVM_HOST_TRIPLE "$host"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
#define LLVM_DEFAULT_TARGET_TRIPLE "$target"
_ACEOF
Modified: llvm/trunk/include/llvm/Config/config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/config.h.cmake Wed Jan 4 13:47:22 2012
@@ -560,6 +560,9 @@
/* Has gcc/MSVC atomic intrinsics */
#cmakedefine01 LLVM_HAS_ATOMICS
+/* Host triple LLVM will run on */
+#cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}"
+
/* Installation directory for include files */
#cmakedefine LLVM_INCLUDEDIR "${LLVM_INCLUDEDIR}"
Modified: llvm/trunk/include/llvm/Config/config.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.in (original)
+++ llvm/trunk/include/llvm/Config/config.h.in Wed Jan 4 13:47:22 2012
@@ -558,6 +558,9 @@
/* Has gcc/MSVC atomic intrinsics */
#undef LLVM_HAS_ATOMICS
+/* Host triple LLVM will run on */
+#undef LLVM_HOST_TRIPLE
+
/* Installation directory for include files */
#undef LLVM_INCLUDEDIR
Modified: llvm/trunk/include/llvm/Config/llvm-config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/llvm-config.h.cmake?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/llvm-config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/llvm-config.h.cmake Wed Jan 4 13:47:22 2012
@@ -40,6 +40,9 @@
/* Has gcc/MSVC atomic intrinsics */
#cmakedefine01 LLVM_HAS_ATOMICS
+/* Host triple LLVM will run on */
+#cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}"
+
/* Installation directory for include files */
#cmakedefine LLVM_INCLUDEDIR "${LLVM_INCLUDEDIR}"
Modified: llvm/trunk/include/llvm/Config/llvm-config.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/llvm-config.h.in?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/llvm-config.h.in (original)
+++ llvm/trunk/include/llvm/Config/llvm-config.h.in Wed Jan 4 13:47:22 2012
@@ -40,6 +40,9 @@
/* Has gcc/MSVC atomic intrinsics */
#undef LLVM_HAS_ATOMICS
+/* Host triple LLVM will run on */
+#undef LLVM_HOST_TRIPLE
+
/* Installation directory for include files */
#undef LLVM_INCLUDEDIR
Modified: llvm/trunk/include/llvm/Support/Host.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Host.h?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Host.h (original)
+++ llvm/trunk/include/llvm/Support/Host.h Wed Jan 4 13:47:22 2012
@@ -33,6 +33,14 @@
return !isLittleEndianHost();
}
+ /// getHostTriple() - Return the host where the compiler will be running.
+ ///
+ /// The host triple is a string in the format of:
+ /// CPU_TYPE-VENDOR-OPERATING_SYSTEM
+ /// or
+ /// CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM
+ std::string getHostTriple();
+
/// getDefaultTargetTriple() - Return the default target triple the compiler
/// has been configured to produce code for.
///
Modified: llvm/trunk/lib/Support/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CommandLine.cpp (original)
+++ llvm/trunk/lib/Support/CommandLine.cpp Wed Jan 4 13:47:22 2012
@@ -1373,6 +1373,7 @@
<< " Built " << __DATE__ << " (" << __TIME__ << ").\n"
#endif
<< " Default target: " << sys::getDefaultTargetTriple() << '\n'
+ << " Host: " << sys::getHostTriple() << '\n'
<< " Host CPU: " << CPU << '\n';
}
void operator=(bool OptionWasSpecified) {
Modified: llvm/trunk/lib/Support/TargetRegistry.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetRegistry.cpp?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/lib/Support/TargetRegistry.cpp (original)
+++ llvm/trunk/lib/Support/TargetRegistry.cpp Wed Jan 4 13:47:22 2012
@@ -84,7 +84,7 @@
}
const Target *TargetRegistry::getClosestTargetForJIT(std::string &Error) {
- const Target *TheTarget = lookupTarget(sys::getDefaultTargetTriple(), Error);
+ const Target *TheTarget = lookupTarget(sys::getHostTriple(), Error);
if (TheTarget && !TheTarget->hasJIT()) {
Error = "No JIT compatible target available for this host";
Modified: llvm/trunk/lib/Support/Unix/Host.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Host.inc?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Host.inc (original)
+++ llvm/trunk/lib/Support/Unix/Host.inc Wed Jan 4 13:47:22 2012
@@ -35,13 +35,9 @@
return info.release;
}
-std::string sys::getDefaultTargetTriple() {
- StringRef TargetTripleString(LLVM_DEFAULT_TARGET_TRIPLE);
- std::pair<StringRef, StringRef> ArchSplit = TargetTripleString.split('-');
-
- // Normalize the arch, since the target triple may not actually match the target.
+std::string getTriple(StringRef &TripleString) {
+ std::pair<StringRef, StringRef> ArchSplit = TripleString.split('-');
std::string Arch = ArchSplit.first;
-
std::string Triple(Arch);
Triple += '-';
Triple += ArchSplit.second;
@@ -61,3 +57,13 @@
return Triple;
}
+
+std::string sys::getDefaultTargetTriple() {
+ StringRef TargetTripleString(LLVM_DEFAULT_TARGET_TRIPLE);
+ return getTriple(TargetTripleString);
+}
+
+std::string sys::getHostTriple() {
+ StringRef HostTripleString(LLVM_HOST_TRIPLE);
+ return getTriple(HostTripleString);
+}
Modified: llvm/trunk/lib/Support/Windows/Host.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Host.inc?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Host.inc (original)
+++ llvm/trunk/lib/Support/Windows/Host.inc Wed Jan 4 13:47:22 2012
@@ -20,3 +20,7 @@
std::string sys::getDefaultTargetTriple() {
return LLVM_DEFAULT_TARGET_TRIPLE;
}
+
+std::string sys::getHostTriple() {
+ return LLVM_HOST_TRIPLE;
+}
Modified: llvm/trunk/projects/sample/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/projects/sample/autoconf/configure.ac?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/projects/sample/autoconf/configure.ac (original)
+++ llvm/trunk/projects/sample/autoconf/configure.ac Wed Jan 4 13:47:22 2012
@@ -1390,6 +1390,8 @@
[Installation directory for man pages])
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
[Time at which LLVM was configured])
+AC_DEFINE_UNQUOTED(LLVM_HOST_TRIPLE, "$host",
+ [Host triple LLVM will run on])
AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target",
[Target triple LLVM will generate code for by default])
Modified: llvm/trunk/projects/sample/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/projects/sample/configure?rev=147542&r1=147541&r2=147542&view=diff
==============================================================================
--- llvm/trunk/projects/sample/configure (original)
+++ llvm/trunk/projects/sample/configure Wed Jan 4 13:47:22 2012
@@ -8854,7 +8854,7 @@
shlibpath_var=LD_LIBRARY_PATH
;;
-freebsd1*)
+freebsd1.*)
dynamic_linker=no
;;
@@ -8877,7 +8877,7 @@
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[123].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -8895,7 +8895,7 @@
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
@@ -10409,7 +10409,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10423 "configure"
+#line 10412 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20819,6 +20819,11 @@
cat >>confdefs.h <<_ACEOF
+#define LLVM_HOST_TRIPLE "$host"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
#define LLVM_DEFAULT_TARGET_TRIPLE "$target"
_ACEOF
More information about the llvm-commits
mailing list