aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvm-mc/llvm-mc.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2010-04-12 19:43:00 +0000
committerSean Callanan <scallanan@apple.com>2010-04-12 19:43:00 +0000
commit668b15467be158a5f0e0c4a5e1ec232da021892c (patch)
tree48d632e7bf9d67a14f6a967b8fb564b9b8306bdb /tools/llvm-mc/llvm-mc.cpp
parentbb6e9d8cf7c5a51b2f66568accc489927f0d538e (diff)
downloadexternal_llvm-668b15467be158a5f0e0c4a5e1ec232da021892c.zip
external_llvm-668b15467be158a5f0e0c4a5e1ec232da021892c.tar.gz
external_llvm-668b15467be158a5f0e0c4a5e1ec232da021892c.tar.bz2
Second try at integrating the edis tester. This
time I use the LIBS variable, which is not subject to a %.a -> -l% transformation, to link llvm-mc against libEnhancedDisassembly. llvm-mc -edis works the same as llvm-mc -disassemble, but outputs tokens and operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101058 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc/llvm-mc.cpp')
-rw-r--r--tools/llvm-mc/llvm-mc.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index c6657f5..47f67c5 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -97,7 +97,8 @@ NoInitialTextSection("n", cl::desc(
enum ActionType {
AC_AsLex,
AC_Assemble,
- AC_Disassemble
+ AC_Disassemble,
+ AC_EDisassemble
};
static cl::opt<ActionType>
@@ -109,6 +110,8 @@ Action(cl::desc("Action to perform:"),
"Assemble a .s file (default)"),
clEnumValN(AC_Disassemble, "disassemble",
"Disassemble strings of hex bytes"),
+ clEnumValN(AC_EDisassemble, "edis",
+ "Enhanced disassembly of strings of hex bytes"),
clEnumValEnd));
static const Target *GetTarget(const char *ProgName) {
@@ -325,7 +328,7 @@ static int AssembleInput(const char *ProgName) {
return Res;
}
-static int DisassembleInput(const char *ProgName) {
+static int DisassembleInput(const char *ProgName, bool Enhanced) {
const Target *TheTarget = GetTarget(ProgName);
if (!TheTarget)
return 0;
@@ -344,7 +347,10 @@ static int DisassembleInput(const char *ProgName) {
return 1;
}
- return Disassembler::disassemble(*TheTarget, TripleName, *Buffer);
+ if (Enhanced)
+ return Disassembler::disassembleEnhanced(TripleName, *Buffer);
+ else
+ return Disassembler::disassemble(*TheTarget, TripleName, *Buffer);
}
@@ -371,7 +377,9 @@ int main(int argc, char **argv) {
case AC_Assemble:
return AssembleInput(argv[0]);
case AC_Disassemble:
- return DisassembleInput(argv[0]);
+ return DisassembleInput(argv[0], false);
+ case AC_EDisassemble:
+ return DisassembleInput(argv[0], true);
}
return 0;