[Polly] Mark classes as final by default. NFC.

This make is obivious that a class was not intended to be derived from.

NPM analysis pass can unfortunately not marked as final because they are
derived from a llvm::Checker<T> template internally by the NPM.

Also normalize the use of classes/structs
 * NPM passes are structs
 * Legacy passes are classes
 * structs that have methods and are not a visitor pattern are classes
 * structs have public inheritance by default, remove "public" keyword
 * Use typedef'ed type instead of inline forward declaration
This commit is contained in:
Michael Kruse 2022-05-17 10:55:27 -05:00
parent d92cec4c96
commit bd93df937a
66 changed files with 209 additions and 212 deletions

View File

@ -41,8 +41,8 @@ template <typename AnalysisT, bool IsSimple,
typename AnalysisGraphTraitsT =
DefaultAnalysisGraphTraits<typename AnalysisT::Result &, GraphT>>
struct DOTGraphTraitsViewer
: public PassInfoMixin<DOTGraphTraitsViewer<AnalysisT, IsSimple, GraphT,
AnalysisGraphTraitsT>> {
: PassInfoMixin<DOTGraphTraitsViewer<AnalysisT, IsSimple, GraphT,
AnalysisGraphTraitsT>> {
DOTGraphTraitsViewer(StringRef GraphName) : Name(GraphName) {}
virtual ~DOTGraphTraitsViewer() {}
@ -96,8 +96,8 @@ template <typename AnalysisT, bool IsSimple,
typename AnalysisGraphTraitsT =
DefaultAnalysisGraphTraits<typename AnalysisT::Result &, GraphT>>
struct DOTGraphTraitsPrinter
: public PassInfoMixin<DOTGraphTraitsPrinter<AnalysisT, IsSimple, GraphT,
AnalysisGraphTraitsT>> {
: PassInfoMixin<DOTGraphTraitsPrinter<AnalysisT, IsSimple, GraphT,
AnalysisGraphTraitsT>> {
DOTGraphTraitsPrinter(StringRef GraphName) : Name(GraphName) {}
virtual ~DOTGraphTraitsPrinter() {}

View File

@ -625,7 +625,7 @@ protected:
/// Generate a new vector basic block for a polyhedral statement.
///
/// The only public function exposed is generate().
class VectorBlockGenerator : BlockGenerator {
class VectorBlockGenerator final : BlockGenerator {
public:
/// Generate a new vector basic block for a ScoPStmt.
///
@ -803,7 +803,7 @@ private:
};
/// Generator for new versions of polyhedral region statements.
class RegionGenerator : public BlockGenerator {
class RegionGenerator final : BlockGenerator {
public:
/// Create a generator for regions.
///

View File

@ -28,7 +28,7 @@ extern VectorizerChoice PollyVectorizerChoice;
/// UnreachableInst.
void markBlockUnreachable(BasicBlock &Block, PollyIRBuilder &Builder);
struct CodeGenerationPass : public PassInfoMixin<CodeGenerationPass> {
struct CodeGenerationPass final : PassInfoMixin<CodeGenerationPass> {
PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
ScopStandardAnalysisResults &AR, SPMUpdater &U);
};

View File

@ -120,7 +120,7 @@ private:
class IRInserter final : public llvm::IRBuilderDefaultInserter {
public:
IRInserter() = default;
IRInserter(class ScopAnnotator &A) : Annotator(&A) {}
IRInserter(ScopAnnotator &A) : Annotator(&A) {}
void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name,
llvm::BasicBlock *BB,
@ -131,7 +131,7 @@ public:
}
private:
class ScopAnnotator *Annotator = nullptr;
ScopAnnotator *Annotator = nullptr;
};
// TODO: We should not name instructions in NDEBUG builds.

View File

@ -29,9 +29,9 @@
namespace polly {
using llvm::SmallPtrSet;
struct Dependences;
class Dependences;
class IslAst {
class IslAst final {
public:
IslAst(const IslAst &) = delete;
IslAst &operator=(const IslAst &) = delete;
@ -163,7 +163,7 @@ public:
///}
};
struct IslAstAnalysis : public AnalysisInfoMixin<IslAstAnalysis> {
struct IslAstAnalysis : AnalysisInfoMixin<IslAstAnalysis> {
static AnalysisKey Key;
using Result = IslAstInfo;
@ -172,7 +172,7 @@ struct IslAstAnalysis : public AnalysisInfoMixin<IslAstAnalysis> {
ScopStandardAnalysisResults &SAR);
};
class IslAstInfoWrapperPass : public ScopPass {
class IslAstInfoWrapperPass final : public ScopPass {
std::unique_ptr<IslAstInfo> Ast;
public:
@ -199,7 +199,7 @@ public:
llvm::Pass *createIslAstInfoWrapperPassPass();
llvm::Pass *createIslAstInfoPrinterLegacyPass(llvm::raw_ostream &OS);
struct IslAstPrinterPass : public PassInfoMixin<IslAstPrinterPass> {
struct IslAstPrinterPass final : PassInfoMixin<IslAstPrinterPass> {
IslAstPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,

View File

@ -78,7 +78,7 @@ class ScopArrayInfo;
/// to use this information in our IslAstGenerator. Preliminary patches are
/// available, but have not been committed yet.
///
class IslExprBuilder {
class IslExprBuilder final {
public:
/// A map from isl_ids to llvm::Values.
typedef llvm::MapVector<isl_id *, llvm::AssertingVH<llvm::Value>> IDToValueTy;

View File

@ -22,7 +22,7 @@ namespace polly {
/// This ParallelLoopGenerator subclass handles the generation of parallelized
/// code, utilizing the GNU OpenMP library.
class ParallelLoopGeneratorGOMP : public ParallelLoopGenerator {
class ParallelLoopGeneratorGOMP final : public ParallelLoopGenerator {
public:
/// Create a parallel loop generator for the current function.
ParallelLoopGeneratorGOMP(PollyIRBuilder &Builder, LoopInfo &LI,

View File

@ -24,7 +24,7 @@ using llvm::GlobalVariable;
/// This ParallelLoopGenerator subclass handles the generation of parallelized
/// code, utilizing the LLVM OpenMP library.
class ParallelLoopGeneratorKMP : public ParallelLoopGenerator {
class ParallelLoopGeneratorKMP final : public ParallelLoopGenerator {
public:
/// Create a parallel loop generator for the current function.
ParallelLoopGeneratorKMP(PollyIRBuilder &Builder, LoopInfo &LI,

View File

@ -13,7 +13,7 @@
namespace polly {
class PerfMonitor {
class PerfMonitor final {
public:
/// Create a new performance monitor.
///

View File

@ -16,7 +16,7 @@
#include "llvm/IR/PassManager.h"
namespace polly {
struct CodePreparationPass : public llvm::PassInfoMixin<CodePreparationPass> {
struct CodePreparationPass final : llvm::PassInfoMixin<CodePreparationPass> {
llvm::PreservedAnalyses run(llvm::Function &F,
llvm::FunctionAnalysisManager &FAM);
};

View File

@ -31,14 +31,14 @@ namespace polly {
llvm::Pass *createDeLICMWrapperPass();
llvm::Pass *createDeLICMPrinterLegacyPass(llvm::raw_ostream &OS);
struct DeLICMPass : llvm::PassInfoMixin<DeLICMPass> {
struct DeLICMPass final : llvm::PassInfoMixin<DeLICMPass> {
DeLICMPass() {}
llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
ScopStandardAnalysisResults &SAR, SPMUpdater &U);
};
struct DeLICMPrinterPass : llvm::PassInfoMixin<DeLICMPrinterPass> {
struct DeLICMPrinterPass final : llvm::PassInfoMixin<DeLICMPrinterPass> {
DeLICMPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Scop &S, ScopAnalysisManager &,

View File

@ -24,7 +24,7 @@ class raw_ostream;
namespace polly {
llvm::Pass *createDeadCodeElimWrapperPass();
struct DeadCodeElimPass : llvm::PassInfoMixin<DeadCodeElimPass> {
struct DeadCodeElimPass final : llvm::PassInfoMixin<DeadCodeElimPass> {
DeadCodeElimPass() {}
llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,

View File

@ -33,7 +33,8 @@ namespace polly {
/// The Dependences struct holds all dependence information we collect and
/// compute for one SCoP. It also offers an interface that allows users to
/// query only specific parts.
struct Dependences {
class Dependences final {
public:
// Granularities of the current dependence analysis
enum AnalysisLevel {
AL_Statement = 0,
@ -191,7 +192,7 @@ private:
const AnalysisLevel Level;
};
struct DependenceAnalysis : public AnalysisInfoMixin<DependenceAnalysis> {
struct DependenceAnalysis final : public AnalysisInfoMixin<DependenceAnalysis> {
static AnalysisKey Key;
struct Result {
Scop &S;
@ -212,8 +213,8 @@ struct DependenceAnalysis : public AnalysisInfoMixin<DependenceAnalysis> {
ScopStandardAnalysisResults &SAR);
};
struct DependenceInfoPrinterPass
: public PassInfoMixin<DependenceInfoPrinterPass> {
struct DependenceInfoPrinterPass final
: PassInfoMixin<DependenceInfoPrinterPass> {
DependenceInfoPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Scop &S, ScopAnalysisManager &,
@ -222,7 +223,7 @@ struct DependenceInfoPrinterPass
raw_ostream &OS;
};
class DependenceInfo : public ScopPass {
class DependenceInfo final : public ScopPass {
public:
static char ID;
@ -266,7 +267,7 @@ llvm::Pass *createDependenceInfoPass();
llvm::Pass *createDependenceInfoPrinterLegacyPass(llvm::raw_ostream &OS);
/// Construct a new DependenceInfoWrapper pass.
class DependenceInfoWrapperPass : public FunctionPass {
class DependenceInfoWrapperPass final : public FunctionPass {
public:
static char ID;

View File

@ -23,14 +23,14 @@ namespace polly {
llvm::Pass *createForwardOpTreeWrapperPass();
llvm::Pass *createForwardOpTreePrinterLegacyPass(llvm::raw_ostream &OS);
struct ForwardOpTreePass : llvm::PassInfoMixin<ForwardOpTreePass> {
struct ForwardOpTreePass final : llvm::PassInfoMixin<ForwardOpTreePass> {
ForwardOpTreePass() {}
llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
ScopStandardAnalysisResults &SAR, SPMUpdater &U);
};
struct ForwardOpTreePrinterPass
struct ForwardOpTreePrinterPass final
: llvm::PassInfoMixin<ForwardOpTreePrinterPass> {
ForwardOpTreePrinterPass(raw_ostream &OS) : OS(OS) {}

View File

@ -19,14 +19,14 @@ llvm::Pass *createJSONImporterPrinterLegacyPass(llvm::raw_ostream &OS);
/// This pass exports a scop to a jscop file. The filename is generated from the
/// concatenation of the function and scop name.
struct JSONExportPass : public llvm::PassInfoMixin<JSONExportPass> {
struct JSONExportPass final : llvm::PassInfoMixin<JSONExportPass> {
llvm::PreservedAnalyses run(Scop &, ScopAnalysisManager &,
ScopStandardAnalysisResults &, SPMUpdater &);
};
/// This pass imports a scop from a jscop file. The filename is deduced from the
/// concatenation of the function and scop name.
struct JSONImportPass : public llvm::PassInfoMixin<JSONExportPass> {
struct JSONImportPass final : llvm::PassInfoMixin<JSONExportPass> {
llvm::PreservedAnalyses run(Scop &, ScopAnalysisManager &,
ScopStandardAnalysisResults &, SPMUpdater &);
};

View File

@ -21,7 +21,7 @@ class OptimizationRemarkEmitter;
namespace polly {
class Scop;
struct Dependences;
class Dependences;
/// Apply loop-transformation metadata.
///

View File

@ -16,7 +16,7 @@ class TargetTransformInfo;
}
namespace polly {
struct Dependences;
class Dependences;
/// Apply the BLIS matmul optimization pattern if possible.
///

View File

@ -31,7 +31,7 @@ class Scop;
class ScopInfo;
class DependenceInfoWrapperPass;
class PolyhedralInfo : public llvm::FunctionPass {
class PolyhedralInfo final : public llvm::FunctionPass {
public:
static char ID; // Pass identification, replacement for typeid

View File

@ -23,7 +23,8 @@ class PassRegistry;
namespace polly {
llvm::Pass *createPruneUnprofitableWrapperPass();
struct PruneUnprofitablePass : llvm::PassInfoMixin<PruneUnprofitablePass> {
struct PruneUnprofitablePass final
: llvm::PassInfoMixin<PruneUnprofitablePass> {
PruneUnprofitablePass() {}
llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,

View File

@ -20,7 +20,7 @@ namespace polly {
llvm::Pass *createIslScheduleOptimizerWrapperPass();
llvm::Pass *createIslScheduleOptimizerPrinterLegacyPass(llvm::raw_ostream &OS);
struct IslScheduleOptimizerPass
struct IslScheduleOptimizerPass final
: llvm::PassInfoMixin<IslScheduleOptimizerPass> {
IslScheduleOptimizerPass() {}
@ -28,7 +28,7 @@ struct IslScheduleOptimizerPass
ScopStandardAnalysisResults &SAR, SPMUpdater &U);
};
struct IslScheduleOptimizerPrinterPass
struct IslScheduleOptimizerPrinterPass final
: llvm::PassInfoMixin<IslScheduleOptimizerPrinterPass> {
IslScheduleOptimizerPrinterPass(raw_ostream &OS) : OS(OS) {}

View File

@ -126,7 +126,7 @@ struct ScheduleTreeVisitor {
/// Recursively visit all nodes of a schedule tree.
template <typename Derived, typename RetTy = void, typename... Args>
struct RecursiveScheduleTreeVisitor
: public ScheduleTreeVisitor<Derived, RetTy, Args...> {
: ScheduleTreeVisitor<Derived, RetTy, Args...> {
using BaseTy = ScheduleTreeVisitor<Derived, RetTy, Args...>;
BaseTy &getBase() { return *this; }
const BaseTy &getBase() const { return *this; }

View File

@ -30,7 +30,7 @@ class ScopDetection;
extern bool ModelReadOnlyScalars;
/// Build the Polly IR (Scop and ScopStmt) on a Region.
class ScopBuilder {
class ScopBuilder final {
/// The AAResults to build AliasSetTracker.
AAResults &AA;

View File

@ -627,7 +627,7 @@ private:
OptimizationRemarkEmitter &ORE;
};
struct ScopAnalysis : public AnalysisInfoMixin<ScopAnalysis> {
struct ScopAnalysis : AnalysisInfoMixin<ScopAnalysis> {
static AnalysisKey Key;
using Result = ScopDetection;
@ -637,7 +637,7 @@ struct ScopAnalysis : public AnalysisInfoMixin<ScopAnalysis> {
Result run(Function &F, FunctionAnalysisManager &FAM);
};
struct ScopAnalysisPrinterPass : public PassInfoMixin<ScopAnalysisPrinterPass> {
struct ScopAnalysisPrinterPass final : PassInfoMixin<ScopAnalysisPrinterPass> {
ScopAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
@ -645,19 +645,20 @@ struct ScopAnalysisPrinterPass : public PassInfoMixin<ScopAnalysisPrinterPass> {
raw_ostream &OS;
};
struct ScopDetectionWrapperPass : public FunctionPass {
static char ID;
class ScopDetectionWrapperPass final : public FunctionPass {
std::unique_ptr<ScopDetection> Result;
public:
ScopDetectionWrapperPass();
/// @name FunctionPass interface
//@{
///@{
static char ID;
void getAnalysisUsage(AnalysisUsage &AU) const override;
void releaseMemory() override;
bool runOnFunction(Function &F) override;
void print(raw_ostream &OS, const Module *M = nullptr) const override;
//@}
///@}
ScopDetection &getSD() const { return *Result; }
};

View File

@ -163,7 +163,7 @@ public:
using RejectReasonPtr = std::shared_ptr<RejectReason>;
/// Stores all errors that occurred during the detection.
class RejectLog {
class RejectLog final {
Region *R;
SmallVector<RejectReasonPtr, 1> ErrorReports;
@ -204,7 +204,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures bad terminator within a Scop candidate.
class ReportInvalidTerminator : public ReportCFG {
class ReportInvalidTerminator final : public ReportCFG {
BasicBlock *BB;
public:
@ -227,7 +227,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures irreducible regions in CFG.
class ReportIrreducibleRegion : public ReportCFG {
class ReportIrreducibleRegion final : public ReportCFG {
Region *R;
DebugLoc DbgLoc;
@ -252,7 +252,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures regions with an unreachable in the exit block.
class ReportUnreachableInExit : public ReportCFG {
class ReportUnreachableInExit final : public ReportCFG {
BasicBlock *BB;
DebugLoc DbgLoc;
@ -278,7 +278,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures regions with an IndirectBr predecessor.
class ReportIndirectPredecessor : public ReportCFG {
class ReportIndirectPredecessor final : public ReportCFG {
Instruction *Inst;
DebugLoc DbgLoc;
@ -328,7 +328,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures a condition that is based on an 'undef' value.
class ReportUndefCond : public ReportAffFunc {
class ReportUndefCond final : public ReportAffFunc {
// The BasicBlock we found the broken condition in.
BasicBlock *BB;
@ -353,7 +353,7 @@ public:
/// Captures an invalid condition
///
/// Conditions have to be either constants or icmp instructions.
class ReportInvalidCond : public ReportAffFunc {
class ReportInvalidCond final : public ReportAffFunc {
// The BasicBlock we found the broken condition in.
BasicBlock *BB;
@ -376,7 +376,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures an undefined operand.
class ReportUndefOperand : public ReportAffFunc {
class ReportUndefOperand final : public ReportAffFunc {
// The BasicBlock we found the undefined operand in.
BasicBlock *BB;
@ -399,7 +399,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures a non-affine branch.
class ReportNonAffBranch : public ReportAffFunc {
class ReportNonAffBranch final : public ReportAffFunc {
// The BasicBlock we found the non-affine branch in.
BasicBlock *BB;
@ -433,7 +433,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures a missing base pointer.
class ReportNoBasePtr : public ReportAffFunc {
class ReportNoBasePtr final : public ReportAffFunc {
public:
ReportNoBasePtr(const Instruction *Inst)
: ReportAffFunc(RejectReasonKind::NoBasePtr, Inst) {}
@ -453,7 +453,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures an undefined base pointer.
class ReportUndefBasePtr : public ReportAffFunc {
class ReportUndefBasePtr final : public ReportAffFunc {
public:
ReportUndefBasePtr(const Instruction *Inst)
: ReportAffFunc(RejectReasonKind::UndefBasePtr, Inst) {}
@ -473,7 +473,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures a base pointer that is not invariant in the region.
class ReportVariantBasePtr : public ReportAffFunc {
class ReportVariantBasePtr final : public ReportAffFunc {
// The variant base pointer.
Value *BaseValue;
@ -498,7 +498,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures a non-affine access function.
class ReportNonAffineAccess : public ReportAffFunc {
class ReportNonAffineAccess final : public ReportAffFunc {
// The non-affine access function.
const SCEV *AccessFunction;
@ -529,7 +529,7 @@ public:
//===----------------------------------------------------------------------===//
/// Report array accesses with differing element size.
class ReportDifferentArrayElementSize : public ReportAffFunc {
class ReportDifferentArrayElementSize final : public ReportAffFunc {
// The base pointer of the memory access.
const Value *BaseValue;
@ -554,7 +554,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures errors with non affine loop bounds.
class ReportLoopBound : public RejectReason {
class ReportLoopBound final : public RejectReason {
// The offending loop.
Loop *L;
@ -586,7 +586,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures errors when loop has no exit.
class ReportLoopHasNoExit : public RejectReason {
class ReportLoopHasNoExit final : public RejectReason {
/// The loop that has no exit.
Loop *L;
@ -614,7 +614,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures errors when a loop has multiple exists.
class ReportLoopHasMultipleExits : public RejectReason {
class ReportLoopHasMultipleExits final : public RejectReason {
/// The loop that has multiple exits.
Loop *L;
@ -642,7 +642,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures errors when not all loop latches are part of the scop.
class ReportLoopOnlySomeLatches : public RejectReason {
class ReportLoopOnlySomeLatches final : public RejectReason {
/// The loop for which not all loop latches are part of the scop.
Loop *L;
@ -670,7 +670,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures errors with non-side-effect-known function calls.
class ReportFuncCall : public RejectReason {
class ReportFuncCall final : public RejectReason {
// The offending call instruction.
Instruction *Inst;
@ -694,7 +694,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures errors with aliasing.
class ReportAlias : public RejectReason {
class ReportAlias final : public RejectReason {
public:
using PointerSnapshotTy = std::vector<const Value *>;
@ -751,7 +751,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures errors with bad IntToPtr instructions.
class ReportIntToPtr : public ReportOther {
class ReportIntToPtr final : public ReportOther {
// The offending base value.
Instruction *BaseValue;
@ -774,7 +774,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures errors with alloca instructions.
class ReportAlloca : public ReportOther {
class ReportAlloca final : public ReportOther {
Instruction *Inst;
public:
@ -796,7 +796,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures errors with unknown instructions.
class ReportUnknownInst : public ReportOther {
class ReportUnknownInst final : public ReportOther {
Instruction *Inst;
public:
@ -818,7 +818,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures errors with regions containing the function entry block.
class ReportEntry : public ReportOther {
class ReportEntry final : public ReportOther {
BasicBlock *BB;
public:
@ -841,7 +841,7 @@ public:
//===----------------------------------------------------------------------===//
/// Report regions that seem not profitable to be optimized.
class ReportUnprofitable : public ReportOther {
class ReportUnprofitable final : public ReportOther {
Region *R;
public:
@ -864,7 +864,7 @@ public:
//===----------------------------------------------------------------------===//
/// Captures errors with non-simple memory accesses.
class ReportNonSimpleMemoryAccess : public ReportOther {
class ReportNonSimpleMemoryAccess final : public ReportOther {
// The offending call instruction.
Instruction *Inst;

View File

@ -27,7 +27,7 @@
namespace llvm {
template <>
struct GraphTraits<polly::ScopDetection *> : public GraphTraits<RegionInfo *> {
struct GraphTraits<polly::ScopDetection *> : GraphTraits<RegionInfo *> {
static NodeRef getEntryNode(polly::ScopDetection *SD) {
return GraphTraits<RegionInfo *>::getEntryNode(SD->getRI());
}
@ -40,8 +40,7 @@ struct GraphTraits<polly::ScopDetection *> : public GraphTraits<RegionInfo *> {
};
template <>
struct DOTGraphTraits<polly::ScopDetection *>
: public DOTGraphTraits<RegionNode *> {
struct DOTGraphTraits<polly::ScopDetection *> : DOTGraphTraits<RegionNode *> {
DOTGraphTraits(bool isSimple = false)
: DOTGraphTraits<RegionNode *>(isSimple) {}
static std::string getGraphName(polly::ScopDetection *SD) {
@ -71,23 +70,22 @@ struct DOTGraphTraits<polly::ScopDetection *>
namespace polly {
struct ScopViewer : public llvm::DOTGraphTraitsViewer<ScopAnalysis, false> {
struct ScopViewer final : llvm::DOTGraphTraitsViewer<ScopAnalysis, false> {
ScopViewer() : llvm::DOTGraphTraitsViewer<ScopAnalysis, false>("scops") {}
bool processFunction(Function &F, const ScopDetection &SD) override;
};
struct ScopOnlyViewer : public llvm::DOTGraphTraitsViewer<ScopAnalysis, false> {
struct ScopOnlyViewer final : llvm::DOTGraphTraitsViewer<ScopAnalysis, false> {
ScopOnlyViewer()
: llvm::DOTGraphTraitsViewer<ScopAnalysis, false>("scops-only") {}
};
struct ScopPrinter : public llvm::DOTGraphTraitsPrinter<ScopAnalysis, false> {
struct ScopPrinter final : llvm::DOTGraphTraitsPrinter<ScopAnalysis, false> {
ScopPrinter() : llvm::DOTGraphTraitsPrinter<ScopAnalysis, false>("scops") {}
};
struct ScopOnlyPrinter
: public llvm::DOTGraphTraitsPrinter<ScopAnalysis, true> {
struct ScopOnlyPrinter final : llvm::DOTGraphTraitsPrinter<ScopAnalysis, true> {
ScopOnlyPrinter()
: llvm::DOTGraphTraitsPrinter<ScopAnalysis, true>("scopsonly") {}
};

View File

@ -216,7 +216,7 @@ using AccFuncVector = std::vector<std::unique_ptr<MemoryAccess>>;
/// Objects are accessible via the ScoP, MemoryAccess or the id associated with
/// the MemoryAccess access function.
///
class ScopArrayInfo {
class ScopArrayInfo final {
public:
/// Construct a ScopArrayInfo object.
///
@ -428,7 +428,7 @@ private:
};
/// Represent memory accesses in statements.
class MemoryAccess {
class MemoryAccess final {
friend class Scop;
friend class ScopStmt;
friend class ScopBuilder;
@ -1135,7 +1135,7 @@ using InvariantEquivClassesTy = SmallVector<InvariantEquivClassTy, 8>;
/// It is further described by its iteration domain, its schedule and its data
/// accesses.
/// At the moment every statement represents a single basic block of LLVM-IR.
class ScopStmt {
class ScopStmt final {
friend class ScopBuilder;
public:
@ -1626,7 +1626,7 @@ raw_ostream &operator<<(raw_ostream &OS, const ScopStmt &S);
/// * A context
/// This context contains information about the values the parameters
/// can take and relations between different parameters.
class Scop {
class Scop final {
public:
/// Type to represent a pair of minimal/maximal access to an array.
using MinMaxAccessTy = std::pair<isl::pw_multi_aff, isl::pw_multi_aff>;
@ -2684,7 +2684,7 @@ raw_ostream &operator<<(raw_ostream &OS, const Scop &scop);
/// The legacy pass manager's analysis pass to compute scop information
/// for a region.
class ScopInfoRegionPass : public RegionPass {
class ScopInfoRegionPass final : public RegionPass {
/// The Scop pointer which is used to construct a Scop.
std::unique_ptr<Scop> S;
@ -2774,7 +2774,7 @@ public:
bool empty() const { return RegionToScopMap.empty(); }
};
struct ScopInfoAnalysis : public AnalysisInfoMixin<ScopInfoAnalysis> {
struct ScopInfoAnalysis : AnalysisInfoMixin<ScopInfoAnalysis> {
static AnalysisKey Key;
using Result = ScopInfo;
@ -2782,7 +2782,7 @@ struct ScopInfoAnalysis : public AnalysisInfoMixin<ScopInfoAnalysis> {
Result run(Function &, FunctionAnalysisManager &);
};
struct ScopInfoPrinterPass : public PassInfoMixin<ScopInfoPrinterPass> {
struct ScopInfoPrinterPass final : PassInfoMixin<ScopInfoPrinterPass> {
ScopInfoPrinterPass(raw_ostream &OS) : Stream(OS) {}
PreservedAnalyses run(Function &, FunctionAnalysisManager &);
@ -2798,7 +2798,7 @@ struct ScopInfoPrinterPass : public PassInfoMixin<ScopInfoPrinterPass> {
/// scop object for all the feasible scops present in a function.
/// This pass is an alternative to the ScopInfoRegionPass in order to avoid a
/// region pass manager.
class ScopInfoWrapperPass : public FunctionPass {
class ScopInfoWrapperPass final : public FunctionPass {
std::unique_ptr<ScopInfo> Result;
public:

View File

@ -124,7 +124,7 @@ extern template class OuterAnalysisManagerProxy<FunctionAnalysisManager, Scop,
namespace polly {
template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
class OwningInnerAnalysisManagerProxy
class OwningInnerAnalysisManagerProxy final
: public InnerAnalysisManagerProxy<AnalysisManagerT, IRUnitT> {
public:
OwningInnerAnalysisManagerProxy()
@ -191,7 +191,7 @@ struct ScopStandardAnalysisResults {
TargetTransformInfo &TTI;
};
class SPMUpdater {
class SPMUpdater final {
public:
SPMUpdater(SmallPriorityWorklist<Region *, 4> &Worklist,
ScopAnalysisManager &SAM)
@ -212,13 +212,12 @@ private:
bool InvalidateCurrentScop;
SmallPriorityWorklist<Region *, 4> &Worklist;
ScopAnalysisManager &SAM;
template <typename ScopPassT> friend class FunctionToScopPassAdaptor;
template <typename ScopPassT> friend struct FunctionToScopPassAdaptor;
};
template <typename ScopPassT>
class FunctionToScopPassAdaptor
: public PassInfoMixin<FunctionToScopPassAdaptor<ScopPassT>> {
public:
struct FunctionToScopPassAdaptor final
: PassInfoMixin<FunctionToScopPassAdaptor<ScopPassT>> {
explicit FunctionToScopPassAdaptor(ScopPassT Pass) : Pass(std::move(Pass)) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) {

View File

@ -52,7 +52,7 @@ llvm::SmallVector<MemoryAccess *, 32> getAccessesInOrder(ScopStmt &Stmt);
llvm::Pass *createSimplifyWrapperPass(int CallNo = 0);
llvm::Pass *createSimplifyPrinterLegacyPass(llvm::raw_ostream &OS);
struct SimplifyPass : public PassInfoMixin<SimplifyPass> {
struct SimplifyPass final : PassInfoMixin<SimplifyPass> {
SimplifyPass(int CallNo = 0) : CallNo(CallNo) {}
llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
@ -62,7 +62,7 @@ private:
int CallNo;
};
struct SimplifyPrinterPass : public PassInfoMixin<SimplifyPrinterPass> {
struct SimplifyPrinterPass final : PassInfoMixin<SimplifyPrinterPass> {
SimplifyPrinterPass(raw_ostream &OS, int CallNo = 0)
: OS(OS), CallNo(CallNo) {}

View File

@ -25,7 +25,7 @@ namespace polly {
llvm::FunctionPass *createDumpFunctionWrapperPass(std::string Suffix);
/// A pass that isolates a function into a new Module and writes it into a file.
struct DumpFunctionPass : llvm::PassInfoMixin<DumpFunctionPass> {
struct DumpFunctionPass final : llvm::PassInfoMixin<DumpFunctionPass> {
std::string Suffix;
DumpFunctionPass(std::string Suffix) : Suffix(std::move(Suffix)) {}

View File

@ -34,7 +34,7 @@ llvm::ModulePass *createDumpModuleWrapperPass(std::string Filename,
bool IsSuffix);
/// A pass that prints the module into a file.
struct DumpModulePass : llvm::PassInfoMixin<DumpModulePass> {
struct DumpModulePass final : llvm::PassInfoMixin<DumpModulePass> {
std::string Filename;
bool IsSuffix;

View File

@ -354,7 +354,7 @@ operator<<(llvm::DiagnosticInfoOptimizationBase &OS,
/// This is typically used inside a nested IslMaxOperationsGuard scope. The
/// IslMaxOperationsGuard defines the number of allowed base operations for some
/// code, IslQuotaScope defines where it is allowed to return an error result.
class IslQuotaScope {
class IslQuotaScope final {
isl_ctx *IslCtx;
int OldOnError;
@ -421,7 +421,7 @@ public:
/// counter cannot be reset to the previous state, or one that adds the
/// operations while being in the nested scope. Use therefore is only allowed
/// while currently a no operations-limit is active.
class IslMaxOperationsGuard {
class IslMaxOperationsGuard final {
private:
/// The ISL context to set the operations limit.
///

View File

@ -48,11 +48,11 @@ template <typename ListT>
using list_element_type = decltype(std::declval<ListT>().get_at(0));
template <typename ListT>
struct isl_iterator
class isl_iterator
: public llvm::iterator_facade_base<isl_iterator<ListT>,
std::forward_iterator_tag,
list_element_type<ListT>> {
public:
using ElementT = list_element_type<ListT>;
explicit isl_iterator(const ListT &List)

View File

@ -27,7 +27,7 @@ class Scop;
typedef std::pair<isl::pw_aff, isl::set> PWACtx;
/// Translate a SCEV to an isl::pw_aff and the domain on which it is invalid.
struct SCEVAffinator : public llvm::SCEVVisitor<SCEVAffinator, PWACtx> {
class SCEVAffinator final : public llvm::SCEVVisitor<SCEVAffinator, PWACtx> {
public:
SCEVAffinator(Scop *S, llvm::LoopInfo &LI);

View File

@ -133,7 +133,7 @@ using BoxedLoopsSetTy = llvm::SetVector<const llvm::Loop *>;
/// is currently not supported in C++ such that those cannot be used directly.
/// (llvm::isa could, but then llvm:cast etc. would not have the expected
/// behavior)
class MemAccInst {
class MemAccInst final {
private:
llvm::Instruction *I;

View File

@ -28,7 +28,7 @@ using llvm::User;
/// Despite its name it is not tied to virtual instructions (although it works
/// fine with them), but to promote consistent handling of values used in
/// statements.
class VirtualUse {
class VirtualUse final {
public:
/// The different types of uses. Handling usually differentiates a lot between
/// these; one can use a switch to handle each case (and get warned by the
@ -167,7 +167,7 @@ public:
};
/// An iterator for virtual operands.
class VirtualOperandIterator {
class VirtualOperandIterator final {
friend class VirtualInstruction;
friend class VirtualUse;
@ -228,7 +228,7 @@ public:
/// ScopStmt/Instruction-pair uniquely identifies a virtual instructions.
/// ScopStmt::getInstruction() can contain the same instruction multiple times,
/// but they necessarily compute the same value.
class VirtualInstruction {
class VirtualInstruction final {
friend class VirtualOperandIterator;
friend struct llvm::DenseMapInfo<VirtualInstruction>;

View File

@ -930,7 +930,7 @@ INITIALIZE_PASS_END(DependenceInfo, "polly-dependences",
namespace {
/// Print result from DependenceAnalysis.
class DependenceInfoPrinterLegacyPass : public ScopPass {
class DependenceInfoPrinterLegacyPass final : public ScopPass {
public:
static char ID;
@ -1037,7 +1037,7 @@ INITIALIZE_PASS_END(
namespace {
/// Print result from DependenceInfoWrapperPass.
class DependenceInfoPrinterLegacyFunctionPass : public FunctionPass {
class DependenceInfoPrinterLegacyFunctionPass final : public FunctionPass {
public:
static char ID;

View File

@ -170,7 +170,7 @@ INITIALIZE_PASS_END(PolyhedralInfo, "polyhedral-info",
namespace {
/// Print result from PolyhedralInfo.
class PolyhedralInfoPrinterLegacyPass : public FunctionPass {
class PolyhedralInfoPrinterLegacyPass final : public FunctionPass {
public:
static char ID;

View File

@ -78,7 +78,7 @@ static bool runPruneUnprofitable(Scop &S) {
return false;
}
class PruneUnprofitableWrapperPass : public ScopPass {
class PruneUnprofitableWrapperPass final : public ScopPass {
public:
static char ID;

View File

@ -281,7 +281,7 @@ static void updateLoopCountStatistic(ScopDetection::LoopStats Stats,
namespace {
class DiagnosticScopFound : public DiagnosticInfo {
class DiagnosticScopFound final : public DiagnosticInfo {
private:
static int PluginDiagnosticKind;
@ -850,7 +850,7 @@ namespace {
/// always add and verify the assumption that for all subscript expressions
/// 'exp' the inequality 0 <= exp < size holds. Hence, we will also verify
/// that 0 <= size, which means smax(0, size) == size.
class SCEVRemoveMax : public SCEVRewriteVisitor<SCEVRemoveMax> {
class SCEVRemoveMax final : public SCEVRewriteVisitor<SCEVRemoveMax> {
public:
SCEVRemoveMax(ScalarEvolution &SE, std::vector<const SCEV *> *Terms)
: SCEVRewriteVisitor(SE), Terms(Terms) {}
@ -2048,7 +2048,7 @@ INITIALIZE_PASS_END(ScopDetectionWrapperPass, "polly-detect",
namespace {
/// Print result from ScopDetectionWrapperPass.
class ScopDetectionPrinterLegacyPass : public FunctionPass {
class ScopDetectionPrinterLegacyPass final : public FunctionPass {
public:
static char ID;

View File

@ -141,9 +141,9 @@ struct ScopDetectionAnalysisGraphTraits {
};
struct ScopViewerWrapperPass
: public DOTGraphTraitsViewerWrapperPass<ScopDetectionWrapperPass, false,
ScopDetection *,
ScopDetectionAnalysisGraphTraits> {
: DOTGraphTraitsViewerWrapperPass<ScopDetectionWrapperPass, false,
ScopDetection *,
ScopDetectionAnalysisGraphTraits> {
static char ID;
ScopViewerWrapperPass()
: DOTGraphTraitsViewerWrapperPass<ScopDetectionWrapperPass, false,
@ -164,9 +164,9 @@ struct ScopViewerWrapperPass
char ScopViewerWrapperPass::ID = 0;
struct ScopOnlyViewerWrapperPass
: public DOTGraphTraitsViewerWrapperPass<ScopDetectionWrapperPass, false,
ScopDetection *,
ScopDetectionAnalysisGraphTraits> {
: DOTGraphTraitsViewerWrapperPass<ScopDetectionWrapperPass, false,
ScopDetection *,
ScopDetectionAnalysisGraphTraits> {
static char ID;
ScopOnlyViewerWrapperPass()
: DOTGraphTraitsViewerWrapperPass<ScopDetectionWrapperPass, false,
@ -177,9 +177,9 @@ struct ScopOnlyViewerWrapperPass
char ScopOnlyViewerWrapperPass::ID = 0;
struct ScopPrinterWrapperPass
: public DOTGraphTraitsPrinterWrapperPass<
ScopDetectionWrapperPass, false, ScopDetection *,
ScopDetectionAnalysisGraphTraits> {
: DOTGraphTraitsPrinterWrapperPass<ScopDetectionWrapperPass, false,
ScopDetection *,
ScopDetectionAnalysisGraphTraits> {
static char ID;
ScopPrinterWrapperPass()
: DOTGraphTraitsPrinterWrapperPass<ScopDetectionWrapperPass, false,
@ -190,9 +190,9 @@ struct ScopPrinterWrapperPass
char ScopPrinterWrapperPass::ID = 0;
struct ScopOnlyPrinterWrapperPass
: public DOTGraphTraitsPrinterWrapperPass<
ScopDetectionWrapperPass, true, ScopDetection *,
ScopDetectionAnalysisGraphTraits> {
: DOTGraphTraitsPrinterWrapperPass<ScopDetectionWrapperPass, true,
ScopDetection *,
ScopDetectionAnalysisGraphTraits> {
static char ID;
ScopOnlyPrinterWrapperPass()
: DOTGraphTraitsPrinterWrapperPass<ScopDetectionWrapperPass, true,

View File

@ -1358,7 +1358,7 @@ void Scop::setContext(isl::set NewContext) {
namespace {
/// Remap parameter values but keep AddRecs valid wrt. invariant loads.
struct SCEVSensitiveParameterRewriter
class SCEVSensitiveParameterRewriter final
: public SCEVRewriteVisitor<SCEVSensitiveParameterRewriter> {
const ValueToValueMap &VMap;
@ -1389,7 +1389,7 @@ public:
};
/// Check whether we should remap a SCEV expression.
struct SCEVFindInsideScop : public SCEVTraversal<SCEVFindInsideScop> {
class SCEVFindInsideScop : public SCEVTraversal<SCEVFindInsideScop> {
const ValueToValueMap &VMap;
bool FoundInside = false;
const Scop *S;
@ -2647,7 +2647,7 @@ INITIALIZE_PASS_END(ScopInfoRegionPass, "polly-scops",
namespace {
/// Print result from ScopInfoRegionPass.
class ScopInfoPrinterLegacyRegionPass : public RegionPass {
class ScopInfoPrinterLegacyRegionPass final : public RegionPass {
public:
static char ID;
@ -2829,7 +2829,7 @@ INITIALIZE_PASS_END(
namespace {
/// Print result from ScopInfoWrapperPass.
class ScopInfoPrinterLegacyFunctionPass : public FunctionPass {
class ScopInfoPrinterLegacyFunctionPass final : public FunctionPass {
public:
static char ID;

View File

@ -303,7 +303,7 @@ static bool generateCode(Scop &S, IslAstInfo &AI, LoopInfo &LI,
namespace {
class CodeGeneration : public ScopPass {
class CodeGeneration final : public ScopPass {
public:
static char ID;

View File

@ -27,7 +27,7 @@ using namespace polly;
namespace {
class CodegenCleanup : public FunctionPass {
class CodegenCleanup final : public FunctionPass {
private:
CodegenCleanup(const CodegenCleanup &) = delete;
const CodegenCleanup &operator=(const CodegenCleanup &) = delete;

View File

@ -828,7 +828,7 @@ INITIALIZE_PASS_END(IslAstInfoWrapperPass, "polly-ast",
namespace {
/// Print result from IslAstInfoWrapperPass.
class IslAstInfoPrinterLegacyPass : public ScopPass {
class IslAstInfoPrinterLegacyPass final : public ScopPass {
public:
static char ID;

View File

@ -246,7 +246,7 @@ static void findReferencesInStmt(ScopStmt *Stmt, SetVector<Value *> &Values,
void polly::addReferencesFromStmt(ScopStmt *Stmt, void *UserPtr,
bool CreateScalarRefs) {
auto &References = *static_cast<struct SubtreeReferences *>(UserPtr);
auto &References = *static_cast<SubtreeReferences *>(UserPtr);
findReferencesInStmt(Stmt, References.Values, References.GlobalMap,
References.SCEVs);
@ -284,8 +284,7 @@ void polly::addReferencesFromStmt(ScopStmt *Stmt, void *UserPtr,
/// @param Set A set which references the ScopStmt we are interested in.
/// @param UserPtr A void pointer that can be casted to a SubtreeReferences
/// structure.
static void addReferencesFromStmtSet(isl::set Set,
struct SubtreeReferences *UserPtr) {
static void addReferencesFromStmtSet(isl::set Set, SubtreeReferences *UserPtr) {
isl::id Id = Set.get_tuple_id();
auto *Stmt = static_cast<ScopStmt *>(Id.get_user());
addReferencesFromStmt(Stmt, UserPtr);
@ -304,9 +303,8 @@ static void addReferencesFromStmtSet(isl::set Set,
/// @param References The SubtreeReferences data structure through which
/// results are returned and further information is
/// provided.
static void
addReferencesFromStmtUnionSet(isl::union_set USet,
struct SubtreeReferences &References) {
static void addReferencesFromStmtUnionSet(isl::union_set USet,
SubtreeReferences &References) {
for (isl::set Set : USet.get_set_list())
addReferencesFromStmtSet(Set, &References);
@ -321,7 +319,7 @@ void IslNodeBuilder::getReferencesInSubtree(const isl::ast_node &For,
SetVector<Value *> &Values,
SetVector<const Loop *> &Loops) {
SetVector<const SCEV *> SCEVs;
struct SubtreeReferences References = {
SubtreeReferences References = {
LI, SE, S, ValueMap, Values, SCEVs, getBlockGenerator(), nullptr};
for (const auto &I : IDToValue)

View File

@ -348,7 +348,7 @@ static void replaceAllUsesAndConstantUses(Value *Old, Value *New,
rewriteOldValToNew(I, Old, New, Builder);
}
class ManagedMemoryRewritePass : public ModulePass {
class ManagedMemoryRewritePass final : public ModulePass {
public:
static char ID;
GPUArch Architecture;

View File

@ -346,7 +346,7 @@ static int computeSizeInBytes(const Type *T) {
/// for generating GPU specific user nodes.
///
/// @see GPUNodeBuilder::createUser
class GPUNodeBuilder : public IslNodeBuilder {
class GPUNodeBuilder final : public IslNodeBuilder {
public:
GPUNodeBuilder(PollyIRBuilder &Builder, ScopAnnotator &Annotator,
const DataLayout &DL, LoopInfo &LI, ScalarEvolution &SE,
@ -409,7 +409,7 @@ private:
GPUArch Arch;
/// Class to free isl_ids.
class IslIdDeleter {
class IslIdDeleter final {
public:
void operator()(__isl_take isl_id *Id) { isl_id_free(Id); };
};
@ -2558,7 +2558,7 @@ alignPwAffs(const std::vector<__isl_take isl_pw_aff *> &&PwAffs,
}
namespace {
class PPCGCodeGeneration : public ScopPass {
class PPCGCodeGeneration final : public ScopPass {
public:
static char ID;

View File

@ -51,7 +51,8 @@ static cl::opt<std::string>
cl::Hidden, cl::value_desc("File postfix"), cl::ValueRequired,
cl::init(""), cl::cat(PollyCategory));
struct JSONExporter : public ScopPass {
class JSONExporter : public ScopPass {
public:
static char ID;
explicit JSONExporter() : ScopPass(ID) {}
@ -65,7 +66,8 @@ struct JSONExporter : public ScopPass {
void getAnalysisUsage(AnalysisUsage &AU) const override;
};
struct JSONImporter : public ScopPass {
class JSONImporter : public ScopPass {
public:
static char ID;
std::vector<std::string> NewAccessStrings;
explicit JSONImporter() : ScopPass(ID) {}
@ -838,7 +840,7 @@ INITIALIZE_PASS_END(JSONImporter, "polly-import-jscop",
namespace {
/// Print result from JSONImporter.
class JSONImporterPrinterLegacyPass : public ScopPass {
class JSONImporterPrinterLegacyPass final : public ScopPass {
public:
static char ID;

View File

@ -82,7 +82,7 @@ static void runDumpFunction(llvm::Function &F, StringRef Suffix) {
LLVM_DEBUG(dbgs() << "Dump file " << Dumpfile << " written successfully\n");
}
class DumpFunctionWrapperPass : public FunctionPass {
class DumpFunctionWrapperPass final : public FunctionPass {
private:
DumpFunctionWrapperPass(const DumpFunctionWrapperPass &) = delete;
const DumpFunctionWrapperPass &

View File

@ -48,7 +48,7 @@ static void runDumpModule(llvm::Module &M, StringRef Filename, bool IsSuffix) {
Out->keep();
}
class DumpModuleWrapperPass : public ModulePass {
class DumpModuleWrapperPass final : public ModulePass {
private:
DumpModuleWrapperPass(const DumpModuleWrapperPass &) = delete;
const DumpModuleWrapperPass &

View File

@ -234,8 +234,7 @@ namespace {
/// We use the constructor of a statically declared object to initialize the
/// different Polly passes right after the Polly library is loaded. This ensures
/// that the Polly passes are available e.g. in the 'opt' tool.
class StaticInitializer {
public:
struct StaticInitializer {
StaticInitializer() {
llvm::PassRegistry &Registry = *llvm::PassRegistry::getPassRegistry();
polly::initializePollyPasses(Registry);

View File

@ -35,7 +35,7 @@ enum TYPE {
} // namespace SCEVType
/// The result the validator returns for a SCEV expression.
class ValidatorResult {
class ValidatorResult final {
/// The type of the expression
SCEVType::TYPE Type;
@ -112,14 +112,13 @@ public:
}
};
raw_ostream &operator<<(raw_ostream &OS, class ValidatorResult &VR) {
raw_ostream &operator<<(raw_ostream &OS, ValidatorResult &VR) {
VR.print(OS);
return OS;
}
/// Check if a SCEV is valid in a SCoP.
struct SCEVValidator
: public SCEVVisitor<SCEVValidator, class ValidatorResult> {
class SCEVValidator : public SCEVVisitor<SCEVValidator, ValidatorResult> {
private:
const Region *R;
Loop *Scope;
@ -131,12 +130,12 @@ public:
InvariantLoadsSetTy *ILS)
: R(R), Scope(Scope), SE(SE), ILS(ILS) {}
class ValidatorResult visitConstant(const SCEVConstant *Constant) {
ValidatorResult visitConstant(const SCEVConstant *Constant) {
return ValidatorResult(SCEVType::INT);
}
class ValidatorResult visitZeroExtendOrTruncateExpr(const SCEV *Expr,
const SCEV *Operand) {
ValidatorResult visitZeroExtendOrTruncateExpr(const SCEV *Expr,
const SCEV *Operand) {
ValidatorResult Op = visit(Operand);
auto Type = Op.getType();
@ -150,23 +149,23 @@ public:
return ValidatorResult(SCEVType::PARAM, Expr);
}
class ValidatorResult visitPtrToIntExpr(const SCEVPtrToIntExpr *Expr) {
ValidatorResult visitPtrToIntExpr(const SCEVPtrToIntExpr *Expr) {
return visit(Expr->getOperand());
}
class ValidatorResult visitTruncateExpr(const SCEVTruncateExpr *Expr) {
ValidatorResult visitTruncateExpr(const SCEVTruncateExpr *Expr) {
return visitZeroExtendOrTruncateExpr(Expr, Expr->getOperand());
}
class ValidatorResult visitZeroExtendExpr(const SCEVZeroExtendExpr *Expr) {
ValidatorResult visitZeroExtendExpr(const SCEVZeroExtendExpr *Expr) {
return visitZeroExtendOrTruncateExpr(Expr, Expr->getOperand());
}
class ValidatorResult visitSignExtendExpr(const SCEVSignExtendExpr *Expr) {
ValidatorResult visitSignExtendExpr(const SCEVSignExtendExpr *Expr) {
return visit(Expr->getOperand());
}
class ValidatorResult visitAddExpr(const SCEVAddExpr *Expr) {
ValidatorResult visitAddExpr(const SCEVAddExpr *Expr) {
ValidatorResult Return(SCEVType::INT);
for (int i = 0, e = Expr->getNumOperands(); i < e; ++i) {
@ -181,7 +180,7 @@ public:
return Return;
}
class ValidatorResult visitMulExpr(const SCEVMulExpr *Expr) {
ValidatorResult visitMulExpr(const SCEVMulExpr *Expr) {
ValidatorResult Return(SCEVType::INT);
bool HasMultipleParams = false;
@ -217,7 +216,7 @@ public:
return Return;
}
class ValidatorResult visitAddRecExpr(const SCEVAddRecExpr *Expr) {
ValidatorResult visitAddRecExpr(const SCEVAddRecExpr *Expr) {
if (!Expr->isAffine()) {
LLVM_DEBUG(dbgs() << "INVALID: AddRec is not affine");
return ValidatorResult(SCEVType::INVALID);
@ -272,7 +271,7 @@ public:
return ZeroStartResult;
}
class ValidatorResult visitSMaxExpr(const SCEVSMaxExpr *Expr) {
ValidatorResult visitSMaxExpr(const SCEVSMaxExpr *Expr) {
ValidatorResult Return(SCEVType::INT);
for (int i = 0, e = Expr->getNumOperands(); i < e; ++i) {
@ -287,7 +286,7 @@ public:
return Return;
}
class ValidatorResult visitSMinExpr(const SCEVSMinExpr *Expr) {
ValidatorResult visitSMinExpr(const SCEVSMinExpr *Expr) {
ValidatorResult Return(SCEVType::INT);
for (int i = 0, e = Expr->getNumOperands(); i < e; ++i) {
@ -302,7 +301,7 @@ public:
return Return;
}
class ValidatorResult visitUMaxExpr(const SCEVUMaxExpr *Expr) {
ValidatorResult visitUMaxExpr(const SCEVUMaxExpr *Expr) {
// We do not support unsigned max operations. If 'Expr' is constant during
// Scop execution we treat this as a parameter, otherwise we bail out.
for (int i = 0, e = Expr->getNumOperands(); i < e; ++i) {
@ -317,7 +316,7 @@ public:
return ValidatorResult(SCEVType::PARAM, Expr);
}
class ValidatorResult visitUMinExpr(const SCEVUMinExpr *Expr) {
ValidatorResult visitUMinExpr(const SCEVUMinExpr *Expr) {
// We do not support unsigned min operations. If 'Expr' is constant during
// Scop execution we treat this as a parameter, otherwise we bail out.
for (int i = 0, e = Expr->getNumOperands(); i < e; ++i) {
@ -332,8 +331,7 @@ public:
return ValidatorResult(SCEVType::PARAM, Expr);
}
class ValidatorResult
visitSequentialUMinExpr(const SCEVSequentialUMinExpr *Expr) {
ValidatorResult visitSequentialUMinExpr(const SCEVSequentialUMinExpr *Expr) {
// We do not support unsigned min operations. If 'Expr' is constant during
// Scop execution we treat this as a parameter, otherwise we bail out.
for (int i = 0, e = Expr->getNumOperands(); i < e; ++i) {
@ -464,7 +462,7 @@ public:
};
/// Check whether a SCEV refers to an SSA name defined inside a region.
class SCEVInRegionDependences {
class SCEVInRegionDependences final {
const Region *R;
Loop *Scope;
const InvariantLoadsSetTy &ILS;
@ -520,7 +518,7 @@ public:
};
/// Find all loops referenced in SCEVAddRecExprs.
class SCEVFindLoops {
class SCEVFindLoops final {
SetVector<const Loop *> &Loops;
public:
@ -541,7 +539,7 @@ void polly::findLoops(const SCEV *Expr, SetVector<const Loop *> &Loops) {
}
/// Find all values referenced in SCEVUnknowns.
class SCEVFindValues {
class SCEVFindValues final {
ScalarEvolution &SE;
SetVector<Value *> &Values;

View File

@ -233,7 +233,7 @@ void polly::recordAssumption(polly::RecordedAssumptionsTy *RecordedAssumptions,
/// and we generate code outside/in front of that region. Hence, we generate the
/// code for the SDiv/SRem operands in front of the analyzed region and then
/// create a new SDiv/SRem operation there too.
struct ScopExpander : SCEVVisitor<ScopExpander, const SCEV *> {
struct ScopExpander final : SCEVVisitor<ScopExpander, const SCEV *> {
friend struct SCEVVisitor<ScopExpander, const SCEV *>;
explicit ScopExpander(const Region &R, ScalarEvolution &SE,

View File

@ -132,7 +132,7 @@ polly::buildCanonicalicationPassesForNPM(llvm::ModulePassManager &MPM,
}
namespace {
class PollyCanonicalize : public ModulePass {
class PollyCanonicalize final : public ModulePass {
PollyCanonicalize(const PollyCanonicalize &) = delete;
const PollyCanonicalize &operator=(const PollyCanonicalize &) = delete;

View File

@ -31,7 +31,7 @@ namespace {
/// Prepare the IR for the scop detection.
///
class CodePreparation : public FunctionPass {
class CodePreparation final : public FunctionPass {
CodePreparation(const CodePreparation &) = delete;
const CodePreparation &operator=(const CodePreparation &) = delete;

View File

@ -183,7 +183,7 @@ isl::union_map expandMapping(isl::union_map Relevant, isl::union_set Universe) {
/// conflict, but overwrite values that might still be required. Another source
/// of problems are multiple writes to the same element at the same timepoint,
/// because their order is undefined.
class Knowledge {
class Knowledge final {
private:
/// { [Element[] -> Zone[]] }
/// Set of array elements and when they are alive.
@ -520,7 +520,7 @@ public:
};
/// Implementation of the DeLICM/DePRE transformation.
class DeLICMImpl : public ZoneAlgorithm {
class DeLICMImpl final : public ZoneAlgorithm {
private:
/// Knowledge before any transformation took place.
Knowledge OriginalZone;
@ -1416,7 +1416,7 @@ static PreservedAnalyses runDeLICMUsingNPM(Scop &S, ScopAnalysisManager &SAM,
return PA;
}
class DeLICMWrapperPass : public ScopPass {
class DeLICMWrapperPass final : public ScopPass {
private:
DeLICMWrapperPass(const DeLICMWrapperPass &) = delete;
const DeLICMWrapperPass &operator=(const DeLICMWrapperPass &) = delete;
@ -1459,7 +1459,7 @@ public:
char DeLICMWrapperPass::ID;
/// Print result from DeLICMWrapperPass.
class DeLICMPrinterLegacyPass : public ScopPass {
class DeLICMPrinterLegacyPass final : public ScopPass {
public:
static char ID;

View File

@ -51,7 +51,7 @@ cl::opt<int> DCEPreciseSteps(
"before the actual dead code elimination."),
cl::ZeroOrMore, cl::init(-1), cl::cat(PollyCategory));
class DeadCodeElimWrapperPass : public ScopPass {
class DeadCodeElimWrapperPass final : public ScopPass {
public:
static char ID;
explicit DeadCodeElimWrapperPass() : ScopPass(ID) {}

View File

@ -35,7 +35,7 @@ void printSchedule(raw_ostream &OS, const isl::union_map &Schedule,
}
/// Flatten the schedule stored in an polly::Scop.
class FlattenSchedule : public ScopPass {
class FlattenSchedule final : public ScopPass {
private:
FlattenSchedule(const FlattenSchedule &) = delete;
const FlattenSchedule &operator=(const FlattenSchedule &) = delete;
@ -98,7 +98,7 @@ public:
char FlattenSchedule::ID;
/// Print result from FlattenSchedule.
class FlattenSchedulePrinterLegacyPass : public ScopPass {
class FlattenSchedulePrinterLegacyPass final : public ScopPass {
public:
static char ID;

View File

@ -197,7 +197,7 @@ struct ForwardingAction {
/// the MemoryAccess is removed and the all the operand tree instructions are
/// moved into the statement. All original instructions are left in the source
/// statements. The simplification pass can clean these up.
class ForwardOpTreeImpl : ZoneAlgorithm {
class ForwardOpTreeImpl final : ZoneAlgorithm {
private:
using MemoizationTy = DenseMap<ForwardingAction::KeyTy, ForwardingAction>;
@ -1101,7 +1101,7 @@ runForwardOpTreeUsingNPM(Scop &S, ScopAnalysisManager &SAM,
/// scalar definition are redirected (We currently do not care about removing
/// the write in this case). This is also useful for the main DeLICM pass as
/// there are less scalars to be mapped.
class ForwardOpTreeWrapperPass : public ScopPass {
class ForwardOpTreeWrapperPass final : public ScopPass {
private:
/// The pass implementation, also holding per-scop data.
std::unique_ptr<ForwardOpTreeImpl> Impl;
@ -1145,7 +1145,7 @@ public:
char ForwardOpTreeWrapperPass::ID;
/// Print result from ForwardOpTreeWrapperPass.
class ForwardOpTreePrinterLegacyPass : public ScopPass {
class ForwardOpTreePrinterLegacyPass final : public ScopPass {
public:
static char ID;

View File

@ -132,7 +132,7 @@ static auto getLoopMDProps(MDNode *LoopMD) {
/// Recursively visit all nodes in a schedule, loop for loop-transformations
/// metadata and apply the first encountered.
class SearchTransformVisitor
class SearchTransformVisitor final
: public RecursiveScheduleTreeVisitor<SearchTransformVisitor> {
private:
using BaseTy = RecursiveScheduleTreeVisitor<SearchTransformVisitor>;

View File

@ -539,8 +539,8 @@ static uint64_t getMatMulTypeSize(MatMulInfoTy MMI) {
/// @param MMI Parameters of the matrix multiplication operands.
/// @return The structure of type MicroKernelParamsTy.
/// @see MicroKernelParamsTy
static struct MicroKernelParamsTy
getMicroKernelParams(const TargetTransformInfo *TTI, MatMulInfoTy MMI) {
static MicroKernelParamsTy getMicroKernelParams(const TargetTransformInfo *TTI,
MatMulInfoTy MMI) {
assert(TTI && "The target transform info should be provided.");
// Nvec - Number of double-precision floating-point numbers that can be hold
@ -614,7 +614,7 @@ static void getTargetCacheParameters(const llvm::TargetTransformInfo *TTI) {
/// @return The structure of type MacroKernelParamsTy.
/// @see MacroKernelParamsTy
/// @see MicroKernelParamsTy
static struct MacroKernelParamsTy
static MacroKernelParamsTy
getMacroKernelParams(const llvm::TargetTransformInfo *TTI,
const MicroKernelParamsTy &MicroKernelParams,
MatMulInfoTy MMI) {
@ -893,7 +893,7 @@ getInductionVariablesSubstitution(isl::schedule_node Node,
/// @return The modified isl_schedule_node.
static isl::schedule_node
isolateAndUnrollMatMulInnerLoops(isl::schedule_node Node,
struct MicroKernelParamsTy MicroKernelParams) {
MicroKernelParamsTy MicroKernelParams) {
isl::schedule_node Child = Node.child(0);
isl::union_map UnMapOldIndVar = Child.get_prefix_schedule_relation();
isl::set Prefix = isl::map::from_union_map(UnMapOldIndVar).range();

View File

@ -34,7 +34,7 @@ using namespace polly;
namespace {
class MaximalStaticExpander : public ScopPass {
class MaximalStaticExpander final : public ScopPass {
public:
static char ID;

View File

@ -237,7 +237,7 @@ struct OptimizerAdditionalInfoTy {
bool Prevect;
};
class ScheduleTreeOptimizer {
class ScheduleTreeOptimizer final {
public:
/// Apply schedule tree transformations.
///
@ -384,7 +384,7 @@ ScheduleTreeOptimizer::isolateFullPartialTiles(isl::schedule_node Node,
return Result;
}
struct InsertSimdMarkers : public ScheduleNodeRewriter<InsertSimdMarkers> {
struct InsertSimdMarkers final : ScheduleNodeRewriter<InsertSimdMarkers> {
isl::schedule_node visitBand(isl::schedule_node_band Band) {
isl::schedule_node Node = visitChildren(Band);
@ -588,7 +588,7 @@ bool ScheduleTreeOptimizer::isProfitableSchedule(Scop &S,
return changed;
}
class IslScheduleOptimizerWrapperPass : public ScopPass {
class IslScheduleOptimizerWrapperPass final : public ScopPass {
public:
static char ID;
@ -1013,7 +1013,7 @@ IslScheduleOptimizerPrinterPass::run(Scop &S, ScopAnalysisManager &SAM,
namespace {
/// Print result from IslScheduleOptimizerWrapperPass.
class IslScheduleOptimizerPrinterLegacyPass : public ScopPass {
class IslScheduleOptimizerPrinterLegacyPass final : public ScopPass {
public:
static char ID;

View File

@ -128,7 +128,7 @@ static isl::schedule rebuildBand(isl::schedule_node_band OldBand,
/// AST build options must be set after the tree has been constructed.
template <typename Derived, typename... Args>
struct ScheduleTreeRewriter
: public RecursiveScheduleTreeVisitor<Derived, isl::schedule, Args...> {
: RecursiveScheduleTreeVisitor<Derived, isl::schedule, Args...> {
Derived &getDerived() { return *static_cast<Derived *>(this); }
const Derived &getDerived() const {
return *static_cast<const Derived *>(this);
@ -212,7 +212,7 @@ struct ScheduleTreeRewriter
/// Rewrite the schedule tree without any changes. Useful to copy a subtree into
/// a new schedule, discarding everything but.
struct IdentityRewriter : public ScheduleTreeRewriter<IdentityRewriter> {};
struct IdentityRewriter : ScheduleTreeRewriter<IdentityRewriter> {};
/// Rewrite a schedule tree to an equivalent one without extension nodes.
///
@ -225,9 +225,9 @@ struct IdentityRewriter : public ScheduleTreeRewriter<IdentityRewriter> {};
/// band nodes to schedule the additional domains at the same position as the
/// extension node would.
///
struct ExtensionNodeRewriter
: public ScheduleTreeRewriter<ExtensionNodeRewriter, const isl::union_set &,
isl::union_map &> {
struct ExtensionNodeRewriter final
: ScheduleTreeRewriter<ExtensionNodeRewriter, const isl::union_set &,
isl::union_map &> {
using BaseTy = ScheduleTreeRewriter<ExtensionNodeRewriter,
const isl::union_set &, isl::union_map &>;
BaseTy &getBase() { return *this; }
@ -356,8 +356,8 @@ struct ExtensionNodeRewriter
///
/// ScheduleTreeRewriter cannot apply the schedule tree options. This class
/// collects these options to apply them later.
struct CollectASTBuildOptions
: public RecursiveScheduleTreeVisitor<CollectASTBuildOptions> {
struct CollectASTBuildOptions final
: RecursiveScheduleTreeVisitor<CollectASTBuildOptions> {
using BaseTy = RecursiveScheduleTreeVisitor<CollectASTBuildOptions>;
BaseTy &getBase() { return *this; }
const BaseTy &getBase() const { return *this; }
@ -376,8 +376,7 @@ struct CollectASTBuildOptions
/// This rewrites a schedule tree with the AST build options applied. We assume
/// that the band nodes are visited in the same order as they were when the
/// build options were collected, typically by CollectASTBuildOptions.
struct ApplyASTBuildOptions
: public ScheduleNodeRewriter<ApplyASTBuildOptions> {
struct ApplyASTBuildOptions final : ScheduleNodeRewriter<ApplyASTBuildOptions> {
using BaseTy = ScheduleNodeRewriter<ApplyASTBuildOptions>;
BaseTy &getBase() { return *this; }
const BaseTy &getBase() const { return *this; }
@ -560,7 +559,8 @@ static isl::set addExtentConstraints(isl::set Set, int VectorWidth) {
}
/// Collapse perfectly nested bands into a single band.
class BandCollapseRewriter : public ScheduleTreeRewriter<BandCollapseRewriter> {
class BandCollapseRewriter final
: public ScheduleTreeRewriter<BandCollapseRewriter> {
private:
using BaseTy = ScheduleTreeRewriter<BandCollapseRewriter>;
BaseTy &getBase() { return *this; }
@ -833,7 +833,7 @@ static isl::schedule tryGreedyFuse(isl::schedule_node LHS,
///
/// The isl::union_map parameters is the set of validity dependencies that have
/// not been resolved/carried by a parent schedule node.
class GreedyFusionRewriter
class GreedyFusionRewriter final
: public ScheduleTreeRewriter<GreedyFusionRewriter, isl::union_map> {
private:
using BaseTy = ScheduleTreeRewriter<GreedyFusionRewriter, isl::union_map>;

View File

@ -27,7 +27,7 @@ using namespace llvm;
using namespace polly;
namespace {
class ScopInliner : public CallGraphSCCPass {
class ScopInliner final : public CallGraphSCCPass {
using llvm::Pass::doInitialization;
public:

View File

@ -119,7 +119,7 @@ static isl::union_map underapproximatedAddMap(isl::union_map UMap,
return UResult;
}
class SimplifyImpl {
class SimplifyImpl final {
private:
/// The invocation id (if there are multiple instances in the pass manager's
/// pipeline) to determine which statistics to update.
@ -754,7 +754,7 @@ void SimplifyImpl::printScop(raw_ostream &OS, Scop &S) const {
printAccesses(OS);
}
class SimplifyWrapperPass : public ScopPass {
class SimplifyWrapperPass final : public ScopPass {
public:
static char ID;
int CallNo;
@ -855,7 +855,7 @@ INITIALIZE_PASS_END(SimplifyWrapperPass, "polly-simplify", "Polly - Simplify",
namespace {
/// Print result from SimplifyWrapperPass.
class SimplifyPrinterLegacyPass : public ScopPass {
class SimplifyPrinterLegacyPass final : public ScopPass {
public:
static char ID;