summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2012-10-22 22:31:46 +0000
committerKevin Enderby <enderby@apple.com>2012-10-22 22:31:46 +0000
commit62183c4e18a964c2715cedb3f6fdc6bb3c4776bd (patch)
tree7900e3224a33ea5cc7fd9ea9e656b91d761afee4 /llvm/lib/MC
parent929fccd4761b3de9d6c651cc85799d4bbfd165b0 (diff)
downloadbcm5719-llvm-62183c4e18a964c2715cedb3f6fdc6bb3c4776bd.tar.gz
bcm5719-llvm-62183c4e18a964c2715cedb3f6fdc6bb3c4776bd.zip
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 llvm-svn: 166445
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/MCDisassembler/Disassembler.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCDisassembler/Disassembler.cpp b/llvm/lib/MC/MCDisassembler/Disassembler.cpp
index 35f675dc6d1..5189c9daeed 100644
--- a/llvm/lib/MC/MCDisassembler/Disassembler.cpp
+++ b/llvm/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);
+}
OpenPOWER on IntegriCloud