277 lines
11 KiB
PHP
277 lines
11 KiB
PHP
/* Autogenerated by mlir-tblgen; don't manually edit */
|
|
|
|
#ifdef GEN_PASS_DECL
|
|
// Generate declarations for all passes.
|
|
#define GEN_PASS_DECL_OPTREDUCTIONPASS
|
|
#define GEN_PASS_DECL_REDUCTIONTREEPASS
|
|
#undef GEN_PASS_DECL
|
|
#endif // GEN_PASS_DECL
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// OptReductionPass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_OPTREDUCTIONPASS
|
|
struct OptReductionPassOptions {
|
|
std::string optPass;
|
|
std::string optPassFile;
|
|
std::string testerName;
|
|
::llvm::SmallVector<std::string> testerArgs;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createOptReductionPass();
|
|
std::unique_ptr<::mlir::Pass> createOptReductionPass(OptReductionPassOptions options);
|
|
#undef GEN_PASS_DECL_OPTREDUCTIONPASS
|
|
#endif // GEN_PASS_DECL_OPTREDUCTIONPASS
|
|
#ifdef GEN_PASS_DEF_OPTREDUCTIONPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createOptReductionPass();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createOptReductionPass(OptReductionPassOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class OptReductionPassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = OptReductionPassBase;
|
|
|
|
OptReductionPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
OptReductionPassBase(const OptReductionPassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
OptReductionPassBase& operator=(const OptReductionPassBase &) = delete;
|
|
OptReductionPassBase(OptReductionPassBase &&) = delete;
|
|
OptReductionPassBase& operator=(OptReductionPassBase &&) = delete;
|
|
~OptReductionPassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("opt-reduction-pass");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "opt-reduction-pass"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(A wrapper pass that reduces the file with optimization passes)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("OptReductionPass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "OptReductionPass"; }
|
|
|
|
/// 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(OptReductionPassBase<DerivedT>)
|
|
|
|
OptReductionPassBase(OptReductionPassOptions options) : OptReductionPassBase() {
|
|
optPass = std::move(options.optPass);
|
|
optPassFile = std::move(options.optPassFile);
|
|
testerName = std::move(options.testerName);
|
|
testerArgs = std::move(options.testerArgs);
|
|
}
|
|
protected:
|
|
::mlir::Pass::Option<std::string> optPass{*this, "opt-pass", ::llvm::cl::desc(R"PO(The optimization passes used for reduction, e.g., symbol-dce)PO")};
|
|
::mlir::Pass::Option<std::string> optPassFile{*this, "opt-pass-file", ::llvm::cl::desc(R"PO(The file path containing the optimization pipeline definition)PO")};
|
|
::mlir::Pass::Option<std::string> testerName{*this, "test", ::llvm::cl::desc(R"PO(The location of the tester which tests the file interestingness)PO")};
|
|
::mlir::Pass::ListOption<std::string> testerArgs{*this, "test-arg", ::llvm::cl::desc(R"PO(arguments of the tester)PO")};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createOptReductionPass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createOptReductionPass(OptReductionPassOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createOptReductionPass() {
|
|
return impl::createOptReductionPass();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createOptReductionPass(OptReductionPassOptions options) {
|
|
return impl::createOptReductionPass(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_OPTREDUCTIONPASS
|
|
#endif // GEN_PASS_DEF_OPTREDUCTIONPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ReductionTreePass
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_DECL_REDUCTIONTREEPASS
|
|
struct ReductionTreePassOptions {
|
|
unsigned traversalModeId = 0;
|
|
std::string testerName;
|
|
::llvm::SmallVector<std::string> testerArgs;
|
|
};
|
|
std::unique_ptr<::mlir::Pass> createReductionTreePass();
|
|
std::unique_ptr<::mlir::Pass> createReductionTreePass(ReductionTreePassOptions options);
|
|
#undef GEN_PASS_DECL_REDUCTIONTREEPASS
|
|
#endif // GEN_PASS_DECL_REDUCTIONTREEPASS
|
|
#ifdef GEN_PASS_DEF_REDUCTIONTREEPASS
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createReductionTreePass();
|
|
} // namespace impl
|
|
|
|
namespace impl {
|
|
std::unique_ptr<::mlir::Pass> createReductionTreePass(ReductionTreePassOptions options);
|
|
} // namespace impl
|
|
namespace impl {
|
|
|
|
template <typename DerivedT>
|
|
class ReductionTreePassBase : public ::mlir::OperationPass<> {
|
|
public:
|
|
using Base = ReductionTreePassBase;
|
|
|
|
ReductionTreePassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
|
|
ReductionTreePassBase(const ReductionTreePassBase &other) : ::mlir::OperationPass<>(other) {}
|
|
ReductionTreePassBase& operator=(const ReductionTreePassBase &) = delete;
|
|
ReductionTreePassBase(ReductionTreePassBase &&) = delete;
|
|
ReductionTreePassBase& operator=(ReductionTreePassBase &&) = delete;
|
|
~ReductionTreePassBase() = default;
|
|
|
|
/// Returns the command-line argument attached to this pass.
|
|
static constexpr ::llvm::StringLiteral getArgumentName() {
|
|
return ::llvm::StringLiteral("reduction-tree");
|
|
}
|
|
::llvm::StringRef getArgument() const override { return "reduction-tree"; }
|
|
|
|
::llvm::StringRef getDescription() const override { return R"PD(Reduce the input with reduction-tree algorithm)PD"; }
|
|
|
|
/// Returns the derived pass name.
|
|
static constexpr ::llvm::StringLiteral getPassName() {
|
|
return ::llvm::StringLiteral("ReductionTreePass");
|
|
}
|
|
::llvm::StringRef getName() const override { return "ReductionTreePass"; }
|
|
|
|
/// 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(ReductionTreePassBase<DerivedT>)
|
|
|
|
ReductionTreePassBase(ReductionTreePassOptions options) : ReductionTreePassBase() {
|
|
traversalModeId = std::move(options.traversalModeId);
|
|
testerName = std::move(options.testerName);
|
|
testerArgs = std::move(options.testerArgs);
|
|
}
|
|
protected:
|
|
::mlir::Pass::Option<unsigned> traversalModeId{*this, "traversal-mode", ::llvm::cl::desc(R"PO(The graph traversal mode, the default is single-path mode)PO"), ::llvm::cl::init(0)};
|
|
::mlir::Pass::Option<std::string> testerName{*this, "test", ::llvm::cl::desc(R"PO(The location of the tester which tests the file interestingness)PO")};
|
|
::mlir::Pass::ListOption<std::string> testerArgs{*this, "test-arg", ::llvm::cl::desc(R"PO(arguments of the tester)PO")};
|
|
private:
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createReductionTreePass() {
|
|
return std::make_unique<DerivedT>();
|
|
}
|
|
|
|
friend std::unique_ptr<::mlir::Pass> createReductionTreePass(ReductionTreePassOptions options) {
|
|
return std::make_unique<DerivedT>(std::move(options));
|
|
}
|
|
};
|
|
} // namespace impl
|
|
|
|
std::unique_ptr<::mlir::Pass> createReductionTreePass() {
|
|
return impl::createReductionTreePass();
|
|
}
|
|
|
|
std::unique_ptr<::mlir::Pass> createReductionTreePass(ReductionTreePassOptions options) {
|
|
return impl::createReductionTreePass(std::move(options));
|
|
}
|
|
#undef GEN_PASS_DEF_REDUCTIONTREEPASS
|
|
#endif // GEN_PASS_DEF_REDUCTIONTREEPASS
|
|
#ifdef GEN_PASS_REGISTRATION
|
|
// Generate registrations for all passes.
|
|
#define GEN_PASS_REGISTRATION_OPTREDUCTIONPASS
|
|
#define GEN_PASS_REGISTRATION_REDUCTIONTREEPASS
|
|
#endif // GEN_PASS_REGISTRATION
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// OptReductionPass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_OPTREDUCTIONPASS
|
|
|
|
inline void registerOptReductionPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createOptReductionPass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerOptReductionPassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createOptReductionPass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_OPTREDUCTIONPASS
|
|
#endif // GEN_PASS_REGISTRATION_OPTREDUCTIONPASS
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ReductionTreePass Registration
|
|
//===----------------------------------------------------------------------===//
|
|
#ifdef GEN_PASS_REGISTRATION_REDUCTIONTREEPASS
|
|
|
|
inline void registerReductionTreePass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createReductionTreePass();
|
|
});
|
|
}
|
|
|
|
// Old registration code, kept for temporary backwards compatibility.
|
|
inline void registerReductionTreePassPass() {
|
|
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
|
|
return createReductionTreePass();
|
|
});
|
|
}
|
|
|
|
#undef GEN_PASS_REGISTRATION_REDUCTIONTREEPASS
|
|
#endif // GEN_PASS_REGISTRATION_REDUCTIONTREEPASS
|
|
#ifdef GEN_PASS_REGISTRATION
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Reducer Registration
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
inline void registerReducerPasses() {
|
|
registerOptReductionPass();
|
|
registerReductionTreePass();
|
|
}
|
|
#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
|