summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2011-01-18 05:34:17 +0000
committerDaniel Dunbar <daniel@zuster.org>2011-01-18 05:34:17 +0000
commit0571093f4cf0414724674448fe6b973c0fa705b3 (patch)
tree36b25ce72a50299815e4f5d7b21ed0e2dc7e52e8 /lib
parentd3df5f32c059b3ac111f1c08571d5493aa1d48c6 (diff)
downloadllvm-0571093f4cf0414724674448fe6b973c0fa705b3.tar.gz
llvm-0571093f4cf0414724674448fe6b973c0fa705b3.tar.bz2
llvm-0571093f4cf0414724674448fe6b973c0fa705b3.tar.xz
McARM: Early exit on failure (NEFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/ARM/AsmParser/ARMAsmParser.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index 3a7668a8d2..08f3a90d1c 100644
--- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -710,6 +710,11 @@ ParseMemory(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
return true;
}
+ // The next token must either be a comma or a closing bracket.
+ const AsmToken &Tok = Parser.getTok();
+ if (!Tok.is(AsmToken::Comma) && !Tok.is(AsmToken::RBrac))
+ return true;
+
bool Preindexed = false;
bool Postindexed = false;
bool OffsetIsReg = false;
@@ -718,7 +723,6 @@ ParseMemory(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
// First look for preindexed address forms, that is after the "[Rn" we now
// have to see if the next token is a comma.
- const AsmToken &Tok = Parser.getTok();
if (Tok.is(AsmToken::Comma)) {
Preindexed = true;
Parser.Lex(); // Eat comma token.
@@ -738,7 +742,6 @@ ParseMemory(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
E = RBracTok.getLoc();
Parser.Lex(); // Eat right bracket token.
-
const AsmToken &ExclaimTok = Parser.getTok();
ARMOperand *WBOp = 0;
if (ExclaimTok.is(AsmToken::Exclaim)) {
@@ -763,9 +766,9 @@ ParseMemory(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
Operands.push_back(WBOp);
return false;
- }
- // The "[Rn" we have so far was not followed by a comma.
- else if (Tok.is(AsmToken::RBrac)) {
+ } else {
+ // The "[Rn" we have so far was not followed by a comma.
+
// If there's anything other than the right brace, this is a post indexing
// addressing form.
E = Tok.getLoc();
@@ -809,8 +812,6 @@ ParseMemory(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
S, E));
return false;
}
-
- return true;
}
/// Parse the offset of a memory operand after we have seen "[Rn," or "[Rn],"