mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-30 04:56:49 +00:00
[PM] Add a collection of no-op analysis passes and switch the new pass
manager tests to use them and be significantly more comprehensive. This, naturally, uncovered a bug where the CGSCC pass manager wasn't printing analyses when they were run. The only remaining core manipulator is I think an invalidate pass similar to the require pass. That'll be next. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225240 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2e306caf39
commit
5b12a2f703
@ -62,8 +62,11 @@ CGSCCAnalysisManager::getResultImpl(void *PassID, LazyCallGraph::SCC &C) {
|
|||||||
// If we don't have a cached result for this function, look up the pass and
|
// If we don't have a cached result for this function, look up the pass and
|
||||||
// run it to produce a result, which we then add to the cache.
|
// run it to produce a result, which we then add to the cache.
|
||||||
if (Inserted) {
|
if (Inserted) {
|
||||||
|
auto &P = lookupPass(PassID);
|
||||||
|
if (DebugPM)
|
||||||
|
dbgs() << "Running CGSCC analysis: " << P.name() << "\n";
|
||||||
CGSCCAnalysisResultListT &ResultList = CGSCCAnalysisResultLists[&C];
|
CGSCCAnalysisResultListT &ResultList = CGSCCAnalysisResultLists[&C];
|
||||||
ResultList.emplace_back(PassID, lookupPass(PassID).run(C, this));
|
ResultList.emplace_back(PassID, P.run(C, this));
|
||||||
RI->second = std::prev(ResultList.end());
|
RI->second = std::prev(ResultList.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,15 +86,23 @@
|
|||||||
; CHECK-NO-VERIFY-NOT: VerifierPass
|
; CHECK-NO-VERIFY-NOT: VerifierPass
|
||||||
; CHECK-NO-VERIFY: Finished module pass manager
|
; CHECK-NO-VERIFY: Finished module pass manager
|
||||||
|
|
||||||
; RUN: opt -disable-output -debug-pass-manager -passes='require<lcg>' %s 2>&1 \
|
; RUN: opt -disable-output -debug-pass-manager -debug-cgscc-pass-manager \
|
||||||
; RUN: | FileCheck %s --check-prefix=CHECK-LCG-ANALYSIS
|
; RUN: -passes='require<no-op-module>,cgscc(require<no-op-cgscc>,function(require<no-op-function>))' %s 2>&1 \
|
||||||
; CHECK-LCG-ANALYSIS: Starting module pass manager
|
; RUN: | FileCheck %s --check-prefix=CHECK-ANALYSES
|
||||||
; CHECK-LCG-ANALYSIS: Running module pass: No-op Analysis Requirement Pass
|
; CHECK-ANALYSES: Starting module pass manager
|
||||||
; CHECK-LCG-ANALYSIS: Running module analysis: Lazy CallGraph Analysis
|
; CHECK-ANALYSES: Running module pass: No-op Analysis Requirement Pass
|
||||||
|
; CHECK-ANALYSES: Running module analysis: NoOpModuleAnalysis
|
||||||
|
; CHECK-ANALYSES: Starting CGSCC pass manager
|
||||||
|
; CHECK-ANALYSES: Running CGSCC pass: No-op Analysis Requirement Pass
|
||||||
|
; CHECK-ANALYSES: Running CGSCC analysis: NoOpCGSCCAnalysis
|
||||||
|
; CHECK-ANALYSES: Starting function pass manager
|
||||||
|
; CHECK-ANALYSES: Running function pass: No-op Analysis Requirement Pass
|
||||||
|
; CHECK-ANALYSES: Running function analysis: NoOpFunctionAnalysis
|
||||||
|
|
||||||
; Make sure no-op passes that preserve all analyses don't even try to do any
|
; Make sure no-op passes that preserve all analyses don't even try to do any
|
||||||
; analysis invalidation.
|
; analysis invalidation.
|
||||||
; RUN: opt -disable-output -debug-pass-manager -debug-cgscc-pass-manager -passes='cgscc(function(no-op-function))' %s 2>&1 \
|
; RUN: opt -disable-output -debug-pass-manager -debug-cgscc-pass-manager \
|
||||||
|
; RUN: -passes='require<no-op-module>,cgscc(require<no-op-cgscc>,function(require<no-op-function>))' %s 2>&1 \
|
||||||
; RUN: | FileCheck %s --check-prefix=CHECK-NO-OP-INVALIDATION
|
; RUN: | FileCheck %s --check-prefix=CHECK-NO-OP-INVALIDATION
|
||||||
; CHECK-NO-OP-INVALIDATION: Starting module pass manager
|
; CHECK-NO-OP-INVALIDATION: Starting module pass manager
|
||||||
; CHECK-NO-OP-INVALIDATION-NOT: Invalidating all non-preserved analyses
|
; CHECK-NO-OP-INVALIDATION-NOT: Invalidating all non-preserved analyses
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#define MODULE_ANALYSIS(NAME, CREATE_PASS)
|
#define MODULE_ANALYSIS(NAME, CREATE_PASS)
|
||||||
#endif
|
#endif
|
||||||
MODULE_ANALYSIS("lcg", LazyCallGraphAnalysis())
|
MODULE_ANALYSIS("lcg", LazyCallGraphAnalysis())
|
||||||
|
MODULE_ANALYSIS("no-op-module", NoOpModuleAnalysis())
|
||||||
#undef MODULE_ANALYSIS
|
#undef MODULE_ANALYSIS
|
||||||
|
|
||||||
#ifndef MODULE_PASS
|
#ifndef MODULE_PASS
|
||||||
@ -34,6 +35,7 @@ MODULE_PASS("verify", VerifierPass())
|
|||||||
#ifndef CGSCC_ANALYSIS
|
#ifndef CGSCC_ANALYSIS
|
||||||
#define CGSCC_ANALYSIS(NAME, CREATE_PASS)
|
#define CGSCC_ANALYSIS(NAME, CREATE_PASS)
|
||||||
#endif
|
#endif
|
||||||
|
CGSCC_ANALYSIS("no-op-cgscc", NoOpCGSCCAnalysis())
|
||||||
#undef CGSCC_ANALYSIS
|
#undef CGSCC_ANALYSIS
|
||||||
|
|
||||||
#ifndef CGSCC_PASS
|
#ifndef CGSCC_PASS
|
||||||
@ -45,6 +47,7 @@ CGSCC_PASS("no-op-cgscc", NoOpCGSCCPass())
|
|||||||
#ifndef FUNCTION_ANALYSIS
|
#ifndef FUNCTION_ANALYSIS
|
||||||
#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
|
#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
|
||||||
#endif
|
#endif
|
||||||
|
FUNCTION_ANALYSIS("no-op-function", NoOpFunctionAnalysis())
|
||||||
#undef FUNCTION_ANALYSIS
|
#undef FUNCTION_ANALYSIS
|
||||||
|
|
||||||
#ifndef FUNCTION_PASS
|
#ifndef FUNCTION_PASS
|
||||||
|
@ -32,6 +32,18 @@ struct NoOpModulePass {
|
|||||||
static StringRef name() { return "NoOpModulePass"; }
|
static StringRef name() { return "NoOpModulePass"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// \brief No-op module analysis.
|
||||||
|
struct NoOpModuleAnalysis {
|
||||||
|
struct Result {};
|
||||||
|
Result run(Module &) { return Result(); }
|
||||||
|
static StringRef name() { return "NoOpModuleAnalysis"; }
|
||||||
|
static void *ID() { return (void *)&PassID; }
|
||||||
|
private:
|
||||||
|
static char PassID;
|
||||||
|
};
|
||||||
|
|
||||||
|
char NoOpModuleAnalysis::PassID;
|
||||||
|
|
||||||
/// \brief No-op CGSCC pass which does nothing.
|
/// \brief No-op CGSCC pass which does nothing.
|
||||||
struct NoOpCGSCCPass {
|
struct NoOpCGSCCPass {
|
||||||
PreservedAnalyses run(LazyCallGraph::SCC &C) {
|
PreservedAnalyses run(LazyCallGraph::SCC &C) {
|
||||||
@ -40,12 +52,36 @@ struct NoOpCGSCCPass {
|
|||||||
static StringRef name() { return "NoOpCGSCCPass"; }
|
static StringRef name() { return "NoOpCGSCCPass"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// \brief No-op CGSCC analysis.
|
||||||
|
struct NoOpCGSCCAnalysis {
|
||||||
|
struct Result {};
|
||||||
|
Result run(LazyCallGraph::SCC &) { return Result(); }
|
||||||
|
static StringRef name() { return "NoOpCGSCCAnalysis"; }
|
||||||
|
static void *ID() { return (void *)&PassID; }
|
||||||
|
private:
|
||||||
|
static char PassID;
|
||||||
|
};
|
||||||
|
|
||||||
|
char NoOpCGSCCAnalysis::PassID;
|
||||||
|
|
||||||
/// \brief No-op function pass which does nothing.
|
/// \brief No-op function pass which does nothing.
|
||||||
struct NoOpFunctionPass {
|
struct NoOpFunctionPass {
|
||||||
PreservedAnalyses run(Function &F) { return PreservedAnalyses::all(); }
|
PreservedAnalyses run(Function &F) { return PreservedAnalyses::all(); }
|
||||||
static StringRef name() { return "NoOpFunctionPass"; }
|
static StringRef name() { return "NoOpFunctionPass"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// \brief No-op function analysis.
|
||||||
|
struct NoOpFunctionAnalysis {
|
||||||
|
struct Result {};
|
||||||
|
Result run(Function &) { return Result(); }
|
||||||
|
static StringRef name() { return "NoOpFunctionAnalysis"; }
|
||||||
|
static void *ID() { return (void *)&PassID; }
|
||||||
|
private:
|
||||||
|
static char PassID;
|
||||||
|
};
|
||||||
|
|
||||||
|
char NoOpFunctionAnalysis::PassID;
|
||||||
|
|
||||||
} // End anonymous namespace.
|
} // End anonymous namespace.
|
||||||
|
|
||||||
void llvm::registerModuleAnalyses(ModuleAnalysisManager &MAM) {
|
void llvm::registerModuleAnalyses(ModuleAnalysisManager &MAM) {
|
||||||
|
Loading…
Reference in New Issue
Block a user