mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-15 22:25:31 +00:00
Allow the MCDisassembler to return a "soft fail" status code, indicating an instruction that is disassemblable, but invalid. Only used for ARM UNPREDICTABLE instructions at the moment.
Patch by James Molloy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137830 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user