mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 21:32:39 +00:00
Reword a few comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74146 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a278f3f552
commit
cc4e605721
@ -108,7 +108,7 @@ static RegisterPass<LoopRotate> X("loop-rotate", "Rotate Loops");
|
|||||||
Pass *llvm::createLoopRotatePass() { return new LoopRotate(); }
|
Pass *llvm::createLoopRotatePass() { return new LoopRotate(); }
|
||||||
|
|
||||||
/// Rotate Loop L as many times as possible. Return true if
|
/// Rotate Loop L as many times as possible. Return true if
|
||||||
/// loop is rotated at least once.
|
/// the loop is rotated at least once.
|
||||||
bool LoopRotate::runOnLoop(Loop *Lp, LPPassManager &LPM) {
|
bool LoopRotate::runOnLoop(Loop *Lp, LPPassManager &LPM) {
|
||||||
|
|
||||||
bool RotatedOneLoop = false;
|
bool RotatedOneLoop = false;
|
||||||
@ -132,15 +132,15 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) {
|
|||||||
OrigPreHeader = L->getLoopPreheader();
|
OrigPreHeader = L->getLoopPreheader();
|
||||||
OrigLatch = L->getLoopLatch();
|
OrigLatch = L->getLoopLatch();
|
||||||
|
|
||||||
// If loop has only one block then there is not much to rotate.
|
// If the loop has only one block then there is not much to rotate.
|
||||||
if (L->getBlocks().size() == 1)
|
if (L->getBlocks().size() == 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
assert(OrigHeader && OrigLatch && OrigPreHeader &&
|
assert(OrigHeader && OrigLatch && OrigPreHeader &&
|
||||||
"Loop is not in canonical form");
|
"Loop is not in canonical form");
|
||||||
|
|
||||||
// If loop header is not one of the loop exit block then
|
// If the loop header is not one of the loop exiting blocks then
|
||||||
// either this loop is already rotated or it is not
|
// either this loop is already rotated or it is not
|
||||||
// suitable for loop rotation transformations.
|
// suitable for loop rotation transformations.
|
||||||
if (!L->isLoopExit(OrigHeader))
|
if (!L->isLoopExit(OrigHeader))
|
||||||
return false;
|
return false;
|
||||||
@ -189,19 +189,19 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) {
|
|||||||
assert(L->contains(NewHeader) && !L->contains(Exit) &&
|
assert(L->contains(NewHeader) && !L->contains(Exit) &&
|
||||||
"Unable to determine loop header and exit blocks");
|
"Unable to determine loop header and exit blocks");
|
||||||
|
|
||||||
// This code assumes that new header has exactly one predecessor. Remove any
|
// This code assumes that the new header has exactly one predecessor.
|
||||||
// single entry PHI nodes in it.
|
// Remove any single-entry PHI nodes in it.
|
||||||
assert(NewHeader->getSinglePredecessor() &&
|
assert(NewHeader->getSinglePredecessor() &&
|
||||||
"New header doesn't have one pred!");
|
"New header doesn't have one pred!");
|
||||||
FoldSingleEntryPHINodes(NewHeader);
|
FoldSingleEntryPHINodes(NewHeader);
|
||||||
|
|
||||||
// Copy PHI nodes and other instructions from original header
|
// Copy PHI nodes and other instructions from the original header
|
||||||
// into original pre-header. Unlike original header, original pre-header is
|
// into the original pre-header. Unlike the original header, the original
|
||||||
// not a member of loop.
|
// pre-header is not a member of the loop.
|
||||||
//
|
//
|
||||||
// New loop header is one and only successor of original header that
|
// The new loop header is the one and only successor of original header that
|
||||||
// is inside the loop. All other original header successors are outside
|
// is inside the loop. All other original header successors are outside
|
||||||
// the loop. Copy PHI Nodes from original header into new loop header.
|
// the loop. Copy PHI Nodes from the original header into the new loop header.
|
||||||
// Add second incoming value, from original loop pre-header into these phi
|
// Add second incoming value, from original loop pre-header into these phi
|
||||||
// nodes. If a value defined in original header is used outside original
|
// nodes. If a value defined in original header is used outside original
|
||||||
// header then new loop header will need new phi nodes with two incoming
|
// header then new loop header will need new phi nodes with two incoming
|
||||||
@ -218,8 +218,8 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) {
|
|||||||
// are directly propagated.
|
// are directly propagated.
|
||||||
Value *NPV = PN->getIncomingValueForBlock(OrigPreHeader);
|
Value *NPV = PN->getIncomingValueForBlock(OrigPreHeader);
|
||||||
|
|
||||||
// Create new PHI node with two incoming values for NewHeader.
|
// Create a new PHI node with two incoming values for NewHeader.
|
||||||
// One incoming value is from OrigLatch (through OrigHeader) and
|
// One incoming value is from OrigLatch (through OrigHeader) and the
|
||||||
// second incoming value is from original pre-header.
|
// second incoming value is from original pre-header.
|
||||||
PHINode *NH = PHINode::Create(PN->getType(), PN->getName(),
|
PHINode *NH = PHINode::Create(PN->getType(), PN->getName(),
|
||||||
NewHeader->begin());
|
NewHeader->begin());
|
||||||
@ -334,8 +334,8 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) {
|
|||||||
// Add second incoming argument from new Pre header.
|
// Add second incoming argument from new Pre header.
|
||||||
UPhi->addIncoming(ILoopHeaderInfo.PreHeader, OrigPreHeader);
|
UPhi->addIncoming(ILoopHeaderInfo.PreHeader, OrigPreHeader);
|
||||||
} else {
|
} else {
|
||||||
// Used outside Exit block. Create a new PHI node from exit block
|
// Used outside Exit block. Create a new PHI node in the exit block
|
||||||
// to receive value from ne new header ane pre header.
|
// to receive the value from the new header and pre-header.
|
||||||
PHINode *PN = PHINode::Create(U->getType(), U->getName(),
|
PHINode *PN = PHINode::Create(U->getType(), U->getName(),
|
||||||
Exit->begin());
|
Exit->begin());
|
||||||
PN->addIncoming(ILoopHeaderInfo.PreHeader, OrigPreHeader);
|
PN->addIncoming(ILoopHeaderInfo.PreHeader, OrigPreHeader);
|
||||||
@ -367,8 +367,8 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Make sure all Exit block PHINodes have required incoming values.
|
/// Make sure all Exit block PHINodes have required incoming values.
|
||||||
/// If incoming value is constant or defined outside the loop then
|
/// If an incoming value is constant or defined outside the loop then
|
||||||
/// PHINode may not have an entry for original pre-header.
|
/// PHINode may not have an entry for the original pre-header.
|
||||||
void LoopRotate::updateExitBlock() {
|
void LoopRotate::updateExitBlock() {
|
||||||
|
|
||||||
for (BasicBlock::iterator I = Exit->begin(), E = Exit->end();
|
for (BasicBlock::iterator I = Exit->begin(), E = Exit->end();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user