mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 19:25:00 +00:00
Change ET-Forest to automatically recalculate its DFSnum's if too many slow
queries are made. Patch by Daniel Berlin! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25323 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -397,16 +397,17 @@ public:
|
||||
///
|
||||
struct ETForestBase : public DominatorBase {
|
||||
ETForestBase(bool isPostDom) : DominatorBase(isPostDom), Nodes(),
|
||||
DFSInfoValid(false) {}
|
||||
DFSInfoValid(false), SlowQueries(0) {}
|
||||
|
||||
virtual void releaseMemory() { reset(); }
|
||||
|
||||
typedef std::map<BasicBlock*, ETNode*> ETMapType;
|
||||
|
||||
|
||||
void updateDFSNumbers();
|
||||
|
||||
/// dominates - Return true if A dominates B.
|
||||
///
|
||||
inline bool dominates(BasicBlock *A, BasicBlock *B) const {
|
||||
inline bool dominates(BasicBlock *A, BasicBlock *B) {
|
||||
if (A == B)
|
||||
return true;
|
||||
|
||||
@@ -415,13 +416,21 @@ struct ETForestBase : public DominatorBase {
|
||||
|
||||
if (DFSInfoValid)
|
||||
return NodeB->DominatedBy(NodeA);
|
||||
else
|
||||
else {
|
||||
// If we end up with too many slow queries, just update the
|
||||
// DFS numbers on the theory that we are going to keep querying.
|
||||
SlowQueries++;
|
||||
if (SlowQueries > 32) {
|
||||
updateDFSNumbers();
|
||||
return NodeB->DominatedBy(NodeA);
|
||||
}
|
||||
return NodeB->DominatedBySlow(NodeA);
|
||||
}
|
||||
}
|
||||
|
||||
/// properlyDominates - Return true if A dominates B and A != B.
|
||||
///
|
||||
bool properlyDominates(BasicBlock *A, BasicBlock *B) const {
|
||||
bool properlyDominates(BasicBlock *A, BasicBlock *B) {
|
||||
return dominates(A, B) && A != B;
|
||||
}
|
||||
|
||||
@@ -474,6 +483,7 @@ protected:
|
||||
void reset();
|
||||
ETMapType Nodes;
|
||||
bool DFSInfoValid;
|
||||
unsigned int SlowQueries;
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user