mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-24 04:32:09 +00:00
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'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243572 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5ff91d8781
commit
3b4ca38ce1
@ -127,6 +127,10 @@ public:
|
|||||||
PerFunctionMIParsingState &PFS);
|
PerFunctionMIParsingState &PFS);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool parseMBBReference(MachineBasicBlock *&MBB,
|
||||||
|
const yaml::StringValue &Source, MachineFunction &MF,
|
||||||
|
const PerFunctionMIParsingState &PFS);
|
||||||
|
|
||||||
/// Return a MIR diagnostic converted from an MI string diagnostic.
|
/// Return a MIR diagnostic converted from an MI string diagnostic.
|
||||||
SMDiagnostic diagFromMIStringDiag(const SMDiagnostic &Error,
|
SMDiagnostic diagFromMIStringDiag(const SMDiagnostic &Error,
|
||||||
SMRange SourceRange);
|
SMRange SourceRange);
|
||||||
@ -352,9 +356,8 @@ bool MIRParserImpl::initializeMachineBasicBlock(
|
|||||||
// Parse the successors.
|
// Parse the successors.
|
||||||
for (const auto &MBBSource : YamlMBB.Successors) {
|
for (const auto &MBBSource : YamlMBB.Successors) {
|
||||||
MachineBasicBlock *SuccMBB = nullptr;
|
MachineBasicBlock *SuccMBB = nullptr;
|
||||||
if (parseMBBReference(SuccMBB, SM, MF, MBBSource.Value, PFS, IRSlots,
|
if (parseMBBReference(SuccMBB, MBBSource, MF, PFS))
|
||||||
Error))
|
return true;
|
||||||
return error(Error, MBBSource.SourceRange);
|
|
||||||
// TODO: Report an error when adding the same successor more than once.
|
// TODO: Report an error when adding the same successor more than once.
|
||||||
MBB.addSuccessor(SuccMBB);
|
MBB.addSuccessor(SuccMBB);
|
||||||
}
|
}
|
||||||
@ -544,8 +547,8 @@ bool MIRParserImpl::initializeJumpTableInfo(
|
|||||||
std::vector<MachineBasicBlock *> Blocks;
|
std::vector<MachineBasicBlock *> Blocks;
|
||||||
for (const auto &MBBSource : Entry.Blocks) {
|
for (const auto &MBBSource : Entry.Blocks) {
|
||||||
MachineBasicBlock *MBB = nullptr;
|
MachineBasicBlock *MBB = nullptr;
|
||||||
if (parseMBBReference(MBB, SM, MF, MBBSource.Value, PFS, IRSlots, Error))
|
if (parseMBBReference(MBB, MBBSource.Value, MF, PFS))
|
||||||
return error(Error, MBBSource.SourceRange);
|
return true;
|
||||||
Blocks.push_back(MBB);
|
Blocks.push_back(MBB);
|
||||||
}
|
}
|
||||||
unsigned Index = JTI->createJumpTableIndex(Blocks);
|
unsigned Index = JTI->createJumpTableIndex(Blocks);
|
||||||
@ -555,6 +558,16 @@ bool MIRParserImpl::initializeJumpTableInfo(
|
|||||||
return false;
|
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,
|
SMDiagnostic MIRParserImpl::diagFromMIStringDiag(const SMDiagnostic &Error,
|
||||||
SMRange SourceRange) {
|
SMRange SourceRange) {
|
||||||
assert(SourceRange.isValid() && "Invalid source range");
|
assert(SourceRange.isValid() && "Invalid source range");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user