Eliminate the cfg namespace, moving LoopInfo, Dominators, Interval* classes
to the global namespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2370 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index 71069c6..7f1fede 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -43,7 +43,7 @@
// doADCE() - Run the Agressive Dead Code Elimination algorithm, returning
// true if the function was modified.
- bool doADCE(cfg::DominanceFrontier &CDG);
+ bool doADCE(DominanceFrontier &CDG);
//===--------------------------------------------------------------------===//
// The implementation of this class
@@ -77,7 +77,7 @@
// doADCE() - Run the Agressive Dead Code Elimination algorithm, returning
// true if the function was modified.
//
-bool ADCE::doADCE(cfg::DominanceFrontier &CDG) {
+bool ADCE::doADCE(DominanceFrontier &CDG) {
#ifdef DEBUG_ADCE
cerr << "Function: " << M;
#endif
@@ -134,10 +134,10 @@
// this block is control dependant on as being alive also...
//
AliveBlocks.insert(BB); // Block is now ALIVE!
- cfg::DominanceFrontier::const_iterator It = CDG.find(BB);
+ DominanceFrontier::const_iterator It = CDG.find(BB);
if (It != CDG.end()) {
// Get the blocks that this node is control dependant on...
- const cfg::DominanceFrontier::DomSetType &CDB = It->second;
+ const DominanceFrontier::DomSetType &CDB = It->second;
for_each(CDB.begin(), CDB.end(), // Mark all their terminators as live
bind_obj(this, &ADCE::markTerminatorLive));
}
@@ -294,12 +294,12 @@
//
virtual bool runOnFunction(Function *F) {
return ADCE(F).doADCE(
- getAnalysis<cfg::DominanceFrontier>(cfg::DominanceFrontier::PostDomID));
+ getAnalysis<DominanceFrontier>(DominanceFrontier::PostDomID));
}
// getAnalysisUsage - We require post dominance frontiers (aka Control
// Dependence Graph)
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
- AU.addRequired(cfg::DominanceFrontier::PostDomID);
+ AU.addRequired(DominanceFrontier::PostDomID);
}
};
}
diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp
index d3f893f..8bdbad5 100644
--- a/lib/Transforms/Scalar/GCSE.cpp
+++ b/lib/Transforms/Scalar/GCSE.cpp
@@ -23,7 +23,6 @@
#include "llvm/Support/InstIterator.h"
#include <set>
#include <algorithm>
-using namespace cfg;
namespace {
class GCSE : public FunctionPass, public InstVisitor<GCSE, bool> {
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 40ee5c7..d9b8415 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -33,7 +33,7 @@
return Cast;
}
-static bool TransformLoop(cfg::LoopInfo *Loops, cfg::Loop *Loop) {
+static bool TransformLoop(LoopInfo *Loops, Loop *Loop) {
// Transform all subloops before this loop...
bool Changed = reduce_apply_bool(Loop->getSubLoops().begin(),
Loop->getSubLoops().end(),
@@ -187,7 +187,7 @@
return Changed;
}
-static bool doit(Function *M, cfg::LoopInfo &Loops) {
+static bool doit(Function *M, LoopInfo &Loops) {
// Induction Variables live in the header nodes of the loops of the function
return reduce_apply_bool(Loops.getTopLevelLoops().begin(),
Loops.getTopLevelLoops().end(),
@@ -198,11 +198,11 @@
namespace {
struct InductionVariableSimplify : public FunctionPass {
virtual bool runOnFunction(Function *F) {
- return doit(F, getAnalysis<cfg::LoopInfo>());
+ return doit(F, getAnalysis<LoopInfo>());
}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
- AU.addRequired(cfg::LoopInfo::ID);
+ AU.addRequired(LoopInfo::ID);
}
};
}
diff --git a/lib/Transforms/Scalar/InductionVars.cpp b/lib/Transforms/Scalar/InductionVars.cpp
index 8e559a3..0225cd5 100644
--- a/lib/Transforms/Scalar/InductionVars.cpp
+++ b/lib/Transforms/Scalar/InductionVars.cpp
@@ -36,7 +36,7 @@
// isLoopInvariant - Return true if the specified value/basic block source is
// an interval invariant computation.
//
-static bool isLoopInvariant(cfg::Interval *Int, Value *V) {
+static bool isLoopInvariant(Interval *Int, Value *V) {
assert(isa<Constant>(V) || isa<Instruction>(V) || isa<Argument>(V));
if (!isa<Instruction>(V))
@@ -71,7 +71,7 @@
return T == isLIV ? isNLIV : isLIV;
}
//
-static LIVType isLinearInductionVariableH(cfg::Interval *Int, Value *V,
+static LIVType isLinearInductionVariableH(Interval *Int, Value *V,
PHINode *PN) {
if (V == PN) { return isLIV; } // PHI node references are (0+PHI)
if (isLoopInvariant(Int, V)) return isLIC;
@@ -121,7 +121,7 @@
// instance of the PHI node and a loop invariant value that is added or
// subtracted to the PHI node. This is calculated by walking the SSA graph
//
-static inline bool isLinearInductionVariable(cfg::Interval *Int, Value *V,
+static inline bool isLinearInductionVariable(Interval *Int, Value *V,
PHINode *PN) {
return isLinearInductionVariableH(Int, V, PN) == isLIV;
}
@@ -176,7 +176,7 @@
// TODO: This should inherit the largest type that is being used by the already
// present induction variables (instead of always using uint)
//
-static PHINode *InjectSimpleInductionVariable(cfg::Interval *Int) {
+static PHINode *InjectSimpleInductionVariable(Interval *Int) {
std::string PHIName, AddName;
BasicBlock *Header = Int->getHeaderNode();
@@ -248,7 +248,7 @@
// One a simple induction variable is known, all other induction variables are
// modified to refer to the "simple" induction variable.
//
-static bool ProcessInterval(cfg::Interval *Int) {
+static bool ProcessInterval(Interval *Int) {
if (!Int->isLoop()) return false; // Not a loop? Ignore it!
std::vector<PHINode *> InductionVars;
@@ -351,13 +351,13 @@
// ProcessIntervalPartition - This function loops over the interval partition
// processing each interval with ProcessInterval
//
-static bool ProcessIntervalPartition(cfg::IntervalPartition &IP) {
+static bool ProcessIntervalPartition(IntervalPartition &IP) {
// This currently just prints out information about the interval structure
// of the function...
#if 0
static unsigned N = 0;
cerr << "\n***********Interval Partition #" << (++N) << "************\n\n";
- copy(IP.begin(), IP.end(), ostream_iterator<cfg::Interval*>(cerr, "\n"));
+ copy(IP.begin(), IP.end(), ostream_iterator<Interval*>(cerr, "\n"));
cerr << "\n*********** PERFORMING WORK ************\n\n";
#endif
@@ -372,8 +372,8 @@
// This function loops over an interval partition of a program, reducing it
// until the graph is gone.
//
-bool InductionVariableCannonicalize::doIt(Function *M,
- cfg::IntervalPartition &IP) {
+bool InductionVariableCannonicalize::doIt(Function *M, IntervalPartition &IP) {
+
bool Changed = false;
#if 0
@@ -383,7 +383,7 @@
// Calculate the reduced version of this graph until we get to an
// irreducible graph or a degenerate graph...
//
- cfg::IntervalPartition *NewIP = new cfg::IntervalPartition(*IP, false);
+ IntervalPartition *NewIP = new IntervalPartition(*IP, false);
if (NewIP->size() == IP->size()) {
cerr << "IRREDUCIBLE GRAPH FOUND!!!\n";
return Changed;
@@ -399,7 +399,7 @@
bool InductionVariableCannonicalize::runOnFunction(Function *F) {
- return doIt(F, getAnalysis<cfg::IntervalPartition>());
+ return doIt(F, getAnalysis<IntervalPartition>());
}
// getAnalysisUsage - This function works on the call graph of a module.
@@ -407,5 +407,5 @@
// module.
//
void InductionVariableCannonicalize::getAnalysisUsage(AnalysisUsage &AU) const {
- AU.addRequired(cfg::IntervalPartition::ID);
+ AU.addRequired(IntervalPartition::ID);
}
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index c3ed142..bbb131f 100644
--- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -29,9 +29,6 @@
using namespace std;
-
-using cfg::DominanceFrontier;
-
namespace {
//instance of the promoter -- to keep all the local function data.