[gardening] Standardize SILBasicBlock successor/predecessor methods that deal with blocks rather than the full successor data structure to have the suffix 'Block'.

This was already done for getSuccessorBlocks() to distinguish getting successor
blocks from getting the full list of SILSuccessors via getSuccessors(). This
commit just makes all of the successor/predecessor code follow that naming
convention.

Some examples:

getSingleSuccessor() => getSingleSuccessorBlock().
isSuccessor() => isSuccessorBlock().
getPreds() => getPredecessorBlocks().

Really, IMO, we should consider renaming SILSuccessor to a more verbose name so
that it is clear that it is more of an internal detail of SILBasicBlock's
implementation rather than something that one should consider as apart of one's
mental model of the IR when one really wants to be thinking about predecessor
and successor blocks. But that is not what this commit is trying to change, it
is just trying to eliminate a bit of technical debt by making the naming
conventions here consistent.
This commit is contained in:
Michael Gottesman
2016-11-27 11:25:33 -08:00
parent 32000742df
commit 38ec08f45f
43 changed files with 195 additions and 178 deletions

View File

@@ -233,10 +233,11 @@ static bool isSingleBlockLoop(SILLoop *L) {
if (BackEdge == Header)
BackEdge = Blocks[0];
if (!BackEdge->getSingleSuccessor())
if (!BackEdge->getSingleSuccessorBlock())
return false;
assert(BackEdge->getSingleSuccessor() == Header && "Loop not well formed");
assert(BackEdge->getSingleSuccessorBlock() == Header &&
"Loop not well formed");
// Check whether the back-edge block is just a split-edge.
return ++BackEdge->begin() == BackEdge->end();
@@ -315,7 +316,7 @@ bool swift::rotateLoop(SILLoop *L, DominanceInfo *DT, SILLoopInfo *LI,
// We don't want to rotate such that we merge two headers of separate loops
// into one. This can be turned into an assert again once we have guaranteed
// preheader insertions.
if (!NewHeader->getSinglePredecessor() && Header != Latch)
if (!NewHeader->getSinglePredecessorBlock() && Header != Latch)
return false;
// Now that we know we can perform the rotation - move the instructions that