[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:
Chandler Carruth
2015-01-06 02:50:06 +00:00
parent 2e306caf39
commit 5b12a2f703
4 changed files with 57 additions and 7 deletions

View File

@@ -32,6 +32,18 @@ struct 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.
struct NoOpCGSCCPass {
PreservedAnalyses run(LazyCallGraph::SCC &C) {
@@ -40,12 +52,36 @@ struct 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.
struct NoOpFunctionPass {
PreservedAnalyses run(Function &F) { return PreservedAnalyses::all(); }
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.
void llvm::registerModuleAnalyses(ModuleAnalysisManager &MAM) {