summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSebastian Pop <spop@codeaurora.org>2012-01-04 19:47:22 +0000
committerSebastian Pop <spop@codeaurora.org>2012-01-04 19:47:22 +0000
commit0f357d6c2240393b53d30cf79c2cd583192e5ed9 (patch)
tree642c100b83b81b7f83bfe293c75df67f1ebff3e3 /llvm/lib
parentaac3e06bf73214a1f44dd40e98c9930b759ded38 (diff)
downloadbcm5719-llvm-0f357d6c2240393b53d30cf79c2cd583192e5ed9.tar.gz
bcm5719-llvm-0f357d6c2240393b53d30cf79c2cd583192e5ed9.zip
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. llvm-svn: 147542
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Support/CommandLine.cpp1
-rw-r--r--llvm/lib/Support/TargetRegistry.cpp2
-rw-r--r--llvm/lib/Support/Unix/Host.inc18
-rw-r--r--llvm/lib/Support/Windows/Host.inc4
4 files changed, 18 insertions, 7 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index ce9344954bc..9e8207baa88 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -1373,6 +1373,7 @@ public:
<< " Built " << __DATE__ << " (" << __TIME__ << ").\n"
#endif
<< " Default target: " << sys::getDefaultTargetTriple() << '\n'
+ << " Host: " << sys::getHostTriple() << '\n'
<< " Host CPU: " << CPU << '\n';
}
void operator=(bool OptionWasSpecified) {
diff --git a/llvm/lib/Support/TargetRegistry.cpp b/llvm/lib/Support/TargetRegistry.cpp
index 53c8d84e7d4..7497bfe035c 100644
--- a/llvm/lib/Support/TargetRegistry.cpp
+++ b/llvm/lib/Support/TargetRegistry.cpp
@@ -84,7 +84,7 @@ void TargetRegistry::RegisterTarget(Target &T,
}
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";
diff --git a/llvm/lib/Support/Unix/Host.inc b/llvm/lib/Support/Unix/Host.inc
index 726e2fbcf05..82f717fc39b 100644
--- a/llvm/lib/Support/Unix/Host.inc
+++ b/llvm/lib/Support/Unix/Host.inc
@@ -35,13 +35,9 @@ static std::string getOSVersion() {
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 @@ std::string sys::getDefaultTargetTriple() {
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);
+}
diff --git a/llvm/lib/Support/Windows/Host.inc b/llvm/lib/Support/Windows/Host.inc
index 2e6d6f19037..cce82349cd6 100644
--- a/llvm/lib/Support/Windows/Host.inc
+++ b/llvm/lib/Support/Windows/Host.inc
@@ -20,3 +20,7 @@ using namespace llvm;
std::string sys::getDefaultTargetTriple() {
return LLVM_DEFAULT_TARGET_TRIPLE;
}
+
+std::string sys::getHostTriple() {
+ return LLVM_HOST_TRIPLE;
+}
OpenPOWER on IntegriCloud