MIR Serialization: Serialize the jump table index operands.

Reviewers: Duncan P. N. Exon Smith


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242358 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alex Lorenz
2015-07-15 23:38:35 +00:00
parent 81bef8c7a7
commit a2e819fb09
8 changed files with 233 additions and 6 deletions

View File

@@ -88,6 +88,7 @@ public:
bool parseMBBReference(MachineBasicBlock *&MBB);
bool parseMBBOperand(MachineOperand &Dest);
bool parseGlobalAddressOperand(MachineOperand &Dest);
bool parseJumpTableIndexOperand(MachineOperand &Dest);
bool parseMachineOperand(MachineOperand &Dest);
private:
@@ -468,6 +469,20 @@ bool MIParser::parseGlobalAddressOperand(MachineOperand &Dest) {
return false;
}
bool MIParser::parseJumpTableIndexOperand(MachineOperand &Dest) {
assert(Token.is(MIToken::JumpTableIndex));
unsigned ID;
if (getUnsigned(ID))
return true;
auto JumpTableEntryInfo = PFS.JumpTableSlots.find(ID);
if (JumpTableEntryInfo == PFS.JumpTableSlots.end())
return error("use of undefined jump table '%jump-table." + Twine(ID) + "'");
lex();
// TODO: Parse target flags.
Dest = MachineOperand::CreateJTI(JumpTableEntryInfo->second);
return false;
}
bool MIParser::parseMachineOperand(MachineOperand &Dest) {
switch (Token.kind()) {
case MIToken::kw_implicit:
@@ -486,6 +501,8 @@ bool MIParser::parseMachineOperand(MachineOperand &Dest) {
case MIToken::GlobalValue:
case MIToken::NamedGlobalValue:
return parseGlobalAddressOperand(Dest);
case MIToken::JumpTableIndex:
return parseJumpTableIndexOperand(Dest);
case MIToken::Error:
return true;
case MIToken::Identifier: