diff options
author | Tim Northover <tnorthover@apple.com> | 2016-07-26 17:28:01 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2016-07-26 17:28:01 +0000 |
commit | 26e40bdb9b52318c7cb5506adcfcab580f7a02d0 (patch) | |
tree | 97c1041392eea35fea5cb67417d26c0ad28f2dda /llvm/lib/CodeGen/MIRParser/MIParser.cpp | |
parent | 3104a6bad05b9b1432b7afd5c31e1318bd8e1814 (diff) | |
download | bcm5719-llvm-26e40bdb9b52318c7cb5506adcfcab580f7a02d0.tar.gz bcm5719-llvm-26e40bdb9b52318c7cb5506adcfcab580f7a02d0.zip |
GlobalISel: omit braces on MachineInstr types when there's only one.
Tidies up the representation a bit in the common case.
llvm-svn: 276772
Diffstat (limited to 'llvm/lib/CodeGen/MIRParser/MIParser.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIParser.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index b1292bb48b0..170f9735d1f 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -598,14 +598,20 @@ bool MIParser::parse(MachineInstr *&MI) { SmallVector<LLT, 1> Tys; if (isPreISelGenericOpcode(OpCode)) { // For generic opcode, at least one type is mandatory. - expectAndConsume(MIToken::lbrace); + auto Loc = Token.location(); + bool ManyTypes = Token.is(MIToken::lbrace); + if (ManyTypes) + lex(); + + // Now actually parse the type(s). 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); + } while (ManyTypes && consumeIfPresent(MIToken::comma)); + + if (ManyTypes) + expectAndConsume(MIToken::rbrace); } // Parse the remaining machine operands. |