MIR Parser: Move the parsing of fixed stack object indices into new method. NFC

This commit moves the code that parses the frame indices for the fixed stack
objects from the method 'parseFixedStackObjectOperand' to a new method named
'parseFixedStackFrameIndex', so that it can be reused when parsing fixed stack
pseudo source values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244814 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alex Lorenz 2015-08-12 21:17:02 +00:00
parent 710eecab5d
commit f84f491d31

View File

@ -107,6 +107,7 @@ public:
bool parseMBBReference(MachineBasicBlock *&MBB); bool parseMBBReference(MachineBasicBlock *&MBB);
bool parseMBBOperand(MachineOperand &Dest); bool parseMBBOperand(MachineOperand &Dest);
bool parseStackObjectOperand(MachineOperand &Dest); bool parseStackObjectOperand(MachineOperand &Dest);
bool parseFixedStackFrameIndex(int &FI);
bool parseFixedStackObjectOperand(MachineOperand &Dest); bool parseFixedStackObjectOperand(MachineOperand &Dest);
bool parseGlobalValue(GlobalValue *&GV); bool parseGlobalValue(GlobalValue *&GV);
bool parseGlobalAddressOperand(MachineOperand &Dest); bool parseGlobalAddressOperand(MachineOperand &Dest);
@ -664,7 +665,7 @@ bool MIParser::parseStackObjectOperand(MachineOperand &Dest) {
return false; return false;
} }
bool MIParser::parseFixedStackObjectOperand(MachineOperand &Dest) { bool MIParser::parseFixedStackFrameIndex(int &FI) {
assert(Token.is(MIToken::FixedStackObject)); assert(Token.is(MIToken::FixedStackObject));
unsigned ID; unsigned ID;
if (getUnsigned(ID)) if (getUnsigned(ID))
@ -674,7 +675,15 @@ bool MIParser::parseFixedStackObjectOperand(MachineOperand &Dest) {
return error(Twine("use of undefined fixed stack object '%fixed-stack.") + return error(Twine("use of undefined fixed stack object '%fixed-stack.") +
Twine(ID) + "'"); Twine(ID) + "'");
lex(); lex();
Dest = MachineOperand::CreateFI(ObjectInfo->second); FI = ObjectInfo->second;
return false;
}
bool MIParser::parseFixedStackObjectOperand(MachineOperand &Dest) {
int FI;
if (parseFixedStackFrameIndex(FI))
return true;
Dest = MachineOperand::CreateFI(FI);
return false; return false;
} }