1 #include "llvm/IR/PassManager.h"
2 #include "polly/CodeGen/IslAst.h"
3 #include "polly/DependenceInfo.h"
4 #include "polly/ScopPass.h"
5 #include "llvm/Analysis/AliasAnalysis.h"
6 #include "llvm/Analysis/CGSCCPassManager.h"
7 #include "llvm/Passes/PassBuilder.h"
8 #include "llvm/Transforms/Scalar/LoopPassManager.h"
9 #include "gtest/gtest.h"
11 using namespace polly
;
15 class ScopPassRegistry
: public ::testing::Test
{
17 ModuleAnalysisManager MAM
;
18 FunctionAnalysisManager FAM
;
19 LoopAnalysisManager LAM
;
20 CGSCCAnalysisManager CGAM
;
21 ScopAnalysisManager SAM
;
25 ScopPassRegistry(ScopPassRegistry
&&) = delete;
26 ScopPassRegistry(const ScopPassRegistry
&) = delete;
27 ScopPassRegistry
&operator=(ScopPassRegistry
&&) = delete;
28 ScopPassRegistry
&operator=(const ScopPassRegistry
&) = delete;
32 AM
= PB
.buildDefaultAAPipeline();
33 PB
.registerModuleAnalyses(MAM
);
34 PB
.registerFunctionAnalyses(FAM
);
35 PB
.registerLoopAnalyses(LAM
);
36 PB
.registerCGSCCAnalyses(CGAM
);
38 FAM
.registerPass([] { return ScopAnalysis(); });
39 FAM
.registerPass([] { return ScopInfoAnalysis(); });
40 FAM
.registerPass([this] { return ScopAnalysisManagerFunctionProxy(SAM
); });
42 // SAM.registerPass([] { return IslAstAnalysis(); });
43 // SAM.registerPass([] { return DependenceAnalysis(); });
44 SAM
.registerPass([this] { return FunctionAnalysisManagerScopProxy(FAM
); });
46 PB
.crossRegisterProxies(LAM
, FAM
, CGAM
, MAM
);
50 TEST_F(ScopPassRegistry
, PrintScops
) {
51 FunctionPassManager FPM
;
52 FPM
.addPass(ScopAnalysisPrinterPass(errs()));
55 TEST_F(ScopPassRegistry
, PrintScopInfo
) {
56 FunctionPassManager FPM
;
57 FPM
.addPass(ScopInfoPrinterPass(errs()));
60 TEST_F(ScopPassRegistry
, PrinIslAstInfo
) {
61 FunctionPassManager FPM
;
63 // SPM.addPass(IslAstPrinterPass(errs()));
64 FPM
.addPass(createFunctionToScopPassAdaptor(std::move(SPM
)));