diff options
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/ADCE.cpp | 12 | ||||
-rw-r--r-- | lib/Transforms/Scalar/GCSE.cpp | 1 | ||||
-rw-r--r-- | lib/Transforms/Scalar/IndVarSimplify.cpp | 8 | ||||
-rw-r--r-- | lib/Transforms/Scalar/InductionVars.cpp | 24 | ||||
-rw-r--r-- | lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 3 |
5 files changed, 22 insertions, 26 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index 71069c617c..7f1fedec24 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -43,7 +43,7 @@ public: // 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 @@ private: // 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 @@ bool ADCE::doADCE(cfg::DominanceFrontier &CDG) { // 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 @@ namespace { // 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 d3f893f022..8bdbad522b 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 40ee5c7f83..d9b8415992 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -33,7 +33,7 @@ static Instruction *InsertCast(Instruction *Val, const Type *Ty, 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 @@ static bool TransformLoop(cfg::LoopInfo *Loops, cfg::Loop *Loop) { 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 @@ static bool doit(Function *M, cfg::LoopInfo &Loops) { 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 8e559a3d6c..0225cd5e3d 100644 --- a/lib/Transforms/Scalar/InductionVars.cpp +++ b/lib/Transforms/Scalar/InductionVars.cpp @@ -36,7 +36,7 @@ using std::cerr; // 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 @@ inline LIVType neg(LIVType T) { 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 @@ static LIVType isLinearInductionVariableH(cfg::Interval *Int, Value *V, // 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 @@ static inline bool isSimpleInductionVar(PHINode *PN) { // 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 @@ static PHINode *InjectSimpleInductionVariable(cfg::Interval *Int) { // 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 @@ static bool ProcessInterval(cfg::Interval *Int) { // 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 @@ static bool ProcessIntervalPartition(cfg::IntervalPartition &IP) { // 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 @@ bool InductionVariableCannonicalize::doIt(Function *M, // 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::doIt(Function *M, 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 @@ bool InductionVariableCannonicalize::runOnFunction(Function *F) { // 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 c3ed142cbf..bbb131fabf 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. |