llvm/polly/include/polly/ScopPass.h

//===--------- ScopPass.h - Pass for Static Control Parts --------*-C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines the ScopPass class.  ScopPasses are just RegionPasses,
// except they operate on Polly IR (Scop and ScopStmt) built by ScopInfo Pass.
// Because they operate on Polly IR, not the LLVM IR, ScopPasses are not allowed
// to modify the LLVM IR. Due to this limitation, the ScopPass class takes
// care of declaring that no LLVM passes are invalidated.
//
//===----------------------------------------------------------------------===//

#ifndef POLLY_SCOP_PASS_H
#define POLLY_SCOP_PASS_H

#include "polly/ScopInfo.h"
#include "llvm/ADT/PriorityWorklist.h"
#include "llvm/Analysis/RegionPass.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/PassManagerImpl.h"

namespace polly {
AllAnalysesOn;
AnalysisManager;
DominatorTreeAnalysis;
InnerAnalysisManagerProxy;
LoopAnalysis;
OuterAnalysisManagerProxy;
PassManager;
RegionInfoAnalysis;
ScalarEvolutionAnalysis;
SmallPriorityWorklist;
TargetIRAnalysis;
TargetTransformInfo;

class Scop;
class SPMUpdater;
struct ScopStandardAnalysisResults;

ScopAnalysisManager;
ScopAnalysisManagerFunctionProxy;
FunctionAnalysisManagerScopProxy;
} // namespace polly

namespace llvm {
Scop;
ScopAnalysisManager;
ScopAnalysisManagerFunctionProxy;
ScopInfo;
ScopStandardAnalysisResults;
SPMUpdater;

template <>
class InnerAnalysisManagerProxy<ScopAnalysisManager, Function>::Result {};

// A partial specialization of the require analysis template pass to handle
// extra parameters
RequireAnalysisPass<AnalysisT, Scop, ScopAnalysisManager, ScopStandardAnalysisResults &, SPMUpdater &>;

template <>
InnerAnalysisManagerProxy<ScopAnalysisManager, Function>::Result
InnerAnalysisManagerProxy<ScopAnalysisManager, Function>::run(
    Function &F, FunctionAnalysisManager &FAM);

template <>
PreservedAnalyses
PassManager<Scop, ScopAnalysisManager, ScopStandardAnalysisResults &,
            SPMUpdater &>::run(Scop &InitialS, ScopAnalysisManager &AM,
                               ScopStandardAnalysisResults &, SPMUpdater &);
extern template class PassManager<Scop, ScopAnalysisManager,
                                  ScopStandardAnalysisResults &, SPMUpdater &>;
extern template class InnerAnalysisManagerProxy<ScopAnalysisManager, Function>;
extern template class OuterAnalysisManagerProxy<FunctionAnalysisManager, Scop,
                                                ScopStandardAnalysisResults &>;
} // namespace llvm

namespace polly {

template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
class OwningInnerAnalysisManagerProxy final
    : public InnerAnalysisManagerProxy<AnalysisManagerT, IRUnitT> {};

template <>
OwningInnerAnalysisManagerProxy<ScopAnalysisManager, Function>::Result
OwningInnerAnalysisManagerProxy<ScopAnalysisManager, Function>::run(
    Function &F, FunctionAnalysisManager &FAM);
extern template class OwningInnerAnalysisManagerProxy<ScopAnalysisManager,
                                                      Function>;

OwningScopAnalysisManagerFunctionProxy;
ScopPassManager;

/// ScopPass - This class adapts the RegionPass interface to allow convenient
/// creation of passes that operate on the Polly IR. Instead of overriding
/// runOnRegion, subclasses override runOnScop.
class ScopPass : public RegionPass {};

struct ScopStandardAnalysisResults {};

class SPMUpdater final {};

template <typename ScopPassT>
struct FunctionToScopPassAdaptor final
    : PassInfoMixin<FunctionToScopPassAdaptor<ScopPassT>> {};

template <typename ScopPassT>
FunctionToScopPassAdaptor<ScopPassT>
createFunctionToScopPassAdaptor(ScopPassT Pass) {}
} // namespace polly

#endif