2020-05-07 09:41:54 +08:00
|
|
|
//===------------------------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2020-10-07 07:14:37 +08:00
|
|
|
#ifndef NPCOMP_REFBACKEND_REFBACKEND_H
|
|
|
|
#define NPCOMP_REFBACKEND_REFBACKEND_H
|
2020-05-07 09:41:54 +08:00
|
|
|
|
|
|
|
#include "mlir/Pass/Pass.h"
|
|
|
|
#include "mlir/Pass/PassManager.h"
|
|
|
|
|
|
|
|
namespace mlir {
|
|
|
|
namespace NPCOMP {
|
|
|
|
|
2020-10-07 07:14:37 +08:00
|
|
|
/// Registers all RefBackend passes.
|
|
|
|
void registerRefBackendPasses();
|
2020-08-28 06:09:10 +08:00
|
|
|
|
2020-10-07 07:14:37 +08:00
|
|
|
// Look in createRefBackendLoweringPipeline for more information about how these
|
2020-05-16 07:33:01 +08:00
|
|
|
// passes fit together.
|
|
|
|
//
|
|
|
|
// Pass summaries are in Passes.td.
|
|
|
|
|
2020-09-17 08:31:40 +08:00
|
|
|
std::unique_ptr<OperationPass<FuncOp>> createLowerStructuralToMemrefPass();
|
2020-05-12 12:22:40 +08:00
|
|
|
|
2020-10-08 08:12:52 +08:00
|
|
|
std::unique_ptr<OperationPass<ModuleOp>> createLowerToRefbackrtABIPass();
|
2020-05-16 07:33:01 +08:00
|
|
|
|
2020-05-19 03:50:16 +08:00
|
|
|
std::unique_ptr<OperationPass<FuncOp>> createLowerAllocMemRefOpsPass();
|
|
|
|
|
2020-05-21 09:48:53 +08:00
|
|
|
std::unique_ptr<OperationPass<ModuleOp>> createLowerToLLVMPass();
|
|
|
|
|
2020-09-26 07:02:09 +08:00
|
|
|
std::unique_ptr<Pass> createRestrictedCanonicalizerPass();
|
|
|
|
|
2020-10-07 07:14:37 +08:00
|
|
|
struct RefBackendLoweringPipelineOptions
|
|
|
|
: public PassPipelineOptions<RefBackendLoweringPipelineOptions> {
|
2020-06-02 10:30:13 +08:00
|
|
|
// If this option is true, then perform optimizations.
|
|
|
|
// If this option is false, only do the bare minimum for correctness.
|
|
|
|
Option<bool> optimize{*this, "optimize", llvm::cl::desc("Do optimizations."),
|
|
|
|
llvm::cl::init(false)};
|
|
|
|
};
|
|
|
|
|
2020-10-07 07:14:37 +08:00
|
|
|
// The main pipeline that encapsulates the full RefBackend lowering.
|
|
|
|
void createRefBackendLoweringPipeline(
|
|
|
|
OpPassManager &pm, const RefBackendLoweringPipelineOptions &options);
|
2020-05-07 09:41:54 +08:00
|
|
|
|
|
|
|
} // namespace NPCOMP
|
|
|
|
} // namespace mlir
|
|
|
|
|
2020-10-07 07:14:37 +08:00
|
|
|
#endif // NPCOMP_REFBACKEND_REFBACKEND_H
|