diff options
author | Alex Lorenz <arphaman@gmail.com> | 2015-07-29 20:57:11 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2015-07-29 20:57:11 +0000 |
commit | 05fa73b2db279c0dbeb1274138b103cdc900fcd8 (patch) | |
tree | 692d1b2f70c8a7aaf7da5646adca1373b2f3de3c /llvm/lib/CodeGen | |
parent | 9b950d81485f14a427cf757a35096e056a5c9d40 (diff) | |
download | bcm5719-llvm-05fa73b2db279c0dbeb1274138b103cdc900fcd8.tar.gz bcm5719-llvm-05fa73b2db279c0dbeb1274138b103cdc900fcd8.zip |
MIR Parser: Extract the code that parses MBB references into a new method. NFC.
This commit extracts the code that's used by the class 'MIRParserImpl' to parse
the machine basic block references into a new method named 'parseMBBReference'.
llvm-svn: 243572
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIRParser.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp index 7f2d4111023..1f433e03d1f 100644 --- a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp @@ -127,6 +127,10 @@ public: PerFunctionMIParsingState &PFS); private: + bool parseMBBReference(MachineBasicBlock *&MBB, + const yaml::StringValue &Source, MachineFunction &MF, + const PerFunctionMIParsingState &PFS); + /// Return a MIR diagnostic converted from an MI string diagnostic. SMDiagnostic diagFromMIStringDiag(const SMDiagnostic &Error, SMRange SourceRange); @@ -352,9 +356,8 @@ bool MIRParserImpl::initializeMachineBasicBlock( // Parse the successors. for (const auto &MBBSource : YamlMBB.Successors) { MachineBasicBlock *SuccMBB = nullptr; - if (parseMBBReference(SuccMBB, SM, MF, MBBSource.Value, PFS, IRSlots, - Error)) - return error(Error, MBBSource.SourceRange); + if (parseMBBReference(SuccMBB, MBBSource, MF, PFS)) + return true; // TODO: Report an error when adding the same successor more than once. MBB.addSuccessor(SuccMBB); } @@ -544,8 +547,8 @@ bool MIRParserImpl::initializeJumpTableInfo( std::vector<MachineBasicBlock *> Blocks; for (const auto &MBBSource : Entry.Blocks) { MachineBasicBlock *MBB = nullptr; - if (parseMBBReference(MBB, SM, MF, MBBSource.Value, PFS, IRSlots, Error)) - return error(Error, MBBSource.SourceRange); + if (parseMBBReference(MBB, MBBSource.Value, MF, PFS)) + return true; Blocks.push_back(MBB); } unsigned Index = JTI->createJumpTableIndex(Blocks); @@ -555,6 +558,16 @@ bool MIRParserImpl::initializeJumpTableInfo( return false; } +bool MIRParserImpl::parseMBBReference(MachineBasicBlock *&MBB, + const yaml::StringValue &Source, + MachineFunction &MF, + const PerFunctionMIParsingState &PFS) { + SMDiagnostic Error; + if (llvm::parseMBBReference(MBB, SM, MF, Source.Value, PFS, IRSlots, Error)) + return error(Error, Source.SourceRange); + return false; +} + SMDiagnostic MIRParserImpl::diagFromMIStringDiag(const SMDiagnostic &Error, SMRange SourceRange) { assert(SourceRange.isValid() && "Invalid source range"); |