summaryrefslogtreecommitdiff
path: root/tools/llvm-objdump
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-03-21 04:13:46 +0000
committerBill Wendling <isanbard@gmail.com>2011-03-21 04:13:46 +0000
commita5c177e70a42f48e4885075c4c48aad0816a2817 (patch)
treeaeeef1186b086a66459727967e2e2d71ff800c92 /tools/llvm-objdump
parent262a8627870c38f385944fc2ed9ae365347adf47 (diff)
downloadllvm-a5c177e70a42f48e4885075c4c48aad0816a2817.tar.gz
llvm-a5c177e70a42f48e4885075c4c48aad0816a2817.tar.bz2
llvm-a5c177e70a42f48e4885075c4c48aad0816a2817.tar.xz
We need to pass the TargetMachine object to the InstPrinter if we are printing
the alias of an InstAlias instead of the thing being aliased. Because we need to know the features that are valid for an InstAlias. This is part of a work-in-progress. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127986 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-objdump')
-rw-r--r--tools/llvm-objdump/llvm-objdump.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp
index 1fef8b6e24..de0165690a 100644
--- a/tools/llvm-objdump/llvm-objdump.cpp
+++ b/tools/llvm-objdump/llvm-objdump.cpp
@@ -38,6 +38,7 @@
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"
+#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Target/TargetSelect.h"
#include <algorithm>
@@ -182,9 +183,21 @@ static void DisassembleInput(const StringRef &Filename) {
return;
}
+ // FIXME: We shouldn't need to do this (and link in codegen).
+ // When we split this out, we should do it in a way that makes
+ // it straightforward to switch subtargets on the fly (.e.g,
+ // the .cpu and .code16 directives).
+ std::string FeaturesStr;
+ OwningPtr<TargetMachine> TM(TheTarget->createTargetMachine(TripleName,
+ FeaturesStr));
+ if (!TM) {
+ errs() << "error: could not create target for triple " << TripleName << "\n";
+ return;
+ }
+
int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
OwningPtr<MCInstPrinter> IP(TheTarget->createMCInstPrinter(
- AsmPrinterVariant, *AsmInfo));
+ *TM, AsmPrinterVariant, *AsmInfo));
if (!IP) {
errs() << "error: no instruction printer for target " << TripleName << '\n';
return;