summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Medic <Vladimir.Medic@imgtec.com>2013-07-17 15:00:42 +0000
committerVladimir Medic <Vladimir.Medic@imgtec.com>2013-07-17 15:00:42 +0000
commit74593e65774a3b39223de30903e7d30c6645abe5 (patch)
tree871bec268e3ed41c7596a7deebfb7f4d326bdc51
parenta0d9b6b69322b27fae1c646271b5d4cc44a7bce5 (diff)
downloadbcm5719-llvm-74593e65774a3b39223de30903e7d30c6645abe5.tar.gz
bcm5719-llvm-74593e65774a3b39223de30903e7d30c6645abe5.zip
This patch checks for valid mnemonics at the beginning of parseInstruction method, thus giving the user the right error message for non-existing instructions.
llvm-svn: 186512
-rw-r--r--llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index a4f3721771e..de3c4fd7954 100644
--- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -1495,6 +1495,11 @@ MCSymbolRefExpr::VariantKind MipsAsmParser::getVariantKind(StringRef Symbol) {
bool MipsAsmParser::
ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc,
SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
+ // Check if we have valid mnemonic
+ if (!mnemonicIsValid(Name)) {
+ Parser.eatToEndOfStatement();
+ return Error(NameLoc, "Unknown instruction");
+ }
// First operand in MCInst is instruction mnemonic.
Operands.push_back(MipsOperand::CreateToken(Name, NameLoc));
OpenPOWER on IntegriCloud