2527 lines
99 KiB
PHP
2527 lines
99 KiB
PHP
/* Autogenerated by mlir-tblgen; don't manually edit */
|
|
|
|
#ifdef GEN_PASS_DECL
|
|
// Generate declarations for all passes.
|
|
#define GEN_PASS_DECL_BUBBLEDOWNMEMORYSPACECASTS
|
|
#define GEN_PASS_DECL_CSEPASS
|
|
#define GEN_PASS_DECL_CANONICALIZERPASS
|
|
#define GEN_PASS_DECL_COMPOSITEFIXEDPOINTPASS
|
|
#define GEN_PASS_DECL_CONTROLFLOWSINKPASS
|
|
#define GEN_PASS_DECL_GENERATERUNTIMEVERIFICATIONPASS
|
|
#define GEN_PASS_DECL_INLINERPASS
|
|
#define GEN_PASS_DECL_LOCATIONSNAPSHOT
|
|
#define GEN_PASS_DECL_LOOPINVARIANTCODEMOTIONPASS
|
|
#define GEN_PASS_DECL_LOOPINVARIANTSUBSETHOISTINGPASS
|
|
#define GEN_PASS_DECL_MEM2REG
|
|
#define GEN_PASS_DECL_PRINTIRPASS
|
|
#define GEN_PASS_DECL_PRINTOPSTATSPASS
|
|
#define GEN_PASS_DECL_REMOVEDEADVALUESPASS
|
|
#define GEN_PASS_DECL_SCCPPASS
|
|
#define GEN_PASS_DECL_SROA
|
|
#define GEN_PASS_DECL_STRIPDEBUGINFOPASS
|
|
#define GEN_PASS_DECL_SYMBOLDCEPASS
|
|
#define GEN_PASS_DECL_SYMBOLPRIVATIZEPASS
|
|
#define GEN_PASS_DECL_TOPOLOGICALSORTPASS
|
|
#define GEN_PASS_DECL_TRIVIALDEADCODEELIMINATIONPASS
|
|
#define GEN_PASS_DECL_VIEWOPGRAPHPASS
|
|
#undef GEN_PASS_DECL
|
|
#endif // GEN_PASS_DECL
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// BubbleDownMemorySpaceCasts
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_BUBBLEDOWNMEMORYSPACECASTS
|
|
std::unique_ptr<::mlir::Pass> createBubbleDownMemorySpaceCasts();
|
|
#undef GEN_PASS_DECL_BUBBLEDOWNMEMORYSPACECASTS
|
|
#endif // GEN_PASS_DECL_BUBBLEDOWNMEMORYSPACECASTS
|
|
#ifdef GEN_PASS_DEF_BUBBLEDOWNMEMORYSPACECASTS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createBubbleDownMemorySpaceCasts();
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class BubbleDownMemorySpaceCastsBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = BubbleDownMemorySpaceCastsBase;
|
|
|
|
BubbleDownMemorySpaceCastsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
BubbleDownMemorySpaceCastsBase(const BubbleDownMemorySpaceCastsBase &other) : ::mlir::OperationPass<>(other) {}
|
|
BubbleDownMemorySpaceCastsBase& operator=(const BubbleDownMemorySpaceCastsBase &) = delete;
|
|
BubbleDownMemorySpaceCastsBase(BubbleDownMemorySpaceCastsBase &&) = delete;
|
|
BubbleDownMemorySpaceCastsBase& operator=(BubbleDownMemorySpaceCastsBase &&) = delete;
|
|
~BubbleDownMemorySpaceCastsBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("bubble-down-memory-space-casts");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "bubble-down-memory-space-casts"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Bubbles down memory-space cast operations.)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("BubbleDownMemorySpaceCasts");
|
|
}
|
|
::llvm::StringRef getName() const override { return "BubbleDownMemorySpaceCasts"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BubbleDownMemorySpaceCastsBase<DerivedT>)
|
|
|
|
protected:
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createBubbleDownMemorySpaceCasts() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createBubbleDownMemorySpaceCasts() {
|
|
return impl::createBubbleDownMemorySpaceCasts();
|
|
}
|
|
#undef GEN_PASS_DEF_BUBBLEDOWNMEMORYSPACECASTS
|
|
#endif // GEN_PASS_DEF_BUBBLEDOWNMEMORYSPACECASTS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// CSEPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_CSEPASS
|
|
std::unique_ptr<::mlir::Pass> createCSEPass();
|
|
#undef GEN_PASS_DECL_CSEPASS
|
|
#endif // GEN_PASS_DECL_CSEPASS
|
|
#ifdef GEN_PASS_DEF_CSEPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createCSEPass();
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class CSEPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = CSEPassBase;
|
|
|
|
CSEPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
CSEPassBase(const CSEPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
CSEPassBase& operator=(const CSEPassBase &) = delete;
|
|
CSEPassBase(CSEPassBase &&) = delete;
|
|
CSEPassBase& operator=(CSEPassBase &&) = delete;
|
|
~CSEPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("cse");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "cse"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Eliminate common sub-expressions)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("CSEPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "CSEPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CSEPassBase<DerivedT>)
|
|
|
|
protected:
|
|
::mlir::Pass::Statistic numCSE{this, "num-cse'd", R"PS(Number of operations CSE'd)PS"};
|
|
::mlir::Pass::Statistic numDCE{this, "num-dce'd", R"PS(Number of operations DCE'd)PS"};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createCSEPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createCSEPass() {
|
|
return impl::createCSEPass();
|
|
}
|
|
#undef GEN_PASS_DEF_CSEPASS
|
|
#endif // GEN_PASS_DEF_CSEPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// CanonicalizerPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_CANONICALIZERPASS
|
|
struct CanonicalizerPassOptions {
|
|
bool topDownProcessingEnabled = true;
|
|
mlir::GreedySimplifyRegionLevel regionSimplifyLevel = mlir::GreedySimplifyRegionLevel::Normal;
|
|
int64_t maxIterations = 10;
|
|
int64_t maxNumRewrites = -1;
|
|
bool testConvergence = false;
|
|
bool cseBetweenIterations = false;
|
|
::llvm::SmallVector<std::string> filterDialects;
|
|
::llvm::SmallVector<std::string> disabledPatterns;
|
|
::llvm::SmallVector<std::string> enabledPatterns;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createCanonicalizerPass();
|
|
std::unique_ptr<::mlir::Pass> createCanonicalizerPass(CanonicalizerPassOptions options);
|
|
#undef GEN_PASS_DECL_CANONICALIZERPASS
|
|
#endif // GEN_PASS_DECL_CANONICALIZERPASS
|
|
#ifdef GEN_PASS_DEF_CANONICALIZERPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createCanonicalizerPass();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createCanonicalizerPass(CanonicalizerPassOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class CanonicalizerPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = CanonicalizerPassBase;
|
|
|
|
CanonicalizerPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
CanonicalizerPassBase(const CanonicalizerPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
CanonicalizerPassBase& operator=(const CanonicalizerPassBase &) = delete;
|
|
CanonicalizerPassBase(CanonicalizerPassBase &&) = delete;
|
|
CanonicalizerPassBase& operator=(CanonicalizerPassBase &&) = delete;
|
|
~CanonicalizerPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("canonicalize");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "canonicalize"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Canonicalize operations)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("CanonicalizerPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "CanonicalizerPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CanonicalizerPassBase<DerivedT>)
|
|
|
|
CanonicalizerPassBase(CanonicalizerPassOptions options) : CanonicalizerPassBase() {
|
|
topDownProcessingEnabled = std::move(options.topDownProcessingEnabled);
|
|
regionSimplifyLevel = std::move(options.regionSimplifyLevel);
|
|
maxIterations = std::move(options.maxIterations);
|
|
maxNumRewrites = std::move(options.maxNumRewrites);
|
|
testConvergence = std::move(options.testConvergence);
|
|
cseBetweenIterations = std::move(options.cseBetweenIterations);
|
|
filterDialects = std::move(options.filterDialects);
|
|
disabledPatterns = std::move(options.disabledPatterns);
|
|
enabledPatterns = std::move(options.enabledPatterns);
|
|
}
|
|
protected:
|
|
::mlir::Pass::Option<bool> topDownProcessingEnabled{*this, "top-down", ::llvm::cl::desc(R"PO(Seed the worklist in general top-down order)PO"), ::llvm::cl::init(true)};
|
|
::mlir::Pass::Option<mlir::GreedySimplifyRegionLevel> regionSimplifyLevel{*this, "region-simplify", ::llvm::cl::desc(R"PO(Perform control flow optimizations to the region tree)PO"), ::llvm::cl::init(mlir::GreedySimplifyRegionLevel::Normal), ::llvm::cl::values(
|
|
clEnumValN(mlir::GreedySimplifyRegionLevel::Disabled, "disabled",
|
|
"Don't run any control-flow simplification."),
|
|
clEnumValN(mlir::GreedySimplifyRegionLevel::Normal, "normal",
|
|
"Perform simple control-flow simplifications (e.g. dead args elimination)."),
|
|
clEnumValN(mlir::GreedySimplifyRegionLevel::Aggressive, "aggressive",
|
|
"Perform aggressive control-flow simplification (e.g. block merging).")
|
|
)};
|
|
::mlir::Pass::Option<int64_t> maxIterations{*this, "max-iterations", ::llvm::cl::desc(R"PO(Max. iterations between applying patterns / simplifying regions)PO"), ::llvm::cl::init(10)};
|
|
::mlir::Pass::Option<int64_t> maxNumRewrites{*this, "max-num-rewrites", ::llvm::cl::desc(R"PO(Max. number of pattern rewrites within an iteration)PO"), ::llvm::cl::init(-1)};
|
|
::mlir::Pass::Option<bool> testConvergence{*this, "test-convergence", ::llvm::cl::desc(R"PO(Test only: Fail pass on non-convergence to detect cyclic pattern)PO"), ::llvm::cl::init(false)};
|
|
::mlir::Pass::Option<bool> cseBetweenIterations{*this, "cse-between-iterations", ::llvm::cl::desc(R"PO(Run full CSE between each pattern-application iteration. CSE-driven changes trigger extra iterations, so this may push the iteration count up to max-iterations and affect convergence under test-convergence.)PO"), ::llvm::cl::init(false)};
|
|
::mlir::Pass::ListOption<std::string> filterDialects{*this, "filter-dialects", ::llvm::cl::desc(R"PO(If non-empty, only collect canonicalization patterns from the dialects with the given namespaces. The listed dialects are force-loaded into the context as dependent dialects.)PO")};
|
|
::mlir::Pass::ListOption<std::string> disabledPatterns{*this, "disable-patterns", ::llvm::cl::desc(R"PO(Labels of patterns that should be filtered out during application)PO")};
|
|
::mlir::Pass::ListOption<std::string> enabledPatterns{*this, "enable-patterns", ::llvm::cl::desc(R"PO(Labels of patterns that should be used during application, all other patterns are filtered out)PO")};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createCanonicalizerPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createCanonicalizerPass(CanonicalizerPassOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createCanonicalizerPass() {
|
|
return impl::createCanonicalizerPass();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createCanonicalizerPass(CanonicalizerPassOptions options) {
|
|
return impl::createCanonicalizerPass(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_CANONICALIZERPASS
|
|
#endif // GEN_PASS_DEF_CANONICALIZERPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// CompositeFixedPointPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_COMPOSITEFIXEDPOINTPASS
|
|
struct CompositeFixedPointPassOptions {
|
|
std::string name = "CompositeFixedPointPass";
|
|
std::string pipelineStr;
|
|
int maxIter = 10;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createCompositeFixedPointPass();
|
|
std::unique_ptr<::mlir::Pass> createCompositeFixedPointPass(CompositeFixedPointPassOptions options);
|
|
#undef GEN_PASS_DECL_COMPOSITEFIXEDPOINTPASS
|
|
#endif // GEN_PASS_DECL_COMPOSITEFIXEDPOINTPASS
|
|
#ifdef GEN_PASS_DEF_COMPOSITEFIXEDPOINTPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createCompositeFixedPointPass();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createCompositeFixedPointPass(CompositeFixedPointPassOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class CompositeFixedPointPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = CompositeFixedPointPassBase;
|
|
|
|
CompositeFixedPointPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
CompositeFixedPointPassBase(const CompositeFixedPointPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
CompositeFixedPointPassBase& operator=(const CompositeFixedPointPassBase &) = delete;
|
|
CompositeFixedPointPassBase(CompositeFixedPointPassBase &&) = delete;
|
|
CompositeFixedPointPassBase& operator=(CompositeFixedPointPassBase &&) = delete;
|
|
~CompositeFixedPointPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("composite-fixed-point-pass");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "composite-fixed-point-pass"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Composite fixed point pass)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("CompositeFixedPointPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "CompositeFixedPointPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CompositeFixedPointPassBase<DerivedT>)
|
|
|
|
CompositeFixedPointPassBase(CompositeFixedPointPassOptions options) : CompositeFixedPointPassBase() {
|
|
name = std::move(options.name);
|
|
pipelineStr = std::move(options.pipelineStr);
|
|
maxIter = std::move(options.maxIter);
|
|
}
|
|
protected:
|
|
::mlir::Pass::Option<std::string> name{*this, "name", ::llvm::cl::desc(R"PO(Composite pass display name)PO"), ::llvm::cl::init("CompositeFixedPointPass")};
|
|
::mlir::Pass::Option<std::string> pipelineStr{*this, "pipeline", ::llvm::cl::desc(R"PO(Composite pass inner pipeline)PO")};
|
|
::mlir::Pass::Option<int> maxIter{*this, "max-iterations", ::llvm::cl::desc(R"PO(Maximum number of iterations if inner pipeline)PO"), ::llvm::cl::init(10)};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createCompositeFixedPointPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createCompositeFixedPointPass(CompositeFixedPointPassOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createCompositeFixedPointPass() {
|
|
return impl::createCompositeFixedPointPass();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createCompositeFixedPointPass(CompositeFixedPointPassOptions options) {
|
|
return impl::createCompositeFixedPointPass(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_COMPOSITEFIXEDPOINTPASS
|
|
#endif // GEN_PASS_DEF_COMPOSITEFIXEDPOINTPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ControlFlowSinkPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_CONTROLFLOWSINKPASS
|
|
std::unique_ptr<::mlir::Pass> createControlFlowSinkPass();
|
|
#undef GEN_PASS_DECL_CONTROLFLOWSINKPASS
|
|
#endif // GEN_PASS_DECL_CONTROLFLOWSINKPASS
|
|
#ifdef GEN_PASS_DEF_CONTROLFLOWSINKPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createControlFlowSinkPass();
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class ControlFlowSinkPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = ControlFlowSinkPassBase;
|
|
|
|
ControlFlowSinkPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
ControlFlowSinkPassBase(const ControlFlowSinkPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
ControlFlowSinkPassBase& operator=(const ControlFlowSinkPassBase &) = delete;
|
|
ControlFlowSinkPassBase(ControlFlowSinkPassBase &&) = delete;
|
|
ControlFlowSinkPassBase& operator=(ControlFlowSinkPassBase &&) = delete;
|
|
~ControlFlowSinkPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("control-flow-sink");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "control-flow-sink"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Sink operations into conditional blocks)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("ControlFlowSinkPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "ControlFlowSinkPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ControlFlowSinkPassBase<DerivedT>)
|
|
|
|
protected:
|
|
::mlir::Pass::Statistic numSunk{this, "num-sunk", R"PS(Number of operations sunk)PS"};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createControlFlowSinkPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createControlFlowSinkPass() {
|
|
return impl::createControlFlowSinkPass();
|
|
}
|
|
#undef GEN_PASS_DEF_CONTROLFLOWSINKPASS
|
|
#endif // GEN_PASS_DEF_CONTROLFLOWSINKPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// GenerateRuntimeVerificationPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_GENERATERUNTIMEVERIFICATIONPASS
|
|
struct GenerateRuntimeVerificationPassOptions {
|
|
unsigned verboseLevel = 1;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createGenerateRuntimeVerificationPass();
|
|
std::unique_ptr<::mlir::Pass> createGenerateRuntimeVerificationPass(GenerateRuntimeVerificationPassOptions options);
|
|
#undef GEN_PASS_DECL_GENERATERUNTIMEVERIFICATIONPASS
|
|
#endif // GEN_PASS_DECL_GENERATERUNTIMEVERIFICATIONPASS
|
|
#ifdef GEN_PASS_DEF_GENERATERUNTIMEVERIFICATIONPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createGenerateRuntimeVerificationPass();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createGenerateRuntimeVerificationPass(GenerateRuntimeVerificationPassOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class GenerateRuntimeVerificationPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = GenerateRuntimeVerificationPassBase;
|
|
|
|
GenerateRuntimeVerificationPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
GenerateRuntimeVerificationPassBase(const GenerateRuntimeVerificationPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
GenerateRuntimeVerificationPassBase& operator=(const GenerateRuntimeVerificationPassBase &) = delete;
|
|
GenerateRuntimeVerificationPassBase(GenerateRuntimeVerificationPassBase &&) = delete;
|
|
GenerateRuntimeVerificationPassBase& operator=(GenerateRuntimeVerificationPassBase &&) = delete;
|
|
~GenerateRuntimeVerificationPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("generate-runtime-verification");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "generate-runtime-verification"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Generate additional runtime op verification checks)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("GenerateRuntimeVerificationPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "GenerateRuntimeVerificationPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GenerateRuntimeVerificationPassBase<DerivedT>)
|
|
|
|
GenerateRuntimeVerificationPassBase(GenerateRuntimeVerificationPassOptions options) : GenerateRuntimeVerificationPassBase() {
|
|
verboseLevel = std::move(options.verboseLevel);
|
|
}
|
|
protected:
|
|
::mlir::Pass::Option<unsigned> verboseLevel{*this, "verbose-level", ::llvm::cl::desc(R"PO(Verbosity level for runtime verification messages: 0 = Minimum (only source location), 1 = Detailed (include full operation details, names, types, shapes, etc.))PO"), ::llvm::cl::init(1)};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createGenerateRuntimeVerificationPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createGenerateRuntimeVerificationPass(GenerateRuntimeVerificationPassOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createGenerateRuntimeVerificationPass() {
|
|
return impl::createGenerateRuntimeVerificationPass();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createGenerateRuntimeVerificationPass(GenerateRuntimeVerificationPassOptions options) {
|
|
return impl::createGenerateRuntimeVerificationPass(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_GENERATERUNTIMEVERIFICATIONPASS
|
|
#endif // GEN_PASS_DEF_GENERATERUNTIMEVERIFICATIONPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// InlinerPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_INLINERPASS
|
|
struct InlinerPassOptions {
|
|
std::string defaultPipelineStr = "canonicalize";
|
|
::llvm::SmallVector<OpPassManager> opPipelineList;
|
|
unsigned maxInliningIterations = 4;
|
|
unsigned inliningThreshold = -1U;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createInlinerPass();
|
|
std::unique_ptr<::mlir::Pass> createInlinerPass(InlinerPassOptions options);
|
|
#undef GEN_PASS_DECL_INLINERPASS
|
|
#endif // GEN_PASS_DECL_INLINERPASS
|
|
#ifdef GEN_PASS_DEF_INLINERPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createInlinerPass();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createInlinerPass(InlinerPassOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class InlinerPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = InlinerPassBase;
|
|
|
|
InlinerPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
InlinerPassBase(const InlinerPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
InlinerPassBase& operator=(const InlinerPassBase &) = delete;
|
|
InlinerPassBase(InlinerPassBase &&) = delete;
|
|
InlinerPassBase& operator=(InlinerPassBase &&) = delete;
|
|
~InlinerPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("inline");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "inline"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Inline function calls)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("InlinerPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "InlinerPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(InlinerPassBase<DerivedT>)
|
|
|
|
InlinerPassBase(InlinerPassOptions options) : InlinerPassBase() {
|
|
defaultPipelineStr = std::move(options.defaultPipelineStr);
|
|
opPipelineList = std::move(options.opPipelineList);
|
|
maxInliningIterations = std::move(options.maxInliningIterations);
|
|
inliningThreshold = std::move(options.inliningThreshold);
|
|
}
|
|
protected:
|
|
::mlir::Pass::Option<std::string> defaultPipelineStr{*this, "default-pipeline", ::llvm::cl::desc(R"PO(The optimizer pipeline used for callables that do not have a dedicated optimizer pipeline in opPipelineList)PO"), ::llvm::cl::init("canonicalize")};
|
|
::mlir::Pass::ListOption<OpPassManager> opPipelineList{*this, "op-pipelines", ::llvm::cl::desc(R"PO(Callable operation specific optimizer pipelines (in the form of `dialect.op(pipeline)`))PO")};
|
|
::mlir::Pass::Option<unsigned> maxInliningIterations{*this, "max-iterations", ::llvm::cl::desc(R"PO(Maximum number of iterations when inlining within an SCC)PO"), ::llvm::cl::init(4)};
|
|
::mlir::Pass::Option<unsigned> inliningThreshold{*this, "inlining-threshold", ::llvm::cl::desc(R"PO(If the ratio between the number of the operations in the callee and the number of the operations in the caller exceeds this value (in percentage), then the callee is not inlined even if it is legal to inline it)PO"), ::llvm::cl::init(-1U)};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createInlinerPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createInlinerPass(InlinerPassOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createInlinerPass() {
|
|
return impl::createInlinerPass();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createInlinerPass(InlinerPassOptions options) {
|
|
return impl::createInlinerPass(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_INLINERPASS
|
|
#endif // GEN_PASS_DEF_INLINERPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// LocationSnapshot
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_LOCATIONSNAPSHOT
|
|
struct LocationSnapshotOptions {
|
|
std::string fileName;
|
|
std::string tag;
|
|
bool enableDebugInfo = false;
|
|
bool printGenericOpForm = false;
|
|
bool useLocalScope = false;
|
|
bool printPrettyDebugInfo = false;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createLocationSnapshot();
|
|
std::unique_ptr<::mlir::Pass> createLocationSnapshot(LocationSnapshotOptions options);
|
|
#undef GEN_PASS_DECL_LOCATIONSNAPSHOT
|
|
#endif // GEN_PASS_DECL_LOCATIONSNAPSHOT
|
|
#ifdef GEN_PASS_DEF_LOCATIONSNAPSHOT
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createLocationSnapshot();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createLocationSnapshot(LocationSnapshotOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class LocationSnapshotBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = LocationSnapshotBase;
|
|
|
|
LocationSnapshotBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
LocationSnapshotBase(const LocationSnapshotBase &other) : ::mlir::OperationPass<>(other) {}
|
|
LocationSnapshotBase& operator=(const LocationSnapshotBase &) = delete;
|
|
LocationSnapshotBase(LocationSnapshotBase &&) = delete;
|
|
LocationSnapshotBase& operator=(LocationSnapshotBase &&) = delete;
|
|
~LocationSnapshotBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("snapshot-op-locations");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "snapshot-op-locations"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Generate new locations from the current IR)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("LocationSnapshot");
|
|
}
|
|
::llvm::StringRef getName() const override { return "LocationSnapshot"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LocationSnapshotBase<DerivedT>)
|
|
|
|
LocationSnapshotBase(LocationSnapshotOptions options) : LocationSnapshotBase() {
|
|
fileName = std::move(options.fileName);
|
|
tag = std::move(options.tag);
|
|
enableDebugInfo = std::move(options.enableDebugInfo);
|
|
printGenericOpForm = std::move(options.printGenericOpForm);
|
|
useLocalScope = std::move(options.useLocalScope);
|
|
printPrettyDebugInfo = std::move(options.printPrettyDebugInfo);
|
|
}
|
|
protected:
|
|
::mlir::Pass::Option<std::string> fileName{*this, "filename", ::llvm::cl::desc(R"PO(The filename to print the generated IR)PO")};
|
|
::mlir::Pass::Option<std::string> tag{*this, "tag", ::llvm::cl::desc(R"PO(A tag to use when fusing the new locations with the original. If unset, the locations are replaced.)PO")};
|
|
::mlir::Pass::Option<bool> enableDebugInfo{*this, "print-debuginfo", ::llvm::cl::desc(R"PO(Print debug info in MLIR output)PO"), ::llvm::cl::init(false)};
|
|
::mlir::Pass::Option<bool> printGenericOpForm{*this, "print-op-generic", ::llvm::cl::desc(R"PO(Print the generic op form)PO"), ::llvm::cl::init(false)};
|
|
::mlir::Pass::Option<bool> useLocalScope{*this, "print-local-scope", ::llvm::cl::desc(R"PO(Print with local scope and inline information (eliding aliases for attributes, types, and locations)PO"), ::llvm::cl::init(false)};
|
|
::mlir::Pass::Option<bool> printPrettyDebugInfo{*this, "pretty-debuginfo", ::llvm::cl::desc(R"PO(Print pretty debug info in MLIR output)PO"), ::llvm::cl::init(false)};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createLocationSnapshot() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createLocationSnapshot(LocationSnapshotOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createLocationSnapshot() {
|
|
return impl::createLocationSnapshot();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createLocationSnapshot(LocationSnapshotOptions options) {
|
|
return impl::createLocationSnapshot(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_LOCATIONSNAPSHOT
|
|
#endif // GEN_PASS_DEF_LOCATIONSNAPSHOT
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// LoopInvariantCodeMotionPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_LOOPINVARIANTCODEMOTIONPASS
|
|
std::unique_ptr<::mlir::Pass> createLoopInvariantCodeMotionPass();
|
|
#undef GEN_PASS_DECL_LOOPINVARIANTCODEMOTIONPASS
|
|
#endif // GEN_PASS_DECL_LOOPINVARIANTCODEMOTIONPASS
|
|
#ifdef GEN_PASS_DEF_LOOPINVARIANTCODEMOTIONPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createLoopInvariantCodeMotionPass();
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class LoopInvariantCodeMotionPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = LoopInvariantCodeMotionPassBase;
|
|
|
|
LoopInvariantCodeMotionPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
LoopInvariantCodeMotionPassBase(const LoopInvariantCodeMotionPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
LoopInvariantCodeMotionPassBase& operator=(const LoopInvariantCodeMotionPassBase &) = delete;
|
|
LoopInvariantCodeMotionPassBase(LoopInvariantCodeMotionPassBase &&) = delete;
|
|
LoopInvariantCodeMotionPassBase& operator=(LoopInvariantCodeMotionPassBase &&) = delete;
|
|
~LoopInvariantCodeMotionPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("loop-invariant-code-motion");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "loop-invariant-code-motion"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Hoist loop invariant instructions outside of the loop)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("LoopInvariantCodeMotionPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "LoopInvariantCodeMotionPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LoopInvariantCodeMotionPassBase<DerivedT>)
|
|
|
|
protected:
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createLoopInvariantCodeMotionPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createLoopInvariantCodeMotionPass() {
|
|
return impl::createLoopInvariantCodeMotionPass();
|
|
}
|
|
#undef GEN_PASS_DEF_LOOPINVARIANTCODEMOTIONPASS
|
|
#endif // GEN_PASS_DEF_LOOPINVARIANTCODEMOTIONPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// LoopInvariantSubsetHoistingPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_LOOPINVARIANTSUBSETHOISTINGPASS
|
|
std::unique_ptr<::mlir::Pass> createLoopInvariantSubsetHoistingPass();
|
|
#undef GEN_PASS_DECL_LOOPINVARIANTSUBSETHOISTINGPASS
|
|
#endif // GEN_PASS_DECL_LOOPINVARIANTSUBSETHOISTINGPASS
|
|
#ifdef GEN_PASS_DEF_LOOPINVARIANTSUBSETHOISTINGPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createLoopInvariantSubsetHoistingPass();
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class LoopInvariantSubsetHoistingPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = LoopInvariantSubsetHoistingPassBase;
|
|
|
|
LoopInvariantSubsetHoistingPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
LoopInvariantSubsetHoistingPassBase(const LoopInvariantSubsetHoistingPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
LoopInvariantSubsetHoistingPassBase& operator=(const LoopInvariantSubsetHoistingPassBase &) = delete;
|
|
LoopInvariantSubsetHoistingPassBase(LoopInvariantSubsetHoistingPassBase &&) = delete;
|
|
LoopInvariantSubsetHoistingPassBase& operator=(LoopInvariantSubsetHoistingPassBase &&) = delete;
|
|
~LoopInvariantSubsetHoistingPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("loop-invariant-subset-hoisting");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "loop-invariant-subset-hoisting"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Hoist loop invariant subset ops outside of the loop)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("LoopInvariantSubsetHoistingPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "LoopInvariantSubsetHoistingPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LoopInvariantSubsetHoistingPassBase<DerivedT>)
|
|
|
|
protected:
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createLoopInvariantSubsetHoistingPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createLoopInvariantSubsetHoistingPass() {
|
|
return impl::createLoopInvariantSubsetHoistingPass();
|
|
}
|
|
#undef GEN_PASS_DEF_LOOPINVARIANTSUBSETHOISTINGPASS
|
|
#endif // GEN_PASS_DEF_LOOPINVARIANTSUBSETHOISTINGPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Mem2Reg
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_MEM2REG
|
|
struct Mem2RegOptions {
|
|
bool enableRegionSimplification = true;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createMem2Reg();
|
|
std::unique_ptr<::mlir::Pass> createMem2Reg(Mem2RegOptions options);
|
|
#undef GEN_PASS_DECL_MEM2REG
|
|
#endif // GEN_PASS_DECL_MEM2REG
|
|
#ifdef GEN_PASS_DEF_MEM2REG
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createMem2Reg();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createMem2Reg(Mem2RegOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class Mem2RegBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = Mem2RegBase;
|
|
|
|
Mem2RegBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
Mem2RegBase(const Mem2RegBase &other) : ::mlir::OperationPass<>(other) {}
|
|
Mem2RegBase& operator=(const Mem2RegBase &) = delete;
|
|
Mem2RegBase(Mem2RegBase &&) = delete;
|
|
Mem2RegBase& operator=(Mem2RegBase &&) = delete;
|
|
~Mem2RegBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("mem2reg");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "mem2reg"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Promotes memory slots into values.)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("Mem2Reg");
|
|
}
|
|
::llvm::StringRef getName() const override { return "Mem2Reg"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(Mem2RegBase<DerivedT>)
|
|
|
|
Mem2RegBase(Mem2RegOptions options) : Mem2RegBase() {
|
|
enableRegionSimplification = std::move(options.enableRegionSimplification);
|
|
}
|
|
protected:
|
|
::mlir::Pass::Option<bool> enableRegionSimplification{*this, "region-simplify", ::llvm::cl::desc(R"PO(Perform control flow optimizations to the region tree)PO"), ::llvm::cl::init(true)};
|
|
::mlir::Pass::Statistic promotedAmount{this, "promoted slots", R"PS(Total amount of memory slot promoted)PS"};
|
|
::mlir::Pass::Statistic newBlockArgumentAmount{this, "new block args", R"PS(Total amount of new block argument inserted in blocks)PS"};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createMem2Reg() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createMem2Reg(Mem2RegOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createMem2Reg() {
|
|
return impl::createMem2Reg();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createMem2Reg(Mem2RegOptions options) {
|
|
return impl::createMem2Reg(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_MEM2REG
|
|
#endif // GEN_PASS_DEF_MEM2REG
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// PrintIRPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_PRINTIRPASS
|
|
struct PrintIRPassOptions {
|
|
std::string label;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createPrintIRPass();
|
|
std::unique_ptr<::mlir::Pass> createPrintIRPass(PrintIRPassOptions options);
|
|
#undef GEN_PASS_DECL_PRINTIRPASS
|
|
#endif // GEN_PASS_DECL_PRINTIRPASS
|
|
#ifdef GEN_PASS_DEF_PRINTIRPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createPrintIRPass();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createPrintIRPass(PrintIRPassOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class PrintIRPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = PrintIRPassBase;
|
|
|
|
PrintIRPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
PrintIRPassBase(const PrintIRPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
PrintIRPassBase& operator=(const PrintIRPassBase &) = delete;
|
|
PrintIRPassBase(PrintIRPassBase &&) = delete;
|
|
PrintIRPassBase& operator=(PrintIRPassBase &&) = delete;
|
|
~PrintIRPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("print-ir");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "print-ir"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Print IR on the debug stream)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("PrintIRPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "PrintIRPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PrintIRPassBase<DerivedT>)
|
|
|
|
PrintIRPassBase(PrintIRPassOptions options) : PrintIRPassBase() {
|
|
label = std::move(options.label);
|
|
}
|
|
protected:
|
|
::mlir::Pass::Option<std::string> label{*this, "label", ::llvm::cl::desc(R"PO(Label)PO")};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createPrintIRPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createPrintIRPass(PrintIRPassOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createPrintIRPass() {
|
|
return impl::createPrintIRPass();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createPrintIRPass(PrintIRPassOptions options) {
|
|
return impl::createPrintIRPass(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_PRINTIRPASS
|
|
#endif // GEN_PASS_DEF_PRINTIRPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// PrintOpStatsPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_PRINTOPSTATSPASS
|
|
struct PrintOpStatsPassOptions {
|
|
bool printAsJSON = false;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createPrintOpStatsPass();
|
|
std::unique_ptr<::mlir::Pass> createPrintOpStatsPass(PrintOpStatsPassOptions options);
|
|
#undef GEN_PASS_DECL_PRINTOPSTATSPASS
|
|
#endif // GEN_PASS_DECL_PRINTOPSTATSPASS
|
|
#ifdef GEN_PASS_DEF_PRINTOPSTATSPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createPrintOpStatsPass();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createPrintOpStatsPass(PrintOpStatsPassOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class PrintOpStatsPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = PrintOpStatsPassBase;
|
|
|
|
PrintOpStatsPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
PrintOpStatsPassBase(const PrintOpStatsPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
PrintOpStatsPassBase& operator=(const PrintOpStatsPassBase &) = delete;
|
|
PrintOpStatsPassBase(PrintOpStatsPassBase &&) = delete;
|
|
PrintOpStatsPassBase& operator=(PrintOpStatsPassBase &&) = delete;
|
|
~PrintOpStatsPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("print-op-stats");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "print-op-stats"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Print statistics of operations)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("PrintOpStatsPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "PrintOpStatsPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PrintOpStatsPassBase<DerivedT>)
|
|
|
|
PrintOpStatsPassBase(PrintOpStatsPassOptions options) : PrintOpStatsPassBase() {
|
|
printAsJSON = std::move(options.printAsJSON);
|
|
}
|
|
protected:
|
|
::mlir::Pass::Option<bool> printAsJSON{*this, "json", ::llvm::cl::desc(R"PO(print the stats as JSON)PO"), ::llvm::cl::init(false)};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createPrintOpStatsPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createPrintOpStatsPass(PrintOpStatsPassOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createPrintOpStatsPass() {
|
|
return impl::createPrintOpStatsPass();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createPrintOpStatsPass(PrintOpStatsPassOptions options) {
|
|
return impl::createPrintOpStatsPass(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_PRINTOPSTATSPASS
|
|
#endif // GEN_PASS_DEF_PRINTOPSTATSPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// RemoveDeadValuesPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_REMOVEDEADVALUESPASS
|
|
struct RemoveDeadValuesPassOptions {
|
|
bool canonicalize = true;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createRemoveDeadValuesPass();
|
|
std::unique_ptr<::mlir::Pass> createRemoveDeadValuesPass(RemoveDeadValuesPassOptions options);
|
|
#undef GEN_PASS_DECL_REMOVEDEADVALUESPASS
|
|
#endif // GEN_PASS_DECL_REMOVEDEADVALUESPASS
|
|
#ifdef GEN_PASS_DEF_REMOVEDEADVALUESPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createRemoveDeadValuesPass();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createRemoveDeadValuesPass(RemoveDeadValuesPassOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class RemoveDeadValuesPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = RemoveDeadValuesPassBase;
|
|
|
|
RemoveDeadValuesPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
RemoveDeadValuesPassBase(const RemoveDeadValuesPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
RemoveDeadValuesPassBase& operator=(const RemoveDeadValuesPassBase &) = delete;
|
|
RemoveDeadValuesPassBase(RemoveDeadValuesPassBase &&) = delete;
|
|
RemoveDeadValuesPassBase& operator=(RemoveDeadValuesPassBase &&) = delete;
|
|
~RemoveDeadValuesPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("remove-dead-values");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "remove-dead-values"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Remove dead values)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("RemoveDeadValuesPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "RemoveDeadValuesPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
registry.insert<ub::UBDialect>();
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RemoveDeadValuesPassBase<DerivedT>)
|
|
|
|
RemoveDeadValuesPassBase(RemoveDeadValuesPassOptions options) : RemoveDeadValuesPassBase() {
|
|
canonicalize = std::move(options.canonicalize);
|
|
}
|
|
protected:
|
|
::mlir::Pass::Option<bool> canonicalize{*this, "canonicalize", ::llvm::cl::desc(R"PO(Canonicalize region branch ops)PO"), ::llvm::cl::init(true)};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createRemoveDeadValuesPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createRemoveDeadValuesPass(RemoveDeadValuesPassOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createRemoveDeadValuesPass() {
|
|
return impl::createRemoveDeadValuesPass();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createRemoveDeadValuesPass(RemoveDeadValuesPassOptions options) {
|
|
return impl::createRemoveDeadValuesPass(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_REMOVEDEADVALUESPASS
|
|
#endif // GEN_PASS_DEF_REMOVEDEADVALUESPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// SCCPPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_SCCPPASS
|
|
std::unique_ptr<::mlir::Pass> createSCCPPass();
|
|
#undef GEN_PASS_DECL_SCCPPASS
|
|
#endif // GEN_PASS_DECL_SCCPPASS
|
|
#ifdef GEN_PASS_DEF_SCCPPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createSCCPPass();
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class SCCPPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = SCCPPassBase;
|
|
|
|
SCCPPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
SCCPPassBase(const SCCPPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
SCCPPassBase& operator=(const SCCPPassBase &) = delete;
|
|
SCCPPassBase(SCCPPassBase &&) = delete;
|
|
SCCPPassBase& operator=(SCCPPassBase &&) = delete;
|
|
~SCCPPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("sccp");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "sccp"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Sparse Conditional Constant Propagation)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("SCCPPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "SCCPPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SCCPPassBase<DerivedT>)
|
|
|
|
protected:
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createSCCPPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createSCCPPass() {
|
|
return impl::createSCCPPass();
|
|
}
|
|
#undef GEN_PASS_DEF_SCCPPASS
|
|
#endif // GEN_PASS_DEF_SCCPPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// SROA
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_SROA
|
|
std::unique_ptr<::mlir::Pass> createSROA();
|
|
#undef GEN_PASS_DECL_SROA
|
|
#endif // GEN_PASS_DECL_SROA
|
|
#ifdef GEN_PASS_DEF_SROA
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createSROA();
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class SROABase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = SROABase;
|
|
|
|
SROABase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
SROABase(const SROABase &other) : ::mlir::OperationPass<>(other) {}
|
|
SROABase& operator=(const SROABase &) = delete;
|
|
SROABase(SROABase &&) = delete;
|
|
SROABase& operator=(SROABase &&) = delete;
|
|
~SROABase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("sroa");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "sroa"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Scalar Replacement of Aggregates)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("SROA");
|
|
}
|
|
::llvm::StringRef getName() const override { return "SROA"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SROABase<DerivedT>)
|
|
|
|
protected:
|
|
::mlir::Pass::Statistic destructuredAmount{this, "destructured slots", R"PS(Total amount of memory slots destructured)PS"};
|
|
::mlir::Pass::Statistic slotsWithMemoryBenefit{this, "slots with memory benefit", R"PS(Total amount of memory slots in which the destructured size was smaller than the total size after eliminating unused fields)PS"};
|
|
::mlir::Pass::Statistic maxSubelementAmount{this, "max subelement number", R"PS(Maximal number of sub-elements a successfully destructured slot initially had)PS"};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createSROA() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createSROA() {
|
|
return impl::createSROA();
|
|
}
|
|
#undef GEN_PASS_DEF_SROA
|
|
#endif // GEN_PASS_DEF_SROA
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// StripDebugInfoPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_STRIPDEBUGINFOPASS
|
|
std::unique_ptr<::mlir::Pass> createStripDebugInfoPass();
|
|
#undef GEN_PASS_DECL_STRIPDEBUGINFOPASS
|
|
#endif // GEN_PASS_DECL_STRIPDEBUGINFOPASS
|
|
#ifdef GEN_PASS_DEF_STRIPDEBUGINFOPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createStripDebugInfoPass();
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class StripDebugInfoPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = StripDebugInfoPassBase;
|
|
|
|
StripDebugInfoPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
StripDebugInfoPassBase(const StripDebugInfoPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
StripDebugInfoPassBase& operator=(const StripDebugInfoPassBase &) = delete;
|
|
StripDebugInfoPassBase(StripDebugInfoPassBase &&) = delete;
|
|
StripDebugInfoPassBase& operator=(StripDebugInfoPassBase &&) = delete;
|
|
~StripDebugInfoPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("strip-debuginfo");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "strip-debuginfo"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Strip debug info from all operations)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("StripDebugInfoPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "StripDebugInfoPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StripDebugInfoPassBase<DerivedT>)
|
|
|
|
protected:
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createStripDebugInfoPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createStripDebugInfoPass() {
|
|
return impl::createStripDebugInfoPass();
|
|
}
|
|
#undef GEN_PASS_DEF_STRIPDEBUGINFOPASS
|
|
#endif // GEN_PASS_DEF_STRIPDEBUGINFOPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// SymbolDCEPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_SYMBOLDCEPASS
|
|
std::unique_ptr<::mlir::Pass> createSymbolDCEPass();
|
|
#undef GEN_PASS_DECL_SYMBOLDCEPASS
|
|
#endif // GEN_PASS_DECL_SYMBOLDCEPASS
|
|
#ifdef GEN_PASS_DEF_SYMBOLDCEPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createSymbolDCEPass();
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class SymbolDCEPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = SymbolDCEPassBase;
|
|
|
|
SymbolDCEPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
SymbolDCEPassBase(const SymbolDCEPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
SymbolDCEPassBase& operator=(const SymbolDCEPassBase &) = delete;
|
|
SymbolDCEPassBase(SymbolDCEPassBase &&) = delete;
|
|
SymbolDCEPassBase& operator=(SymbolDCEPassBase &&) = delete;
|
|
~SymbolDCEPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("symbol-dce");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "symbol-dce"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Eliminate dead symbols)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("SymbolDCEPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "SymbolDCEPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolDCEPassBase<DerivedT>)
|
|
|
|
protected:
|
|
::mlir::Pass::Statistic numDCE{this, "num-dce'd", R"PS(Number of symbols DCE'd)PS"};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createSymbolDCEPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createSymbolDCEPass() {
|
|
return impl::createSymbolDCEPass();
|
|
}
|
|
#undef GEN_PASS_DEF_SYMBOLDCEPASS
|
|
#endif // GEN_PASS_DEF_SYMBOLDCEPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// SymbolPrivatizePass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_SYMBOLPRIVATIZEPASS
|
|
struct SymbolPrivatizePassOptions {
|
|
::llvm::SmallVector<std::string> exclude;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createSymbolPrivatizePass();
|
|
std::unique_ptr<::mlir::Pass> createSymbolPrivatizePass(SymbolPrivatizePassOptions options);
|
|
#undef GEN_PASS_DECL_SYMBOLPRIVATIZEPASS
|
|
#endif // GEN_PASS_DECL_SYMBOLPRIVATIZEPASS
|
|
#ifdef GEN_PASS_DEF_SYMBOLPRIVATIZEPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createSymbolPrivatizePass();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createSymbolPrivatizePass(SymbolPrivatizePassOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class SymbolPrivatizePassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = SymbolPrivatizePassBase;
|
|
|
|
SymbolPrivatizePassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
SymbolPrivatizePassBase(const SymbolPrivatizePassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
SymbolPrivatizePassBase& operator=(const SymbolPrivatizePassBase &) = delete;
|
|
SymbolPrivatizePassBase(SymbolPrivatizePassBase &&) = delete;
|
|
SymbolPrivatizePassBase& operator=(SymbolPrivatizePassBase &&) = delete;
|
|
~SymbolPrivatizePassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("symbol-privatize");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "symbol-privatize"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Mark symbols private)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("SymbolPrivatizePass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "SymbolPrivatizePass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolPrivatizePassBase<DerivedT>)
|
|
|
|
SymbolPrivatizePassBase(SymbolPrivatizePassOptions options) : SymbolPrivatizePassBase() {
|
|
exclude = std::move(options.exclude);
|
|
}
|
|
protected:
|
|
::mlir::Pass::ListOption<std::string> exclude{*this, "exclude", ::llvm::cl::desc(R"PO(Comma separated list of symbols that should not be marked private)PO")};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createSymbolPrivatizePass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createSymbolPrivatizePass(SymbolPrivatizePassOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createSymbolPrivatizePass() {
|
|
return impl::createSymbolPrivatizePass();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createSymbolPrivatizePass(SymbolPrivatizePassOptions options) {
|
|
return impl::createSymbolPrivatizePass(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_SYMBOLPRIVATIZEPASS
|
|
#endif // GEN_PASS_DEF_SYMBOLPRIVATIZEPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// TopologicalSortPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_TOPOLOGICALSORTPASS
|
|
std::unique_ptr<::mlir::Pass> createTopologicalSortPass();
|
|
#undef GEN_PASS_DECL_TOPOLOGICALSORTPASS
|
|
#endif // GEN_PASS_DECL_TOPOLOGICALSORTPASS
|
|
#ifdef GEN_PASS_DEF_TOPOLOGICALSORTPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createTopologicalSortPass();
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class TopologicalSortPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = TopologicalSortPassBase;
|
|
|
|
TopologicalSortPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
TopologicalSortPassBase(const TopologicalSortPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
TopologicalSortPassBase& operator=(const TopologicalSortPassBase &) = delete;
|
|
TopologicalSortPassBase(TopologicalSortPassBase &&) = delete;
|
|
TopologicalSortPassBase& operator=(TopologicalSortPassBase &&) = delete;
|
|
~TopologicalSortPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("topological-sort");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "topological-sort"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Sort regions without SSA dominance in topological order)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("TopologicalSortPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "TopologicalSortPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TopologicalSortPassBase<DerivedT>)
|
|
|
|
protected:
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createTopologicalSortPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createTopologicalSortPass() {
|
|
return impl::createTopologicalSortPass();
|
|
}
|
|
#undef GEN_PASS_DEF_TOPOLOGICALSORTPASS
|
|
#endif // GEN_PASS_DEF_TOPOLOGICALSORTPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// TrivialDeadCodeEliminationPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_TRIVIALDEADCODEELIMINATIONPASS
|
|
struct TrivialDeadCodeEliminationPassOptions {
|
|
bool recursive = true;
|
|
bool removeBlocks = true;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createTrivialDeadCodeEliminationPass();
|
|
std::unique_ptr<::mlir::Pass> createTrivialDeadCodeEliminationPass(TrivialDeadCodeEliminationPassOptions options);
|
|
#undef GEN_PASS_DECL_TRIVIALDEADCODEELIMINATIONPASS
|
|
#endif // GEN_PASS_DECL_TRIVIALDEADCODEELIMINATIONPASS
|
|
#ifdef GEN_PASS_DEF_TRIVIALDEADCODEELIMINATIONPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createTrivialDeadCodeEliminationPass();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createTrivialDeadCodeEliminationPass(TrivialDeadCodeEliminationPassOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class TrivialDeadCodeEliminationPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = TrivialDeadCodeEliminationPassBase;
|
|
|
|
TrivialDeadCodeEliminationPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
TrivialDeadCodeEliminationPassBase(const TrivialDeadCodeEliminationPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
TrivialDeadCodeEliminationPassBase& operator=(const TrivialDeadCodeEliminationPassBase &) = delete;
|
|
TrivialDeadCodeEliminationPassBase(TrivialDeadCodeEliminationPassBase &&) = delete;
|
|
TrivialDeadCodeEliminationPassBase& operator=(TrivialDeadCodeEliminationPassBase &&) = delete;
|
|
~TrivialDeadCodeEliminationPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("trivial-dce");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "trivial-dce"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Remove trivially dead operations and blocks)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("TrivialDeadCodeEliminationPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "TrivialDeadCodeEliminationPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TrivialDeadCodeEliminationPassBase<DerivedT>)
|
|
|
|
TrivialDeadCodeEliminationPassBase(TrivialDeadCodeEliminationPassOptions options) : TrivialDeadCodeEliminationPassBase() {
|
|
recursive = std::move(options.recursive);
|
|
removeBlocks = std::move(options.removeBlocks);
|
|
}
|
|
protected:
|
|
::mlir::Pass::Option<bool> recursive{*this, "recursive", ::llvm::cl::desc(R"PO(Recursively visit nested regions)PO"), ::llvm::cl::init(true)};
|
|
::mlir::Pass::Option<bool> removeBlocks{*this, "remove-blocks", ::llvm::cl::desc(R"PO(Remove unreachable blocks)PO"), ::llvm::cl::init(true)};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createTrivialDeadCodeEliminationPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createTrivialDeadCodeEliminationPass(TrivialDeadCodeEliminationPassOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createTrivialDeadCodeEliminationPass() {
|
|
return impl::createTrivialDeadCodeEliminationPass();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createTrivialDeadCodeEliminationPass(TrivialDeadCodeEliminationPassOptions options) {
|
|
return impl::createTrivialDeadCodeEliminationPass(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_TRIVIALDEADCODEELIMINATIONPASS
|
|
#endif // GEN_PASS_DEF_TRIVIALDEADCODEELIMINATIONPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ViewOpGraphPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_VIEWOPGRAPHPASS
|
|
struct ViewOpGraphPassOptions {
|
|
unsigned maxLabelLen = 20;
|
|
bool printAttrs = true;
|
|
bool printControlFlowEdges = false;
|
|
bool printDataFlowEdges = true;
|
|
bool printResultTypes = true;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createViewOpGraphPass();
|
|
std::unique_ptr<::mlir::Pass> createViewOpGraphPass(ViewOpGraphPassOptions options);
|
|
#undef GEN_PASS_DECL_VIEWOPGRAPHPASS
|
|
#endif // GEN_PASS_DECL_VIEWOPGRAPHPASS
|
|
#ifdef GEN_PASS_DEF_VIEWOPGRAPHPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createViewOpGraphPass();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createViewOpGraphPass(ViewOpGraphPassOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class ViewOpGraphPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = ViewOpGraphPassBase;
|
|
|
|
ViewOpGraphPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
ViewOpGraphPassBase(const ViewOpGraphPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
ViewOpGraphPassBase& operator=(const ViewOpGraphPassBase &) = delete;
|
|
ViewOpGraphPassBase(ViewOpGraphPassBase &&) = delete;
|
|
ViewOpGraphPassBase& operator=(ViewOpGraphPassBase &&) = delete;
|
|
~ViewOpGraphPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("view-op-graph");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "view-op-graph"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Print Graphviz visualization of an operation)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("ViewOpGraphPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "ViewOpGraphPass"; }
|
|
|
|
/// Support isa/dyn_cast functionality for the derived pass class.
|
|
static bool classof(const ::mlir::Pass *pass) {
|
|
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
|
|
}
|
|
|
|
/// A clone method to create a copy of this pass.
|
|
std::unique_ptr<::mlir::Pass> clonePass() const override {
|
|
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
|
|
}
|
|
|
|
/// Return the dialect that must be loaded in the context before this pass.
|
|
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
|
|
|
|
}
|
|
|
|
/// Explicitly declare the TypeID for this class. We declare an explicit private
|
|
/// instantiation because Pass classes should only be visible by the current
|
|
/// library.
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ViewOpGraphPassBase<DerivedT>)
|
|
|
|
ViewOpGraphPassBase(ViewOpGraphPassOptions options) : ViewOpGraphPassBase() {
|
|
maxLabelLen = std::move(options.maxLabelLen);
|
|
printAttrs = std::move(options.printAttrs);
|
|
printControlFlowEdges = std::move(options.printControlFlowEdges);
|
|
printDataFlowEdges = std::move(options.printDataFlowEdges);
|
|
printResultTypes = std::move(options.printResultTypes);
|
|
}
|
|
protected:
|
|
::mlir::Pass::Option<unsigned> maxLabelLen{*this, "max-label-len", ::llvm::cl::desc(R"PO(Limit attribute/type length to number of chars)PO"), ::llvm::cl::init(20)};
|
|
::mlir::Pass::Option<bool> printAttrs{*this, "print-attrs", ::llvm::cl::desc(R"PO(Print attributes of operations)PO"), ::llvm::cl::init(true)};
|
|
::mlir::Pass::Option<bool> printControlFlowEdges{*this, "print-control-flow-edges", ::llvm::cl::desc(R"PO(Print control flow edges)PO"), ::llvm::cl::init(false)};
|
|
::mlir::Pass::Option<bool> printDataFlowEdges{*this, "print-data-flow-edges", ::llvm::cl::desc(R"PO(Print data flow edges)PO"), ::llvm::cl::init(true)};
|
|
::mlir::Pass::Option<bool> printResultTypes{*this, "print-result-types", ::llvm::cl::desc(R"PO(Print result types of operations)PO"), ::llvm::cl::init(true)};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createViewOpGraphPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createViewOpGraphPass(ViewOpGraphPassOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createViewOpGraphPass() {
|
|
return impl::createViewOpGraphPass();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createViewOpGraphPass(ViewOpGraphPassOptions options) {
|
|
return impl::createViewOpGraphPass(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_VIEWOPGRAPHPASS
|
|
#endif // GEN_PASS_DEF_VIEWOPGRAPHPASS
|
|
#ifdef GEN_PASS_REGISTRATION
|
|
// Generate registrations for all passes.
|
|
#define GEN_PASS_REGISTRATION_BUBBLEDOWNMEMORYSPACECASTS
|
|
#define GEN_PASS_REGISTRATION_CSEPASS
|
|
#define GEN_PASS_REGISTRATION_CANONICALIZERPASS
|
|
#define GEN_PASS_REGISTRATION_COMPOSITEFIXEDPOINTPASS
|
|
#define GEN_PASS_REGISTRATION_CONTROLFLOWSINKPASS
|
|
#define GEN_PASS_REGISTRATION_GENERATERUNTIMEVERIFICATIONPASS
|
|
#define GEN_PASS_REGISTRATION_INLINERPASS
|
|
#define GEN_PASS_REGISTRATION_LOCATIONSNAPSHOT
|
|
#define GEN_PASS_REGISTRATION_LOOPINVARIANTCODEMOTIONPASS
|
|
#define GEN_PASS_REGISTRATION_LOOPINVARIANTSUBSETHOISTINGPASS
|
|
#define GEN_PASS_REGISTRATION_MEM2REG
|
|
#define GEN_PASS_REGISTRATION_PRINTIRPASS
|
|
#define GEN_PASS_REGISTRATION_PRINTOPSTATSPASS
|
|
#define GEN_PASS_REGISTRATION_REMOVEDEADVALUESPASS
|
|
#define GEN_PASS_REGISTRATION_SCCPPASS
|
|
#define GEN_PASS_REGISTRATION_SROA
|
|
#define GEN_PASS_REGISTRATION_STRIPDEBUGINFOPASS
|
|
#define GEN_PASS_REGISTRATION_SYMBOLDCEPASS
|
|
#define GEN_PASS_REGISTRATION_SYMBOLPRIVATIZEPASS
|
|
#define GEN_PASS_REGISTRATION_TOPOLOGICALSORTPASS
|
|
#define GEN_PASS_REGISTRATION_TRIVIALDEADCODEELIMINATIONPASS
|
|
#define GEN_PASS_REGISTRATION_VIEWOPGRAPHPASS
|
|
#endif // GEN_PASS_REGISTRATION
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// BubbleDownMemorySpaceCasts Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_BUBBLEDOWNMEMORYSPACECASTS
|
|
|
|
inline void registerBubbleDownMemorySpaceCasts() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createBubbleDownMemorySpaceCasts();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerBubbleDownMemorySpaceCastsPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createBubbleDownMemorySpaceCasts();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_BUBBLEDOWNMEMORYSPACECASTS
|
|
#endif // GEN_PASS_REGISTRATION_BUBBLEDOWNMEMORYSPACECASTS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// CSEPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_CSEPASS
|
|
|
|
inline void registerCSEPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createCSEPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerCSEPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createCSEPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_CSEPASS
|
|
#endif // GEN_PASS_REGISTRATION_CSEPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// CanonicalizerPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_CANONICALIZERPASS
|
|
|
|
inline void registerCanonicalizerPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createCanonicalizerPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerCanonicalizerPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createCanonicalizerPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_CANONICALIZERPASS
|
|
#endif // GEN_PASS_REGISTRATION_CANONICALIZERPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// CompositeFixedPointPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_COMPOSITEFIXEDPOINTPASS
|
|
|
|
inline void registerCompositeFixedPointPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createCompositeFixedPointPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerCompositeFixedPointPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createCompositeFixedPointPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_COMPOSITEFIXEDPOINTPASS
|
|
#endif // GEN_PASS_REGISTRATION_COMPOSITEFIXEDPOINTPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ControlFlowSinkPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_CONTROLFLOWSINKPASS
|
|
|
|
inline void registerControlFlowSinkPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createControlFlowSinkPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerControlFlowSinkPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createControlFlowSinkPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_CONTROLFLOWSINKPASS
|
|
#endif // GEN_PASS_REGISTRATION_CONTROLFLOWSINKPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// GenerateRuntimeVerificationPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_GENERATERUNTIMEVERIFICATIONPASS
|
|
|
|
inline void registerGenerateRuntimeVerificationPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createGenerateRuntimeVerificationPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerGenerateRuntimeVerificationPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createGenerateRuntimeVerificationPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_GENERATERUNTIMEVERIFICATIONPASS
|
|
#endif // GEN_PASS_REGISTRATION_GENERATERUNTIMEVERIFICATIONPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// InlinerPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_INLINERPASS
|
|
|
|
inline void registerInlinerPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createInlinerPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerInlinerPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createInlinerPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_INLINERPASS
|
|
#endif // GEN_PASS_REGISTRATION_INLINERPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// LocationSnapshot Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_LOCATIONSNAPSHOT
|
|
|
|
inline void registerLocationSnapshot() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createLocationSnapshot();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerLocationSnapshotPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createLocationSnapshot();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_LOCATIONSNAPSHOT
|
|
#endif // GEN_PASS_REGISTRATION_LOCATIONSNAPSHOT
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// LoopInvariantCodeMotionPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_LOOPINVARIANTCODEMOTIONPASS
|
|
|
|
inline void registerLoopInvariantCodeMotionPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createLoopInvariantCodeMotionPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerLoopInvariantCodeMotionPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createLoopInvariantCodeMotionPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_LOOPINVARIANTCODEMOTIONPASS
|
|
#endif // GEN_PASS_REGISTRATION_LOOPINVARIANTCODEMOTIONPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// LoopInvariantSubsetHoistingPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_LOOPINVARIANTSUBSETHOISTINGPASS
|
|
|
|
inline void registerLoopInvariantSubsetHoistingPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createLoopInvariantSubsetHoistingPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerLoopInvariantSubsetHoistingPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createLoopInvariantSubsetHoistingPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_LOOPINVARIANTSUBSETHOISTINGPASS
|
|
#endif // GEN_PASS_REGISTRATION_LOOPINVARIANTSUBSETHOISTINGPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Mem2Reg Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_MEM2REG
|
|
|
|
inline void registerMem2Reg() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createMem2Reg();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerMem2RegPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createMem2Reg();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_MEM2REG
|
|
#endif // GEN_PASS_REGISTRATION_MEM2REG
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// PrintIRPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_PRINTIRPASS
|
|
|
|
inline void registerPrintIRPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createPrintIRPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerPrintIRPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createPrintIRPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_PRINTIRPASS
|
|
#endif // GEN_PASS_REGISTRATION_PRINTIRPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// PrintOpStatsPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_PRINTOPSTATSPASS
|
|
|
|
inline void registerPrintOpStatsPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createPrintOpStatsPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerPrintOpStatsPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createPrintOpStatsPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_PRINTOPSTATSPASS
|
|
#endif // GEN_PASS_REGISTRATION_PRINTOPSTATSPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// RemoveDeadValuesPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_REMOVEDEADVALUESPASS
|
|
|
|
inline void registerRemoveDeadValuesPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createRemoveDeadValuesPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerRemoveDeadValuesPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createRemoveDeadValuesPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_REMOVEDEADVALUESPASS
|
|
#endif // GEN_PASS_REGISTRATION_REMOVEDEADVALUESPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// SCCPPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_SCCPPASS
|
|
|
|
inline void registerSCCPPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createSCCPPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerSCCPPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createSCCPPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_SCCPPASS
|
|
#endif // GEN_PASS_REGISTRATION_SCCPPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// SROA Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_SROA
|
|
|
|
inline void registerSROA() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createSROA();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerSROAPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createSROA();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_SROA
|
|
#endif // GEN_PASS_REGISTRATION_SROA
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// StripDebugInfoPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_STRIPDEBUGINFOPASS
|
|
|
|
inline void registerStripDebugInfoPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createStripDebugInfoPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerStripDebugInfoPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createStripDebugInfoPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_STRIPDEBUGINFOPASS
|
|
#endif // GEN_PASS_REGISTRATION_STRIPDEBUGINFOPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// SymbolDCEPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_SYMBOLDCEPASS
|
|
|
|
inline void registerSymbolDCEPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createSymbolDCEPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerSymbolDCEPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createSymbolDCEPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_SYMBOLDCEPASS
|
|
#endif // GEN_PASS_REGISTRATION_SYMBOLDCEPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// SymbolPrivatizePass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_SYMBOLPRIVATIZEPASS
|
|
|
|
inline void registerSymbolPrivatizePass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createSymbolPrivatizePass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerSymbolPrivatizePassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createSymbolPrivatizePass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_SYMBOLPRIVATIZEPASS
|
|
#endif // GEN_PASS_REGISTRATION_SYMBOLPRIVATIZEPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// TopologicalSortPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_TOPOLOGICALSORTPASS
|
|
|
|
inline void registerTopologicalSortPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createTopologicalSortPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerTopologicalSortPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createTopologicalSortPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_TOPOLOGICALSORTPASS
|
|
#endif // GEN_PASS_REGISTRATION_TOPOLOGICALSORTPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// TrivialDeadCodeEliminationPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_TRIVIALDEADCODEELIMINATIONPASS
|
|
|
|
inline void registerTrivialDeadCodeEliminationPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createTrivialDeadCodeEliminationPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerTrivialDeadCodeEliminationPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createTrivialDeadCodeEliminationPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_TRIVIALDEADCODEELIMINATIONPASS
|
|
#endif // GEN_PASS_REGISTRATION_TRIVIALDEADCODEELIMINATIONPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ViewOpGraphPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_VIEWOPGRAPHPASS
|
|
|
|
inline void registerViewOpGraphPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createViewOpGraphPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerViewOpGraphPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createViewOpGraphPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_VIEWOPGRAPHPASS
|
|
#endif // GEN_PASS_REGISTRATION_VIEWOPGRAPHPASS
|
|
#ifdef GEN_PASS_REGISTRATION
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Transforms Registration
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
inline void registerTransformsPasses() {
|
|
registerBubbleDownMemorySpaceCasts();
|
|
registerCSEPass();
|
|
registerCanonicalizerPass();
|
|
registerCompositeFixedPointPass();
|
|
registerControlFlowSinkPass();
|
|
registerGenerateRuntimeVerificationPass();
|
|
registerInlinerPass();
|
|
registerLocationSnapshot();
|
|
registerLoopInvariantCodeMotionPass();
|
|
registerLoopInvariantSubsetHoistingPass();
|
|
registerMem2Reg();
|
|
registerPrintIRPass();
|
|
registerPrintOpStatsPass();
|
|
registerRemoveDeadValuesPass();
|
|
registerSCCPPass();
|
|
registerSROA();
|
|
registerStripDebugInfoPass();
|
|
registerSymbolDCEPass();
|
|
registerSymbolPrivatizePass();
|
|
registerTopologicalSortPass();
|
|
registerTrivialDeadCodeEliminationPass();
|
|
registerViewOpGraphPass();
|
|
}
|
|
#undef GEN_PASS_REGISTRATION
|
|
#endif // GEN_PASS_REGISTRATION
|
|
#ifdef GEN_PASS_CLASSES
|
|
#error "GEN_PASS_CLASSES is deprecated; use per-pass macros"
|
|
#undef GEN_PASS_CLASSES
|
|
#endif // GEN_PASS_CLASSES
|