Skip to content

Commit

Permalink
llvm-mc: Support -arch as a simplified form of -triple.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98417 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
ddunbar committed Mar 13, 2010
1 parent 0af20d8 commit 181ab6a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tools/llvm-mc/llvm-mc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Host.h"
#include "llvm/System/Signals.h"
#include "llvm/Target/TargetAsmBackend.h"
#include "llvm/Target/TargetAsmParser.h"
Expand Down Expand Up @@ -75,10 +76,13 @@ static cl::list<std::string>
IncludeDirs("I", cl::desc("Directory of include files"),
cl::value_desc("directory"), cl::Prefix);

static cl::opt<std::string>
ArchName("arch", cl::desc("Target arch to assemble for, "
"see -version for available targets"));

static cl::opt<std::string>
TripleName("triple", cl::desc("Target triple to assemble for, "
"see -version for available targets"),
cl::init(LLVM_HOSTTRIPLE));
"see -version for available targets"));

enum ActionType {
AC_AsLex,
Expand All @@ -98,6 +102,15 @@ Action(cl::desc("Action to perform:"),
clEnumValEnd));

static const Target *GetTarget(const char *ProgName) {
// Figure out the target triple.
if (TripleName.empty())
TripleName = sys::getHostTriple();
if (!ArchName.empty()) {
llvm::Triple TT(TripleName);
TT.setArchName(ArchName);
TripleName = TT.str();
}

// Get the target specific parser.
std::string Error;
const Target *TheTarget = TargetRegistry::lookupTarget(TripleName, Error);
Expand Down

0 comments on commit 181ab6a

Please sign in to comment.