summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2014-06-11 20:26:40 +0000
committerJim Grosbach <grosbach@apple.com>2014-06-11 20:26:40 +0000
commit7ca05676526739a3aaa91ade5afed753b7bb45d3 (patch)
tree902e07f78bf2e80f0a158d0646e939eb6adbf8dd /tools
parent7fa80b45ebcb3ecde309e048fc207aa4c4858680 (diff)
downloadllvm-7ca05676526739a3aaa91ade5afed753b7bb45d3.tar.gz
llvm-7ca05676526739a3aaa91ade5afed753b7bb45d3.tar.bz2
llvm-7ca05676526739a3aaa91ade5afed753b7bb45d3.tar.xz
llvm-mc: Add option for prefering hex format disassembly.
Previously there was a separate mode entirely (--hdis vs. --disassemble). It makes a bit more sense for the immediate printing style to be a flag for --disassmeble rather than an entirely different thing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210700 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-mc/llvm-mc.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index 84d578b4d0..e5d38d2e27 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -65,6 +65,10 @@ static cl::opt<unsigned>
OutputAsmVariant("output-asm-variant",
cl::desc("Syntax variant to use for output printing"));
+static cl::opt<bool>
+PrintImmHex("print-imm-hex", cl::init(false),
+ cl::desc("Prefer hex format for immediate values"));
+
enum OutputFileType {
OFT_Null,
OFT_AssemblyFile,
@@ -167,7 +171,6 @@ enum ActionType {
AC_Assemble,
AC_Disassemble,
AC_MDisassemble,
- AC_HDisassemble
};
static cl::opt<ActionType>
@@ -181,9 +184,6 @@ Action(cl::desc("Action to perform:"),
"Disassemble strings of hex bytes"),
clEnumValN(AC_MDisassemble, "mdis",
"Marked up disassembly of strings of hex bytes"),
- clEnumValN(AC_HDisassemble, "hdis",
- "Disassemble strings of hex bytes printing "
- "immediates as hex"),
clEnumValEnd));
static const Target *GetTarget(const char *ProgName) {
@@ -445,6 +445,11 @@ int main(int argc, char **argv) {
if (FileType == OFT_AssemblyFile) {
IP =
TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *MCII, *MRI, *STI);
+
+ // Set the display preference for hex vs. decimal immediates.
+ IP->setPrintImmHex(PrintImmHex);
+
+ // Set up the AsmStreamer.
MCCodeEmitter *CE = nullptr;
MCAsmBackend *MAB = nullptr;
if (ShowEncoding) {
@@ -480,11 +485,6 @@ int main(int argc, char **argv) {
IP->setUseMarkup(1);
disassemble = true;
break;
- case AC_HDisassemble:
- assert(IP && "Expected assembly output");
- IP->setPrintImmHex(1);
- disassemble = true;
- break;
case AC_Disassemble:
disassemble = true;
break;