[PM] Refactor the analysis registration and pass pipeline parsing to

live in a class.

While this isn't really significant right now, I need to expose some
state to the pass construction expressions, and making them get
evaluated within a class context is a nice way to collect members that
they may need to access.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227715 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chandler Carruth
2015-02-01 07:40:05 +00:00
parent 29bd1dd972
commit 581ef38430
3 changed files with 96 additions and 71 deletions

View File

@@ -38,14 +38,16 @@ static cl::opt<bool>
bool llvm::runPassPipeline(StringRef Arg0, LLVMContext &Context, Module &M,
tool_output_file *Out, StringRef PassPipeline,
OutputKind OK, VerifierKind VK) {
Passes P;
FunctionAnalysisManager FAM(DebugPM);
CGSCCAnalysisManager CGAM(DebugPM);
ModuleAnalysisManager MAM(DebugPM);
// Register all the basic analyses with the managers.
registerModuleAnalyses(MAM);
registerCGSCCAnalyses(CGAM);
registerFunctionAnalyses(FAM);
P.registerModuleAnalyses(MAM);
P.registerCGSCCAnalyses(CGAM);
P.registerFunctionAnalyses(FAM);
// Cross register the analysis managers through their proxies.
MAM.registerPass(FunctionAnalysisManagerModuleProxy(FAM));
@@ -59,7 +61,8 @@ bool llvm::runPassPipeline(StringRef Arg0, LLVMContext &Context, Module &M,
if (VK > VK_NoVerifier)
MPM.addPass(VerifierPass());
if (!parsePassPipeline(MPM, PassPipeline, VK == VK_VerifyEachPass, DebugPM)) {
if (!P.parsePassPipeline(MPM, PassPipeline, VK == VK_VerifyEachPass,
DebugPM)) {
errs() << Arg0 << ": unable to parse pass pipeline description.\n";
return false;
}