diff options
| author | Alex Lorenz <arphaman@gmail.com> | 2015-07-29 18:51:21 +0000 |
|---|---|---|
| committer | Alex Lorenz <arphaman@gmail.com> | 2015-07-29 18:51:21 +0000 |
| commit | fbe9c04c5f72cf3eca39793aafc92071ef13c046 (patch) | |
| tree | 7f7de65b56c41854f8ab107689e8fde08453cf08 /llvm/lib/CodeGen/MIRParser/MIParser.cpp | |
| parent | 57a9c7eba59ef9438296ec6387d8460b09069450 (diff) | |
| download | bcm5719-llvm-fbe9c04c5f72cf3eca39793aafc92071ef13c046.tar.gz bcm5719-llvm-fbe9c04c5f72cf3eca39793aafc92071ef13c046.zip | |
MIR Parser: Parse multiple LHS register machine operands.
llvm-svn: 243553
Diffstat (limited to 'llvm/lib/CodeGen/MIRParser/MIParser.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIParser.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index 2ef76114331..6c0cd9d6ef8 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -214,6 +214,8 @@ static const char *toString(MIToken::TokenKind TokenKind) { switch (TokenKind) { case MIToken::comma: return "','"; + case MIToken::equal: + return "'='"; case MIToken::lparen: return "'('"; case MIToken::rparen: @@ -234,18 +236,19 @@ bool MIParser::parse(MachineInstr *&MI) { lex(); // Parse any register operands before '=' - // TODO: Allow parsing of multiple operands before '=' MachineOperand MO = MachineOperand::CreateImm(0); SmallVector<MachineOperandWithLocation, 8> Operands; - if (Token.isRegister() || Token.isRegisterFlag()) { + while (Token.isRegister() || Token.isRegisterFlag()) { auto Loc = Token.location(); if (parseRegisterOperand(MO, /*IsDef=*/true)) return true; Operands.push_back(MachineOperandWithLocation(MO, Loc, Token.location())); - if (Token.isNot(MIToken::equal)) - return error("expected '='"); + if (Token.isNot(MIToken::comma)) + break; lex(); } + if (!Operands.empty() && expectAndConsume(MIToken::equal)) + return true; unsigned OpCode, Flags = 0; if (Token.isError() || parseInstruction(OpCode, Flags)) |

