This patch extends mips register parsing methods to allow indexed register parsing...
[oota-llvm.git] / lib / Target / Mips / AsmParser / MipsAsmParser.cpp
index de3c4fd7954b9ef3fc2b91b0c828e1843cf2c740..56a5dfdafbdd64ba3a384a7988fc53b3f734c222 100644 (file)
@@ -1268,6 +1268,18 @@ MipsAsmParser::parseRegs(SmallVectorImpl<MCParsedAsmOperand*> &Operands,
     // Set the proper register kind.
     MipsOperand* op = static_cast<MipsOperand*>(Operands.back());
     op->setRegKind(Kind);
+    if ((Kind == MipsOperand::Kind_CPURegs)
+      && (getLexer().is(AsmToken::LParen))) {
+      // Check if it is indexed addressing operand.
+      Operands.push_back(MipsOperand::CreateToken("(", getLexer().getLoc()));
+      Parser.Lex(); // Eat the parenthesis.
+      if (parseRegs(Operands,RegKind) != MatchOperand_Success)
+        return MatchOperand_NoMatch;
+      if (getLexer().isNot(AsmToken::RParen))
+        return MatchOperand_NoMatch;
+      Operands.push_back(MipsOperand::CreateToken(")", getLexer().getLoc()));
+      Parser.Lex();
+    }
     return MatchOperand_Success;
   }
   return MatchOperand_NoMatch;