mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-04 16:01:46 +00:00
Move some logic into a helper function and expand the commentary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137756 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1fc291f0d3
commit
d54b4e612a
@ -147,6 +147,8 @@ class ARMAsmParser : public MCTargetAsmParser {
|
|||||||
const SmallVectorImpl<MCParsedAsmOperand*> &Ops);
|
const SmallVectorImpl<MCParsedAsmOperand*> &Ops);
|
||||||
void processInstruction(MCInst &Inst,
|
void processInstruction(MCInst &Inst,
|
||||||
const SmallVectorImpl<MCParsedAsmOperand*> &Ops);
|
const SmallVectorImpl<MCParsedAsmOperand*> &Ops);
|
||||||
|
bool shouldOmitCCOutOperand(StringRef Mnemonic,
|
||||||
|
SmallVectorImpl<MCParsedAsmOperand*> &Operands);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum ARMMatchResultTy {
|
enum ARMMatchResultTy {
|
||||||
@ -2739,6 +2741,25 @@ getMnemonicAcceptInfo(StringRef Mnemonic, bool &CanAcceptCarrySet,
|
|||||||
CanAcceptPredicationCode = false;
|
CanAcceptPredicationCode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ARMAsmParser::shouldOmitCCOutOperand(StringRef Mnemonic,
|
||||||
|
SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
|
||||||
|
|
||||||
|
// The 'mov' mnemonic is special. One variant has a cc_out operand, while
|
||||||
|
// another does not. Specifically, the MOVW instruction does not. So we
|
||||||
|
// special case it here and remove the defaulted (non-setting) cc_out
|
||||||
|
// operand if that's the instruction we're trying to match.
|
||||||
|
//
|
||||||
|
// We do this as post-processing of the explicit operands rather than just
|
||||||
|
// conditionally adding the cc_out in the first place because we need
|
||||||
|
// to check the type of the parsed immediate operand.
|
||||||
|
if (Mnemonic == "mov" && Operands.size() > 4 &&
|
||||||
|
!static_cast<ARMOperand*>(Operands[4])->isARMSOImm() &&
|
||||||
|
static_cast<ARMOperand*>(Operands[4])->isImm0_65535Expr() &&
|
||||||
|
static_cast<ARMOperand*>(Operands[1])->getReg() == 0)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// Parse an arm instruction mnemonic followed by its operands.
|
/// Parse an arm instruction mnemonic followed by its operands.
|
||||||
bool ARMAsmParser::ParseInstruction(StringRef Name, SMLoc NameLoc,
|
bool ARMAsmParser::ParseInstruction(StringRef Name, SMLoc NameLoc,
|
||||||
SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
|
SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
|
||||||
@ -2845,19 +2866,13 @@ bool ARMAsmParser::ParseInstruction(StringRef Name, SMLoc NameLoc,
|
|||||||
|
|
||||||
Parser.Lex(); // Consume the EndOfStatement
|
Parser.Lex(); // Consume the EndOfStatement
|
||||||
|
|
||||||
|
// Some instructions, mostly Thumb, have forms for the same mnemonic that
|
||||||
// The 'mov' mnemonic is special. One variant has a cc_out operand, while
|
// do and don't have a cc_out optional-def operand. With some spot-checks
|
||||||
// another does not. Specifically, the MOVW instruction does not. So we
|
// of the operand list, we can figure out which variant we're trying to
|
||||||
// special case it here and remove the defaulted (non-setting) cc_out
|
// parse and adjust accordingly before actually matching. Reason number
|
||||||
// operand if that's the instruction we're trying to match.
|
// #317 the table driven matcher doesn't fit well with the ARM instruction
|
||||||
//
|
// set.
|
||||||
// We do this post-processing of the explicit operands rather than just
|
if (shouldOmitCCOutOperand(Mnemonic, Operands)) {
|
||||||
// conditionally adding the cc_out in the first place because we need
|
|
||||||
// to check the type of the parsed immediate operand.
|
|
||||||
if (Mnemonic == "mov" && Operands.size() > 4 &&
|
|
||||||
!static_cast<ARMOperand*>(Operands[4])->isARMSOImm() &&
|
|
||||||
static_cast<ARMOperand*>(Operands[4])->isImm0_65535Expr() &&
|
|
||||||
static_cast<ARMOperand*>(Operands[1])->getReg() == 0) {
|
|
||||||
ARMOperand *Op = static_cast<ARMOperand*>(Operands[1]);
|
ARMOperand *Op = static_cast<ARMOperand*>(Operands[1]);
|
||||||
Operands.erase(Operands.begin() + 1);
|
Operands.erase(Operands.begin() + 1);
|
||||||
delete Op;
|
delete Op;
|
||||||
|
Loading…
Reference in New Issue
Block a user