[C++11] Add 'override' keyword to virtual methods that override their base class.

llvm-svn: 202953
This commit is contained in:
Craig Topper 2014-03-05 09:10:37 +00:00
parent 6a927ecb7a
commit 3e4c697ca1
87 changed files with 342 additions and 300 deletions

View File

@ -312,7 +312,7 @@ public:
/// \brief Register analysis passes for this target with a pass manager. /// \brief Register analysis passes for this target with a pass manager.
/// ///
/// This registers target independent analysis passes. /// This registers target independent analysis passes.
virtual void addAnalysisPasses(PassManagerBase &PM); void addAnalysisPasses(PassManagerBase &PM) override;
/// createPassConfig - Create a pass configuration object to be used by /// createPassConfig - Create a pass configuration object to be used by
/// addPassToEmitX methods for generating a pipeline of CodeGen passes. /// addPassToEmitX methods for generating a pipeline of CodeGen passes.
@ -321,12 +321,10 @@ public:
/// addPassesToEmitFile - Add passes to the specified pass manager to get the /// addPassesToEmitFile - Add passes to the specified pass manager to get the
/// specified file emitted. Typically this will involve several steps of code /// specified file emitted. Typically this will involve several steps of code
/// generation. /// generation.
virtual bool addPassesToEmitFile(PassManagerBase &PM, bool addPassesToEmitFile(PassManagerBase &PM, formatted_raw_ostream &Out,
formatted_raw_ostream &Out, CodeGenFileType FileType, bool DisableVerify = true,
CodeGenFileType FileType, AnalysisID StartAfter = 0,
bool DisableVerify = true, AnalysisID StopAfter = 0) override;
AnalysisID StartAfter = 0,
AnalysisID StopAfter = 0);
/// addPassesToEmitMachineCode - Add passes to the specified pass manager to /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
/// get machine code emitted. This uses a JITCodeEmitter object to handle /// get machine code emitted. This uses a JITCodeEmitter object to handle
@ -334,19 +332,16 @@ public:
/// of functions. This method returns true if machine code emission is /// of functions. This method returns true if machine code emission is
/// not supported. /// not supported.
/// ///
virtual bool addPassesToEmitMachineCode(PassManagerBase &PM, bool addPassesToEmitMachineCode(PassManagerBase &PM, JITCodeEmitter &MCE,
JITCodeEmitter &MCE, bool DisableVerify = true) override;
bool DisableVerify = true);
/// addPassesToEmitMC - Add passes to the specified pass manager to get /// addPassesToEmitMC - Add passes to the specified pass manager to get
/// machine code emitted with the MCJIT. This method returns true if machine /// machine code emitted with the MCJIT. This method returns true if machine
/// code is not supported. It fills the MCContext Ctx pointer which can be /// code is not supported. It fills the MCContext Ctx pointer which can be
/// used to build custom MCStreamer. /// used to build custom MCStreamer.
/// ///
virtual bool addPassesToEmitMC(PassManagerBase &PM, bool addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx,
MCContext *&Ctx, raw_ostream &OS, bool DisableVerify = true) override;
raw_ostream &OS,
bool DisableVerify = true);
/// addCodeEmitter - This pass should be overridden by the target to add a /// addCodeEmitter - This pass should be overridden by the target to add a
/// code emitter, if supported. If this is not supported, 'true' should be /// code emitter, if supported. If this is not supported, 'true' should be

View File

@ -36,16 +36,16 @@ struct Inliner : public CallGraphSCCPass {
/// getAnalysisUsage - For this class, we declare that we require and preserve /// getAnalysisUsage - For this class, we declare that we require and preserve
/// the call graph. If the derived class implements this method, it should /// the call graph. If the derived class implements this method, it should
/// always explicitly call the implementation here. /// always explicitly call the implementation here.
virtual void getAnalysisUsage(AnalysisUsage &Info) const; void getAnalysisUsage(AnalysisUsage &Info) const override;
// Main run interface method, this implements the interface required by the // Main run interface method, this implements the interface required by the
// Pass class. // Pass class.
virtual bool runOnSCC(CallGraphSCC &SCC); bool runOnSCC(CallGraphSCC &SCC) override;
using llvm::Pass::doFinalization; using llvm::Pass::doFinalization;
// doFinalization - Remove now-dead linkonce functions at the end of // doFinalization - Remove now-dead linkonce functions at the end of
// processing to avoid breaking the SCC traversal. // processing to avoid breaking the SCC traversal.
virtual bool doFinalization(CallGraph &CG); bool doFinalization(CallGraph &CG) override;
/// This method returns the value specified by the -inline-threshold value, /// This method returns the value specified by the -inline-threshold value,
/// specified on the command line. This is typically not directly needed. /// specified on the command line. This is typically not directly needed.

View File

@ -32,7 +32,7 @@ public:
} }
// We can preserve non-critical-edgeness when we unify function exit nodes // We can preserve non-critical-edgeness when we unify function exit nodes
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
// getReturn|Unwind|UnreachableBlock - Return the new single (or nonexistent) // getReturn|Unwind|UnreachableBlock - Return the new single (or nonexistent)
// return, unwind, or unreachable basic blocks in the CFG. // return, unwind, or unreachable basic blocks in the CFG.
@ -41,7 +41,7 @@ public:
BasicBlock *getUnwindBlock() const { return UnwindBlock; } BasicBlock *getUnwindBlock() const { return UnwindBlock; }
BasicBlock *getUnreachableBlock() const { return UnreachableBlock; } BasicBlock *getUnreachableBlock() const { return UnreachableBlock; }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
}; };
Pass *createUnifyFunctionExitNodesPass(); Pass *createUnifyFunctionExitNodesPass();

View File

@ -27,7 +27,7 @@ namespace {
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
Hello() : FunctionPass(ID) {} Hello() : FunctionPass(ID) {}
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
++HelloCounter; ++HelloCounter;
errs() << "Hello: "; errs() << "Hello: ";
errs().write_escaped(F.getName()) << '\n'; errs().write_escaped(F.getName()) << '\n';
@ -45,7 +45,7 @@ namespace {
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
Hello2() : FunctionPass(ID) {} Hello2() : FunctionPass(ID) {}
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
++HelloCounter; ++HelloCounter;
errs() << "Hello: "; errs() << "Hello: ";
errs().write_escaped(F.getName()) << '\n'; errs().write_escaped(F.getName()) << '\n';
@ -53,7 +53,7 @@ namespace {
} }
// We don't modify the program, so we preserve all analyses. // We don't modify the program, so we preserve all analyses.
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };

View File

@ -58,12 +58,12 @@ namespace {
/// ArgPromotion - The 'by reference' to 'by value' argument promotion pass. /// ArgPromotion - The 'by reference' to 'by value' argument promotion pass.
/// ///
struct ArgPromotion : public CallGraphSCCPass { struct ArgPromotion : public CallGraphSCCPass {
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();
CallGraphSCCPass::getAnalysisUsage(AU); CallGraphSCCPass::getAnalysisUsage(AU);
} }
virtual bool runOnSCC(CallGraphSCC &SCC); bool runOnSCC(CallGraphSCC &SCC) override;
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
explicit ArgPromotion(unsigned maxElements = 3) explicit ArgPromotion(unsigned maxElements = 3)
: CallGraphSCCPass(ID), maxElements(maxElements) { : CallGraphSCCPass(ID), maxElements(maxElements) {

View File

@ -36,7 +36,7 @@ public:
initializeBarrierNoopPass(*PassRegistry::getPassRegistry()); initializeBarrierNoopPass(*PassRegistry::getPassRegistry());
} }
bool runOnModule(Module &M) { return false; } bool runOnModule(Module &M) override { return false; }
}; };
} }

View File

@ -42,7 +42,7 @@ namespace {
// For this pass, process all of the globals in the module, eliminating // For this pass, process all of the globals in the module, eliminating
// duplicate constants. // duplicate constants.
bool runOnModule(Module &M); bool runOnModule(Module &M) override;
// Return true iff we can determine the alignment of this global variable. // Return true iff we can determine the alignment of this global variable.
bool hasKnownAlignment(GlobalVariable *GV) const; bool hasKnownAlignment(GlobalVariable *GV) const;

View File

@ -138,7 +138,7 @@ namespace {
initializeDAEPass(*PassRegistry::getPassRegistry()); initializeDAEPass(*PassRegistry::getPassRegistry());
} }
bool runOnModule(Module &M); bool runOnModule(Module &M) override;
virtual bool ShouldHackArguments() const { return false; } virtual bool ShouldHackArguments() const { return false; }
@ -173,7 +173,7 @@ namespace {
static char ID; static char ID;
DAH() : DAE(ID) {} DAH() : DAE(ID) {}
virtual bool ShouldHackArguments() const { return true; } bool ShouldHackArguments() const override { return true; }
}; };
} }

View File

@ -68,7 +68,7 @@ namespace {
explicit GVExtractorPass(std::vector<GlobalValue*>& GVs, bool deleteS = true) explicit GVExtractorPass(std::vector<GlobalValue*>& GVs, bool deleteS = true)
: ModulePass(ID), Named(GVs.begin(), GVs.end()), deleteStuff(deleteS) {} : ModulePass(ID), Named(GVs.begin(), GVs.end()), deleteStuff(deleteS) {}
bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
// Visit the global inline asm. // Visit the global inline asm.
if (!deleteStuff) if (!deleteStuff)
M.setModuleInlineAsm(""); M.setModuleInlineAsm("");

View File

@ -51,7 +51,7 @@ namespace {
} }
// runOnSCC - Analyze the SCC, performing the transformation if possible. // runOnSCC - Analyze the SCC, performing the transformation if possible.
bool runOnSCC(CallGraphSCC &SCC); bool runOnSCC(CallGraphSCC &SCC) override;
// AddReadAttrs - Deduce readonly/readnone attributes for the SCC. // AddReadAttrs - Deduce readonly/readnone attributes for the SCC.
bool AddReadAttrs(const CallGraphSCC &SCC); bool AddReadAttrs(const CallGraphSCC &SCC);
@ -120,7 +120,7 @@ namespace {
// call declarations. // call declarations.
bool annotateLibraryCalls(const CallGraphSCC &SCC); bool annotateLibraryCalls(const CallGraphSCC &SCC);
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();
AU.addRequired<TargetLibraryInfo>(); AU.addRequired<TargetLibraryInfo>();
@ -342,9 +342,9 @@ namespace {
ArgumentUsesTracker(const SmallPtrSet<Function*, 8> &SCCNodes) ArgumentUsesTracker(const SmallPtrSet<Function*, 8> &SCCNodes)
: Captured(false), SCCNodes(SCCNodes) {} : Captured(false), SCCNodes(SCCNodes) {}
void tooManyUses() { Captured = true; } void tooManyUses() override { Captured = true; }
bool captured(Use *U) { bool captured(Use *U) override {
CallSite CS(U->getUser()); CallSite CS(U->getUser());
if (!CS.getInstruction()) { Captured = true; return true; } if (!CS.getInstruction()) { Captured = true; return true; }

View File

@ -38,7 +38,7 @@ namespace {
// run - Do the GlobalDCE pass on the specified module, optionally updating // run - Do the GlobalDCE pass on the specified module, optionally updating
// the specified callgraph to reflect the changes. // the specified callgraph to reflect the changes.
// //
bool runOnModule(Module &M); bool runOnModule(Module &M) override;
private: private:
SmallPtrSet<GlobalValue*, 32> AliveGlobals; SmallPtrSet<GlobalValue*, 32> AliveGlobals;

View File

@ -63,7 +63,7 @@ STATISTIC(NumCXXDtorsRemoved, "Number of global C++ destructors removed");
namespace { namespace {
struct GlobalOpt : public ModulePass { struct GlobalOpt : public ModulePass {
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<TargetLibraryInfo>(); AU.addRequired<TargetLibraryInfo>();
} }
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
@ -71,7 +71,7 @@ namespace {
initializeGlobalOptPass(*PassRegistry::getPassRegistry()); initializeGlobalOptPass(*PassRegistry::getPassRegistry());
} }
bool runOnModule(Module &M); bool runOnModule(Module &M) override;
private: private:
GlobalVariable *FindGlobalCtors(Module &M); GlobalVariable *FindGlobalCtors(Module &M);

View File

@ -39,7 +39,7 @@ namespace {
initializeIPCPPass(*PassRegistry::getPassRegistry()); initializeIPCPPass(*PassRegistry::getPassRegistry());
} }
bool runOnModule(Module &M); bool runOnModule(Module &M) override;
private: private:
bool PropagateConstantsIntoArguments(Function &F); bool PropagateConstantsIntoArguments(Function &F);
bool PropagateConstantReturn(Function &F); bool PropagateConstantReturn(Function &F);

View File

@ -47,13 +47,13 @@ public:
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
virtual InlineCost getInlineCost(CallSite CS); InlineCost getInlineCost(CallSite CS) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual bool runOnSCC(CallGraphSCC &SCC); bool runOnSCC(CallGraphSCC &SCC) override;
using llvm::Pass::doFinalization; using llvm::Pass::doFinalization;
virtual bool doFinalization(CallGraph &CG) { bool doFinalization(CallGraph &CG) override {
return removeDeadFunctions(CG, /*AlwaysInlineOnly=*/ true); return removeDeadFunctions(CG, /*AlwaysInlineOnly=*/ true);
} }
}; };

View File

@ -48,12 +48,12 @@ public:
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
InlineCost getInlineCost(CallSite CS) { InlineCost getInlineCost(CallSite CS) override {
return ICA->getInlineCost(CS, getInlineThreshold(CS)); return ICA->getInlineCost(CS, getInlineThreshold(CS));
} }
virtual bool runOnSCC(CallGraphSCC &SCC); bool runOnSCC(CallGraphSCC &SCC) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
}; };
} // end anonymous namespace } // end anonymous namespace

View File

@ -60,9 +60,9 @@ namespace {
explicit InternalizePass(bool OnlyHidden = false); explicit InternalizePass(bool OnlyHidden = false);
explicit InternalizePass(ArrayRef<const char *> ExportList, bool OnlyHidden); explicit InternalizePass(ArrayRef<const char *> ExportList, bool OnlyHidden);
void LoadFile(const char *Filename); void LoadFile(const char *Filename);
virtual bool runOnModule(Module &M); bool runOnModule(Module &M) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
AU.addPreserved<CallGraphWrapperPass>(); AU.addPreserved<CallGraphWrapperPass>();
} }

View File

@ -42,9 +42,9 @@ namespace {
initializeLoopExtractorPass(*PassRegistry::getPassRegistry()); initializeLoopExtractorPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequiredID(BreakCriticalEdgesID); AU.addRequiredID(BreakCriticalEdgesID);
AU.addRequiredID(LoopSimplifyID); AU.addRequiredID(LoopSimplifyID);
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
@ -180,7 +180,7 @@ namespace {
LoadFile(BlockFile.c_str()); LoadFile(BlockFile.c_str());
} }
bool runOnModule(Module &M); bool runOnModule(Module &M) override;
}; };
} }

View File

@ -561,7 +561,7 @@ public:
initializeMergeFunctionsPass(*PassRegistry::getPassRegistry()); initializeMergeFunctionsPass(*PassRegistry::getPassRegistry());
} }
bool runOnModule(Module &M); bool runOnModule(Module &M) override;
private: private:
typedef DenseSet<ComparableFunction> FnSetType; typedef DenseSet<ComparableFunction> FnSetType;

View File

@ -28,14 +28,14 @@ STATISTIC(NumPartialInlined, "Number of functions partially inlined");
namespace { namespace {
struct PartialInliner : public ModulePass { struct PartialInliner : public ModulePass {
virtual void getAnalysisUsage(AnalysisUsage &AU) const { } void getAnalysisUsage(AnalysisUsage &AU) const override { }
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
PartialInliner() : ModulePass(ID) { PartialInliner() : ModulePass(ID) {
initializePartialInlinerPass(*PassRegistry::getPassRegistry()); initializePartialInlinerPass(*PassRegistry::getPassRegistry());
} }
bool runOnModule(Module& M); bool runOnModule(Module& M) override;
private: private:
Function* unswitchFunction(Function* F); Function* unswitchFunction(Function* F);
}; };

View File

@ -41,7 +41,7 @@ namespace {
} }
// runOnSCC - Analyze the SCC, performing the transformation if possible. // runOnSCC - Analyze the SCC, performing the transformation if possible.
bool runOnSCC(CallGraphSCC &SCC); bool runOnSCC(CallGraphSCC &SCC) override;
bool SimplifyFunction(Function *F); bool SimplifyFunction(Function *F);
void DeleteBasicBlock(BasicBlock *BB); void DeleteBasicBlock(BasicBlock *BB);

View File

@ -32,7 +32,7 @@ public:
StripDeadPrototypesPass() : ModulePass(ID) { StripDeadPrototypesPass() : ModulePass(ID) {
initializeStripDeadPrototypesPassPass(*PassRegistry::getPassRegistry()); initializeStripDeadPrototypesPassPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnModule(Module &M); bool runOnModule(Module &M) override;
}; };
} // end anonymous namespace } // end anonymous namespace

View File

@ -44,9 +44,9 @@ namespace {
initializeStripSymbolsPass(*PassRegistry::getPassRegistry()); initializeStripSymbolsPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnModule(Module &M); bool runOnModule(Module &M) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };
@ -59,9 +59,9 @@ namespace {
initializeStripNonDebugSymbolsPass(*PassRegistry::getPassRegistry()); initializeStripNonDebugSymbolsPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnModule(Module &M); bool runOnModule(Module &M) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };
@ -74,9 +74,9 @@ namespace {
initializeStripDebugDeclarePass(*PassRegistry::getPassRegistry()); initializeStripDebugDeclarePass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnModule(Module &M); bool runOnModule(Module &M) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };
@ -89,9 +89,9 @@ namespace {
initializeStripDeadDebugInfoPass(*PassRegistry::getPassRegistry()); initializeStripDeadDebugInfoPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnModule(Module &M); bool runOnModule(Module &M) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };

View File

@ -102,11 +102,11 @@ public:
} }
public: public:
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
bool DoOneIteration(Function &F, unsigned ItNum); bool DoOneIteration(Function &F, unsigned ItNum);
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
const DataLayout *getDataLayout() const { return DL; } const DataLayout *getDataLayout() const { return DL; }

View File

@ -2508,7 +2508,7 @@ public:
/// replaceAllUsesWith - override so that instruction replacement /// replaceAllUsesWith - override so that instruction replacement
/// can be defined in terms of the instruction combiner framework. /// can be defined in terms of the instruction combiner framework.
virtual void replaceAllUsesWith(Instruction *I, Value *With) const { void replaceAllUsesWith(Instruction *I, Value *With) const override {
IC->ReplaceInstUsesWith(*I, With); IC->ReplaceInstUsesWith(*I, With);
} }
}; };

View File

@ -301,7 +301,7 @@ struct AddressSanitizer : public FunctionPass {
CheckLifetime(CheckLifetime || ClCheckLifetime), CheckLifetime(CheckLifetime || ClCheckLifetime),
BlacklistFile(BlacklistFile.empty() ? ClBlacklistFile BlacklistFile(BlacklistFile.empty() ? ClBlacklistFile
: BlacklistFile) {} : BlacklistFile) {}
virtual const char *getPassName() const { const char *getPassName() const override {
return "AddressSanitizerFunctionPass"; return "AddressSanitizerFunctionPass";
} }
void instrumentMop(Instruction *I); void instrumentMop(Instruction *I);
@ -319,9 +319,9 @@ struct AddressSanitizer : public FunctionPass {
Value *Size, Value *Size,
Instruction *InsertBefore, bool IsWrite); Instruction *InsertBefore, bool IsWrite);
Value *memToShadow(Value *Shadow, IRBuilder<> &IRB); Value *memToShadow(Value *Shadow, IRBuilder<> &IRB);
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
bool maybeInsertAsanInitAtFunctionEntry(Function &F); bool maybeInsertAsanInitAtFunctionEntry(Function &F);
virtual bool doInitialization(Module &M); bool doInitialization(Module &M) override;
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
private: private:
@ -368,9 +368,9 @@ class AddressSanitizerModule : public ModulePass {
CheckInitOrder(CheckInitOrder || ClInitializers), CheckInitOrder(CheckInitOrder || ClInitializers),
BlacklistFile(BlacklistFile.empty() ? ClBlacklistFile BlacklistFile(BlacklistFile.empty() ? ClBlacklistFile
: BlacklistFile) {} : BlacklistFile) {}
bool runOnModule(Module &M); bool runOnModule(Module &M) override;
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
virtual const char *getPassName() const { const char *getPassName() const override {
return "AddressSanitizerModule"; return "AddressSanitizerModule";
} }

View File

@ -45,9 +45,9 @@ namespace {
initializeBoundsCheckingPass(*PassRegistry::getPassRegistry()); initializeBoundsCheckingPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<DataLayoutPass>(); AU.addRequired<DataLayoutPass>();
AU.addRequired<TargetLibraryInfo>(); AU.addRequired<TargetLibraryInfo>();
} }

View File

@ -213,8 +213,8 @@ class DataFlowSanitizer : public ModulePass {
DataFlowSanitizer(StringRef ABIListFile = StringRef(), DataFlowSanitizer(StringRef ABIListFile = StringRef(),
void *(*getArgTLS)() = 0, void *(*getRetValTLS)() = 0); void *(*getArgTLS)() = 0, void *(*getRetValTLS)() = 0);
static char ID; static char ID;
bool doInitialization(Module &M); bool doInitialization(Module &M) override;
bool runOnModule(Module &M); bool runOnModule(Module &M) override;
}; };
struct DFSanFunction { struct DFSanFunction {

View File

@ -67,11 +67,12 @@ public:
// This function is called after an Instruction, GlobalValue, or GlobalAlias // This function is called after an Instruction, GlobalValue, or GlobalAlias
// is printed. // is printed.
void printInfoComment(const Value &V, formatted_raw_ostream &Out) { void printInfoComment(const Value &V, formatted_raw_ostream &Out) override {
addEntry(&V, Out); addEntry(&V, Out);
} }
void emitFunctionAnnot(const Function *F, formatted_raw_ostream &Out) { void emitFunctionAnnot(const Function *F,
formatted_raw_ostream &Out) override {
addEntry(F, Out); addEntry(F, Out);
} }

View File

@ -43,7 +43,7 @@ class DebugIR : public llvm::ModulePass {
public: public:
static char ID; static char ID;
const char *getPassName() const { return "DebugIR"; } const char *getPassName() const override { return "DebugIR"; }
/// Generate a file on disk to be displayed in a debugger. If Filename and /// Generate a file on disk to be displayed in a debugger. If Filename and
/// Directory are empty, a temporary path will be generated. /// Directory are empty, a temporary path will be generated.
@ -62,7 +62,7 @@ public:
/// Run pass on M and set Path to the source file path in the output module. /// Run pass on M and set Path to the source file path in the output module.
bool runOnModule(llvm::Module &M, std::string &Path); bool runOnModule(llvm::Module &M, std::string &Path);
bool runOnModule(llvm::Module &M); bool runOnModule(llvm::Module &M) override;
private: private:

View File

@ -80,7 +80,7 @@ namespace {
~GCOVProfiler() { ~GCOVProfiler() {
DeleteContainerPointers(Funcs); DeleteContainerPointers(Funcs);
} }
virtual const char *getPassName() const { const char *getPassName() const override {
return "GCOV Profiler"; return "GCOV Profiler";
} }
@ -93,7 +93,7 @@ namespace {
ReversedVersion[4] = '\0'; ReversedVersion[4] = '\0';
initializeGCOVProfilerPass(*PassRegistry::getPassRegistry()); initializeGCOVProfilerPass(*PassRegistry::getPassRegistry());
} }
bool runOnModule(Module &M); bool runOnModule(Module &M) override;
// Create the .gcno files for the Module based on DebugInfo. // Create the .gcno files for the Module based on DebugInfo.
void emitProfileNotes(); void emitProfileNotes();

View File

@ -211,9 +211,9 @@ class MemorySanitizer : public FunctionPass {
WarningFn(0), WarningFn(0),
BlacklistFile(BlacklistFile.empty() ? ClBlacklistFile : BlacklistFile), BlacklistFile(BlacklistFile.empty() ? ClBlacklistFile : BlacklistFile),
WrapIndirectCalls(!ClWrapIndirectCalls.empty()) {} WrapIndirectCalls(!ClWrapIndirectCalls.empty()) {}
const char *getPassName() const { return "MemorySanitizer"; } const char *getPassName() const override { return "MemorySanitizer"; }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
bool doInitialization(Module &M); bool doInitialization(Module &M) override;
static char ID; // Pass identification, replacement for typeid. static char ID; // Pass identification, replacement for typeid.
private: private:
@ -2321,7 +2321,7 @@ struct VarArgAMD64Helper : public VarArgHelper {
// would have been to associate each live instance of va_list with a copy of // would have been to associate each live instance of va_list with a copy of
// MSanParamTLS, and extract shadow on va_arg() call in the argument list // MSanParamTLS, and extract shadow on va_arg() call in the argument list
// order. // order.
void visitCallSite(CallSite &CS, IRBuilder<> &IRB) { void visitCallSite(CallSite &CS, IRBuilder<> &IRB) override {
unsigned GpOffset = 0; unsigned GpOffset = 0;
unsigned FpOffset = AMD64GpEndOffset; unsigned FpOffset = AMD64GpEndOffset;
unsigned OverflowOffset = AMD64FpEndOffset; unsigned OverflowOffset = AMD64FpEndOffset;
@ -2364,7 +2364,7 @@ struct VarArgAMD64Helper : public VarArgHelper {
"_msarg"); "_msarg");
} }
void visitVAStartInst(VAStartInst &I) { void visitVAStartInst(VAStartInst &I) override {
IRBuilder<> IRB(&I); IRBuilder<> IRB(&I);
VAStartInstrumentationList.push_back(&I); VAStartInstrumentationList.push_back(&I);
Value *VAListTag = I.getArgOperand(0); Value *VAListTag = I.getArgOperand(0);
@ -2376,7 +2376,7 @@ struct VarArgAMD64Helper : public VarArgHelper {
/* size */24, /* alignment */8, false); /* size */24, /* alignment */8, false);
} }
void visitVACopyInst(VACopyInst &I) { void visitVACopyInst(VACopyInst &I) override {
IRBuilder<> IRB(&I); IRBuilder<> IRB(&I);
Value *VAListTag = I.getArgOperand(0); Value *VAListTag = I.getArgOperand(0);
Value *ShadowPtr = MSV.getShadowPtr(VAListTag, IRB.getInt8Ty(), IRB); Value *ShadowPtr = MSV.getShadowPtr(VAListTag, IRB.getInt8Ty(), IRB);
@ -2387,7 +2387,7 @@ struct VarArgAMD64Helper : public VarArgHelper {
/* size */24, /* alignment */8, false); /* size */24, /* alignment */8, false);
} }
void finalizeInstrumentation() { void finalizeInstrumentation() override {
assert(!VAArgOverflowSize && !VAArgTLSCopy && assert(!VAArgOverflowSize && !VAArgTLSCopy &&
"finalizeInstrumentation called twice"); "finalizeInstrumentation called twice");
if (!VAStartInstrumentationList.empty()) { if (!VAStartInstrumentationList.empty()) {
@ -2439,13 +2439,13 @@ struct VarArgNoOpHelper : public VarArgHelper {
VarArgNoOpHelper(Function &F, MemorySanitizer &MS, VarArgNoOpHelper(Function &F, MemorySanitizer &MS,
MemorySanitizerVisitor &MSV) {} MemorySanitizerVisitor &MSV) {}
void visitCallSite(CallSite &CS, IRBuilder<> &IRB) {} void visitCallSite(CallSite &CS, IRBuilder<> &IRB) override {}
void visitVAStartInst(VAStartInst &I) {} void visitVAStartInst(VAStartInst &I) override {}
void visitVACopyInst(VACopyInst &I) {} void visitVACopyInst(VACopyInst &I) override {}
void finalizeInstrumentation() {} void finalizeInstrumentation() override {}
}; };
VarArgHelper *CreateVarArgHelper(Function &Func, MemorySanitizer &Msan, VarArgHelper *CreateVarArgHelper(Function &Func, MemorySanitizer &Msan,

View File

@ -81,9 +81,9 @@ struct ThreadSanitizer : public FunctionPass {
DL(0), DL(0),
BlacklistFile(BlacklistFile.empty() ? ClBlacklistFile BlacklistFile(BlacklistFile.empty() ? ClBlacklistFile
: BlacklistFile) { } : BlacklistFile) { }
const char *getPassName() const; const char *getPassName() const override;
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
bool doInitialization(Module &M); bool doInitialization(Module &M) override;
static char ID; // Pass identification, replacement for typeid. static char ID; // Pass identification, replacement for typeid.
private: private:

View File

@ -37,8 +37,8 @@ using namespace llvm::objcarc;
namespace { namespace {
/// \brief Autorelease pool elimination. /// \brief Autorelease pool elimination.
class ObjCARCAPElim : public ModulePass { class ObjCARCAPElim : public ModulePass {
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual bool runOnModule(Module &M); bool runOnModule(Module &M) override;
static bool MayAutorelease(ImmutableCallSite CS, unsigned Depth = 0); static bool MayAutorelease(ImmutableCallSite CS, unsigned Depth = 0);
static bool OptimizeBB(BasicBlock *BB); static bool OptimizeBB(BasicBlock *BB);

View File

@ -44,28 +44,28 @@ namespace objcarc {
} }
private: private:
virtual void initializePass() { void initializePass() override {
InitializeAliasAnalysis(this); InitializeAliasAnalysis(this);
} }
/// This method is used when a pass implements an analysis interface through /// This method is used when a pass implements an analysis interface through
/// multiple inheritance. If needed, it should override this to adjust the /// multiple inheritance. If needed, it should override this to adjust the
/// this pointer as needed for the specified pass info. /// this pointer as needed for the specified pass info.
virtual void *getAdjustedAnalysisPointer(const void *PI) { void *getAdjustedAnalysisPointer(const void *PI) override {
if (PI == &AliasAnalysis::ID) if (PI == &AliasAnalysis::ID)
return static_cast<AliasAnalysis *>(this); return static_cast<AliasAnalysis *>(this);
return this; return this;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual AliasResult alias(const Location &LocA, const Location &LocB); AliasResult alias(const Location &LocA, const Location &LocB) override;
virtual bool pointsToConstantMemory(const Location &Loc, bool OrLocal); bool pointsToConstantMemory(const Location &Loc, bool OrLocal) override;
virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS); ModRefBehavior getModRefBehavior(ImmutableCallSite CS) override;
virtual ModRefBehavior getModRefBehavior(const Function *F); ModRefBehavior getModRefBehavior(const Function *F) override;
virtual ModRefResult getModRefInfo(ImmutableCallSite CS, ModRefResult getModRefInfo(ImmutableCallSite CS,
const Location &Loc); const Location &Loc) override;
virtual ModRefResult getModRefInfo(ImmutableCallSite CS1, ModRefResult getModRefInfo(ImmutableCallSite CS1,
ImmutableCallSite CS2); ImmutableCallSite CS2) override;
}; };
} // namespace objcarc } // namespace objcarc

View File

@ -79,9 +79,9 @@ namespace {
void ContractRelease(Instruction *Release, void ContractRelease(Instruction *Release,
inst_iterator &Iter); inst_iterator &Iter);
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual bool doInitialization(Module &M); bool doInitialization(Module &M) override;
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
public: public:
static char ID; static char ID;

View File

@ -50,9 +50,9 @@ using namespace llvm::objcarc;
namespace { namespace {
/// \brief Early ARC transformations. /// \brief Early ARC transformations.
class ObjCARCExpand : public FunctionPass { class ObjCARCExpand : public FunctionPass {
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual bool doInitialization(Module &M); bool doInitialization(Module &M) override;
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
/// A flag indicating whether this optimization pass should run. /// A flag indicating whether this optimization pass should run.
bool Run; bool Run;

View File

@ -1163,10 +1163,10 @@ namespace {
void GatherStatistics(Function &F, bool AfterOptimization = false); void GatherStatistics(Function &F, bool AfterOptimization = false);
#endif #endif
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual bool doInitialization(Module &M); bool doInitialization(Module &M) override;
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void releaseMemory(); void releaseMemory() override;
public: public:
static char ID; static char ID;

View File

@ -37,9 +37,9 @@ namespace {
initializeADCEPass(*PassRegistry::getPassRegistry()); initializeADCEPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function& F); bool runOnFunction(Function& F) override;
virtual void getAnalysisUsage(AnalysisUsage& AU) const { void getAnalysisUsage(AnalysisUsage& AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
} }

View File

@ -86,11 +86,11 @@ public:
initializeConstantHoistingPass(*PassRegistry::getPassRegistry()); initializeConstantHoistingPass(*PassRegistry::getPassRegistry());
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
const char *getPassName() const { return "Constant Hoisting"; } const char *getPassName() const override { return "Constant Hoisting"; }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<TargetTransformInfo>(); AU.addRequired<TargetTransformInfo>();

View File

@ -40,9 +40,9 @@ namespace {
initializeConstantPropagationPass(*PassRegistry::getPassRegistry()); initializeConstantPropagationPass(*PassRegistry::getPassRegistry());
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
AU.addRequired<TargetLibraryInfo>(); AU.addRequired<TargetLibraryInfo>();
} }

View File

@ -48,9 +48,9 @@ namespace {
initializeCorrelatedValuePropagationPass(*PassRegistry::getPassRegistry()); initializeCorrelatedValuePropagationPass(*PassRegistry::getPassRegistry());
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<LazyValueInfo>(); AU.addRequired<LazyValueInfo>();
} }
}; };

View File

@ -38,7 +38,7 @@ namespace {
DeadInstElimination() : BasicBlockPass(ID) { DeadInstElimination() : BasicBlockPass(ID) {
initializeDeadInstEliminationPass(*PassRegistry::getPassRegistry()); initializeDeadInstEliminationPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnBasicBlock(BasicBlock &BB) { bool runOnBasicBlock(BasicBlock &BB) override {
if (skipOptnoneFunction(BB)) if (skipOptnoneFunction(BB))
return false; return false;
TargetLibraryInfo *TLI = getAnalysisIfAvailable<TargetLibraryInfo>(); TargetLibraryInfo *TLI = getAnalysisIfAvailable<TargetLibraryInfo>();
@ -54,7 +54,7 @@ namespace {
return Changed; return Changed;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
} }
}; };
@ -79,9 +79,9 @@ namespace {
initializeDCEPass(*PassRegistry::getPassRegistry()); initializeDCEPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
} }
}; };

View File

@ -53,7 +53,7 @@ namespace {
initializeDSEPass(*PassRegistry::getPassRegistry()); initializeDSEPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
if (skipOptnoneFunction(F)) if (skipOptnoneFunction(F))
return false; return false;
@ -79,7 +79,7 @@ namespace {
void RemoveAccessedObjects(const AliasAnalysis::Location &LoadedLoc, void RemoveAccessedObjects(const AliasAnalysis::Location &LoadedLoc,
SmallSetVector<Value*, 16> &DeadStackObjects); SmallSetVector<Value*, 16> &DeadStackObjects);
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();

View File

@ -303,7 +303,7 @@ public:
initializeEarlyCSEPass(*PassRegistry::getPassRegistry()); initializeEarlyCSEPass(*PassRegistry::getPassRegistry());
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
private: private:
@ -376,7 +376,7 @@ private:
bool processNode(DomTreeNode *Node); bool processNode(DomTreeNode *Node);
// This transformation requires dominator postdominator info // This transformation requires dominator postdominator info
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<TargetLibraryInfo>(); AU.addRequired<TargetLibraryInfo>();
AU.setPreservesCFG(); AU.setPreservesCFG();

View File

@ -26,9 +26,9 @@ public:
FlattenCFGPass() : FunctionPass(ID) { FlattenCFGPass() : FunctionPass(ID) {
initializeFlattenCFGPassPass(*PassRegistry::getPassRegistry()); initializeFlattenCFGPassPass(*PassRegistry::getPassRegistry());
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();
} }

View File

@ -615,7 +615,7 @@ namespace {
initializeGVNPass(*PassRegistry::getPassRegistry()); initializeGVNPass(*PassRegistry::getPassRegistry());
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
/// markInstructionForDeletion - This removes the specified instruction from /// markInstructionForDeletion - This removes the specified instruction from
/// our various maps and marks it for deletion. /// our various maps and marks it for deletion.
@ -676,7 +676,7 @@ namespace {
SmallVector<std::pair<TerminatorInst*, unsigned>, 4> toSplit; SmallVector<std::pair<TerminatorInst*, unsigned>, 4> toSplit;
// This transformation requires dominator postdominator info // This transformation requires dominator postdominator info
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<TargetLibraryInfo>(); AU.addRequired<TargetLibraryInfo>();
if (!NoLoads) if (!NoLoads)

View File

@ -112,15 +112,15 @@ namespace {
initializeGlobalMergePass(*PassRegistry::getPassRegistry()); initializeGlobalMergePass(*PassRegistry::getPassRegistry());
} }
virtual bool doInitialization(Module &M); bool doInitialization(Module &M) override;
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual bool doFinalization(Module &M); bool doFinalization(Module &M) override;
const char *getPassName() const { const char *getPassName() const override {
return "Merge internal globals"; return "Merge internal globals";
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
FunctionPass::getAnalysisUsage(AU); FunctionPass::getAnalysisUsage(AU);
} }

View File

@ -84,9 +84,9 @@ namespace {
initializeIndVarSimplifyPass(*PassRegistry::getPassRegistry()); initializeIndVarSimplifyPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<LoopInfo>(); AU.addRequired<LoopInfo>();
AU.addRequired<ScalarEvolution>(); AU.addRequired<ScalarEvolution>();
@ -99,7 +99,7 @@ namespace {
} }
private: private:
virtual void releaseMemory() { void releaseMemory() override {
DeadInsts.clear(); DeadInsts.clear();
} }
@ -1138,7 +1138,7 @@ namespace {
} }
// Implement the interface used by simplifyUsersOfIV. // Implement the interface used by simplifyUsersOfIV.
virtual void visitCast(CastInst *Cast) { visitIVCast(Cast, WI, SE, DL); } void visitCast(CastInst *Cast) override { visitIVCast(Cast, WI, SE, DL); }
}; };
} }

View File

@ -105,9 +105,9 @@ namespace {
initializeJumpThreadingPass(*PassRegistry::getPassRegistry()); initializeJumpThreadingPass(*PassRegistry::getPassRegistry());
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<LazyValueInfo>(); AU.addRequired<LazyValueInfo>();
AU.addPreserved<LazyValueInfo>(); AU.addPreserved<LazyValueInfo>();
AU.addRequired<TargetLibraryInfo>(); AU.addRequired<TargetLibraryInfo>();

View File

@ -77,12 +77,12 @@ namespace {
initializeLICMPass(*PassRegistry::getPassRegistry()); initializeLICMPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM) override;
/// This transformation requires natural loop information & requires that /// This transformation requires natural loop information & requires that
/// loop preheaders be inserted into the CFG... /// loop preheaders be inserted into the CFG...
/// ///
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<LoopInfo>(); AU.addRequired<LoopInfo>();
@ -98,7 +98,7 @@ namespace {
using llvm::Pass::doFinalization; using llvm::Pass::doFinalization;
bool doFinalization() { bool doFinalization() override {
assert(LoopToAliasSetMap.empty() && "Didn't free loop alias sets"); assert(LoopToAliasSetMap.empty() && "Didn't free loop alias sets");
return false; return false;
} }
@ -122,11 +122,12 @@ namespace {
DenseMap<Loop*, AliasSetTracker*> LoopToAliasSetMap; DenseMap<Loop*, AliasSetTracker*> LoopToAliasSetMap;
/// cloneBasicBlockAnalysis - Simple Analysis hook. Clone alias set info. /// cloneBasicBlockAnalysis - Simple Analysis hook. Clone alias set info.
void cloneBasicBlockAnalysis(BasicBlock *From, BasicBlock *To, Loop *L); void cloneBasicBlockAnalysis(BasicBlock *From, BasicBlock *To,
Loop *L) override;
/// deleteAnalysisValue - Simple Analysis hook. Delete value V from alias /// deleteAnalysisValue - Simple Analysis hook. Delete value V from alias
/// set. /// set.
void deleteAnalysisValue(Value *V, Loop *L); void deleteAnalysisValue(Value *V, Loop *L) override;
/// SinkRegion - Walk the specified region of the CFG (defined by all blocks /// SinkRegion - Walk the specified region of the CFG (defined by all blocks
/// dominated by the specified block, and that are in the current loop) in /// dominated by the specified block, and that are in the current loop) in
@ -694,8 +695,8 @@ namespace {
LoopExitBlocks(LEB), LoopInsertPts(LIP), PredCache(PIC), AST(ast), LoopExitBlocks(LEB), LoopInsertPts(LIP), PredCache(PIC), AST(ast),
LI(li), DL(dl), Alignment(alignment), TBAATag(TBAATag) {} LI(li), DL(dl), Alignment(alignment), TBAATag(TBAATag) {}
virtual bool isInstInList(Instruction *I, bool isInstInList(Instruction *I,
const SmallVectorImpl<Instruction*> &) const { const SmallVectorImpl<Instruction*> &) const override {
Value *Ptr; Value *Ptr;
if (LoadInst *LI = dyn_cast<LoadInst>(I)) if (LoadInst *LI = dyn_cast<LoadInst>(I))
Ptr = LI->getOperand(0); Ptr = LI->getOperand(0);
@ -704,7 +705,7 @@ namespace {
return PointerMustAliases.count(Ptr); return PointerMustAliases.count(Ptr);
} }
virtual void doExtraRewritesBeforeFinalDeletion() const { void doExtraRewritesBeforeFinalDeletion() const override {
// Insert stores after in the loop exit blocks. Each exit block gets a // Insert stores after in the loop exit blocks. Each exit block gets a
// store of the live-out values that feed them. Since we've already told // store of the live-out values that feed them. Since we've already told
// the SSA updater about the defs in the loop and the preheader // the SSA updater about the defs in the loop and the preheader
@ -722,11 +723,11 @@ namespace {
} }
} }
virtual void replaceLoadWithValue(LoadInst *LI, Value *V) const { void replaceLoadWithValue(LoadInst *LI, Value *V) const override {
// Update alias analysis. // Update alias analysis.
AST.copyValue(LI, V); AST.copyValue(LI, V);
} }
virtual void instructionDeleted(Instruction *I) const { void instructionDeleted(Instruction *I) const override {
AST.deleteValue(I); AST.deleteValue(I);
} }
}; };

View File

@ -34,9 +34,9 @@ namespace {
} }
// Possibly eliminate loop L if it is dead. // Possibly eliminate loop L if it is dead.
bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<LoopInfo>(); AU.addRequired<LoopInfo>();
AU.addRequired<ScalarEvolution>(); AU.addRequired<ScalarEvolution>();

View File

@ -144,7 +144,7 @@ namespace {
DL = 0; DT = 0; SE = 0; TLI = 0; TTI = 0; DL = 0; DT = 0; SE = 0; TLI = 0; TTI = 0;
} }
bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM) override;
bool runOnLoopBlock(BasicBlock *BB, const SCEV *BECount, bool runOnLoopBlock(BasicBlock *BB, const SCEV *BECount,
SmallVectorImpl<BasicBlock*> &ExitBlocks); SmallVectorImpl<BasicBlock*> &ExitBlocks);
@ -164,7 +164,7 @@ namespace {
/// This transformation requires natural loop information & requires that /// This transformation requires natural loop information & requires that
/// loop preheaders be inserted into the CFG. /// loop preheaders be inserted into the CFG.
/// ///
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<LoopInfo>(); AU.addRequired<LoopInfo>();
AU.addPreserved<LoopInfo>(); AU.addPreserved<LoopInfo>();
AU.addRequiredID(LoopSimplifyID); AU.addRequiredID(LoopSimplifyID);

View File

@ -36,9 +36,9 @@ namespace {
initializeLoopInstSimplifyPass(*PassRegistry::getPassRegistry()); initializeLoopInstSimplifyPass(*PassRegistry::getPassRegistry());
} }
bool runOnLoop(Loop*, LPPassManager&); bool runOnLoop(Loop*, LPPassManager&) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
AU.addRequired<LoopInfo>(); AU.addRequired<LoopInfo>();
AU.addRequiredID(LoopSimplifyID); AU.addRequiredID(LoopSimplifyID);

View File

@ -125,9 +125,9 @@ namespace {
initializeLoopRerollPass(*PassRegistry::getPassRegistry()); initializeLoopRerollPass(*PassRegistry::getPassRegistry());
} }
bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();
AU.addRequired<LoopInfo>(); AU.addRequired<LoopInfo>();
AU.addPreserved<LoopInfo>(); AU.addPreserved<LoopInfo>();

View File

@ -44,7 +44,7 @@ namespace {
} }
// LCSSA form makes instruction renaming easier. // LCSSA form makes instruction renaming easier.
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addPreserved<DominatorTreeWrapperPass>(); AU.addPreserved<DominatorTreeWrapperPass>();
AU.addRequired<LoopInfo>(); AU.addRequired<LoopInfo>();
AU.addPreserved<LoopInfo>(); AU.addPreserved<LoopInfo>();
@ -56,7 +56,7 @@ namespace {
AU.addRequired<TargetTransformInfo>(); AU.addRequired<TargetTransformInfo>();
} }
bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM) override;
bool simplifyLoopLatch(Loop *L); bool simplifyLoopLatch(Loop *L);
bool rotateLoop(Loop *L, bool SimplifiedLatch); bool rotateLoop(Loop *L, bool SimplifiedLatch);

View File

@ -4867,8 +4867,8 @@ public:
LoopStrengthReduce(); LoopStrengthReduce();
private: private:
bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM) override;
void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
}; };
} }

View File

@ -87,12 +87,12 @@ namespace {
bool UserAllowPartial; // CurrentAllowPartial is user-specified. bool UserAllowPartial; // CurrentAllowPartial is user-specified.
bool UserRuntime; // CurrentRuntime is user-specified. bool UserRuntime; // CurrentRuntime is user-specified.
bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM) override;
/// This transformation requires natural loop information & requires that /// This transformation requires natural loop information & requires that
/// loop preheaders be inserted into the CFG... /// loop preheaders be inserted into the CFG...
/// ///
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<LoopInfo>(); AU.addRequired<LoopInfo>();
AU.addPreserved<LoopInfo>(); AU.addPreserved<LoopInfo>();
AU.addRequiredID(LoopSimplifyID); AU.addRequiredID(LoopSimplifyID);

View File

@ -156,13 +156,13 @@ namespace {
initializeLoopUnswitchPass(*PassRegistry::getPassRegistry()); initializeLoopUnswitchPass(*PassRegistry::getPassRegistry());
} }
bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM) override;
bool processCurrentLoop(); bool processCurrentLoop();
/// This transformation requires natural loop information & requires that /// This transformation requires natural loop information & requires that
/// loop preheaders be inserted into the CFG. /// loop preheaders be inserted into the CFG.
/// ///
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequiredID(LoopSimplifyID); AU.addRequiredID(LoopSimplifyID);
AU.addPreservedID(LoopSimplifyID); AU.addPreservedID(LoopSimplifyID);
AU.addRequired<LoopInfo>(); AU.addRequired<LoopInfo>();
@ -176,7 +176,7 @@ namespace {
private: private:
virtual void releaseMemory() { void releaseMemory() override {
BranchesInfo.forgetLoop(currentLoop); BranchesInfo.forgetLoop(currentLoop);
} }

View File

@ -111,7 +111,7 @@ namespace {
LowerAtomic() : BasicBlockPass(ID) { LowerAtomic() : BasicBlockPass(ID) {
initializeLowerAtomicPass(*PassRegistry::getPassRegistry()); initializeLowerAtomicPass(*PassRegistry::getPassRegistry());
} }
bool runOnBasicBlock(BasicBlock &BB) { bool runOnBasicBlock(BasicBlock &BB) override {
if (skipOptnoneFunction(BB)) if (skipOptnoneFunction(BB))
return false; return false;
bool Changed = false; bool Changed = false;

View File

@ -315,11 +315,11 @@ namespace {
DL = 0; DL = 0;
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
private: private:
// This transformation requires dominator postdominator info // This transformation requires dominator postdominator info
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<MemoryDependenceAnalysis>(); AU.addRequired<MemoryDependenceAnalysis>();

View File

@ -35,8 +35,8 @@ namespace {
initializePartiallyInlineLibCallsPass(*PassRegistry::getPassRegistry()); initializePartiallyInlineLibCallsPass(*PassRegistry::getPassRegistry());
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
private: private:
/// Optimize calls to sqrt. /// Optimize calls to sqrt.

View File

@ -167,9 +167,9 @@ namespace {
initializeReassociatePass(*PassRegistry::getPassRegistry()); initializeReassociatePass(*PassRegistry::getPassRegistry());
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
} }
private: private:

View File

@ -40,7 +40,7 @@ namespace {
initializeRegToMemPass(*PassRegistry::getPassRegistry()); initializeRegToMemPass(*PassRegistry::getPassRegistry());
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequiredID(BreakCriticalEdgesID); AU.addRequiredID(BreakCriticalEdgesID);
AU.addPreservedID(BreakCriticalEdgesID); AU.addPreservedID(BreakCriticalEdgesID);
} }
@ -56,7 +56,7 @@ namespace {
return false; return false;
} }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
}; };
} }

View File

@ -1499,7 +1499,7 @@ namespace {
/// Sparse Conditional Constant Propagator. /// Sparse Conditional Constant Propagator.
/// ///
struct SCCP : public FunctionPass { struct SCCP : public FunctionPass {
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<TargetLibraryInfo>(); AU.addRequired<TargetLibraryInfo>();
} }
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
@ -1510,7 +1510,7 @@ namespace {
// runOnFunction - Run the Sparse Conditional Constant Propagation // runOnFunction - Run the Sparse Conditional Constant Propagation
// algorithm, and return true if the function was modified. // algorithm, and return true if the function was modified.
// //
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
}; };
} // end anonymous namespace } // end anonymous namespace
@ -1632,14 +1632,14 @@ namespace {
/// Constant Propagation. /// Constant Propagation.
/// ///
struct IPSCCP : public ModulePass { struct IPSCCP : public ModulePass {
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<TargetLibraryInfo>(); AU.addRequired<TargetLibraryInfo>();
} }
static char ID; static char ID;
IPSCCP() : ModulePass(ID) { IPSCCP() : ModulePass(ID) {
initializeIPSCCPPass(*PassRegistry::getPassRegistry()); initializeIPSCCPPass(*PassRegistry::getPassRegistry());
} }
bool runOnModule(Module &M); bool runOnModule(Module &M) override;
}; };
} // end anonymous namespace } // end anonymous namespace

View File

@ -836,8 +836,8 @@ public:
DVIs.pop_back_val()->eraseFromParent(); DVIs.pop_back_val()->eraseFromParent();
} }
virtual bool isInstInList(Instruction *I, bool isInstInList(Instruction *I,
const SmallVectorImpl<Instruction*> &Insts) const { const SmallVectorImpl<Instruction*> &Insts) const override {
Value *Ptr; Value *Ptr;
if (LoadInst *LI = dyn_cast<LoadInst>(I)) if (LoadInst *LI = dyn_cast<LoadInst>(I))
Ptr = LI->getOperand(0); Ptr = LI->getOperand(0);
@ -864,7 +864,7 @@ public:
return false; return false;
} }
virtual void updateDebugInfo(Instruction *Inst) const { void updateDebugInfo(Instruction *Inst) const override {
for (SmallVectorImpl<DbgDeclareInst *>::const_iterator I = DDIs.begin(), for (SmallVectorImpl<DbgDeclareInst *>::const_iterator I = DDIs.begin(),
E = DDIs.end(); I != E; ++I) { E = DDIs.end(); I != E; ++I) {
DbgDeclareInst *DDI = *I; DbgDeclareInst *DDI = *I;
@ -975,10 +975,10 @@ public:
C(0), DL(0), DT(0) { C(0), DL(0), DT(0) {
initializeSROAPass(*PassRegistry::getPassRegistry()); initializeSROAPass(*PassRegistry::getPassRegistry());
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
const char *getPassName() const { return "SROA"; } const char *getPassName() const override { return "SROA"; }
static char ID; static char ID;
private: private:

View File

@ -244,15 +244,15 @@ public:
initializeSampleProfileLoaderPass(*PassRegistry::getPassRegistry()); initializeSampleProfileLoaderPass(*PassRegistry::getPassRegistry());
} }
virtual bool doInitialization(Module &M); bool doInitialization(Module &M) override;
void dump() { Profiler->dump(); } void dump() { Profiler->dump(); }
virtual const char *getPassName() const { return "Sample profile pass"; } const char *getPassName() const override { return "Sample profile pass"; }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
AU.addRequired<LoopInfo>(); AU.addRequired<LoopInfo>();
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();

View File

@ -80,7 +80,7 @@ namespace {
ScalarLoadThreshold = SLT; ScalarLoadThreshold = SLT;
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
bool performScalarRepl(Function &F); bool performScalarRepl(Function &F);
bool performPromotion(Function &F); bool performPromotion(Function &F);
@ -195,7 +195,7 @@ namespace {
// getAnalysisUsage - This pass does not require any passes, but we know it // getAnalysisUsage - This pass does not require any passes, but we know it
// will not alter the CFG, so say so. // will not alter the CFG, so say so.
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
AU.setPreservesCFG(); AU.setPreservesCFG();
} }
@ -212,7 +212,7 @@ namespace {
// getAnalysisUsage - This pass does not require any passes, but we know it // getAnalysisUsage - This pass does not require any passes, but we know it
// will not alter the CFG, so say so. // will not alter the CFG, so say so.
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
} }
}; };
@ -1082,14 +1082,14 @@ public:
} }
} }
virtual bool isInstInList(Instruction *I, bool isInstInList(Instruction *I,
const SmallVectorImpl<Instruction*> &Insts) const { const SmallVectorImpl<Instruction*> &Insts) const override {
if (LoadInst *LI = dyn_cast<LoadInst>(I)) if (LoadInst *LI = dyn_cast<LoadInst>(I))
return LI->getOperand(0) == AI; return LI->getOperand(0) == AI;
return cast<StoreInst>(I)->getPointerOperand() == AI; return cast<StoreInst>(I)->getPointerOperand() == AI;
} }
virtual void updateDebugInfo(Instruction *Inst) const { void updateDebugInfo(Instruction *Inst) const override {
for (SmallVectorImpl<DbgDeclareInst *>::const_iterator I = DDIs.begin(), for (SmallVectorImpl<DbgDeclareInst *>::const_iterator I = DDIs.begin(),
E = DDIs.end(); I != E; ++I) { E = DDIs.end(); I != E; ++I) {
DbgDeclareInst *DDI = *I; DbgDeclareInst *DDI = *I;

View File

@ -131,8 +131,8 @@ public:
initializeScalarizerPass(*PassRegistry::getPassRegistry()); initializeScalarizerPass(*PassRegistry::getPassRegistry());
} }
virtual bool doInitialization(Module &M); bool doInitialization(Module &M) override;
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
// InstVisitor methods. They return true if the instruction was scalarized, // InstVisitor methods. They return true if the instruction was scalarized,
// false if nothing changed. // false if nothing changed.

View File

@ -46,9 +46,9 @@ struct CFGSimplifyPass : public FunctionPass {
CFGSimplifyPass() : FunctionPass(ID) { CFGSimplifyPass() : FunctionPass(ID) {
initializeCFGSimplifyPassPass(*PassRegistry::getPassRegistry()); initializeCFGSimplifyPassPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<TargetTransformInfo>(); AU.addRequired<TargetTransformInfo>();
} }
}; };

View File

@ -40,9 +40,9 @@ namespace {
initializeSinkingPass(*PassRegistry::getPassRegistry()); initializeSinkingPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
FunctionPass::getAnalysisUsage(AU); FunctionPass::getAnalysisUsage(AU);
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();

View File

@ -235,15 +235,15 @@ public:
} }
using Pass::doInitialization; using Pass::doInitialization;
virtual bool doInitialization(Region *R, RGPassManager &RGM); bool doInitialization(Region *R, RGPassManager &RGM) override;
virtual bool runOnRegion(Region *R, RGPassManager &RGM); bool runOnRegion(Region *R, RGPassManager &RGM) override;
virtual const char *getPassName() const { const char *getPassName() const override {
return "Structurize control flow"; return "Structurize control flow";
} }
void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequiredID(LowerSwitchID); AU.addRequiredID(LowerSwitchID);
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
AU.addPreserved<DominatorTreeWrapperPass>(); AU.addPreserved<DominatorTreeWrapperPass>();

View File

@ -89,9 +89,9 @@ namespace {
initializeTailCallElimPass(*PassRegistry::getPassRegistry()); initializeTailCallElimPass(*PassRegistry::getPassRegistry());
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const override;
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
private: private:
CallInst *FindTRECandidate(Instruction *I, CallInst *FindTRECandidate(Instruction *I,

View File

@ -76,7 +76,7 @@ namespace {
initializeAddDiscriminatorsPass(*PassRegistry::getPassRegistry()); initializeAddDiscriminatorsPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
}; };
} }

View File

@ -39,9 +39,9 @@ namespace {
initializeBreakCriticalEdgesPass(*PassRegistry::getPassRegistry()); initializeBreakCriticalEdgesPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addPreserved<DominatorTreeWrapperPass>(); AU.addPreserved<DominatorTreeWrapperPass>();
AU.addPreserved<LoopInfo>(); AU.addPreserved<LoopInfo>();

View File

@ -27,11 +27,11 @@ namespace {
initializeInstNamerPass(*PassRegistry::getPassRegistry()); initializeInstNamerPass(*PassRegistry::getPassRegistry());
} }
void getAnalysisUsage(AnalysisUsage &Info) const { void getAnalysisUsage(AnalysisUsage &Info) const override {
Info.setPreservesAll(); Info.setPreservesAll();
} }
bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
for (Function::arg_iterator AI = F.arg_begin(), AE = F.arg_end(); for (Function::arg_iterator AI = F.arg_begin(), AE = F.arg_end();
AI != AE; ++AI) AI != AE; ++AI)
if (!AI->hasName() && !AI->getType()->isVoidTy()) if (!AI->hasName() && !AI->getType()->isVoidTy())

View File

@ -252,12 +252,12 @@ struct LCSSA : public FunctionPass {
LoopInfo *LI; LoopInfo *LI;
ScalarEvolution *SE; ScalarEvolution *SE;
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
/// This transformation requires natural loop information & requires that /// This transformation requires natural loop information & requires that
/// loop preheaders be inserted into the CFG. It maintains both of these, /// loop preheaders be inserted into the CFG. It maintains both of these,
/// as well as the CFG. It also requires dominator information. /// as well as the CFG. It also requires dominator information.
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
@ -270,7 +270,7 @@ struct LCSSA : public FunctionPass {
private: private:
bool processLoop(Loop &L); bool processLoop(Loop &L);
virtual void verifyAnalysis() const; void verifyAnalysis() const override;
}; };
} }

View File

@ -743,9 +743,9 @@ namespace {
LoopInfo *LI; LoopInfo *LI;
ScalarEvolution *SE; ScalarEvolution *SE;
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
// We need loop information to identify the loops... // We need loop information to identify the loops...
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
AU.addPreserved<DominatorTreeWrapperPass>(); AU.addPreserved<DominatorTreeWrapperPass>();
@ -760,7 +760,7 @@ namespace {
} }
/// verifyAnalysis() - Verify LoopSimplifyForm's guarantees. /// verifyAnalysis() - Verify LoopSimplifyForm's guarantees.
void verifyAnalysis() const; void verifyAnalysis() const override;
private: private:
bool ProcessLoop(Loop *L); bool ProcessLoop(Loop *L);

View File

@ -52,7 +52,7 @@ namespace {
initializeLowerExpectIntrinsicPass(*PassRegistry::getPassRegistry()); initializeLowerExpectIntrinsicPass(*PassRegistry::getPassRegistry());
} }
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
}; };
} }

View File

@ -80,10 +80,10 @@ namespace {
useExpensiveEHSupport(useExpensiveEHSupport) { useExpensiveEHSupport(useExpensiveEHSupport) {
initializeLowerInvokePass(*PassRegistry::getPassRegistry()); initializeLowerInvokePass(*PassRegistry::getPassRegistry());
} }
bool doInitialization(Module &M); bool doInitialization(Module &M) override;
bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
// This is a cluster of orthogonal Transforms // This is a cluster of orthogonal Transforms
AU.addPreserved("mem2reg"); AU.addPreserved("mem2reg");
AU.addPreservedID(LowerSwitchID); AU.addPreservedID(LowerSwitchID);

View File

@ -37,9 +37,9 @@ namespace {
initializeLowerSwitchPass(*PassRegistry::getPassRegistry()); initializeLowerSwitchPass(*PassRegistry::getPassRegistry());
} }
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
// This is a cluster of orthogonal Transforms // This is a cluster of orthogonal Transforms
AU.addPreserved<UnifyFunctionExitNodes>(); AU.addPreserved<UnifyFunctionExitNodes>();
AU.addPreserved("mem2reg"); AU.addPreserved("mem2reg");

View File

@ -34,9 +34,9 @@ namespace {
// runOnFunction - 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. // instructions that are safe for promotion, then we promote each one.
// //
virtual bool runOnFunction(Function &F); bool runOnFunction(Function &F) override;
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();
AU.setPreservesCFG(); AU.setPreservesCFG();
// This is a cluster of orthogonal Transforms // This is a cluster of orthogonal Transforms

View File

@ -48,11 +48,11 @@ namespace {
initializeMetaRenamerPass(*PassRegistry::getPassRegistry()); initializeMetaRenamerPass(*PassRegistry::getPassRegistry());
} }
void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll(); AU.setPreservesAll();
} }
bool runOnModule(Module &M) { bool runOnModule(Module &M) override {
static const char *const metaNames[] = { static const char *const metaNames[] = {
// See http://en.wikipedia.org/wiki/Metasyntactic_variable // See http://en.wikipedia.org/wiki/Metasyntactic_variable
"foo", "bar", "baz", "quux", "barney", "snork", "zot", "blam", "hoge", "foo", "bar", "baz", "quux", "barney", "snork", "zot", "blam", "hoge",

View File

@ -38,13 +38,13 @@ namespace {
initializeInstSimplifierPass(*PassRegistry::getPassRegistry()); initializeInstSimplifierPass(*PassRegistry::getPassRegistry());
} }
void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG(); AU.setPreservesCFG();
AU.addRequired<TargetLibraryInfo>(); AU.addRequired<TargetLibraryInfo>();
} }
/// runOnFunction - Remove instructions that simplify. /// runOnFunction - Remove instructions that simplify.
bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
const DominatorTreeWrapperPass *DTWP = const DominatorTreeWrapperPass *DTWP =
getAnalysisIfAvailable<DominatorTreeWrapperPass>(); getAnalysisIfAvailable<DominatorTreeWrapperPass>();
const DominatorTree *DT = DTWP ? &DTWP->getDomTree() : 0; const DominatorTree *DT = DTWP ? &DTWP->getDomTree() : 0;

View File

@ -152,7 +152,8 @@ protected:
struct InstFortifiedLibCallOptimization : public FortifiedLibCallOptimization { struct InstFortifiedLibCallOptimization : public FortifiedLibCallOptimization {
CallInst *CI; CallInst *CI;
bool isFoldable(unsigned SizeCIOp, unsigned SizeArgOp, bool isString) const { bool isFoldable(unsigned SizeCIOp, unsigned SizeArgOp,
bool isString) const override {
if (CI->getArgOperand(SizeCIOp) == CI->getArgOperand(SizeArgOp)) if (CI->getArgOperand(SizeCIOp) == CI->getArgOperand(SizeArgOp))
return true; return true;
if (ConstantInt *SizeCI = if (ConstantInt *SizeCI =
@ -175,7 +176,8 @@ struct InstFortifiedLibCallOptimization : public FortifiedLibCallOptimization {
}; };
struct MemCpyChkOpt : public InstFortifiedLibCallOptimization { struct MemCpyChkOpt : public InstFortifiedLibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
this->CI = CI; this->CI = CI;
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
LLVMContext &Context = CI->getParent()->getContext(); LLVMContext &Context = CI->getParent()->getContext();
@ -198,7 +200,8 @@ struct MemCpyChkOpt : public InstFortifiedLibCallOptimization {
}; };
struct MemMoveChkOpt : public InstFortifiedLibCallOptimization { struct MemMoveChkOpt : public InstFortifiedLibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
this->CI = CI; this->CI = CI;
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
LLVMContext &Context = CI->getParent()->getContext(); LLVMContext &Context = CI->getParent()->getContext();
@ -221,7 +224,8 @@ struct MemMoveChkOpt : public InstFortifiedLibCallOptimization {
}; };
struct MemSetChkOpt : public InstFortifiedLibCallOptimization { struct MemSetChkOpt : public InstFortifiedLibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
this->CI = CI; this->CI = CI;
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
LLVMContext &Context = CI->getParent()->getContext(); LLVMContext &Context = CI->getParent()->getContext();
@ -245,7 +249,8 @@ struct MemSetChkOpt : public InstFortifiedLibCallOptimization {
}; };
struct StrCpyChkOpt : public InstFortifiedLibCallOptimization { struct StrCpyChkOpt : public InstFortifiedLibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
this->CI = CI; this->CI = CI;
StringRef Name = Callee->getName(); StringRef Name = Callee->getName();
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
@ -290,7 +295,8 @@ struct StrCpyChkOpt : public InstFortifiedLibCallOptimization {
}; };
struct StpCpyChkOpt : public InstFortifiedLibCallOptimization { struct StpCpyChkOpt : public InstFortifiedLibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
this->CI = CI; this->CI = CI;
StringRef Name = Callee->getName(); StringRef Name = Callee->getName();
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
@ -340,7 +346,8 @@ struct StpCpyChkOpt : public InstFortifiedLibCallOptimization {
}; };
struct StrNCpyChkOpt : public InstFortifiedLibCallOptimization { struct StrNCpyChkOpt : public InstFortifiedLibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
this->CI = CI; this->CI = CI;
StringRef Name = Callee->getName(); StringRef Name = Callee->getName();
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
@ -369,7 +376,8 @@ struct StrNCpyChkOpt : public InstFortifiedLibCallOptimization {
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
struct StrCatOpt : public LibCallOptimization { struct StrCatOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// Verify the "strcat" function prototype. // Verify the "strcat" function prototype.
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 2 || if (FT->getNumParams() != 2 ||
@ -419,7 +427,8 @@ struct StrCatOpt : public LibCallOptimization {
}; };
struct StrNCatOpt : public StrCatOpt { struct StrNCatOpt : public StrCatOpt {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// Verify the "strncat" function prototype. // Verify the "strncat" function prototype.
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 3 || if (FT->getNumParams() != 3 ||
@ -463,7 +472,8 @@ struct StrNCatOpt : public StrCatOpt {
}; };
struct StrChrOpt : public LibCallOptimization { struct StrChrOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// Verify the "strchr" function prototype. // Verify the "strchr" function prototype.
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 2 || if (FT->getNumParams() != 2 ||
@ -512,7 +522,8 @@ struct StrChrOpt : public LibCallOptimization {
}; };
struct StrRChrOpt : public LibCallOptimization { struct StrRChrOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// Verify the "strrchr" function prototype. // Verify the "strrchr" function prototype.
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 2 || if (FT->getNumParams() != 2 ||
@ -548,7 +559,8 @@ struct StrRChrOpt : public LibCallOptimization {
}; };
struct StrCmpOpt : public LibCallOptimization { struct StrCmpOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// Verify the "strcmp" function prototype. // Verify the "strcmp" function prototype.
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 2 || if (FT->getNumParams() != 2 ||
@ -593,7 +605,8 @@ struct StrCmpOpt : public LibCallOptimization {
}; };
struct StrNCmpOpt : public LibCallOptimization { struct StrNCmpOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// Verify the "strncmp" function prototype. // Verify the "strncmp" function prototype.
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 3 || if (FT->getNumParams() != 3 ||
@ -643,7 +656,8 @@ struct StrNCmpOpt : public LibCallOptimization {
}; };
struct StrCpyOpt : public LibCallOptimization { struct StrCpyOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// Verify the "strcpy" function prototype. // Verify the "strcpy" function prototype.
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 2 || if (FT->getNumParams() != 2 ||
@ -672,7 +686,8 @@ struct StrCpyOpt : public LibCallOptimization {
}; };
struct StpCpyOpt: public LibCallOptimization { struct StpCpyOpt: public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// Verify the "stpcpy" function prototype. // Verify the "stpcpy" function prototype.
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 2 || if (FT->getNumParams() != 2 ||
@ -708,7 +723,8 @@ struct StpCpyOpt: public LibCallOptimization {
}; };
struct StrNCpyOpt : public LibCallOptimization { struct StrNCpyOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 3 || FT->getReturnType() != FT->getParamType(0) || if (FT->getNumParams() != 3 || FT->getReturnType() != FT->getParamType(0) ||
FT->getParamType(0) != FT->getParamType(1) || FT->getParamType(0) != FT->getParamType(1) ||
@ -755,8 +771,9 @@ struct StrNCpyOpt : public LibCallOptimization {
}; };
struct StrLenOpt : public LibCallOptimization { struct StrLenOpt : public LibCallOptimization {
virtual bool ignoreCallingConv() { return true; } bool ignoreCallingConv() override { return true; }
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 1 || if (FT->getNumParams() != 1 ||
FT->getParamType(0) != B.getInt8PtrTy() || FT->getParamType(0) != B.getInt8PtrTy() ||
@ -778,7 +795,8 @@ struct StrLenOpt : public LibCallOptimization {
}; };
struct StrPBrkOpt : public LibCallOptimization { struct StrPBrkOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 2 || if (FT->getNumParams() != 2 ||
FT->getParamType(0) != B.getInt8PtrTy() || FT->getParamType(0) != B.getInt8PtrTy() ||
@ -813,7 +831,8 @@ struct StrPBrkOpt : public LibCallOptimization {
}; };
struct StrToOpt : public LibCallOptimization { struct StrToOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if ((FT->getNumParams() != 2 && FT->getNumParams() != 3) || if ((FT->getNumParams() != 2 && FT->getNumParams() != 3) ||
!FT->getParamType(0)->isPointerTy() || !FT->getParamType(0)->isPointerTy() ||
@ -832,7 +851,8 @@ struct StrToOpt : public LibCallOptimization {
}; };
struct StrSpnOpt : public LibCallOptimization { struct StrSpnOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 2 || if (FT->getNumParams() != 2 ||
FT->getParamType(0) != B.getInt8PtrTy() || FT->getParamType(0) != B.getInt8PtrTy() ||
@ -861,7 +881,8 @@ struct StrSpnOpt : public LibCallOptimization {
}; };
struct StrCSpnOpt : public LibCallOptimization { struct StrCSpnOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 2 || if (FT->getNumParams() != 2 ||
FT->getParamType(0) != B.getInt8PtrTy() || FT->getParamType(0) != B.getInt8PtrTy() ||
@ -893,7 +914,8 @@ struct StrCSpnOpt : public LibCallOptimization {
}; };
struct StrStrOpt : public LibCallOptimization { struct StrStrOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 2 || if (FT->getNumParams() != 2 ||
!FT->getParamType(0)->isPointerTy() || !FT->getParamType(0)->isPointerTy() ||
@ -957,7 +979,8 @@ struct StrStrOpt : public LibCallOptimization {
}; };
struct MemCmpOpt : public LibCallOptimization { struct MemCmpOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 3 || !FT->getParamType(0)->isPointerTy() || if (FT->getNumParams() != 3 || !FT->getParamType(0)->isPointerTy() ||
!FT->getParamType(1)->isPointerTy() || !FT->getParamType(1)->isPointerTy() ||
@ -1009,7 +1032,8 @@ struct MemCmpOpt : public LibCallOptimization {
}; };
struct MemCpyOpt : public LibCallOptimization { struct MemCpyOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// These optimizations require DataLayout. // These optimizations require DataLayout.
if (!DL) return 0; if (!DL) return 0;
@ -1028,7 +1052,8 @@ struct MemCpyOpt : public LibCallOptimization {
}; };
struct MemMoveOpt : public LibCallOptimization { struct MemMoveOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// These optimizations require DataLayout. // These optimizations require DataLayout.
if (!DL) return 0; if (!DL) return 0;
@ -1047,7 +1072,8 @@ struct MemMoveOpt : public LibCallOptimization {
}; };
struct MemSetOpt : public LibCallOptimization { struct MemSetOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// These optimizations require DataLayout. // These optimizations require DataLayout.
if (!DL) return 0; if (!DL) return 0;
@ -1075,7 +1101,8 @@ struct MemSetOpt : public LibCallOptimization {
struct UnaryDoubleFPOpt : public LibCallOptimization { struct UnaryDoubleFPOpt : public LibCallOptimization {
bool CheckRetType; bool CheckRetType;
UnaryDoubleFPOpt(bool CheckReturnType): CheckRetType(CheckReturnType) {} UnaryDoubleFPOpt(bool CheckReturnType): CheckRetType(CheckReturnType) {}
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 1 || !FT->getReturnType()->isDoubleTy() || if (FT->getNumParams() != 1 || !FT->getReturnType()->isDoubleTy() ||
!FT->getParamType(0)->isDoubleTy()) !FT->getParamType(0)->isDoubleTy())
@ -1107,7 +1134,8 @@ struct UnaryDoubleFPOpt : public LibCallOptimization {
struct BinaryDoubleFPOpt : public LibCallOptimization { struct BinaryDoubleFPOpt : public LibCallOptimization {
bool CheckRetType; bool CheckRetType;
BinaryDoubleFPOpt(bool CheckReturnType): CheckRetType(CheckReturnType) {} BinaryDoubleFPOpt(bool CheckReturnType): CheckRetType(CheckReturnType) {}
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
// Just make sure this has 2 arguments of the same FP type, which match the // Just make sure this has 2 arguments of the same FP type, which match the
// result type. // result type.
@ -1155,7 +1183,8 @@ struct UnsafeFPLibCallOptimization : public LibCallOptimization {
struct CosOpt : public UnsafeFPLibCallOptimization { struct CosOpt : public UnsafeFPLibCallOptimization {
CosOpt(bool UnsafeFPShrink) : UnsafeFPLibCallOptimization(UnsafeFPShrink) {} CosOpt(bool UnsafeFPShrink) : UnsafeFPLibCallOptimization(UnsafeFPShrink) {}
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
Value *Ret = NULL; Value *Ret = NULL;
if (UnsafeFPShrink && Callee->getName() == "cos" && if (UnsafeFPShrink && Callee->getName() == "cos" &&
TLI->has(LibFunc::cosf)) { TLI->has(LibFunc::cosf)) {
@ -1182,7 +1211,8 @@ struct CosOpt : public UnsafeFPLibCallOptimization {
struct PowOpt : public UnsafeFPLibCallOptimization { struct PowOpt : public UnsafeFPLibCallOptimization {
PowOpt(bool UnsafeFPShrink) : UnsafeFPLibCallOptimization(UnsafeFPShrink) {} PowOpt(bool UnsafeFPShrink) : UnsafeFPLibCallOptimization(UnsafeFPShrink) {}
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
Value *Ret = NULL; Value *Ret = NULL;
if (UnsafeFPShrink && Callee->getName() == "pow" && if (UnsafeFPShrink && Callee->getName() == "pow" &&
TLI->has(LibFunc::powf)) { TLI->has(LibFunc::powf)) {
@ -1256,7 +1286,8 @@ struct PowOpt : public UnsafeFPLibCallOptimization {
struct Exp2Opt : public UnsafeFPLibCallOptimization { struct Exp2Opt : public UnsafeFPLibCallOptimization {
Exp2Opt(bool UnsafeFPShrink) : UnsafeFPLibCallOptimization(UnsafeFPShrink) {} Exp2Opt(bool UnsafeFPShrink) : UnsafeFPLibCallOptimization(UnsafeFPShrink) {}
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
Value *Ret = NULL; Value *Ret = NULL;
if (UnsafeFPShrink && Callee->getName() == "exp2" && if (UnsafeFPShrink && Callee->getName() == "exp2" &&
TLI->has(LibFunc::exp2f)) { TLI->has(LibFunc::exp2f)) {
@ -1313,7 +1344,8 @@ struct Exp2Opt : public UnsafeFPLibCallOptimization {
struct SinCosPiOpt : public LibCallOptimization { struct SinCosPiOpt : public LibCallOptimization {
SinCosPiOpt() {} SinCosPiOpt() {}
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// Make sure the prototype is as expected, otherwise the rest of the // Make sure the prototype is as expected, otherwise the rest of the
// function is probably invalid and likely to abort. // function is probably invalid and likely to abort.
if (!isTrigLibCall(CI)) if (!isTrigLibCall(CI))
@ -1464,7 +1496,8 @@ struct SinCosPiOpt : public LibCallOptimization {
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
struct FFSOpt : public LibCallOptimization { struct FFSOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
// Just make sure this has 2 arguments of the same FP type, which match the // Just make sure this has 2 arguments of the same FP type, which match the
// result type. // result type.
@ -1497,8 +1530,9 @@ struct FFSOpt : public LibCallOptimization {
}; };
struct AbsOpt : public LibCallOptimization { struct AbsOpt : public LibCallOptimization {
virtual bool ignoreCallingConv() { return true; } bool ignoreCallingConv() override { return true; }
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
// We require integer(integer) where the types agree. // We require integer(integer) where the types agree.
if (FT->getNumParams() != 1 || !FT->getReturnType()->isIntegerTy() || if (FT->getNumParams() != 1 || !FT->getReturnType()->isIntegerTy() ||
@ -1515,7 +1549,8 @@ struct AbsOpt : public LibCallOptimization {
}; };
struct IsDigitOpt : public LibCallOptimization { struct IsDigitOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
// We require integer(i32) // We require integer(i32)
if (FT->getNumParams() != 1 || !FT->getReturnType()->isIntegerTy() || if (FT->getNumParams() != 1 || !FT->getReturnType()->isIntegerTy() ||
@ -1531,7 +1566,8 @@ struct IsDigitOpt : public LibCallOptimization {
}; };
struct IsAsciiOpt : public LibCallOptimization { struct IsAsciiOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
// We require integer(i32) // We require integer(i32)
if (FT->getNumParams() != 1 || !FT->getReturnType()->isIntegerTy() || if (FT->getNumParams() != 1 || !FT->getReturnType()->isIntegerTy() ||
@ -1546,7 +1582,8 @@ struct IsAsciiOpt : public LibCallOptimization {
}; };
struct ToAsciiOpt : public LibCallOptimization { struct ToAsciiOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
// We require i32(i32) // We require i32(i32)
if (FT->getNumParams() != 1 || FT->getReturnType() != FT->getParamType(0) || if (FT->getNumParams() != 1 || FT->getReturnType() != FT->getParamType(0) ||
@ -1566,7 +1603,8 @@ struct ToAsciiOpt : public LibCallOptimization {
struct ErrorReportingOpt : public LibCallOptimization { struct ErrorReportingOpt : public LibCallOptimization {
ErrorReportingOpt(int S = -1) : StreamArg(S) {} ErrorReportingOpt(int S = -1) : StreamArg(S) {}
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &) override {
// Error reporting calls should be cold, mark them as such. // Error reporting calls should be cold, mark them as such.
// This applies even to non-builtin calls: it is only a hint and applies to // This applies even to non-builtin calls: it is only a hint and applies to
// functions that the frontend might not understand as builtins. // functions that the frontend might not understand as builtins.
@ -1668,7 +1706,8 @@ struct PrintFOpt : public LibCallOptimization {
return 0; return 0;
} }
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// Require one fixed pointer argument and an integer/void result. // Require one fixed pointer argument and an integer/void result.
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() < 1 || !FT->getParamType(0)->isPointerTy() || if (FT->getNumParams() < 1 || !FT->getParamType(0)->isPointerTy() ||
@ -1761,7 +1800,8 @@ struct SPrintFOpt : public LibCallOptimization {
return 0; return 0;
} }
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// Require two fixed pointer arguments and an integer result. // Require two fixed pointer arguments and an integer result.
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 2 || !FT->getParamType(0)->isPointerTy() || if (FT->getNumParams() != 2 || !FT->getParamType(0)->isPointerTy() ||
@ -1842,7 +1882,8 @@ struct FPrintFOpt : public LibCallOptimization {
return 0; return 0;
} }
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// Require two fixed paramters as pointers and integer result. // Require two fixed paramters as pointers and integer result.
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() != 2 || !FT->getParamType(0)->isPointerTy() || if (FT->getNumParams() != 2 || !FT->getParamType(0)->isPointerTy() ||
@ -1870,7 +1911,8 @@ struct FPrintFOpt : public LibCallOptimization {
}; };
struct FWriteOpt : public LibCallOptimization { struct FWriteOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
ErrorReportingOpt ER(/* StreamArg = */ 3); ErrorReportingOpt ER(/* StreamArg = */ 3);
(void) ER.callOptimizer(Callee, CI, B); (void) ER.callOptimizer(Callee, CI, B);
@ -1906,7 +1948,8 @@ struct FWriteOpt : public LibCallOptimization {
}; };
struct FPutsOpt : public LibCallOptimization { struct FPutsOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
ErrorReportingOpt ER(/* StreamArg = */ 1); ErrorReportingOpt ER(/* StreamArg = */ 1);
(void) ER.callOptimizer(Callee, CI, B); (void) ER.callOptimizer(Callee, CI, B);
@ -1931,7 +1974,8 @@ struct FPutsOpt : public LibCallOptimization {
}; };
struct PutsOpt : public LibCallOptimization { struct PutsOpt : public LibCallOptimization {
virtual Value *callOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { Value *callOptimizer(Function *Callee, CallInst *CI,
IRBuilder<> &B) override {
// Require one fixed pointer argument and an integer/void result. // Require one fixed pointer argument and an integer/void result.
FunctionType *FT = Callee->getFunctionType(); FunctionType *FT = Callee->getFunctionType();
if (FT->getNumParams() < 1 || !FT->getParamType(0)->isPointerTy() || if (FT->getNumParams() < 1 || !FT->getParamType(0)->isPointerTy() ||

View File

@ -431,7 +431,7 @@ namespace {
return changed; return changed;
} }
virtual bool runOnBasicBlock(BasicBlock &BB) { bool runOnBasicBlock(BasicBlock &BB) override {
// OptimizeNone check deferred to vectorizeBB(). // OptimizeNone check deferred to vectorizeBB().
AA = &getAnalysis<AliasAnalysis>(); AA = &getAnalysis<AliasAnalysis>();
@ -444,7 +444,7 @@ namespace {
return vectorizeBB(BB); return vectorizeBB(BB);
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
BasicBlockPass::getAnalysisUsage(AU); BasicBlockPass::getAnalysisUsage(AU);
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();
AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<DominatorTreeWrapperPass>();

View File

@ -433,11 +433,12 @@ public:
InnerLoopVectorizer(OrigLoop, SE, LI, DT, DL, TLI, 1, UnrollFactor) { } InnerLoopVectorizer(OrigLoop, SE, LI, DT, DL, TLI, 1, UnrollFactor) { }
private: private:
virtual void scalarizeInstruction(Instruction *Instr, bool IfPredicateStore = false); void scalarizeInstruction(Instruction *Instr,
virtual void vectorizeMemoryInstruction(Instruction *Instr); bool IfPredicateStore = false) override;
virtual Value *getBroadcastInstrs(Value *V); void vectorizeMemoryInstruction(Instruction *Instr) override;
virtual Value *getConsecutiveVector(Value* Val, int StartIdx, bool Negate); Value *getBroadcastInstrs(Value *V) override;
virtual Value *reverseVector(Value *Vec); Value *getConsecutiveVector(Value* Val, int StartIdx, bool Negate) override;
Value *reverseVector(Value *Vec) override;
}; };
/// \brief Look for a meaningful debug location on the instruction or it's /// \brief Look for a meaningful debug location on the instruction or it's
@ -1020,7 +1021,7 @@ struct LoopVectorize : public FunctionPass {
BlockFrequency ColdEntryFreq; BlockFrequency ColdEntryFreq;
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
SE = &getAnalysis<ScalarEvolution>(); SE = &getAnalysis<ScalarEvolution>();
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>(); DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
DL = DLP ? &DLP->getDataLayout() : 0; DL = DLP ? &DLP->getDataLayout() : 0;
@ -1160,7 +1161,7 @@ struct LoopVectorize : public FunctionPass {
return true; return true;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequiredID(LoopSimplifyID); AU.addRequiredID(LoopSimplifyID);
AU.addRequiredID(LCSSAID); AU.addRequiredID(LCSSAID);
AU.addRequired<BlockFrequencyInfo>(); AU.addRequired<BlockFrequencyInfo>();

View File

@ -1783,7 +1783,7 @@ struct SLPVectorizer : public FunctionPass {
LoopInfo *LI; LoopInfo *LI;
DominatorTree *DT; DominatorTree *DT;
virtual bool runOnFunction(Function &F) { bool runOnFunction(Function &F) override {
if (skipOptnoneFunction(F)) if (skipOptnoneFunction(F))
return false; return false;
@ -1842,7 +1842,7 @@ struct SLPVectorizer : public FunctionPass {
return Changed; return Changed;
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const override {
FunctionPass::getAnalysisUsage(AU); FunctionPass::getAnalysisUsage(AU);
AU.addRequired<ScalarEvolution>(); AU.addRequired<ScalarEvolution>();
AU.addRequired<AliasAnalysis>(); AU.addRequired<AliasAnalysis>();