From 0a39c58503cad3cb02197257a182ec79df7a9305 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Tue, 18 Aug 2015 22:18:52 +0000 Subject: [PATCH] MIR Parser: Extract the code that parses stack object references into a new method. This commit extracts the code that parses the stack object references into a new method named 'parseStackFrameIndex', so that it can be reused when parsing standalone stack object references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245370 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MIRParser/MIParser.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/MIRParser/MIParser.cpp b/lib/CodeGen/MIRParser/MIParser.cpp index c6c0e4516f1..e040672a465 100644 --- a/lib/CodeGen/MIRParser/MIParser.cpp +++ b/lib/CodeGen/MIRParser/MIParser.cpp @@ -114,6 +114,7 @@ public: bool parseFPImmediateOperand(MachineOperand &Dest); bool parseMBBReference(MachineBasicBlock *&MBB); bool parseMBBOperand(MachineOperand &Dest); + bool parseStackFrameIndex(int &FI); bool parseStackObjectOperand(MachineOperand &Dest); bool parseFixedStackFrameIndex(int &FI); bool parseFixedStackObjectOperand(MachineOperand &Dest); @@ -929,7 +930,7 @@ bool MIParser::parseMBBOperand(MachineOperand &Dest) { return false; } -bool MIParser::parseStackObjectOperand(MachineOperand &Dest) { +bool MIParser::parseStackFrameIndex(int &FI) { assert(Token.is(MIToken::StackObject)); unsigned ID; if (getUnsigned(ID)) @@ -946,7 +947,15 @@ bool MIParser::parseStackObjectOperand(MachineOperand &Dest) { return error(Twine("the name of the stack object '%stack.") + Twine(ID) + "' isn't '" + Token.stringValue() + "'"); lex(); - Dest = MachineOperand::CreateFI(ObjectInfo->second); + FI = ObjectInfo->second; + return false; +} + +bool MIParser::parseStackObjectOperand(MachineOperand &Dest) { + int FI; + if (parseStackFrameIndex(FI)) + return true; + Dest = MachineOperand::CreateFI(FI); return false; } -- 2.34.1