EDInstInfo *getEDInfo() const;
private:
mutable std::vector<unsigned> ITBlock;
- void AddThumbPredicate(MCInst&) const;
+ DecodeStatus AddThumbPredicate(MCInst&) const;
void UpdateThumbVFPPredicate(MCInst&) const;
};
}
// encoding, but rather get their predicates from IT context. We need
// to fix up the predicate operands using this context information as a
// post-pass.
-void ThumbDisassembler::AddThumbPredicate(MCInst &MI) const {
+MCDisassembler::DecodeStatus
+ThumbDisassembler::AddThumbPredicate(MCInst &MI) const {
// A few instructions actually have predicates encoded in them. Don't
// try to overwrite it if we're seeing one of those.
switch (MI.getOpcode()) {
case ARM::tBcc:
case ARM::t2Bcc:
- return;
+ return Success;
+ case ARM::tCBZ:
+ case ARM::tCBNZ:
+ // Some instructions are not allowed in IT blocks.
+ if (!ITBlock.empty())
+ return SoftFail;
+ break;
default:
break;
}
MI.insert(I, MCOperand::CreateReg(0));
else
MI.insert(I, MCOperand::CreateReg(ARM::CPSR));
- return;
+ return Success;
}
}
MI.insert(I, MCOperand::CreateReg(0));
else
MI.insert(I, MCOperand::CreateReg(ARM::CPSR));
+
+ return Success;
}
// Thumb VFP instructions are a special case. Because we share their
DecodeStatus result = decodeThumbInstruction16(MI, insn16, Address, this, STI);
if (result != MCDisassembler::Fail) {
Size = 2;
- AddThumbPredicate(MI);
+ Check(result, AddThumbPredicate(MI));
return result;
}
if (result) {
Size = 2;
bool InITBlock = !ITBlock.empty();
- AddThumbPredicate(MI);
+ Check(result, AddThumbPredicate(MI));
AddThumb1SBit(MI, InITBlock);
return result;
}
result = decodeThumb2Instruction16(MI, insn16, Address, this, STI);
if (result != MCDisassembler::Fail) {
Size = 2;
- AddThumbPredicate(MI);
+ Check(result, AddThumbPredicate(MI));
// If we find an IT instruction, we need to parse its condition
// code and mask operands so that we can apply them correctly
if (result != MCDisassembler::Fail) {
Size = 4;
bool InITBlock = ITBlock.size();
- AddThumbPredicate(MI);
+ Check(result, AddThumbPredicate(MI));
AddThumb1SBit(MI, InITBlock);
return result;
}
result = decodeThumb2Instruction32(MI, insn32, Address, this, STI);
if (result != MCDisassembler::Fail) {
Size = 4;
- AddThumbPredicate(MI);
+ Check(result, AddThumbPredicate(MI));
return result;
}
result = decodeNEONDupInstruction32(MI, insn32, Address, this, STI);
if (result != MCDisassembler::Fail) {
Size = 4;
- AddThumbPredicate(MI);
+ Check(result, AddThumbPredicate(MI));
return result;
}
result = decodeNEONLoadStoreInstruction32(MI, NEONLdStInsn, Address, this, STI);
if (result != MCDisassembler::Fail) {
Size = 4;
- AddThumbPredicate(MI);
+ Check(result, AddThumbPredicate(MI));
return result;
}
}
result = decodeNEONDataInstruction32(MI, NEONDataInsn, Address, this, STI);
if (result != MCDisassembler::Fail) {
Size = 4;
- AddThumbPredicate(MI);
+ Check(result, AddThumbPredicate(MI));
return result;
}
}