mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242934 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -112,6 +112,7 @@ public:
|
|||||||
bool parseConstantPoolIndexOperand(MachineOperand &Dest);
|
bool parseConstantPoolIndexOperand(MachineOperand &Dest);
|
||||||
bool parseJumpTableIndexOperand(MachineOperand &Dest);
|
bool parseJumpTableIndexOperand(MachineOperand &Dest);
|
||||||
bool parseExternalSymbolOperand(MachineOperand &Dest);
|
bool parseExternalSymbolOperand(MachineOperand &Dest);
|
||||||
|
bool parseMDNode(MDNode *&Node);
|
||||||
bool parseMetadataOperand(MachineOperand &Dest);
|
bool parseMetadataOperand(MachineOperand &Dest);
|
||||||
bool parseCFIOffset(int &Offset);
|
bool parseCFIOffset(int &Offset);
|
||||||
bool parseCFIOperand(MachineOperand &Dest);
|
bool parseCFIOperand(MachineOperand &Dest);
|
||||||
@@ -576,7 +577,7 @@ bool MIParser::parseExternalSymbolOperand(MachineOperand &Dest) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MIParser::parseMetadataOperand(MachineOperand &Dest) {
|
bool MIParser::parseMDNode(MDNode *&Node) {
|
||||||
assert(Token.is(MIToken::exclaim));
|
assert(Token.is(MIToken::exclaim));
|
||||||
auto Loc = Token.location();
|
auto Loc = Token.location();
|
||||||
lex();
|
lex();
|
||||||
@@ -589,7 +590,15 @@ bool MIParser::parseMetadataOperand(MachineOperand &Dest) {
|
|||||||
if (NodeInfo == IRSlots.MetadataNodes.end())
|
if (NodeInfo == IRSlots.MetadataNodes.end())
|
||||||
return error(Loc, "use of undefined metadata '!" + Twine(ID) + "'");
|
return error(Loc, "use of undefined metadata '!" + Twine(ID) + "'");
|
||||||
lex();
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user