[llvm-commits] [llvm] r123739 - /llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp

Daniel Dunbar daniel at zuster.org
Mon Jan 17 21:34:18 PST 2011


Author: ddunbar
Date: Mon Jan 17 23:34:17 2011
New Revision: 123739

URL: http://llvm.org/viewvc/llvm-project?rev=123739&view=rev
Log:
McARM: Early exit on failure (NEFC).

Modified:
    llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp

Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=123739&r1=123738&r2=123739&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Mon Jan 17 23:34:17 2011
@@ -710,6 +710,11 @@
     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 @@
 
   // 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 @@
     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 @@
       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 @@
                                              S, E));
     return false;
   }
-
-  return true;
 }
 
 /// Parse the offset of a memory operand after we have seen "[Rn," or "[Rn],"





More information about the llvm-commits mailing list