From ca7409664273fed4b473127295af3af0836b3077 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 18 Aug 2009 03:35:57 +0000 Subject: 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 --- tools/bugpoint/BugDriver.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tools/bugpoint/BugDriver.cpp') 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 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; } -- cgit v1.2.3