diff options
author | Alex Lorenz <arphaman@gmail.com> | 2015-07-22 21:07:04 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2015-07-22 21:07:04 +0000 |
commit | 44f29259d05ec372f3fbb9baa599a2b902a53b14 (patch) | |
tree | 7cd4e129b623cca5e437b83755c1dcb6e2ddeed3 /llvm/lib | |
parent | 83a019d42787a627567f1aec100a3bb4b232c4b9 (diff) | |
download | bcm5719-llvm-44f29259d05ec372f3fbb9baa599a2b902a53b14.tar.gz bcm5719-llvm-44f29259d05ec372f3fbb9baa599a2b902a53b14.zip |
MIR Parser: Extract the MDNode parsing code into a separate method. NFC.
This change would allow the machine instruction parser to reuse this method when
parsing the metadata node for the machine instruction's debug location property.
llvm-svn: 242934
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIParser.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index 212996bfaf5..edb4259fea7 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -112,6 +112,7 @@ public: bool parseConstantPoolIndexOperand(MachineOperand &Dest); bool parseJumpTableIndexOperand(MachineOperand &Dest); bool parseExternalSymbolOperand(MachineOperand &Dest); + bool parseMDNode(MDNode *&Node); bool parseMetadataOperand(MachineOperand &Dest); bool parseCFIOffset(int &Offset); bool parseCFIOperand(MachineOperand &Dest); @@ -576,7 +577,7 @@ bool MIParser::parseExternalSymbolOperand(MachineOperand &Dest) { return false; } -bool MIParser::parseMetadataOperand(MachineOperand &Dest) { +bool MIParser::parseMDNode(MDNode *&Node) { assert(Token.is(MIToken::exclaim)); auto Loc = Token.location(); lex(); @@ -589,7 +590,15 @@ bool MIParser::parseMetadataOperand(MachineOperand &Dest) { if (NodeInfo == IRSlots.MetadataNodes.end()) return error(Loc, "use of undefined metadata '!" + Twine(ID) + "'"); lex(); - Dest = MachineOperand::CreateMetadata(NodeInfo->second.get()); + Node = NodeInfo->second.get(); + return false; +} + +bool MIParser::parseMetadataOperand(MachineOperand &Dest) { + MDNode *Node = nullptr; + if (parseMDNode(Node)) + return true; + Dest = MachineOperand::CreateMetadata(Node); return false; } |