diff options
author | Tim Northover <tnorthover@apple.com> | 2016-07-22 22:13:36 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2016-07-22 22:13:36 +0000 |
commit | 98a56eb7f43e220a1f7a5d4dc1f9c32bf5a353ae (patch) | |
tree | fa6c4a1b442bd6377566abc8570a160bf817320b /llvm/lib/CodeGen/MIRParser/MIParser.cpp | |
parent | e3a032a7408ccff451cb5c081511797e05dca162 (diff) | |
download | bcm5719-llvm-98a56eb7f43e220a1f7a5d4dc1f9c32bf5a353ae.tar.gz bcm5719-llvm-98a56eb7f43e220a1f7a5d4dc1f9c32bf5a353ae.zip |
GlobalISel: allow multiple types on MachineInstrs.
llvm-svn: 276481
Diffstat (limited to 'llvm/lib/CodeGen/MIRParser/MIParser.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIParser.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index 695c58d1a08..b1292bb48b0 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -595,12 +595,17 @@ bool MIParser::parse(MachineInstr *&MI) { if (Token.isError() || parseInstruction(OpCode, Flags)) return true; - LLT Ty{}; + SmallVector<LLT, 1> Tys; if (isPreISelGenericOpcode(OpCode)) { - // For generic opcode, a type is mandatory. - auto Loc = Token.location(); - if (parseLowLevelType(Loc, Ty)) - return true; + // For generic opcode, at least one type is mandatory. + expectAndConsume(MIToken::lbrace); + do { + auto Loc = Token.location(); + Tys.resize(Tys.size() + 1); + if (parseLowLevelType(Loc, Tys[Tys.size() - 1])) + return true; + } while (consumeIfPresent(MIToken::comma)); + expectAndConsume(MIToken::rbrace); } // Parse the remaining machine operands. @@ -658,8 +663,10 @@ bool MIParser::parse(MachineInstr *&MI) { // TODO: Check for extraneous machine operands. MI = MF.CreateMachineInstr(MCID, DebugLocation, /*NoImplicit=*/true); MI->setFlags(Flags); - if (Ty.isValid()) - MI->setType(Ty); + if (Tys.size() > 0) { + for (unsigned i = 0; i < Tys.size(); ++i) + MI->setType(Tys[i], i); + } for (const auto &Operand : Operands) MI->addOperand(MF, Operand.Operand); if (assignRegisterTies(*MI, Operands)) |