1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[PM] Change the name of the repeating utility to something less

overloaded (and simpler).

Sean rightly pointed out in code review that we've started using
"wrapper pass" as a specific part of the old pass manager, and in fact
it is more applicable there. Here, we really have a pass *template* to
build a repeated pass, so call it that.

llvm-svn: 277689
This commit is contained in:
Chandler Carruth 2016-08-04 03:52:53 +00:00
parent 868a5eb560
commit 824dbd8926
3 changed files with 16 additions and 18 deletions

View File

@ -992,21 +992,19 @@ struct InvalidateAllAnalysesPass : PassInfoMixin<InvalidateAllAnalysesPass> {
/// This can be useful when debugging or testing passes. It also serves as an
/// example of how to extend the pass manager in ways beyond composition.
template <typename PassT>
class RepeatingPassWrapper : public PassInfoMixin<RepeatingPassWrapper<PassT>> {
class RepeatedPass : public PassInfoMixin<RepeatedPass<PassT>> {
public:
RepeatingPassWrapper(int Count, PassT P) : Count(Count), P(std::move(P)) {}
RepeatedPass(int Count, PassT P) : Count(Count), P(std::move(P)) {}
// We have to explicitly define all the special member functions because MSVC
// refuses to generate them.
RepeatingPassWrapper(const RepeatingPassWrapper &Arg)
: Count(Arg.Count), P(Arg.P) {}
RepeatingPassWrapper(RepeatingPassWrapper &&Arg)
: Count(Arg.Count), P(std::move(Arg.P)) {}
friend void swap(RepeatingPassWrapper &LHS, RepeatingPassWrapper &RHS) {
RepeatedPass(const RepeatedPass &Arg) : Count(Arg.Count), P(Arg.P) {}
RepeatedPass(RepeatedPass &&Arg) : Count(Arg.Count), P(std::move(Arg.P)) {}
friend void swap(RepeatedPass &LHS, RepeatedPass &RHS) {
using std::swap;
swap(LHS.Count, RHS.Count);
swap(LHS.P, RHS.P);
}
RepeatingPassWrapper &operator=(RepeatingPassWrapper RHS) {
RepeatedPass &operator=(RepeatedPass RHS) {
swap(*this, RHS);
return *this;
}
@ -1026,8 +1024,8 @@ private:
};
template <typename PassT>
RepeatingPassWrapper<PassT> createRepeatingPassWrapper(int Count, PassT P) {
return RepeatingPassWrapper<PassT>(Count, std::move(P));
RepeatedPass<PassT> createRepeatedPass(int Count, PassT P) {
return RepeatedPass<PassT>(Count, std::move(P));
}
}

View File

@ -470,7 +470,7 @@ bool PassBuilder::parseModulePass(ModulePassManager &MPM,
if (!parseModulePassPipeline(NestedMPM, InnerPipeline, VerifyEachPass,
DebugLogging))
return false;
MPM.addPass(createRepeatingPassWrapper(*Count, std::move(NestedMPM)));
MPM.addPass(createRepeatedPass(*Count, std::move(NestedMPM)));
return true;
}
// Normal passes can't have pipelines.
@ -557,7 +557,7 @@ bool PassBuilder::parseCGSCCPass(CGSCCPassManager &CGPM,
if (!parseCGSCCPassPipeline(NestedCGPM, InnerPipeline, VerifyEachPass,
DebugLogging))
return false;
CGPM.addPass(createRepeatingPassWrapper(*Count, std::move(NestedCGPM)));
CGPM.addPass(createRepeatedPass(*Count, std::move(NestedCGPM)));
return true;
}
// Normal passes can't have pipelines.
@ -617,7 +617,7 @@ bool PassBuilder::parseFunctionPass(FunctionPassManager &FPM,
if (!parseFunctionPassPipeline(NestedFPM, InnerPipeline, VerifyEachPass,
DebugLogging))
return false;
FPM.addPass(createRepeatingPassWrapper(*Count, std::move(NestedFPM)));
FPM.addPass(createRepeatedPass(*Count, std::move(NestedFPM)));
return true;
}
// Normal passes can't have pipelines.
@ -667,7 +667,7 @@ bool PassBuilder::parseLoopPass(LoopPassManager &LPM, const PipelineElement &E,
if (!parseLoopPassPipeline(NestedLPM, InnerPipeline, VerifyEachPass,
DebugLogging))
return false;
LPM.addPass(createRepeatingPassWrapper(*Count, std::move(NestedLPM)));
LPM.addPass(createRepeatedPass(*Count, std::move(NestedLPM)));
return true;
}
// Normal passes can't have pipelines.

View File

@ -372,7 +372,7 @@
; RUN: -passes='repeat<3>(no-op-module)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-REPEAT-MODULE-PASS
; CHECK-REPEAT-MODULE-PASS: Starting llvm::Module pass manager run
; CHECK-REPEAT-MODULE-PASS-NEXT: Running pass: RepeatingPassWrapper
; CHECK-REPEAT-MODULE-PASS-NEXT: Running pass: RepeatedPass
; CHECK-REPEAT-MODULE-PASS-NEXT: Starting llvm::Module pass manager run
; CHECK-REPEAT-MODULE-PASS-NEXT: Running pass: NoOpModulePass
; CHECK-REPEAT-MODULE-PASS-NEXT: Finished llvm::Module pass manager run
@ -393,7 +393,7 @@
; CHECK-REPEAT-CGSCC-PASS-NEXT: Running analysis: LazyCallGraphAnalysis
; CHECK-REPEAT-CGSCC-PASS-NEXT: Running an SCC pass across the RefSCC: [(foo)]
; CHECK-REPEAT-CGSCC-PASS-NEXT: Starting llvm::LazyCallGraph::SCC pass manager run
; CHECK-REPEAT-CGSCC-PASS-NEXT: Running pass: RepeatingPassWrapper
; CHECK-REPEAT-CGSCC-PASS-NEXT: Running pass: RepeatedPass
; CHECK-REPEAT-CGSCC-PASS-NEXT: Starting llvm::LazyCallGraph::SCC pass manager run
; CHECK-REPEAT-CGSCC-PASS-NEXT: Running pass: NoOpCGSCCPass
; CHECK-REPEAT-CGSCC-PASS-NEXT: Finished llvm::LazyCallGraph::SCC pass manager run
@ -413,7 +413,7 @@
; CHECK-REPEAT-FUNCTION-PASS-NEXT: Running pass: ModuleToFunctionPassAdaptor
; CHECK-REPEAT-FUNCTION-PASS-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}>
; CHECK-REPEAT-FUNCTION-PASS-NEXT: Starting llvm::Function pass manager run
; CHECK-REPEAT-FUNCTION-PASS-NEXT: Running pass: RepeatingPassWrapper
; CHECK-REPEAT-FUNCTION-PASS-NEXT: Running pass: RepeatedPass
; CHECK-REPEAT-FUNCTION-PASS-NEXT: Starting llvm::Function pass manager run
; CHECK-REPEAT-FUNCTION-PASS-NEXT: Running pass: NoOpFunctionPass
; CHECK-REPEAT-FUNCTION-PASS-NEXT: Finished llvm::Function pass manager run
@ -438,7 +438,7 @@
; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: LoopAnalysis
; CHECK-REPEAT-LOOP-PASS-NEXT: Running analysis: DominatorTreeAnalysis
; CHECK-REPEAT-LOOP-PASS-NEXT: Starting llvm::Loop pass manager run
; CHECK-REPEAT-LOOP-PASS-NEXT: Running pass: RepeatingPassWrapper
; CHECK-REPEAT-LOOP-PASS-NEXT: Running pass: RepeatedPass
; CHECK-REPEAT-LOOP-PASS-NEXT: Starting llvm::Loop pass manager run
; CHECK-REPEAT-LOOP-PASS-NEXT: Running pass: NoOpLoopPass
; CHECK-REPEAT-LOOP-PASS-NEXT: Finished llvm::Loop pass manager run