diff options
| author | Matthias Braun <matze@braunis.de> | 2016-03-28 18:18:46 +0000 |
|---|---|---|
| committer | Matthias Braun <matze@braunis.de> | 2016-03-28 18:18:46 +0000 |
| commit | b74eb41d581316beaadbc08d0b3c7541d0287372 (patch) | |
| tree | 5729361f09da3f5b04a7053b3683ea2ecd2037bc /llvm/lib/CodeGen/MIRParser/MIParser.cpp | |
| parent | 2bd8eeb6b7ab8b39a884f37cd24e7373f5f0ea35 (diff) | |
| download | bcm5719-llvm-b74eb41d581316beaadbc08d0b3c7541d0287372.tar.gz bcm5719-llvm-b74eb41d581316beaadbc08d0b3c7541d0287372.zip | |
MIRParser: Add %subreg.xxx syntax for subregister index operands
Differential Revision: http://reviews.llvm.org/D18279
llvm-svn: 264608
Diffstat (limited to 'llvm/lib/CodeGen/MIRParser/MIParser.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIParser.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index 141aeb57349..8c7345111c5 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -144,6 +144,7 @@ public: bool parseGlobalValue(GlobalValue *&GV); bool parseGlobalAddressOperand(MachineOperand &Dest); bool parseConstantPoolIndexOperand(MachineOperand &Dest); + bool parseSubRegisterIndexOperand(MachineOperand &Dest); bool parseJumpTableIndexOperand(MachineOperand &Dest); bool parseExternalSymbolOperand(MachineOperand &Dest); bool parseMDNode(MDNode *&Node); @@ -1237,6 +1238,17 @@ bool MIParser::parseExternalSymbolOperand(MachineOperand &Dest) { return false; } +bool MIParser::parseSubRegisterIndexOperand(MachineOperand &Dest) { + assert(Token.is(MIToken::SubRegisterIndex)); + StringRef Name = Token.stringValue(); + unsigned SubRegIndex = getSubRegIndex(Token.stringValue()); + if (SubRegIndex == 0) + return error(Twine("unknown subregister index '") + Name + "'"); + lex(); + Dest = MachineOperand::CreateImm(SubRegIndex); + return false; +} + bool MIParser::parseMDNode(MDNode *&Node) { assert(Token.is(MIToken::exclaim)); auto Loc = Token.location(); @@ -1482,6 +1494,8 @@ bool MIParser::parseMachineOperand(MachineOperand &Dest, return parseJumpTableIndexOperand(Dest); case MIToken::ExternalSymbol: return parseExternalSymbolOperand(Dest); + case MIToken::SubRegisterIndex: + return parseSubRegisterIndexOperand(Dest); case MIToken::exclaim: return parseMetadataOperand(Dest); case MIToken::kw_cfi_same_value: |

