From 382fb96882f338e5b92c231f78e99e531c6c63ae Mon Sep 17 00:00:00 2001 From: Daniel Sanders Date: Tue, 1 Apr 2014 10:37:46 +0000 Subject: [PATCH] [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 --- lib/Target/Mips/AsmParser/MipsAsmParser.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp index 95e7d09ce0c..d3bfe40fc50 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( -- 2.34.1