diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2013-12-30 18:38:01 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2013-12-30 18:38:01 +0000 |
commit | e3a9dc134db8a369af7642e367dc52acab5048c7 (patch) | |
tree | 653cf27a4870eeafe590478bcc86402bbfc53c8e /llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | |
parent | 05893f475bc4db060a0b894837248d492783b8a1 (diff) | |
download | bcm5719-llvm-e3a9dc134db8a369af7642e367dc52acab5048c7.tar.gz bcm5719-llvm-e3a9dc134db8a369af7642e367dc52acab5048c7.zip |
ARM IAS: account for predicated pre-UAL mnemonics
Checking the trailing letter of the mnemonic is insufficient. Be more thorough
in the scanning of the instruction to ensure that we correctly work with the
predicated mnemonics.
llvm-svn: 198235
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 6e0038c9b03..33274bfd0fa 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -5107,18 +5107,37 @@ static bool doesIgnoreDataTypeSuffix(StringRef Mnemonic, StringRef DT) { } static void applyMnemonicAliases(StringRef &Mnemonic, unsigned Features, unsigned VariantID); + +static bool RequiresVFPRegListValidation(StringRef Inst, + bool &AcceptSinglePrecisionOnly, + bool &AcceptDoublePrecisionOnly) { + if (Inst.size() < 7) + return false; + + if (Inst.startswith("fldm") || Inst.startswith("fstm")) { + StringRef AddressingMode = Inst.substr(4, 2); + if (AddressingMode == "ia" || AddressingMode == "db" || + AddressingMode == "ea" || AddressingMode == "fd") { + AcceptSinglePrecisionOnly = Inst[6] == 's'; + AcceptDoublePrecisionOnly = Inst[6] == 'd' || Inst[6] == 'x'; + return true; + } + } + + return false; +} + /// Parse an arm instruction mnemonic followed by its operands. bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc, SmallVectorImpl<MCParsedAsmOperand*> &Operands) { // FIXME: Can this be done via tablegen in some fashion? - bool RequireVFPRegisterList; - bool AcceptDoublePrecisionOnly; + bool RequireVFPRegisterListCheck; bool AcceptSinglePrecisionOnly; - RequireVFPRegisterList = Name.startswith("fldm") || Name.startswith("fstm"); - AcceptDoublePrecisionOnly = - RequireVFPRegisterList && (Name.back() == 'd' || Name.back() == 'x'); - AcceptSinglePrecisionOnly = RequireVFPRegisterList && Name.back() == 's'; + bool AcceptDoublePrecisionOnly; + RequireVFPRegisterListCheck = + RequiresVFPRegListValidation(Name, AcceptSinglePrecisionOnly, + AcceptDoublePrecisionOnly); // Apply mnemonic aliases before doing anything else, as the destination // mnemonic may include suffices and we want to handle them normally. @@ -5288,7 +5307,7 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name, Parser.Lex(); // Consume the EndOfStatement - if (RequireVFPRegisterList) { + if (RequireVFPRegisterListCheck) { ARMOperand *Op = static_cast<ARMOperand*>(Operands.back()); if (AcceptSinglePrecisionOnly && !Op->isSPRRegList()) return Error(Op->getStartLoc(), |