diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-03-13 02:20:38 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-03-13 02:20:38 +0000 |
commit | 181ab6a854162da908310e23714b43b0091c9094 (patch) | |
tree | a73419387c256edebde4ad0ff11f07c8641d326e /tools | |
parent | 0af20d847ac89f797d613a8a4fc3e7127ccb0b36 (diff) | |
download | external_llvm-181ab6a854162da908310e23714b43b0091c9094.zip external_llvm-181ab6a854162da908310e23714b43b0091c9094.tar.gz external_llvm-181ab6a854162da908310e23714b43b0091c9094.tar.bz2 |
llvm-mc: Support -arch as a simplified form of -triple.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98417 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-mc/llvm-mc.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 03953c7..48e0d3d 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -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" @@ -76,9 +77,12 @@ 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, @@ -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); |