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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202953 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2014-03-05 09:10:37 +00:00
parent b6193185a0
commit 7b62be28cb
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.
///
/// 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
/// 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
/// specified file emitted. Typically this will involve several steps of code
/// generation.
virtual bool addPassesToEmitFile(PassManagerBase &PM,
formatted_raw_ostream &Out,
CodeGenFileType FileType,
bool DisableVerify = true,
AnalysisID StartAfter = 0,
AnalysisID StopAfter = 0);
bool addPassesToEmitFile(PassManagerBase &PM, formatted_raw_ostream &Out,
CodeGenFileType FileType, bool DisableVerify = true,
AnalysisID StartAfter = 0,
AnalysisID StopAfter = 0) override;
/// addPassesToEmitMachineCode - Add passes to the specified pass manager to
/// 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
/// not supported.
///
virtual bool addPassesToEmitMachineCode(PassManagerBase &PM,
JITCodeEmitter &MCE,
bool DisableVerify = true);
bool addPassesToEmitMachineCode(PassManagerBase &PM, JITCodeEmitter &MCE,
bool DisableVerify = true) override;
/// addPassesToEmitMC - Add passes to the specified pass manager to get
/// 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
/// used to build custom MCStreamer.
///
virtual bool addPassesToEmitMC(PassManagerBase &PM,
MCContext *&Ctx,
raw_ostream &OS,
bool DisableVerify = true);
bool addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx,
raw_ostream &OS, bool DisableVerify = true) override;
/// addCodeEmitter - This pass should be overridden by the target to add a
/// 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
/// the call graph. If the derived class implements this method, it should
/// 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
// Pass class.
virtual bool runOnSCC(CallGraphSCC &SCC);
bool runOnSCC(CallGraphSCC &SCC) override;
using llvm::Pass::doFinalization;
// doFinalization - Remove now-dead linkonce functions at the end of
// 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,
/// 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
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
void getAnalysisUsage(AnalysisUsage &AU) const override;
// getReturn|Unwind|UnreachableBlock - Return the new single (or nonexistent)
// return, unwind, or unreachable basic blocks in the CFG.
@ -41,7 +41,7 @@ public:
BasicBlock *getUnwindBlock() const { return UnwindBlock; }
BasicBlock *getUnreachableBlock() const { return UnreachableBlock; }
virtual bool runOnFunction(Function &F);
bool runOnFunction(Function &F) override;
};
Pass *createUnifyFunctionExitNodesPass();

View File

@ -27,7 +27,7 @@ namespace {
static char ID; // Pass identification, replacement for typeid
Hello() : FunctionPass(ID) {}
virtual bool runOnFunction(Function &F) {
bool runOnFunction(Function &F) override {
++HelloCounter;
errs() << "Hello: ";
errs().write_escaped(F.getName()) << '\n';
@ -45,7 +45,7 @@ namespace {
static char ID; // Pass identification, replacement for typeid
Hello2() : FunctionPass(ID) {}
virtual bool runOnFunction(Function &F) {
bool runOnFunction(Function &F) override {
++HelloCounter;
errs() << "Hello: ";
errs().write_escaped(F.getName()) << '\n';
@ -53,7 +53,7 @@ namespace {
}
// 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();
}
};

View File

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

View File

@ -36,7 +36,7 @@ public:
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
// duplicate constants.
bool runOnModule(Module &M);
bool runOnModule(Module &M) override;
// Return true iff we can determine the alignment of this global variable.
bool hasKnownAlignment(GlobalVariable *GV) const;

View File

@ -138,7 +138,7 @@ namespace {
initializeDAEPass(*PassRegistry::getPassRegistry());
}
bool runOnModule(Module &M);
bool runOnModule(Module &M) override;
virtual bool ShouldHackArguments() const { return false; }
@ -173,7 +173,7 @@ namespace {
static char 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)
: ModulePass(ID), Named(GVs.begin(), GVs.end()), deleteStuff(deleteS) {}
bool runOnModule(Module &M) {
bool runOnModule(Module &M) override {
// Visit the global inline asm.
if (!deleteStuff)
M.setModuleInlineAsm("");

View File

@ -51,7 +51,7 @@ namespace {
}
// 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.
bool AddReadAttrs(const CallGraphSCC &SCC);
@ -120,7 +120,7 @@ namespace {
// call declarations.
bool annotateLibraryCalls(const CallGraphSCC &SCC);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
AU.addRequired<AliasAnalysis>();
AU.addRequired<TargetLibraryInfo>();
@ -342,9 +342,9 @@ namespace {
ArgumentUsesTracker(const SmallPtrSet<Function*, 8> &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());
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
// the specified callgraph to reflect the changes.
//
bool runOnModule(Module &M);
bool runOnModule(Module &M) override;
private:
SmallPtrSet<GlobalValue*, 32> AliveGlobals;

View File

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

View File

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

View File

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

View File

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

View File

@ -60,9 +60,9 @@ namespace {
explicit InternalizePass(bool OnlyHidden = false);
explicit InternalizePass(ArrayRef<const char *> ExportList, bool OnlyHidden);
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.addPreserved<CallGraphWrapperPass>();
}

View File

@ -42,9 +42,9 @@ namespace {
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(LoopSimplifyID);
AU.addRequired<DominatorTreeWrapperPass>();
@ -180,7 +180,7 @@ namespace {
LoadFile(BlockFile.c_str());
}
bool runOnModule(Module &M);
bool runOnModule(Module &M) override;
};
}

View File

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

View File

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

View File

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

View File

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

View File

@ -44,9 +44,9 @@ namespace {
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();
}
};
@ -59,9 +59,9 @@ namespace {
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();
}
};
@ -74,9 +74,9 @@ namespace {
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();
}
};
@ -89,9 +89,9 @@ namespace {
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();
}
};

View File

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

View File

@ -2508,7 +2508,7 @@ public:
/// replaceAllUsesWith - override so that instruction replacement
/// 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);
}
};

View File

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

View File

@ -45,9 +45,9 @@ namespace {
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<TargetLibraryInfo>();
}

View File

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

View File

@ -67,11 +67,12 @@ public:
// This function is called after an Instruction, GlobalValue, or GlobalAlias
// is printed.
void printInfoComment(const Value &V, formatted_raw_ostream &Out) {
void printInfoComment(const Value &V, formatted_raw_ostream &Out) override {
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);
}

View File

@ -43,7 +43,7 @@ class DebugIR : public llvm::ModulePass {
public:
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
/// 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.
bool runOnModule(llvm::Module &M, std::string &Path);
bool runOnModule(llvm::Module &M);
bool runOnModule(llvm::Module &M) override;
private:

View File

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

View File

@ -211,9 +211,9 @@ class MemorySanitizer : public FunctionPass {
WarningFn(0),
BlacklistFile(BlacklistFile.empty() ? ClBlacklistFile : BlacklistFile),
WrapIndirectCalls(!ClWrapIndirectCalls.empty()) {}
const char *getPassName() const { return "MemorySanitizer"; }
bool runOnFunction(Function &F);
bool doInitialization(Module &M);
const char *getPassName() const override { return "MemorySanitizer"; }
bool runOnFunction(Function &F) override;
bool doInitialization(Module &M) override;
static char ID; // Pass identification, replacement for typeid.
private:
@ -2321,7 +2321,7 @@ struct VarArgAMD64Helper : public VarArgHelper {
// 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
// order.
void visitCallSite(CallSite &CS, IRBuilder<> &IRB) {
void visitCallSite(CallSite &CS, IRBuilder<> &IRB) override {
unsigned GpOffset = 0;
unsigned FpOffset = AMD64GpEndOffset;
unsigned OverflowOffset = AMD64FpEndOffset;
@ -2364,7 +2364,7 @@ struct VarArgAMD64Helper : public VarArgHelper {
"_msarg");
}
void visitVAStartInst(VAStartInst &I) {
void visitVAStartInst(VAStartInst &I) override {
IRBuilder<> IRB(&I);
VAStartInstrumentationList.push_back(&I);
Value *VAListTag = I.getArgOperand(0);
@ -2376,7 +2376,7 @@ struct VarArgAMD64Helper : public VarArgHelper {
/* size */24, /* alignment */8, false);
}
void visitVACopyInst(VACopyInst &I) {
void visitVACopyInst(VACopyInst &I) override {
IRBuilder<> IRB(&I);
Value *VAListTag = I.getArgOperand(0);
Value *ShadowPtr = MSV.getShadowPtr(VAListTag, IRB.getInt8Ty(), IRB);
@ -2387,7 +2387,7 @@ struct VarArgAMD64Helper : public VarArgHelper {
/* size */24, /* alignment */8, false);
}
void finalizeInstrumentation() {
void finalizeInstrumentation() override {
assert(!VAArgOverflowSize && !VAArgTLSCopy &&
"finalizeInstrumentation called twice");
if (!VAStartInstrumentationList.empty()) {
@ -2439,13 +2439,13 @@ struct VarArgNoOpHelper : public VarArgHelper {
VarArgNoOpHelper(Function &F, MemorySanitizer &MS,
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,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,9 +37,9 @@ namespace {
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();
}

View File

@ -86,11 +86,11 @@ public:
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.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<TargetTransformInfo>();

View File

@ -40,9 +40,9 @@ namespace {
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.addRequired<TargetLibraryInfo>();
}

View File

@ -48,9 +48,9 @@ namespace {
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>();
}
};

View File

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

View File

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

View File

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

View File

@ -26,9 +26,9 @@ public:
FlattenCFGPass() : FunctionPass(ID) {
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>();
}

View File

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

View File

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

View File

@ -84,9 +84,9 @@ namespace {
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<LoopInfo>();
AU.addRequired<ScalarEvolution>();
@ -99,7 +99,7 @@ namespace {
}
private:
virtual void releaseMemory() {
void releaseMemory() override {
DeadInsts.clear();
}
@ -1138,7 +1138,7 @@ namespace {
}
// 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());
}
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.addPreserved<LazyValueInfo>();
AU.addRequired<TargetLibraryInfo>();

View File

@ -77,12 +77,12 @@ namespace {
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
/// loop preheaders be inserted into the CFG...
///
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<LoopInfo>();
@ -98,7 +98,7 @@ namespace {
using llvm::Pass::doFinalization;
bool doFinalization() {
bool doFinalization() override {
assert(LoopToAliasSetMap.empty() && "Didn't free loop alias sets");
return false;
}
@ -122,11 +122,12 @@ namespace {
DenseMap<Loop*, AliasSetTracker*> LoopToAliasSetMap;
/// 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
/// 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
/// 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),
LI(li), DL(dl), Alignment(alignment), TBAATag(TBAATag) {}
virtual bool isInstInList(Instruction *I,
const SmallVectorImpl<Instruction*> &) const {
bool isInstInList(Instruction *I,
const SmallVectorImpl<Instruction*> &) const override {
Value *Ptr;
if (LoadInst *LI = dyn_cast<LoadInst>(I))
Ptr = LI->getOperand(0);
@ -704,7 +705,7 @@ namespace {
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
// 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
@ -722,11 +723,11 @@ namespace {
}
}
virtual void replaceLoadWithValue(LoadInst *LI, Value *V) const {
void replaceLoadWithValue(LoadInst *LI, Value *V) const override {
// Update alias analysis.
AST.copyValue(LI, V);
}
virtual void instructionDeleted(Instruction *I) const {
void instructionDeleted(Instruction *I) const override {
AST.deleteValue(I);
}
};

View File

@ -34,9 +34,9 @@ namespace {
}
// 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<LoopInfo>();
AU.addRequired<ScalarEvolution>();

View File

@ -144,7 +144,7 @@ namespace {
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,
SmallVectorImpl<BasicBlock*> &ExitBlocks);
@ -164,7 +164,7 @@ namespace {
/// This transformation requires natural loop information & requires that
/// loop preheaders be inserted into the CFG.
///
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<LoopInfo>();
AU.addPreserved<LoopInfo>();
AU.addRequiredID(LoopSimplifyID);

View File

@ -36,9 +36,9 @@ namespace {
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.addRequired<LoopInfo>();
AU.addRequiredID(LoopSimplifyID);

View File

@ -125,9 +125,9 @@ namespace {
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<LoopInfo>();
AU.addPreserved<LoopInfo>();

View File

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

View File

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

View File

@ -87,12 +87,12 @@ namespace {
bool UserAllowPartial; // CurrentAllowPartial 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
/// loop preheaders be inserted into the CFG...
///
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<LoopInfo>();
AU.addPreserved<LoopInfo>();
AU.addRequiredID(LoopSimplifyID);

View File

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

View File

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

View File

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

View File

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

View File

@ -167,9 +167,9 @@ namespace {
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();
}
private:

View File

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

View File

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

View File

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

View File

@ -244,15 +244,15 @@ public:
initializeSampleProfileLoaderPass(*PassRegistry::getPassRegistry());
}
virtual bool doInitialization(Module &M);
bool doInitialization(Module &M) override;
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.addRequired<LoopInfo>();
AU.addRequired<DominatorTreeWrapperPass>();

View File

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

View File

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

View File

@ -46,9 +46,9 @@ struct CFGSimplifyPass : public FunctionPass {
CFGSimplifyPass() : FunctionPass(ID) {
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>();
}
};

View File

@ -40,9 +40,9 @@ namespace {
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();
FunctionPass::getAnalysisUsage(AU);
AU.addRequired<AliasAnalysis>();

View File

@ -235,15 +235,15 @@ public:
}
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";
}
void getAnalysisUsage(AnalysisUsage &AU) const {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequiredID(LowerSwitchID);
AU.addRequired<DominatorTreeWrapperPass>();
AU.addPreserved<DominatorTreeWrapperPass>();

View File

@ -89,9 +89,9 @@ namespace {
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:
CallInst *FindTRECandidate(Instruction *I,

View File

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

View File

@ -39,9 +39,9 @@ namespace {
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<LoopInfo>();

View File

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

View File

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

View File

@ -743,9 +743,9 @@ namespace {
LoopInfo *LI;
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...
AU.addRequired<DominatorTreeWrapperPass>();
AU.addPreserved<DominatorTreeWrapperPass>();
@ -760,7 +760,7 @@ namespace {
}
/// verifyAnalysis() - Verify LoopSimplifyForm's guarantees.
void verifyAnalysis() const;
void verifyAnalysis() const override;
private:
bool ProcessLoop(Loop *L);

View File

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

View File

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

View File

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

View File

@ -34,9 +34,9 @@ namespace {
// runOnFunction - To run this pass, first we calculate the alloca
// 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.setPreservesCFG();
// This is a cluster of orthogonal Transforms

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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