diff options
author | Alex Lorenz <arphaman@gmail.com> | 2015-08-21 21:48:22 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2015-08-21 21:48:22 +0000 |
commit | 5d8b0bd9b06f11fe5ecf819f7eddb42f9ca19787 (patch) | |
tree | e334b41b8b820e77a0269f02e2dd7bc346ca9a46 /llvm/lib/CodeGen | |
parent | d583b19569183563aa5c4f8d15309edad09c8113 (diff) | |
download | bcm5719-llvm-5d8b0bd9b06f11fe5ecf819f7eddb42f9ca19787.tar.gz bcm5719-llvm-5d8b0bd9b06f11fe5ecf819f7eddb42f9ca19787.zip |
MIRParser: Split the 'parseIRConstant' method into two methods. NFC.
One variant of this method can be reused when parsing the quoted IR pointer
expressions in the machine memory operands.
llvm-svn: 245743
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIParser.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index 7a12bae329c..e7fb4378121 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -122,6 +122,8 @@ public: bool parseRegisterOperand(MachineOperand &Dest, Optional<unsigned> &TiedDefIdx, bool IsDef = false); bool parseImmediateOperand(MachineOperand &Dest); + bool parseIRConstant(StringRef::iterator Loc, StringRef Source, + const Constant *&C); bool parseIRConstant(StringRef::iterator Loc, const Constant *&C); bool parseTypedImmediateOperand(MachineOperand &Dest); bool parseFPImmediateOperand(MachineOperand &Dest); @@ -976,9 +978,9 @@ bool MIParser::parseImmediateOperand(MachineOperand &Dest) { return false; } -bool MIParser::parseIRConstant(StringRef::iterator Loc, const Constant *&C) { - auto Source = StringRef(Loc, Token.range().end() - Loc).str(); - lex(); +bool MIParser::parseIRConstant(StringRef::iterator Loc, StringRef StringValue, + const Constant *&C) { + auto Source = StringValue.str(); // The source has to be null terminated. SMDiagnostic Err; C = parseConstantValue(Source.c_str(), Err, *MF.getFunction()->getParent()); if (!C) @@ -986,6 +988,13 @@ bool MIParser::parseIRConstant(StringRef::iterator Loc, const Constant *&C) { return false; } +bool MIParser::parseIRConstant(StringRef::iterator Loc, const Constant *&C) { + if (parseIRConstant(Loc, StringRef(Loc, Token.range().end() - Loc), C)) + return true; + lex(); + return false; +} + bool MIParser::parseTypedImmediateOperand(MachineOperand &Dest) { assert(Token.is(MIToken::IntegerType)); auto Loc = Token.location(); |