diff options
| author | Daniel Sanders <daniel.sanders@imgtec.com> | 2014-04-01 10:41:48 +0000 |
|---|---|---|
| committer | Daniel Sanders <daniel.sanders@imgtec.com> | 2014-04-01 10:41:48 +0000 |
| commit | ffd8436d6c31bbe2190bd195a44de1b736703934 (patch) | |
| tree | 3c29dabba3344723ce6fe2b32653c60802020e68 /llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp | |
| parent | 315386c0836810d27e7c156fa4921846b0cde586 (diff) | |
| download | bcm5719-llvm-ffd8436d6c31bbe2190bd195a44de1b736703934.tar.gz bcm5719-llvm-ffd8436d6c31bbe2190bd195a44de1b736703934.zip | |
[mips] Extend ParseJumpTarget to support the full symbol expression syntax.
Summary:
This should fix the issues the D3222 caused in lld. Testcase is based on
the one that failed in the buildbot.
Depends on D3233
Reviewers: matheusalmeida, vmedic
Reviewed By: matheusalmeida
Differential Revision: http://llvm-reviews.chandlerc.com/D3234
llvm-svn: 205298
Diffstat (limited to 'llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp')
| -rw-r--r-- | llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp index 12469822f71..759a2db2839 100644 --- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -1868,35 +1868,14 @@ MipsAsmParser::OperandMatchResultTy MipsAsmParser::ParseJumpTarget( if (ResTy != MatchOperand_NoMatch) return ResTy; - // Consume the $ if there is one. We'll add it to the symbol below. - bool hasConsumedDollar = false; - if (getLexer().is(AsmToken::Dollar)) { - Parser.Lex(); - hasConsumedDollar = true; + const MCExpr *Expr = nullptr; + if (Parser.parseExpression(Expr)) { + // We have no way of knowing if a symbol was consumed so we must ParseFail + return MatchOperand_ParseFail; } - - StringRef Identifier; - if (Parser.parseIdentifier(Identifier)) - return hasConsumedDollar ? MatchOperand_ParseFail : MatchOperand_NoMatch; - - if (hasConsumedDollar) - Identifier = StringRef("$" + Identifier.str()); - - SMLoc E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1); - MCSymbol *Sym = getContext().GetOrCreateSymbol(Identifier); - - // Create a symbol reference. - const MCExpr *Res = - MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_None, getContext()); - - Operands.push_back(MipsOperand::CreateImm(Res, S, E, *this)); + Operands.push_back( + MipsOperand::CreateImm(Expr, S, getLexer().getLoc(), *this)); return MatchOperand_Success; - // // Look for the existing symbol, we should check if - // // we need to assign the proper RegisterKind. - // if (searchSymbolAlias(Operands)) - // return false; - - return MatchOperand_NoMatch; } MipsAsmParser::OperandMatchResultTy |

