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"
10
11using namespace polly;
12using namespace llvm;
13
14namespace {
15class ScopPassRegistry : public ::testing::Test {
16protected:
17 ModuleAnalysisManager MAM;
18 FunctionAnalysisManager FAM;
19 LoopAnalysisManager LAM;
20 CGSCCAnalysisManager CGAM;
21 ScopAnalysisManager SAM;
22 AAManager AM;
23
24public:
25 ScopPassRegistry(ScopPassRegistry &&) = delete;
26 ScopPassRegistry(const ScopPassRegistry &) = delete;
27 ScopPassRegistry &operator=(ScopPassRegistry &&) = delete;
28 ScopPassRegistry &operator=(const ScopPassRegistry &) = delete;
29 ScopPassRegistry() {
30 PassBuilder PB;
31
32 AM = PB.buildDefaultAAPipeline();
33 PB.registerModuleAnalyses(MAM);
34 PB.registerFunctionAnalyses(FAM);
35 PB.registerLoopAnalyses(LAM);
36 PB.registerCGSCCAnalyses(CGAM);
37
38 FAM.registerPass(PassBuilder: [] { return ScopAnalysis(); });
39 FAM.registerPass(PassBuilder: [] { return ScopInfoAnalysis(); });
40 FAM.registerPass(PassBuilder: [this] { return ScopAnalysisManagerFunctionProxy(SAM); });
41
42 // SAM.registerPass([] { return IslAstAnalysis(); });
43 // SAM.registerPass([] { return DependenceAnalysis(); });
44 SAM.registerPass(PassBuilder: [this] { return FunctionAnalysisManagerScopProxy(FAM); });
45
46 PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
47 }
48};
49
50TEST_F(ScopPassRegistry, PrintScops) {
51 FunctionPassManager FPM;
52 FPM.addPass(Pass: ScopAnalysisPrinterPass(errs()));
53}
54
55TEST_F(ScopPassRegistry, PrintScopInfo) {
56 FunctionPassManager FPM;
57 FPM.addPass(Pass: ScopInfoPrinterPass(errs()));
58}
59
60TEST_F(ScopPassRegistry, PrinIslAstInfo) {
61 FunctionPassManager FPM;
62 ScopPassManager SPM;
63 // SPM.addPass(IslAstPrinterPass(errs()));
64 FPM.addPass(Pass: createFunctionToScopPassAdaptor(Pass: std::move(SPM)));
65}
66} // namespace
67

source code of polly/unittests/ScopPassManager/PassManagerTest.cpp