forked from OSchip/llvm-project
[AVR] Don't assert on an undefined operand
Not all operands are correctly disassembled at the moment. This means that some machine instructions won't have all the necessary operands set. To avoid asserting, print an error instead until the necessary support has been implemented. Differential Revision: https://reviews.llvm.org/D73958
This commit is contained in:
parent
a5424ded37
commit
d1af6011e5
|
@ -100,6 +100,16 @@ const char *AVRInstPrinter::getPrettyRegisterName(unsigned RegNum,
|
|||
|
||||
void AVRInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
|
||||
raw_ostream &O) {
|
||||
if (OpNo >= MI->size()) {
|
||||
// Not all operands are correctly disassembled at the moment. This means
|
||||
// that some machine instructions won't have all the necessary operands
|
||||
// set.
|
||||
// To avoid asserting, print <unknown> instead until the necessary support
|
||||
// has been implemented.
|
||||
O << "<unknown>";
|
||||
return;
|
||||
}
|
||||
|
||||
const MCOperand &Op = MI->getOperand(OpNo);
|
||||
const MCOperandInfo &MOI = this->MII.get(MI->getOpcode()).OpInfo[OpNo];
|
||||
|
||||
|
@ -125,6 +135,16 @@ void AVRInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
|
|||
/// being encoded as a pc-relative value.
|
||||
void AVRInstPrinter::printPCRelImm(const MCInst *MI, unsigned OpNo,
|
||||
raw_ostream &O) {
|
||||
if (OpNo >= MI->size()) {
|
||||
// Not all operands are correctly disassembled at the moment. This means
|
||||
// that some machine instructions won't have all the necessary operands
|
||||
// set.
|
||||
// To avoid asserting, print <unknown> instead until the necessary support
|
||||
// has been implemented.
|
||||
O << "<unknown>";
|
||||
return;
|
||||
}
|
||||
|
||||
const MCOperand &Op = MI->getOperand(OpNo);
|
||||
|
||||
if (Op.isImm()) {
|
||||
|
|
Loading…
Reference in New Issue