diff options
author | Kevin Enderby <enderby@apple.com> | 2012-10-22 22:31:46 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2012-10-22 22:31:46 +0000 |
commit | 3ed0316f756e2f1730f46654776fcf77f5ace7aa (patch) | |
tree | c7769b081a31d4e7194751368e2090ba967bfb2b /tools | |
parent | 8ee16c7b661ce0b1c1d33db07b57ad2c88b5a8b2 (diff) |
Add support for annotated disassembly output for X86 and arm.
Per the October 12, 2012 Proposal for annotated disassembly output sent out by
Jim Grosbach this set of changes implements this for X86 and arm. The llvm-mc
tool now has a -mdis option to produced the marked up disassembly and a couple
of small example test cases have been added.
rdar://11764962
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166445 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-mc/llvm-mc.cpp | 11 | ||||
-rw-r--r-- | tools/lto/lto.exports | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 756221b79a..f7c3748f07 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -158,7 +158,8 @@ enum ActionType { AC_AsLex, AC_Assemble, AC_Disassemble, - AC_EDisassemble + AC_EDisassemble, + AC_MDisassemble }; static cl::opt<ActionType> @@ -172,6 +173,8 @@ Action(cl::desc("Action to perform:"), "Disassemble strings of hex bytes"), clEnumValN(AC_EDisassemble, "edis", "Enhanced disassembly of strings of hex bytes"), + clEnumValN(AC_MDisassemble, "mdis", + "Marked up disassembly of strings of hex bytes"), clEnumValEnd)); static const Target *GetTarget(const char *ProgName) { @@ -402,8 +405,9 @@ int main(int argc, char **argv) { OwningPtr<MCSubtargetInfo> STI(TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr)); + MCInstPrinter *IP; if (FileType == OFT_AssemblyFile) { - MCInstPrinter *IP = + IP = TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *MCII, *MRI, *STI); MCCodeEmitter *CE = 0; MCAsmBackend *MAB = 0; @@ -436,6 +440,9 @@ int main(int argc, char **argv) { case AC_Assemble: Res = AssembleInput(ProgName, TheTarget, SrcMgr, Ctx, *Str, *MAI, *STI); break; + case AC_MDisassemble: + IP->setUseMarkup(1); + // Fall through to do disassembly. case AC_Disassemble: Res = Disassembler::disassemble(*TheTarget, TripleName, *STI, *Str, *Buffer, SrcMgr, Out->os()); diff --git a/tools/lto/lto.exports b/tools/lto/lto.exports index b900bfb594..4940bb147e 100644 --- a/tools/lto/lto.exports +++ b/tools/lto/lto.exports @@ -30,3 +30,4 @@ lto_codegen_compile_to_file LLVMCreateDisasm LLVMDisasmDispose LLVMDisasmInstruction +LLVMSetDisasmOptions |