summaryrefslogtreecommitdiff
path: root/tools/bugpoint/BugDriver.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-18 03:35:57 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-18 03:35:57 +0000
commitca7409664273fed4b473127295af3af0836b3077 (patch)
tree4dec85698109cbee1fa006a2cbcc962b0ec1628b /tools/bugpoint/BugDriver.cpp
parent2bd4bb0397135d2ccde8ff6f411da597d9e4ed55 (diff)
downloadllvm-ca7409664273fed4b473127295af3af0836b3077.tar.gz
llvm-ca7409664273fed4b473127295af3af0836b3077.tar.bz2
llvm-ca7409664273fed4b473127295af3af0836b3077.tar.xz
Change bugpoint to use Triple to make runtime decisions.
- This is cleaner, and makes bugpoint match the host instead of the build architecture. - Patch by Sandeep Patel! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79309 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/BugDriver.cpp')
-rw-r--r--tools/bugpoint/BugDriver.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp
index c3cc389a28..bfc7058274 100644
--- a/tools/bugpoint/BugDriver.cpp
+++ b/tools/bugpoint/BugDriver.cpp
@@ -25,9 +25,14 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/System/Host.h"
#include <memory>
using namespace llvm;
+namespace llvm {
+ Triple TargetTriple;
+}
+
// Anonymous namespace to define command line options for debugging.
//
namespace {
@@ -88,6 +93,20 @@ Module *llvm::ParseInputFile(const std::string &Filename,
Result = 0;
}
+ // If we don't have an override triple, use the first one to configure
+ // bugpoint, or use the host triple if none provided.
+ if (Result) {
+ if (TargetTriple.getTriple().empty()) {
+ Triple TheTriple(Result->getTargetTriple());
+
+ if (TheTriple.getTriple().empty())
+ TheTriple.setTriple(sys::getHostTriple());
+
+ TargetTriple.setTriple(TheTriple.getTriple());
+ }
+
+ Result->setTargetTriple(TargetTriple.getTriple()); // override the triple
+ }
return Result;
}