summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MIRParser/MIParser.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2015-08-05 18:52:21 +0000
committerAlex Lorenz <arphaman@gmail.com>2015-08-05 18:52:21 +0000
commit05e3882e81d4d25f52f716d2f6555510e25c6143 (patch)
treeb1fc3bfce2a2588955c7f13993a59ca527082c50 /llvm/lib/CodeGen/MIRParser/MIParser.cpp
parent124955aade67bb0455a8c0dc1f01d86b265ef277 (diff)
downloadbcm5719-llvm-05e3882e81d4d25f52f716d2f6555510e25c6143.tar.gz
bcm5719-llvm-05e3882e81d4d25f52f716d2f6555510e25c6143.zip
MIR Serialization: Serialize the typed immediate integer machine operands.
llvm-svn: 244098
Diffstat (limited to 'llvm/lib/CodeGen/MIRParser/MIParser.cpp')
-rw-r--r--llvm/lib/CodeGen/MIRParser/MIParser.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index 5bedd3e18f3..15f93eea87f 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -100,6 +100,7 @@ public:
bool parseRegisterOperand(MachineOperand &Dest, bool IsDef = false);
bool parseImmediateOperand(MachineOperand &Dest);
bool parseIRConstant(StringRef::iterator Loc, const Constant *&C);
+ bool parseTypedImmediateOperand(MachineOperand &Dest);
bool parseFPImmediateOperand(MachineOperand &Dest);
bool parseMBBReference(MachineBasicBlock *&MBB);
bool parseMBBOperand(MachineOperand &Dest);
@@ -568,6 +569,19 @@ bool MIParser::parseIRConstant(StringRef::iterator Loc, const Constant *&C) {
return false;
}
+bool MIParser::parseTypedImmediateOperand(MachineOperand &Dest) {
+ assert(Token.is(MIToken::IntegerType));
+ auto Loc = Token.location();
+ lex();
+ if (Token.isNot(MIToken::IntegerLiteral))
+ return error("expected an integer literal");
+ const Constant *C = nullptr;
+ if (parseIRConstant(Loc, C))
+ return true;
+ Dest = MachineOperand::CreateCImm(cast<ConstantInt>(C));
+ return false;
+}
+
bool MIParser::parseFPImmediateOperand(MachineOperand &Dest) {
auto Loc = Token.location();
lex();
@@ -907,6 +921,8 @@ bool MIParser::parseMachineOperand(MachineOperand &Dest) {
return parseRegisterOperand(Dest);
case MIToken::IntegerLiteral:
return parseImmediateOperand(Dest);
+ case MIToken::IntegerType:
+ return parseTypedImmediateOperand(Dest);
case MIToken::kw_half:
case MIToken::kw_float:
case MIToken::kw_double:
OpenPOWER on IntegriCloud