summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2013-12-29 17:58:35 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2013-12-29 17:58:35 +0000
commit4da9c6e566b798724ab2df2578c8ca23b025f780 (patch)
tree451090b3a0521b44e1552913a00b099ed279fe5e /llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
parenta1937cbc625e7ba0f5aabd715413f17be7d33c49 (diff)
downloadbcm5719-llvm-4da9c6e566b798724ab2df2578c8ca23b025f780.tar.gz
bcm5719-llvm-4da9c6e566b798724ab2df2578c8ca23b025f780.zip
ARM: provide VFP aliases for pre-V6 mnemonics
In order to provide compatibility with the GNU assembler, provide aliases for pre-UAL mnemonics for floating point operations. llvm-svn: 198172
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp')
-rw-r--r--llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index d4122bcb4af..c0e54723469 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -5111,6 +5111,15 @@ static void applyMnemonicAliases(StringRef &Mnemonic, unsigned Features,
bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
SMLoc NameLoc,
SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
+ // FIXME: Can this be done via tablegen in some fashion?
+ bool HasPrecisionRestrictions;
+ bool AcceptDoublePrecisionOnly;
+ bool AcceptSinglePrecisionOnly;
+ HasPrecisionRestrictions = Name.startswith("fldm") || Name.startswith("fstm");
+ AcceptDoublePrecisionOnly =
+ HasPrecisionRestrictions && (Name.back() == 'd' || Name.back() == 'x');
+ AcceptSinglePrecisionOnly = HasPrecisionRestrictions && Name.back() == 's';
+
// Apply mnemonic aliases before doing anything else, as the destination
// mnemonic may include suffices and we want to handle them normally.
// The generic tblgen'erated code does this later, at the start of
@@ -5279,6 +5288,26 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
Parser.Lex(); // Consume the EndOfStatement
+ if (HasPrecisionRestrictions) {
+ ARMOperand *Op = static_cast<ARMOperand*>(Operands.back());
+ assert(Op->isRegList());
+ const SmallVectorImpl<unsigned> &RegList = Op->getRegList();
+ for (SmallVectorImpl<unsigned>::const_iterator RLI = RegList.begin(),
+ RLE = RegList.end();
+ RLI != RLE; ++RLI) {
+ if (AcceptSinglePrecisionOnly &&
+ !ARMMCRegisterClasses[ARM::SPRRegClassID].contains(*RLI))
+ return Error(Op->getStartLoc(),
+ "VFP/Neon single precision register expected");
+ else if (AcceptDoublePrecisionOnly &&
+ !ARMMCRegisterClasses[ARM::DPRRegClassID].contains(*RLI))
+ return Error(Op->getStartLoc(),
+ "VFP/Neon double precision register expected");
+ else
+ llvm_unreachable("must have single or double precision restrictions");
+ }
+ }
+
// Some instructions, mostly Thumb, have forms for the same mnemonic that
// do and don't have a cc_out optional-def operand. With some spot-checks
// of the operand list, we can figure out which variant we're trying to
OpenPOWER on IntegriCloud