summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LLVMTargetMachine.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-05-18 17:22:19 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-05-18 17:22:19 +0000
commit62bc96a1a59f3ddf8c91e3e3fca58f7a9f31b0b2 (patch)
tree23222952208d9db3daf8cb8342571d5bf3840c94 /llvm/lib/CodeGen/LLVMTargetMachine.cpp
parent8b6be164d6cd6972c6ddae320257f874a020ac15 (diff)
downloadbcm5719-llvm-62bc96a1a59f3ddf8c91e3e3fca58f7a9f31b0b2.tar.gz
bcm5719-llvm-62bc96a1a59f3ddf8c91e3e3fca58f7a9f31b0b2.zip
llc (et al): Add support for --show-encoding and --show-inst.
llvm-svn: 104029
Diffstat (limited to 'llvm/lib/CodeGen/LLVMTargetMachine.cpp')
-rw-r--r--llvm/lib/CodeGen/LLVMTargetMachine.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index 681b678c37f..9a776ed0e8d 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -65,6 +65,10 @@ static cl::opt<bool> PrintISelInput("print-isel-input", cl::Hidden,
cl::desc("Print LLVM IR input to isel pass"));
static cl::opt<bool> PrintGCInfo("print-gc", cl::Hidden,
cl::desc("Dump garbage collector data"));
+static cl::opt<bool> ShowMCEncoding("show-mc-encoding", cl::Hidden,
+ cl::desc("Show encoding in .s output"));
+static cl::opt<bool> ShowMCInst("show-mc-inst", cl::Hidden,
+ cl::desc("Show instruction structure in .s output"));
static cl::opt<bool> VerifyMachineCode("verify-machineinstrs", cl::Hidden,
cl::desc("Verify generated machine code"),
cl::init(getenv("LLVM_VERIFY_MACHINEINSTRS")!=NULL));
@@ -131,10 +135,18 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
case CGFT_AssemblyFile: {
MCInstPrinter *InstPrinter =
getTarget().createMCInstPrinter(MAI.getAssemblerDialect(), MAI);
+
+ // Create a code emitter if asked to show the encoding.
+ //
+ // FIXME: These are currently leaked.
+ MCCodeEmitter *MCE = 0;
+ if (ShowMCEncoding)
+ MCE = getTarget().createCodeEmitter(*this, *Context);
+
AsmStreamer.reset(createAsmStreamer(*Context, Out,
getTargetData()->isLittleEndian(),
getVerboseAsm(), InstPrinter,
- /*codeemitter*/0));
+ MCE, ShowMCInst));
break;
}
case CGFT_ObjectFile: {
OpenPOWER on IntegriCloud