X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FGCStrategy.cpp;h=1fdff6bbf106295941606b19bb3adfc4002a7786;hb=953f25078959d2517c88bf903a8270dc11f1403f;hp=8bb6f1614a2ad9d40605f46d92382f4cfe03ab93;hpb=56e1394c8861ecdc551815ae875d2c3db2fa9cdb;p=oota-llvm.git diff --git a/lib/CodeGen/GCStrategy.cpp b/lib/CodeGen/GCStrategy.cpp index 8bb6f1614a2..1fdff6bbf10 100644 --- a/lib/CodeGen/GCStrategy.cpp +++ b/lib/CodeGen/GCStrategy.cpp @@ -21,7 +21,6 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/Passes.h" -#include "llvm/IR/DominatorInternals.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Module.h" @@ -53,11 +52,11 @@ namespace { static char ID; LowerIntrinsics(); - const char *getPassName() const; - void getAnalysisUsage(AnalysisUsage &AU) const; + const char *getPassName() const override; + void getAnalysisUsage(AnalysisUsage &AU) const override; - bool doInitialization(Module &M); - bool runOnFunction(Function &F); + bool doInitialization(Module &M) override; + bool runOnFunction(Function &F) override; }; @@ -83,9 +82,9 @@ namespace { static char ID; GCMachineCodeAnalysis(); - void getAnalysisUsage(AnalysisUsage &AU) const; + void getAnalysisUsage(AnalysisUsage &AU) const override; - bool runOnMachineFunction(MachineFunction &MF); + bool runOnMachineFunction(MachineFunction &MF) override; }; } @@ -102,13 +101,6 @@ GCStrategy::GCStrategy() : UsesMetadata(false) {} -GCStrategy::~GCStrategy() { - for (iterator I = begin(), E = end(); I != E; ++I) - delete *I; - - Functions.clear(); -} - bool GCStrategy::initializeCustomLowering(Module &M) { return false; } bool GCStrategy::performCustomLowering(Function &F) { @@ -119,14 +111,13 @@ bool GCStrategy::performCustomLowering(Function &F) { bool GCStrategy::findCustomSafePoints(GCFunctionInfo& FI, MachineFunction &F) { dbgs() << "gc " << getName() << " must override findCustomSafePoints.\n"; - llvm_unreachable(0); + llvm_unreachable(nullptr); } GCFunctionInfo *GCStrategy::insertFunctionInfo(const Function &F) { - GCFunctionInfo *FI = new GCFunctionInfo(F, *this); - Functions.push_back(FI); - return FI; + Functions.push_back(make_unique(F, *this)); + return Functions.back().get(); } // ----------------------------------------------------------------------------- @@ -154,7 +145,7 @@ const char *LowerIntrinsics::getPassName() const { void LowerIntrinsics::getAnalysisUsage(AnalysisUsage &AU) const { FunctionPass::getAnalysisUsage(AU); AU.addRequired(); - AU.addPreserved(); + AU.addPreserved(); } /// doInitialization - If this module uses the GC intrinsics, find them now. @@ -271,8 +262,9 @@ bool LowerIntrinsics::runOnFunction(Function &F) { // Custom lowering may modify the CFG, so dominators must be recomputed. if (UseCustomLoweringPass) { - if (DominatorTree *DT = getAnalysisIfAvailable()) - DT->DT->recalculate(F); + if (DominatorTreeWrapperPass *DTWP = + getAnalysisIfAvailable()) + DTWP->getDomTree().recalculate(F); } return MadeChange;