reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
#include "llvm/IR/PassManager.h"
#include "polly/CodeGen/IslAst.h"
#include "polly/DependenceInfo.h"
#include "polly/ScopPass.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/CGSCCPassManager.h"
#include "llvm/Passes/PassBuilder.h"
#include "llvm/Transforms/Scalar/LoopPassManager.h"
#include "gtest/gtest.h"

using namespace polly;
using namespace llvm;

namespace {
class ScopPassRegistry : public ::testing::Test {
protected:
  ModuleAnalysisManager MAM;
  FunctionAnalysisManager FAM;
  LoopAnalysisManager LAM;
  CGSCCAnalysisManager CGAM;
  ScopAnalysisManager SAM;
  AAManager AM;

public:
  ScopPassRegistry(ScopPassRegistry &&) = delete;
  ScopPassRegistry(const ScopPassRegistry &) = delete;
  ScopPassRegistry &operator=(ScopPassRegistry &&) = delete;
  ScopPassRegistry &operator=(const ScopPassRegistry &) = delete;
  ScopPassRegistry() {
    PassBuilder PB;

    AM = PB.buildDefaultAAPipeline();
    PB.registerModuleAnalyses(MAM);
    PB.registerFunctionAnalyses(FAM);
    PB.registerLoopAnalyses(LAM);
    PB.registerCGSCCAnalyses(CGAM);

    FAM.registerPass([] { return ScopAnalysis(); });
    FAM.registerPass([] { return ScopInfoAnalysis(); });
    FAM.registerPass([this] { return ScopAnalysisManagerFunctionProxy(SAM); });

    // SAM.registerPass([] { return IslAstAnalysis(); });
    // SAM.registerPass([] { return DependenceAnalysis(); });
    SAM.registerPass([this] { return FunctionAnalysisManagerScopProxy(FAM); });

    PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
  }
};

TEST_F(ScopPassRegistry, PrintScops) {
  FunctionPassManager FPM;
  FPM.addPass(ScopAnalysisPrinterPass(errs()));
}

TEST_F(ScopPassRegistry, PrintScopInfo) {
  FunctionPassManager FPM;
  FPM.addPass(ScopInfoPrinterPass(errs()));
}

TEST_F(ScopPassRegistry, PrinIslAstInfo) {
  FunctionPassManager FPM;
  ScopPassManager SPM;
  // SPM.addPass(IslAstPrinterPass(errs()));
  FPM.addPass(createFunctionToScopPassAdaptor(std::move(SPM)));
}
} // namespace