X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTransforms%2FUtils%2FPromoteMemoryToRegister.cpp;h=bbb131fabfb7a39920f0734432bd85694be0d899;hb=1b7f7dc4b45a900fae2e9b062d588a995935727a;hp=79c03864d86259ce29dd519afe1ab9f26b8d43fb;hpb=2fbfdcffd3e0cf41422aaa6c526c37cb02b81341;p=oota-llvm.git diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 79c03864d86..bbb131fabfb 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -20,18 +20,15 @@ #include "llvm/Transforms/Scalar/PromoteMemoryToRegister.h" #include "llvm/Analysis/Dominators.h" #include "llvm/iMemory.h" +#include "llvm/iPHINode.h" +#include "llvm/iTerminators.h" #include "llvm/Pass.h" #include "llvm/Function.h" #include "llvm/BasicBlock.h" -#include "llvm/Assembly/Writer.h" // For debugging -#include "llvm/iPHINode.h" -#include "llvm/iTerminators.h" +#include "llvm/ConstantVals.h" using namespace std; - -using cfg::DominanceFrontier; - namespace { //instance of the promoter -- to keep all the local function data. @@ -141,8 +138,8 @@ bool PromoteInstance::PromoteFunction(Function *F, DominanceFrontier & DF) { DominanceFrontier::DomSetType s = (*it).second; for (DominanceFrontier::DomSetType::iterator p = s.begin();p!=s.end(); ++p) { - if (queuePhiNode((BasicBlock *)*p, i)) - PhiNodes[i].push_back((BasicBlock *)*p); + if (queuePhiNode(*p, i)) + PhiNodes[i].push_back(*p); } } // perform iterative step @@ -152,8 +149,8 @@ bool PromoteInstance::PromoteFunction(Function *F, DominanceFrontier & DF) { DominanceFrontier::DomSetType s = it->second; for (DominanceFrontier::DomSetType::iterator p = s.begin(); p!=s.end(); ++p) { - if (queuePhiNode((BasicBlock *)*p,i)) - PhiNodes[i].push_back((BasicBlock*)*p); + if (queuePhiNode(*p,i)) + PhiNodes[i].push_back(*p); } } } @@ -309,22 +306,20 @@ bool PromoteInstance::queuePhiNode(BasicBlock *bb, int i /*the alloca*/) namespace { - struct PromotePass : public MethodPass { + struct PromotePass : public FunctionPass { - // runOnMethod - To run this pass, first we calculate the alloca + // runOnFunction - To run this pass, first we calculate the alloca // instructions that are safe for promotion, then we promote each one. // - virtual bool runOnMethod(Function *F) { + virtual bool runOnFunction(Function *F) { return (bool)PromoteInstance(F, getAnalysis()); } - // getAnalysisUsageInfo - We need dominance frontiers + // getAnalysisUsage - We need dominance frontiers // - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { - Requires.push_back(DominanceFrontier::ID); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(DominanceFrontier::ID); } }; }