aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-mc/Disassembler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-mc/Disassembler.cpp')
-rw-r--r--tools/llvm-mc/Disassembler.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/tools/llvm-mc/Disassembler.cpp b/tools/llvm-mc/Disassembler.cpp
index c389f6a953..626724c58e 100644
--- a/tools/llvm-mc/Disassembler.cpp
+++ b/tools/llvm-mc/Disassembler.cpp
@@ -65,15 +65,26 @@ static bool PrintInsts(const MCDisassembler &DisAsm,
for (Index = 0; Index < Bytes.size(); Index += Size) {
MCInst Inst;
- if (DisAsm.getInstruction(Inst, Size, memoryObject, Index,
- /*REMOVE*/ nulls())) {
- Printer.printInst(&Inst, Out);
- Out << "\n";
- } else {
+ MCDisassembler::DecodeStatus S;
+ S = DisAsm.getInstruction(Inst, Size, memoryObject, Index,
+ /*REMOVE*/ nulls());
+ switch (S) {
+ case MCDisassembler::Fail:
SM.PrintMessage(SMLoc::getFromPointer(Bytes[Index].second),
"invalid instruction encoding", "warning");
if (Size == 0)
Size = 1; // skip illegible bytes
+ break;
+
+ case MCDisassembler::SoftFail:
+ SM.PrintMessage(SMLoc::getFromPointer(Bytes[Index].second),
+ "potentially undefined instruction encoding", "warning");
+ // Fall through
+
+ case MCDisassembler::Success:
+ Printer.printInst(&Inst, Out);
+ Out << "\n";
+ break;
}
}