ARM IAS: support GNU extension for ldrd, strd

The GNU assembler has an extension that allows for the elision of the paired
register (dt2) for the LDRD and STRD mnemonics.  Add support for this in the
assembly parser.  Canonicalise the usage during the instruction parsing from
the specified version.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198915 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Saleem Abdulrasool
2014-01-10 04:38:35 +00:00
parent 4eeee88e91
commit 003132d48c
3 changed files with 45 additions and 1 deletions

View File

@@ -5445,6 +5445,19 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
}
}
// GNU Assembler extension (compatibility)
if ((Mnemonic == "ldrd" || Mnemonic == "strd") && !isThumb() &&
Operands.size() == 4) {
ARMOperand *Op = static_cast<ARMOperand *>(Operands[2]);
assert(Op->isReg() && "expected register argument");
assert(MRI->getMatchingSuperReg(Op->getReg(), ARM::gsub_0,
&MRI->getRegClass(ARM::GPRPairRegClassID))
&& "expected register pair");
Operands.insert(Operands.begin() + 3,
ARMOperand::CreateReg(Op->getReg() + 1, Op->getStartLoc(),
Op->getEndLoc()));
}
// FIXME: As said above, this is all a pretty gross hack. This instruction
// does not fit with other "subs" and tblgen.
// Adjust operands of B9.3.19 SUBS PC, LR, #imm (Thumb2) system instruction
@@ -8793,6 +8806,11 @@ unsigned ARMAsmParser::validateTargetOperandClass(MCParsedAsmOperand *AsmOp,
"expression value must be representiable in 32 bits");
}
break;
case MCK_GPRPair:
if (Op->isReg() &&
MRI->getRegClass(ARM::GPRRegClassID).contains(Op->getReg()))
return Match_Success;
break;
}
return Match_InvalidOperand;
}