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 /lib/MC/MCDisassembler | |
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 'lib/MC/MCDisassembler')
-rw-r--r-- | lib/MC/MCDisassembler/Disassembler.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/MC/MCDisassembler/Disassembler.cpp b/lib/MC/MCDisassembler/Disassembler.cpp index 35f675dc6d..5189c9daee 100644 --- a/lib/MC/MCDisassembler/Disassembler.cpp +++ b/lib/MC/MCDisassembler/Disassembler.cpp @@ -184,3 +184,17 @@ size_t LLVMDisasmInstruction(LLVMDisasmContextRef DCR, uint8_t *Bytes, } llvm_unreachable("Invalid DecodeStatus!"); } + +// +// LLVMSetDisasmOptions() sets the disassembler's options. It returns 1 if it +// can set all the Options and 0 otherwise. +// +int LLVMSetDisasmOptions(LLVMDisasmContextRef DCR, uint64_t Options){ + if (Options & LLVMDisassembler_Option_UseMarkup){ + LLVMDisasmContext *DC = (LLVMDisasmContext *)DCR; + MCInstPrinter *IP = DC->getIP(); + IP->setUseMarkup(1); + Options &= ~LLVMDisassembler_Option_UseMarkup; + } + return (Options == 0); +} |