mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Cleanup. Added LoopBlocksDFS::perform for simple clients.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137195 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
155a92a491
commit
2d31ae3d9d
@ -61,6 +61,9 @@ public:
|
|||||||
|
|
||||||
Loop *getLoop() const { return L; }
|
Loop *getLoop() const { return L; }
|
||||||
|
|
||||||
|
/// Traverse the loop blocks and store the DFS result.
|
||||||
|
void perform(LoopInfo *LI);
|
||||||
|
|
||||||
/// Return true if postorder numbers are assigned to all loop blocks.
|
/// Return true if postorder numbers are assigned to all loop blocks.
|
||||||
bool isComplete() const { return PostBlocks.size() == L->getNumBlocks(); }
|
bool isComplete() const { return PostBlocks.size() == L->getNumBlocks(); }
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/Analysis/Dominators.h"
|
#include "llvm/Analysis/Dominators.h"
|
||||||
|
#include "llvm/Analysis/LoopIterator.h"
|
||||||
#include "llvm/Assembly/Writer.h"
|
#include "llvm/Assembly/Writer.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
@ -417,3 +418,15 @@ void LoopInfo::print(raw_ostream &OS, const Module*) const {
|
|||||||
LI.print(OS);
|
LI.print(OS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
// LoopBlocksDFS implementation
|
||||||
|
//
|
||||||
|
|
||||||
|
/// Traverse the loop blocks and store the DFS result.
|
||||||
|
/// Useful for clients that just want the final DFS result and don't need to
|
||||||
|
/// visit blocks during the initial traversal.
|
||||||
|
void LoopBlocksDFS::perform(LoopInfo *LI) {
|
||||||
|
LoopBlocksTraversal Traversal(*this, LI);
|
||||||
|
for (LoopBlocksTraversal::POTIterator POI = Traversal.begin(),
|
||||||
|
POE = Traversal.end(); POI != POE; ++POI) ;
|
||||||
|
}
|
||||||
|
@ -230,13 +230,8 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount,
|
|||||||
// reverse postorder so that LastValueMap contains the correct value at each
|
// reverse postorder so that LastValueMap contains the correct value at each
|
||||||
// exit.
|
// exit.
|
||||||
LoopBlocksDFS DFS(L);
|
LoopBlocksDFS DFS(L);
|
||||||
{
|
DFS.perform(LI);
|
||||||
// Traverse the loop blocks using depth-first search to record RPO numbers
|
|
||||||
// for each block in the DFS result.
|
|
||||||
LoopBlocksTraversal Traversal(DFS, LI);
|
|
||||||
for (LoopBlocksTraversal::POTIterator POI = Traversal.begin(),
|
|
||||||
POE = Traversal.end(); POI != POE; ++POI);
|
|
||||||
}
|
|
||||||
// Stash the DFS iterators before adding blocks to the loop.
|
// Stash the DFS iterators before adding blocks to the loop.
|
||||||
LoopBlocksDFS::RPOIterator BlockBegin = DFS.beginRPO();
|
LoopBlocksDFS::RPOIterator BlockBegin = DFS.beginRPO();
|
||||||
LoopBlocksDFS::RPOIterator BlockEnd = DFS.endRPO();
|
LoopBlocksDFS::RPOIterator BlockEnd = DFS.endRPO();
|
||||||
|
Loading…
Reference in New Issue
Block a user