summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/AsmParser
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2014-04-01 10:37:46 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2014-04-01 10:37:46 +0000
commit382fb96882f338e5b92c231f78e99e531c6c63ae (patch)
treebad2a4b74590734d598f073c12afabee00dd388c /lib/Target/Mips/AsmParser
parentacfb67961848bc2127da4a2b179c3ea762f4a9b2 (diff)
downloadllvm-382fb96882f338e5b92c231f78e99e531c6c63ae.tar.gz
llvm-382fb96882f338e5b92c231f78e99e531c6c63ae.tar.bz2
llvm-382fb96882f338e5b92c231f78e99e531c6c63ae.tar.xz
[mips] Hoist Parser.Lex() calls out of MatchAnyRegisterNameWithoutDollar()
Summary: No functional change Depends on D3222 Reviewers: matheusalmeida, vmedic Reviewed By: matheusalmeida Differential Revision: http://llvm-reviews.chandlerc.com/D3232 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205295 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/AsmParser')
-rw-r--r--lib/Target/Mips/AsmParser/MipsAsmParser.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index 95e7d09ce0..d3bfe40fc5 100644
--- a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -1710,9 +1710,10 @@ bool MipsAsmParser::searchSymbolAlias(
if (DefSymbol.startswith("$")) {
OperandMatchResultTy ResTy =
MatchAnyRegisterNameWithoutDollar(Operands, DefSymbol.substr(1), S);
- if (ResTy == MatchOperand_Success)
+ if (ResTy == MatchOperand_Success) {
+ Parser.Lex();
return true;
- else if (ResTy == MatchOperand_ParseFail)
+ } else if (ResTy == MatchOperand_ParseFail)
llvm_unreachable("Should never ParseFail");
return false;
}
@@ -1734,7 +1735,6 @@ MipsAsmParser::MatchAnyRegisterNameWithoutDollar(
SMLoc S) {
int Index = matchCPURegisterName(Identifier);
if (Index != -1) {
- Parser.Lex();
Operands.push_back(MipsOperand::CreateGPRReg(
Index, getContext().getRegisterInfo(), S, getLexer().getLoc(), *this));
return MatchOperand_Success;
@@ -1742,7 +1742,6 @@ MipsAsmParser::MatchAnyRegisterNameWithoutDollar(
Index = matchFPURegisterName(Identifier);
if (Index != -1) {
- Parser.Lex();
Operands.push_back(MipsOperand::CreateFGRReg(
Index, getContext().getRegisterInfo(), S, getLexer().getLoc(), *this));
return MatchOperand_Success;
@@ -1750,7 +1749,6 @@ MipsAsmParser::MatchAnyRegisterNameWithoutDollar(
Index = matchFCCRegisterName(Identifier);
if (Index != -1) {
- Parser.Lex();
Operands.push_back(MipsOperand::CreateFCCReg(
Index, getContext().getRegisterInfo(), S, getLexer().getLoc(), *this));
return MatchOperand_Success;
@@ -1758,7 +1756,6 @@ MipsAsmParser::MatchAnyRegisterNameWithoutDollar(
Index = matchACRegisterName(Identifier);
if (Index != -1) {
- Parser.Lex();
Operands.push_back(MipsOperand::CreateACCReg(
Index, getContext().getRegisterInfo(), S, getLexer().getLoc(), *this));
return MatchOperand_Success;
@@ -1766,7 +1763,6 @@ MipsAsmParser::MatchAnyRegisterNameWithoutDollar(
Index = matchMSA128RegisterName(Identifier);
if (Index != -1) {
- Parser.Lex();
Operands.push_back(MipsOperand::CreateMSA128Reg(
Index, getContext().getRegisterInfo(), S, getLexer().getLoc(), *this));
return MatchOperand_Success;
@@ -1774,7 +1770,6 @@ MipsAsmParser::MatchAnyRegisterNameWithoutDollar(
Index = matchMSA128CtrlRegisterName(Identifier);
if (Index != -1) {
- Parser.Lex();
Operands.push_back(MipsOperand::CreateMSACtrlReg(
Index, getContext().getRegisterInfo(), S, getLexer().getLoc(), *this));
return MatchOperand_Success;
@@ -1791,7 +1786,11 @@ MipsAsmParser::ParseAnyRegisterWithoutDollar(
if (Token.is(AsmToken::Identifier)) {
DEBUG(dbgs() << ".. identifier\n");
StringRef Identifier = Token.getIdentifier();
- return MatchAnyRegisterNameWithoutDollar(Operands, Identifier, S);
+ OperandMatchResultTy ResTy =
+ MatchAnyRegisterNameWithoutDollar(Operands, Identifier, S);
+ if (ResTy == MatchOperand_Success)
+ Parser.Lex();
+ return ResTy;
} else if (Token.is(AsmToken::Integer)) {
DEBUG(dbgs() << ".. integer\n");
Operands.push_back(MipsOperand::CreateNumericReg(