[MLIR] Update pass declarations to new autogenerated files

The patch introduces the required changes to update the pass declarations and definitions to use the new autogenerated files and allow dropping the old infrastructure.

Reviewed By: mehdi_amini, rriddle

Differential Review: https://reviews.llvm.org/D132838
This commit is contained in:
Michele Scuttari 2022-08-31 10:16:29 +02:00
parent 9e842dd4bd
commit 67d0d7ac0a
No known key found for this signature in database
GPG Key ID: E79E7BDFEE4B62D4
276 changed files with 1808 additions and 1279 deletions

View File

@ -44,7 +44,7 @@ def CodeGenRewrite : Pass<"cg-rewrite", "mlir::ModuleOp"> {
];
}
def TargetRewrite : Pass<"target-rewrite", "mlir::ModuleOp"> {
def TargetRewritePass : Pass<"target-rewrite", "mlir::ModuleOp"> {
let summary = "Rewrite some FIR dialect into target specific forms.";
let description = [{
Certain abstractions in the FIR dialect need to be rewritten to reflect

View File

@ -20,6 +20,12 @@ namespace fir {
struct NameUniquer;
#define GEN_PASS_DECL_FIRTOLLVMLOWERING
#define GEN_PASS_DECL_CODEGENREWRITE
#define GEN_PASS_DECL_TARGETREWRITEPASS
#define GEN_PASS_DECL_BOXEDPROCEDUREPASS
#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
/// Prerequiste pass for code gen. Perform intermediate rewrites to perform
/// the code gen (to LLVM-IR dialect) conversion.
std::unique_ptr<mlir::Pass> createFirCodeGenRewritePass();

View File

@ -28,6 +28,22 @@ namespace fir {
// Passes defined in Passes.td
//===----------------------------------------------------------------------===//
#define GEN_PASS_DECL_ABSTRACTRESULTONFUNCOPT
#define GEN_PASS_DECL_ABSTRACTRESULTONGLOBALOPT
#define GEN_PASS_DECL_AFFINEDIALECTPROMOTION
#define GEN_PASS_DECL_AFFINEDIALECTDEMOTION
#define GEN_PASS_DECL_ANNOTATECONSTANTOPERANDS
#define GEN_PASS_DECL_ARRAYVALUECOPY
#define GEN_PASS_DECL_CHARACTERCONVERSION
#define GEN_PASS_DECL_CFGCONVERSION
#define GEN_PASS_DECL_EXTERNALNAMECONVERSION
#define GEN_PASS_DECL_MEMREFDATAFLOWOPT
#define GEN_PASS_DECL_SIMPLIFYINTRINSICS
#define GEN_PASS_DECL_MEMORYALLOCATIONOPT
#define GEN_PASS_DECL_SIMPLIFYREGIONLITE
#define GEN_PASS_DECL_ALGEBRAICSIMPLIFICATION
#include "flang/Optimizer/Transforms/Passes.h.inc"
std::unique_ptr<mlir::Pass> createAbstractResultOnFuncOptPass();
std::unique_ptr<mlir::Pass> createAbstractResultOnGlobalOptPass();
std::unique_ptr<mlir::Pass> createAffineDemotionPass();

View File

@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/CodeGen/CodeGen.h"
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include "flang/Optimizer/Builder/LowLevelIntrinsics.h"
#include "flang/Optimizer/CodeGen/CodeGen.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
@ -19,6 +19,11 @@
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
namespace fir {
#define GEN_PASS_DEF_BOXEDPROCEDUREPASS
#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
} // namespace fir
#define DEBUG_TYPE "flang-procedure-pointer"
using namespace fir;
@ -169,7 +174,8 @@ private:
/// the frame pointer during execution. In LLVM IR, the frame pointer is
/// designated with the `nest` attribute. The thunk's address will then be used
/// as the call target instead of the original function's address directly.
class BoxedProcedurePass : public BoxedProcedurePassBase<BoxedProcedurePass> {
class BoxedProcedurePass
: public fir::impl::BoxedProcedurePassBase<BoxedProcedurePass> {
public:
BoxedProcedurePass() { options = {true}; }
BoxedProcedurePass(bool useThunks) { options = {useThunks}; }

View File

@ -11,8 +11,8 @@
//===----------------------------------------------------------------------===//
#include "flang/Optimizer/CodeGen/CodeGen.h"
#include "CGOps.h"
#include "PassDetail.h"
#include "flang/ISO_Fortran_binding.h"
#include "flang/Optimizer/Dialect/FIRAttr.h"
#include "flang/Optimizer/Dialect/FIROps.h"
@ -27,6 +27,8 @@
#include "mlir/Conversion/MathToLLVM/MathToLLVM.h"
#include "mlir/Conversion/MathToLibm/MathToLibm.h"
#include "mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Matchers.h"
#include "mlir/Pass/Pass.h"
@ -34,6 +36,11 @@
#include "mlir/Target/LLVMIR/ModuleTranslation.h"
#include "llvm/ADT/ArrayRef.h"
namespace fir {
#define GEN_PASS_DEF_FIRTOLLVMLOWERING
#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
} // namespace fir
#define DEBUG_TYPE "flang-codegen"
// fir::LLVMTypeConverter for converting to LLVM IR dialect types.
@ -3045,7 +3052,8 @@ struct IsPresentOpConversion : public FIROpConversion<fir::IsPresentOp> {
auto ptr = adaptor.getOperands()[0];
if (isPresent.getVal().getType().isa<fir::BoxCharType>()) {
[[maybe_unused]] auto structTy = ptr.getType().cast<mlir::LLVM::LLVMStructType>();
[[maybe_unused]] auto structTy =
ptr.getType().cast<mlir::LLVM::LLVMStructType>();
assert(!structTy.isOpaque() && !structTy.getBody().empty());
ptr = rewriter.create<mlir::LLVM::ExtractValueOp>(loc, ptr, 0);
@ -3282,7 +3290,8 @@ namespace {
///
/// This pass lowers all FIR dialect operations to LLVM IR dialect. An
/// MLIR pass is used to lower residual Std dialect to LLVM IR dialect.
class FIRToLLVMLowering : public fir::FIRToLLVMLoweringBase<FIRToLLVMLowering> {
class FIRToLLVMLowering
: public fir::impl::FIRToLLVMLoweringBase<FIRToLLVMLowering> {
public:
FIRToLLVMLowering() = default;
FIRToLLVMLowering(fir::FIRToLLVMPassOptions options) : options{options} {}

View File

@ -10,9 +10,9 @@
//
//===----------------------------------------------------------------------===//
#include "CGOps.h"
#include "PassDetail.h"
#include "flang/Optimizer/CodeGen/CodeGen.h"
#include "CGOps.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
@ -21,6 +21,11 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
namespace fir {
#define GEN_PASS_DEF_CODEGENREWRITE
#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
} // namespace fir
//===----------------------------------------------------------------------===//
// Codegen rewrite: rewriting of subgraphs of ops
//===----------------------------------------------------------------------===//
@ -258,7 +263,7 @@ public:
}
};
class CodeGenRewrite : public fir::CodeGenRewriteBase<CodeGenRewrite> {
class CodeGenRewrite : public fir::impl::CodeGenRewriteBase<CodeGenRewrite> {
public:
void runOn(mlir::Operation *op, mlir::Region &region) {
auto &context = getContext();

View File

@ -14,12 +14,12 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/CodeGen/CodeGen.h"
#include "Target.h"
#include "flang/Optimizer/Builder/Character.h"
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include "flang/Optimizer/Builder/Todo.h"
#include "flang/Optimizer/CodeGen/CodeGen.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIROpsSupport.h"
@ -30,6 +30,11 @@
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Debug.h"
namespace fir {
#define GEN_PASS_DEF_TARGETREWRITEPASS
#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
} // namespace fir
#define DEBUG_TYPE "flang-target-rewrite"
namespace {
@ -66,7 +71,7 @@ struct FixupTy {
/// generation that traverses the FIR and modifies types and operations to a
/// form that is appropriate for the specific target. LLVM IR has specific
/// idioms that are used for distinct target processor and ABI combinations.
class TargetRewrite : public fir::TargetRewriteBase<TargetRewrite> {
class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
public:
TargetRewrite(const fir::TargetRewriteOptions &options) {
noCharacterConversion = options.noCharacterConversion;

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/Builder/Todo.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
@ -19,6 +18,12 @@
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/TypeSwitch.h"
namespace fir {
#define GEN_PASS_DEF_ABSTRACTRESULTONFUNCOPT
#define GEN_PASS_DEF_ABSTRACTRESULTONGLOBALOPT
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
#define DEBUG_TYPE "flang-abstract-result-opt"
namespace fir {
@ -248,7 +253,7 @@ public:
class AbstractResultOnFuncOpt
: public AbstractResultOptTemplate<AbstractResultOnFuncOpt,
fir::AbstractResultOnFuncOptBase> {
fir::impl::AbstractResultOnFuncOptBase> {
public:
void runOnSpecificOperation(mlir::func::FuncOp func, bool shouldBoxResult,
mlir::RewritePatternSet &patterns,
@ -292,8 +297,8 @@ inline static bool containsFunctionTypeWithAbstractResult(mlir::Type type) {
}
class AbstractResultOnGlobalOpt
: public AbstractResultOptTemplate<AbstractResultOnGlobalOpt,
fir::AbstractResultOnGlobalOptBase> {
: public AbstractResultOptTemplate<
AbstractResultOnGlobalOpt, fir::impl::AbstractResultOnGlobalOptBase> {
public:
void runOnSpecificOperation(fir::GlobalOp global, bool,
mlir::RewritePatternSet &,

View File

@ -16,7 +16,6 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
@ -36,6 +35,11 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
namespace fir {
#define GEN_PASS_DEF_AFFINEDIALECTDEMOTION
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
#define DEBUG_TYPE "flang-affine-demotion"
using namespace fir;
@ -137,7 +141,7 @@ public:
};
class AffineDialectDemotion
: public AffineDialectDemotionBase<AffineDialectDemotion> {
: public fir::impl::AffineDialectDemotionBase<AffineDialectDemotion> {
public:
void runOnOperation() override {
auto *context = &getContext();

View File

@ -15,7 +15,6 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
@ -31,6 +30,11 @@
#include "llvm/ADT/Optional.h"
#include "llvm/Support/Debug.h"
namespace fir {
#define GEN_PASS_DEF_AFFINEDIALECTPROMOTION
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
#define DEBUG_TYPE "flang-affine-promotion"
using namespace fir;
@ -579,7 +583,7 @@ public:
/// Promote fir.do_loop and fir.if to affine.for and affine.if, in the cases
/// where such a promotion is possible.
class AffineDialectPromotion
: public AffineDialectPromotionBase<AffineDialectPromotion> {
: public fir::impl::AffineDialectPromotionBase<AffineDialectPromotion> {
public:
void runOnOperation() override {

View File

@ -11,16 +11,21 @@
// the parameters of the patterns for Fortran programs.
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/Transforms/Passes.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/Math/Transforms/Passes.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
namespace fir {
#define GEN_PASS_DEF_ALGEBRAICSIMPLIFICATION
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
using namespace mlir;
namespace {
struct AlgebraicSimplification
: public fir::AlgebraicSimplificationBase<AlgebraicSimplification> {
: public fir::impl::AlgebraicSimplificationBase<AlgebraicSimplification> {
AlgebraicSimplification(const GreedyRewriteConfig &rewriteConfig) {
config = rewriteConfig;
}

View File

@ -6,18 +6,24 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
// #include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Transforms/Passes.h"
#include "mlir/IR/BuiltinAttributes.h"
namespace fir {
#define GEN_PASS_DEF_ANNOTATECONSTANTOPERANDS
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
#define DEBUG_TYPE "flang-annotate-constant"
using namespace fir;
namespace {
struct AnnotateConstantOperands
: AnnotateConstantOperandsBase<AnnotateConstantOperands> {
: public impl::AnnotateConstantOperandsBase<AnnotateConstantOperands> {
void runOnOperation() override {
auto *context = &getContext();
mlir::Dialect *firDialect = context->getLoadedDialect("fir");

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/Builder/Array.h"
#include "flang/Optimizer/Builder/BoxValue.h"
#include "flang/Optimizer/Builder/FIRBuilder.h"
@ -22,6 +21,11 @@
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/Support/Debug.h"
namespace fir {
#define GEN_PASS_DEF_ARRAYVALUECOPY
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
#define DEBUG_TYPE "flang-array-value-copy"
using namespace fir;
@ -1326,7 +1330,7 @@ public:
};
class ArrayValueCopyConverter
: public ArrayValueCopyBase<ArrayValueCopyConverter> {
: public fir::impl::ArrayValueCopyBase<ArrayValueCopyConverter> {
public:
void runOnOperation() override {
auto func = getOperation();

View File

@ -6,19 +6,24 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
#include "flang/Optimizer/Support/FIRContext.h"
#include "flang/Optimizer/Support/KindMapping.h"
#include "flang/Optimizer/Transforms/Passes.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/Support/Debug.h"
namespace fir {
#define GEN_PASS_DEF_CHARACTERCONVERSION
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
#define DEBUG_TYPE "flang-character-conversion"
namespace {
@ -95,7 +100,7 @@ public:
/// Rewrite the `fir.char_convert` op into a loop. This pass must be run only on
/// fir::CharConvertOp.
class CharacterConversion
: public fir::CharacterConversionBase<CharacterConversion> {
: public fir::impl::CharacterConversionBase<CharacterConversion> {
public:
void runOnOperation() override {
CharacterConversionOptions clOpts{useRuntimeCalls.getValue()};

View File

@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Support/InternalNames.h"
#include "flang/Optimizer/Transforms/Passes.h"
@ -17,6 +17,11 @@
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
namespace fir {
#define GEN_PASS_DEF_EXTERNALNAMECONVERSION
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
using namespace mlir;
//===----------------------------------------------------------------------===//
@ -117,7 +122,7 @@ public:
};
class ExternalNameConversionPass
: public fir::ExternalNameConversionBase<ExternalNameConversionPass> {
: public fir::impl::ExternalNameConversionBase<ExternalNameConversionPass> {
public:
mlir::ModuleOp getModule() { return getOperation(); }
void runOnOperation() override;

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
@ -19,6 +18,11 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
namespace fir {
#define GEN_PASS_DEF_MEMREFDATAFLOWOPT
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
#define DEBUG_TYPE "fir-memref-dataflow-opt"
using namespace mlir;
@ -94,7 +98,7 @@ private:
mlir::DominanceInfo *domInfo;
};
class MemDataFlowOpt : public fir::MemRefDataFlowOptBase<MemDataFlowOpt> {
class MemDataFlowOpt : public fir::impl::MemRefDataFlowOptBase<MemDataFlowOpt> {
public:
void runOnOperation() override {
mlir::func::FuncOp f = getOperation();

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
@ -18,6 +17,11 @@
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/TypeSwitch.h"
namespace fir {
#define GEN_PASS_DEF_MEMORYALLOCATIONOPT
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
#define DEBUG_TYPE "flang-memory-allocation-opt"
// Number of elements in an array does not determine where it is allocated.
@ -151,7 +155,7 @@ private:
/// 2. If a stack allocation is an array with a runtime evaluated size make
/// it a heap allocation.
class MemoryAllocationOpt
: public fir::MemoryAllocationOptBase<MemoryAllocationOpt> {
: public fir::impl::MemoryAllocationOptBase<MemoryAllocationOpt> {
public:
MemoryAllocationOpt() {
// Set options with default values. (See Passes.td.) Note that the

View File

@ -1,29 +0,0 @@
//===- PassDetail.h - Optimizer Transforms Pass class details ---*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef FORTRAN_OPTMIZER_TRANSFORMS_PASSDETAIL_H
#define FORTRAN_OPTMIZER_TRANSFORMS_PASSDETAIL_H
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/OpenACC/OpenACC.h"
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassRegistry.h"
namespace fir {
#define GEN_PASS_CLASSES
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
#endif // FORTRAN_OPTMIZER_TRANSFORMS_PASSDETAIL_H

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Transforms/Passes.h"
@ -17,6 +16,11 @@
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/Support/CommandLine.h"
namespace fir {
#define GEN_PASS_DEF_CFGCONVERSION
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
using namespace fir;
using namespace mlir;
@ -297,7 +301,7 @@ public:
};
/// Convert FIR structured control flow ops to CFG ops.
class CfgConversion : public CFGConversionBase<CfgConversion> {
class CfgConversion : public fir::impl::CFGConversionBase<CfgConversion> {
public:
void runOnOperation() override {
auto *context = &getContext();

View File

@ -22,7 +22,6 @@
/// and small in size.
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/Builder/BoxValue.h"
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include "flang/Optimizer/Builder/Todo.h"
@ -30,6 +29,7 @@
#include "flang/Optimizer/Dialect/FIRType.h"
#include "flang/Optimizer/Support/FIRContext.h"
#include "flang/Optimizer/Transforms/Passes.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Pass/Pass.h"
@ -40,12 +40,17 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
namespace fir {
#define GEN_PASS_DEF_SIMPLIFYINTRINSICS
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
#define DEBUG_TYPE "flang-simplify-intrinsics"
namespace {
class SimplifyIntrinsicsPass
: public fir::SimplifyIntrinsicsBase<SimplifyIntrinsicsPass> {
: public fir::impl::SimplifyIntrinsicsBase<SimplifyIntrinsicsPass> {
using FunctionTypeGeneratorTy =
std::function<mlir::FunctionType(fir::FirOpBuilder &)>;
using FunctionBodyGeneratorTy =

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Transforms/Passes.h"
#include "mlir/IR/PatternMatch.h"
@ -15,10 +14,15 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/RegionUtils.h"
namespace fir {
#define GEN_PASS_DEF_SIMPLIFYREGIONLITE
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir
namespace {
class SimplifyRegionLitePass
: public fir::SimplifyRegionLiteBase<SimplifyRegionLitePass> {
: public fir::impl::SimplifyRegionLiteBase<SimplifyRegionLitePass> {
public:
void runOnOperation() override;
};

View File

@ -17,6 +17,9 @@ class LLVMTypeConverter;
class RewritePatternSet;
class Pass;
#define GEN_PASS_DECL_CONVERTAMDGPUTOROCDL
#include "mlir/Conversion/Passes.h.inc"
void populateAMDGPUToROCDLConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns,
amdgpu::Chipset chipset);

View File

@ -23,6 +23,9 @@ class ValueRange;
class RewritePatternSet;
#define GEN_PASS_DECL_CONVERTAFFINETOSTANDARD
#include "mlir/Conversion/Passes.h.inc"
/// Collect a set of patterns to convert from the Affine dialect to the Standard
/// dialect, in particular convert structured affine control flow into CFG
/// branch-based control flow.

View File

@ -17,6 +17,9 @@ class LLVMTypeConverter;
class RewritePatternSet;
class Pass;
#define GEN_PASS_DECL_CONVERTARITHMETICTOLLVM
#include "mlir/Conversion/Passes.h.inc"
namespace arith {
void populateArithmeticToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);

View File

@ -18,6 +18,9 @@ class SPIRVTypeConverter;
class RewritePatternSet;
class Pass;
#define GEN_PASS_DECL_CONVERTARITHMETICTOSPIRV
#include "mlir/Conversion/Passes.h.inc"
namespace arith {
void populateArithmeticToSPIRVPatterns(SPIRVTypeConverter &typeConverter,
RewritePatternSet &patterns);

View File

@ -9,9 +9,15 @@
#ifndef MLIR_CONVERSION_ARMNEON2DTOINTR_ARMNEON2DTOINTR_H_
#define MLIR_CONVERSION_ARMNEON2DTOINTR_ARMNEON2DTOINTR_H_
#include "mlir/Pass/Pass.h"
#include <memory>
namespace mlir {
class Pass;
class RewritePatternSet;
#define GEN_PASS_DECL_CONVERTARMNEON2DTOINTR
#include "mlir/Conversion/Passes.h.inc"
/// Populates patterns for the lowering of Arm NEON 2D ops to intrinsics.
/// See createConvertArmNeon2dToIntrPass.
void populateConvertArmNeon2dToIntrPatterns(RewritePatternSet &patterns);

View File

@ -21,6 +21,9 @@ class MLIRContext;
class TypeConverter;
class RewritePatternSet;
#define GEN_PASS_DECL_CONVERTASYNCTOLLVM
#include "mlir/Conversion/Passes.h.inc"
/// Create a pass to convert Async operations to the LLVM dialect.
std::unique_ptr<OperationPass<ModuleOp>> createConvertAsyncToLLVMPass();

View File

@ -15,6 +15,9 @@ namespace mlir {
class Pass;
class RewritePatternSet;
#define GEN_PASS_DECL_CONVERTBUFFERIZATIONTOMEMREF
#include "mlir/Conversion/Passes.h.inc"
/// Collect a set of patterns to convert memory-related operations from the
/// Bufferization dialect to the MemRef dialect.
void populateBufferizationToMemRefConversionPatterns(

View File

@ -15,6 +15,9 @@ class LLVMTypeConverter;
class Pass;
class RewritePatternSet;
#define GEN_PASS_DECL_CONVERTCOMPLEXTOLLVM
#include "mlir/Conversion/Passes.h.inc"
class ComplexStructBuilder : public StructBuilder {
public:
/// Construct a helper for the given complex number value.

View File

@ -14,6 +14,9 @@ namespace mlir {
template <typename T>
class OperationPass;
#define GEN_PASS_DECL_CONVERTCOMPLEXTOLIBM
#include "mlir/Conversion/Passes.h.inc"
/// Populate the given list with patterns that convert from Complex to Libm
/// calls.
void populateComplexToLibmConversionPatterns(RewritePatternSet &patterns,

View File

@ -14,6 +14,9 @@ namespace mlir {
class RewritePatternSet;
class Pass;
#define GEN_PASS_DECL_CONVERTCOMPLEXTOSTANDARD
#include "mlir/Conversion/Passes.h.inc"
/// Populate the given list with patterns that convert from Complex to Standard.
void populateComplexToStandardConversionPatterns(RewritePatternSet &patterns);

View File

@ -20,6 +20,9 @@ class LLVMTypeConverter;
class RewritePatternSet;
class Pass;
#define GEN_PASS_DECL_CONVERTCONTROLFLOWTOLLVM
#include "mlir/Conversion/Passes.h.inc"
namespace cf {
/// Collect the patterns to convert from the ControlFlow dialect to LLVM. The
/// conversion patterns capture the LLVMTypeConverter by reference meaning the

View File

@ -18,6 +18,9 @@
namespace mlir {
class ModuleOp;
#define GEN_PASS_DECL_CONVERTCONTROLFLOWTOSPIRV
#include "mlir/Conversion/Passes.h.inc"
/// Creates a pass to convert ControlFlow ops to SPIR-V ops.
std::unique_ptr<OperationPass<>> createConvertControlFlowToSPIRVPass();

View File

@ -10,6 +10,7 @@
#define MLIR_CONVERSION_FUNCTOLLVM_CONVERTFUNCTOLLVMPASS_H_
#include <memory>
#include <string>
namespace mlir {
class LowerToLLVMOptions;
@ -18,6 +19,9 @@ template <typename T>
class OperationPass;
class Pass;
#define GEN_PASS_DECL_CONVERTFUNCTOLLVM
#include "mlir/Conversion/Passes.h.inc"
/// Creates a pass to convert the Func dialect into the LLVMIR dialect.
std::unique_ptr<OperationPass<ModuleOp>> createConvertFuncToLLVMPass();
std::unique_ptr<OperationPass<ModuleOp>>

View File

@ -18,6 +18,9 @@
namespace mlir {
class ModuleOp;
#define GEN_PASS_DECL_CONVERTFUNCTOSPIRV
#include "mlir/Conversion/Passes.h.inc"
/// Creates a pass to convert Func ops to SPIR-V ops.
std::unique_ptr<OperationPass<>> createConvertFuncToSPIRVPass();

View File

@ -38,6 +38,9 @@ namespace LLVM {
class LLVMDialect;
} // namespace LLVM
#define GEN_PASS_DECL_GPUTOLLVMCONVERSIONPASS
#include "mlir/Conversion/Passes.h.inc"
using OwnedBlob = std::unique_ptr<std::vector<char>>;
using BlobGenerator =
std::function<OwnedBlob(const std::string &, Location, StringRef)>;

View File

@ -25,6 +25,9 @@ class GPUModuleOp;
class MMAMatrixType;
} // namespace gpu
#define GEN_PASS_DECL_CONVERTGPUOPSTONVVMOPS
#include "mlir/Conversion/Passes.h.inc"
LLVM::LLVMStructType convertMMAToLLVMType(gpu::MMAMatrixType type);
/// Configure target to convert from the GPU dialect to NVVM.

View File

@ -24,6 +24,9 @@ namespace gpu {
class GPUModuleOp;
} // namespace gpu
#define GEN_PASS_DECL_CONVERTGPUOPSTOROCDLOPS
#include "mlir/Conversion/Passes.h.inc"
/// Collect a set of patterns to convert from the GPU dialect to ROCDL.
/// If `runtime` is Unknown, gpu.printf will not be lowered
/// The resulting pattern set should be run over a gpu.module op

View File

@ -21,6 +21,9 @@ class ModuleOp;
template <typename T>
class OperationPass;
#define GEN_PASS_DECL_CONVERTGPUTOSPIRV
#include "mlir/Conversion/Passes.h.inc"
/// Creates a pass to convert GPU kernel ops to corresponding SPIR-V ops. For a
/// gpu.func to be converted, it should have a spv.entry_point_abi attribute.
/// If `mapMemorySpace` is true, performs MemRef memory space to SPIR-V mapping

View File

@ -24,6 +24,10 @@ class ModuleOp;
template <typename T>
class OperationPass;
#define GEN_PASS_DECL_CONVERTVULKANLAUNCHFUNCTOVULKANCALLS
#define GEN_PASS_DECL_CONVERTGPULAUNCHFUNCTOVULKANLAUNCHFUNC
#include "mlir/Conversion/Passes.h.inc"
std::unique_ptr<OperationPass<ModuleOp>>
createConvertVulkanLaunchFuncToVulkanCallsPass();

View File

@ -18,6 +18,9 @@ template <typename T>
class OperationPass;
class RewritePatternSet;
#define GEN_PASS_DECL_CONVERTLINALGTOLLVM
#include "mlir/Conversion/Passes.h.inc"
/// Populate the given list with patterns that convert from Linalg to LLVM.
void populateLinalgToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);

View File

@ -18,6 +18,9 @@
namespace mlir {
class ModuleOp;
#define GEN_PASS_DECL_CONVERTLINALGTOSPIRV
#include "mlir/Conversion/Passes.h.inc"
/// Creates and returns a pass to convert Linalg ops to SPIR-V ops.
std::unique_ptr<OperationPass<ModuleOp>> createLinalgToSPIRVPass();

View File

@ -17,6 +17,9 @@ class ModuleOp;
template <typename T>
class OperationPass;
#define GEN_PASS_DECL_CONVERTLINALGTOSTANDARD
#include "mlir/Conversion/Passes.h.inc"
namespace linalg {
//===----------------------------------------------------------------------===//

View File

@ -14,6 +14,9 @@
namespace mlir {
class Pass;
#define GEN_PASS_DECL_CONVERTMATHTOFUNCS
#include "mlir/Conversion/Passes.h.inc"
// Pass to convert some Math operations into calls of functions
// containing software implementation of these operations.
std::unique_ptr<Pass> createConvertMathToFuncsPass();

View File

@ -17,6 +17,9 @@ class LLVMTypeConverter;
class RewritePatternSet;
class Pass;
#define GEN_PASS_DECL_CONVERTMATHTOLLVM
#include "mlir/Conversion/Passes.h.inc"
void populateMathToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);

View File

@ -14,6 +14,9 @@ namespace mlir {
template <typename T>
class OperationPass;
#define GEN_PASS_DECL_CONVERTMATHTOLIBM
#include "mlir/Conversion/Passes.h.inc"
/// Populate the given list with patterns that convert from Math to Libm calls.
/// If log1pBenefit is present, use it instead of benefit for the Log1p op.
void populateMathToLibmConversionPatterns(

View File

@ -18,6 +18,9 @@
namespace mlir {
class ModuleOp;
#define GEN_PASS_DECL_CONVERTMATHTOSPIRV
#include "mlir/Conversion/Passes.h.inc"
/// Creates a pass to convert Math ops to SPIR-V ops.
std::unique_ptr<OperationPass<>> createConvertMathToSPIRVPass();

View File

@ -16,6 +16,9 @@ class Pass;
class LLVMTypeConverter;
class RewritePatternSet;
#define GEN_PASS_DECL_CONVERTMEMREFTOLLVM
#include "mlir/Conversion/Passes.h.inc"
/// Collect a set of patterns to convert memory-related operations from the
/// MemRef dialect to the LLVM dialect.
void populateMemRefToLLVMConversionPatterns(LLVMTypeConverter &converter,

View File

@ -19,6 +19,10 @@
namespace mlir {
class ModuleOp;
#define GEN_PASS_DECL_MAPMEMREFSTORAGECLASS
#define GEN_PASS_DECL_CONVERTMEMREFTOSPIRV
#include "mlir/Conversion/Passes.h.inc"
/// Creates a pass to map numeric MemRef memory spaces to symbolic SPIR-V
/// storage classes. The mapping is read from the command-line option.
std::unique_ptr<OperationPass<>> createMapMemRefStorageClassPass();

View File

@ -16,6 +16,9 @@ class LLVMTypeConverter;
class RewritePatternSet;
class Pass;
#define GEN_PASS_DECL_CONVERTNVGPUTONVVM
#include "mlir/Conversion/Passes.h.inc"
void populateNVGPUToNVVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);

View File

@ -18,6 +18,9 @@ template <typename T>
class OperationPass;
class RewritePatternSet;
#define GEN_PASS_DECL_CONVERTOPENACCTOLLVM
#include "mlir/Conversion/Passes.h.inc"
static constexpr unsigned kPtrBasePosInDataDescriptor = 0;
static constexpr unsigned kPtrPosInDataDescriptor = 1;
static constexpr unsigned kSizePosInDataDescriptor = 2;

View File

@ -16,6 +16,9 @@ template <typename T>
class OperationPass;
class RewritePatternSet;
#define GEN_PASS_DECL_CONVERTOPENACCTOSCF
#include "mlir/Conversion/Passes.h.inc"
/// Collect the patterns to convert from the OpenACC dialect to OpenACC with
/// SCF dialect.
void populateOpenACCToSCFConversionPatterns(RewritePatternSet &patterns);

View File

@ -19,6 +19,9 @@ template <typename T>
class OperationPass;
class RewritePatternSet;
#define GEN_PASS_DECL_CONVERTOOPENMPTOLLVM
#include "mlir/Conversion/Passes.h.inc"
/// Configure dynamic conversion legality of regionless operations from OpenMP
/// to LLVM.
void configureOpenMPToLLVMConversionLegality(ConversionTarget &target,

View File

@ -20,6 +20,9 @@ class ModuleOp;
template <typename OpT>
class OperationPass;
#define GEN_PASS_DECL_CONVERTPDLTOPDLINTERP
#include "mlir/Conversion/Passes.h.inc"
/// Creates and returns a pass to convert PDL ops to PDL interpreter ops.
std::unique_ptr<OperationPass<ModuleOp>> createPDLToPDLInterpPass();

View File

@ -780,7 +780,6 @@ def ConvertTensorToLinalg : Pass<"convert-tensor-to-linalg", "ModuleOp"> {
];
}
//===----------------------------------------------------------------------===//
// TensorToSPIRV
//===----------------------------------------------------------------------===//

View File

@ -15,6 +15,9 @@ namespace mlir {
class Pass;
class RewritePatternSet;
#define GEN_PASS_DECL_RECONCILEUNREALIZEDCASTS
#include "mlir/Conversion/Passes.h.inc"
/// Creates a pass that eliminates noop `unrealized_conversion_cast` operation
/// sequences.
std::unique_ptr<Pass> createReconcileUnrealizedCastsPass();

View File

@ -15,6 +15,9 @@ namespace mlir {
class Pass;
class RewritePatternSet;
#define GEN_PASS_DECL_SCFTOCONTROLFLOW
#include "mlir/Conversion/Passes.h.inc"
/// Collect a set of patterns to convert SCF operations to CFG branch-based
/// operations within the ControlFlow dialect.
void populateSCFToControlFlowConversionPatterns(RewritePatternSet &patterns);

View File

@ -18,6 +18,10 @@ template <typename T>
class InterfacePass;
class Pass;
#define GEN_PASS_DECL_CONVERTAFFINEFORTOGPU
#define GEN_PASS_DECL_CONVERTPARALLELLOOPTOGPU
#include "mlir/Conversion/Passes.h.inc"
/// Create a pass that converts loop nests into GPU kernels. It considers
/// top-level affine.for operations as roots of loop nests and converts them to
/// the gpu.launch operations if possible.

View File

@ -16,6 +16,9 @@ class ModuleOp;
template <typename T>
class OperationPass;
#define GEN_PASS_DECL_CONVERTSCFTOOPENMP
#include "mlir/Conversion/Passes.h.inc"
std::unique_ptr<OperationPass<ModuleOp>> createConvertSCFToOpenMPPass();
} // namespace mlir

View File

@ -18,6 +18,9 @@
namespace mlir {
class ModuleOp;
#define GEN_PASS_DECL_SCFTOSPIRV
#include "mlir/Conversion/Passes.h.inc"
/// Creates a pass to convert SCF ops into SPIR-V ops.
std::unique_ptr<OperationPass<>> createConvertSCFToSPIRVPass();

View File

@ -20,6 +20,10 @@ class ModuleOp;
template <typename T>
class OperationPass;
#define GEN_PASS_DECL_LOWERHOSTCODETOLLVM
#define GEN_PASS_DECL_CONVERTSPIRVTOLLVM
#include "mlir/Conversion/Passes.h.inc"
/// Creates a pass to emulate `gpu.launch_func` call in LLVM dialect and lower
/// the host module code to LLVM.
///

View File

@ -19,6 +19,10 @@ template <typename T>
class OperationPass;
class RewritePatternSet;
#define GEN_PASS_DECL_CONVERTSHAPECONSTRAINTS
#define GEN_PASS_DECL_CONVERTSHAPETOSTANDARD
#include "mlir/Conversion/Passes.h.inc"
void populateShapeToStandardConversionPatterns(RewritePatternSet &patterns);
std::unique_ptr<OperationPass<ModuleOp>> createConvertShapeToStandardPass();

View File

@ -18,6 +18,9 @@
namespace mlir {
class ModuleOp;
#define GEN_PASS_DECL_CONVERTTENSORTOLINALG
#include "mlir/Conversion/Passes.h.inc"
/// Creates a pass to convert Tensor ops to Linalg ops.
std::unique_ptr<OperationPass<ModuleOp>> createConvertTensorToLinalgPass();

View File

@ -18,6 +18,9 @@
namespace mlir {
class ModuleOp;
#define GEN_PASS_DECL_CONVERTTENSORTOSPIRV
#include "mlir/Conversion/Passes.h.inc"
/// Creates a pass to convert Tensor ops to SPIR-V ops.
std::unique_ptr<OperationPass<>> createConvertTensorToSPIRVPass();

View File

@ -16,6 +16,10 @@
#include "mlir/Pass/Pass.h"
namespace mlir {
#define GEN_PASS_DECL_TOSATOARITH
#include "mlir/Conversion/Passes.h.inc"
namespace tosa {
std::unique_ptr<Pass> createTosaToArith();

View File

@ -17,6 +17,11 @@
#include "mlir/Pass/Pass.h"
namespace mlir {
#define GEN_PASS_DECL_TOSATOLINALG
#define GEN_PASS_DECL_TOSATOLINALGNAMED
#include "mlir/Conversion/Passes.h.inc"
namespace tosa {
std::unique_ptr<Pass> createTosaToLinalg();

View File

@ -16,6 +16,10 @@
#include "mlir/Pass/Pass.h"
namespace mlir {
#define GEN_PASS_DECL_TOSATOSCF
#include "mlir/Conversion/Passes.h.inc"
namespace tosa {
std::unique_ptr<Pass> createTosaToSCF();

View File

@ -16,6 +16,10 @@
#include "mlir/Pass/Pass.h"
namespace mlir {
#define GEN_PASS_DECL_TOSATOTENSOR
#include "mlir/Conversion/Passes.h.inc"
namespace tosa {
std::unique_ptr<Pass> createTosaToTensor();

View File

@ -16,6 +16,9 @@ class MLIRContext;
class Pass;
class RewritePatternSet;
#define GEN_PASS_DECL_CONVERTVECTORTOGPU
#include "mlir/Conversion/Passes.h.inc"
/// Patterns to transform vector ops into a canonical form to convert to MMA
/// matrix operations. If `useNvGpu` is true, then the patterns will populated
/// will prepare for conversion to `nvgpu` mma operations rather than the `gpu`

View File

@ -16,6 +16,9 @@ class ModuleOp;
template <typename T>
class OperationPass;
#define GEN_PASS_DECL_CONVERTVECTORTOLLVM
#include "mlir/Conversion/Passes.h.inc"
/// Options to control Vector to LLVM lowering.
///
/// This should kept in sync with VectorToLLVM options defined for the

View File

@ -16,6 +16,9 @@ class MLIRContext;
class Pass;
class RewritePatternSet;
#define GEN_PASS_DECL_CONVERTVECTORTOSCF
#include "mlir/Conversion/Passes.h.inc"
/// When lowering an N-d vector transfer op to an (N-1)-d vector transfer op,
/// a temporary buffer is created through which individual (N-1)-d vector are
/// staged. This pattern can be applied multiple time, until the transfer op

View File

@ -18,6 +18,9 @@
namespace mlir {
class ModuleOp;
#define GEN_PASS_DECL_VECTORTOSPIRVPASS
#include "mlir/Conversion/Passes.h.inc"
/// Creates a pass to convert Vector Ops to SPIR-V ops.
std::unique_ptr<OperationPass<>> createConvertVectorToSPIRVPass();

View File

@ -28,6 +28,22 @@ class AffineForOp;
/// producer-consumer and sibling fusion.
enum FusionMode { Greedy, ProducerConsumer, Sibling };
#define GEN_PASS_DECL_AFFINEDATACOPYGENERATION
#define GEN_PASS_DECL_AFFINELOOPFUSION
#define GEN_PASS_DECL_AFFINELOOPINVARIANTCODEMOTION
#define GEN_PASS_DECL_AFFINELOOPTILING
#define GEN_PASS_DECL_AFFINELOOPUNROLL
#define GEN_PASS_DECL_AFFINELOOPUNROLLANDJAM
#define GEN_PASS_DECL_AFFINEPIPELINEDATATRANSFER
#define GEN_PASS_DECL_AFFINESCALARREPLACEMENT
#define GEN_PASS_DECL_AFFINEVECTORIZE
#define GEN_PASS_DECL_AFFINEPARALLELIZE
#define GEN_PASS_DECL_AFFINELOOPNORMALIZE
#define GEN_PASS_DECL_LOOPCOALESCING
#define GEN_PASS_DECL_SIMPLIFYAFFINESTRUCTURES
#define GEN_PASS_DECL_AFFINEEXPANDINDEXOPS
#include "mlir/Dialect/Affine/Passes.h.inc"
/// Creates a simplification pass for affine structures (maps and sets). In
/// addition, this pass also normalizes memrefs to have the trivial (identity)
/// layout map.

View File

@ -14,6 +14,11 @@
namespace mlir {
namespace arith {
#define GEN_PASS_DECL_ARITHMETICBUFFERIZE
#define GEN_PASS_DECL_ARITHMETICEXPANDOPS
#define GEN_PASS_DECL_ARITHMETICUNSIGNEDWHENEQUIVALENT
#include "mlir/Dialect/Arithmetic/Transforms/Passes.h.inc"
/// Create a pass to bufferize Arithmetic ops.
std::unique_ptr<Pass> createArithmeticBufferizePass();

View File

@ -18,6 +18,13 @@
namespace mlir {
class ModuleOp;
#define GEN_PASS_DECL_ASYNCPARALLELFOR
#define GEN_PASS_DECL_ASYNCTOASYNCRUNTIME
#define GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTING
#define GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTINGOPT
#define GEN_PASS_DECL_ASYNCRUNTIMEPOLICYBASEDREFCOUNTING
#include "mlir/Dialect/Async/Passes.h.inc"
std::unique_ptr<Pass> createAsyncParallelForPass();
std::unique_ptr<Pass> createAsyncParallelForPass(bool asyncDispatch,

View File

@ -17,6 +17,19 @@ struct OneShotBufferizationOptions;
// Passes
//===----------------------------------------------------------------------===//
#define GEN_PASS_DECL_BUFFERDEALLOCATION
#define GEN_PASS_DECL_BUFFERHOISTING
#define GEN_PASS_DECL_BUFFERLOOPHOISTING
#define GEN_PASS_DECL_BUFFERRESULTSTOOUTPARAMS
#define GEN_PASS_DECL_FINALIZINGBUFFERIZE
#define GEN_PASS_DECL_BUFFERIZATIONBUFFERIZE
#define GEN_PASS_DECL_DROPEQUIVALENTBUFFERRESULTS
#define GEN_PASS_DECL_ONESHOTBUFFERIZE
#define GEN_PASS_DECL_PROMOTEBUFFERSTOSTACK
#define GEN_PASS_DECL_TENSORCOPYINSERTION
#define GEN_PASS_DECL_ALLOCTENSORELIMINATION
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
/// Creates an instance of the BufferDeallocation pass to free all allocated
/// buffers.
std::unique_ptr<Pass> createBufferDeallocationPass();

View File

@ -25,6 +25,10 @@ class BufferizeTypeConverter;
class RewritePatternSet;
namespace func {
#define GEN_PASS_DECL_FUNCBUFFERIZE
#include "mlir/Dialect/Func/Transforms/Passes.h.inc"
/// Creates an instance of func bufferization pass.
std::unique_ptr<Pass> createFuncBufferizePass();

View File

@ -27,6 +27,12 @@ namespace func {
class FuncOp;
} // namespace func
#define GEN_PASS_DECL_GPULAUNCHSINKINDEXCOMPUTATIONS
#define GEN_PASS_DECL_GPUKERNELOUTLINING
#define GEN_PASS_DECL_GPUASYNCREGION
#define GEN_PASS_DECL_GPUMAPPARALLELLOOPS
#include "mlir/Dialect/GPU/Transforms/Passes.h.inc"
/// Pass that moves ops which are likely an index computation into gpu.launch
/// body.
std::unique_ptr<Pass> createGpuLauchSinkIndexComputationsPass();

View File

@ -17,6 +17,9 @@ class Pass;
namespace LLVM {
#define GEN_PASS_DECL_LLVMLEGALIZEFOREXPORT
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
/// Make argument-taking successors of each block distinct. PHI nodes in LLVM
/// IR use the predecessor ID to identify which value to take. They do not
/// support different values coming from the same predecessor. If a block has

View File

@ -16,6 +16,9 @@ class Pass;
namespace NVVM {
#define GEN_PASS_DECL_NVVMOPTIMIZEFORTARGET
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
/// Creates a pass that optimizes LLVM IR for the NVVM target.
std::unique_ptr<Pass> createOptimizeForTargetPass();

View File

@ -15,6 +15,10 @@ namespace mlir {
class Pass;
namespace LLVM {
#define GEN_PASS_DECL_LLVMREQUESTCWRAPPERS
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
std::unique_ptr<Pass> createRequestCWrappersPass();
} // namespace LLVM
} // namespace mlir

View File

@ -26,6 +26,30 @@ namespace bufferization {
struct OneShotBufferizationOptions;
} // namespace bufferization
#define GEN_PASS_DECL_CONVERTELEMENTWISETOLINALG
#define GEN_PASS_DECL_LINALGINITTENSORTOALLOCTENSOR
#define GEN_PASS_DECL_LINALGFOLDUNITEXTENTDIMS
#define GEN_PASS_DECL_LINALGELEMENTWISEOPFUSION
#define GEN_PASS_DECL_LINALGNAMEDOPCONVERSION
#define GEN_PASS_DECL_LINALGINLINESCALAROPERANDS
#define GEN_PASS_DECL_LINALGLOWERTOAFFINELOOPS
#define GEN_PASS_DECL_LINALGLOWERTOLOOPSPASS
#define GEN_PASS_DECL_LINALGLOWERTOPARALLELLOOPS
#define GEN_PASS_DECL_LINALGBUFFERIZE
#define GEN_PASS_DECL_LINALGTILINGPASS
#define GEN_PASS_DECL_LINALGGENERALIZATION
#define GEN_PASS_DECL_LINALGDETENSORIZE
#define GEN_PASS_DECL_LINALGSTRATEGYTILEANDFUSEPASS
#define GEN_PASS_DECL_LINALGSTRATEGYTILEPASS
#define GEN_PASS_DECL_LINALGSTRATEGYPADPASS
#define GEN_PASS_DECL_LINALGSTRATEGYDECOMPOSEPASS
#define GEN_PASS_DECL_LINALGSTRATEGYPEELPASS
#define GEN_PASS_DECL_LINALGSTRATEGYVECTORIZEPASS
#define GEN_PASS_DECL_LINALGSTRATEGYENABLEPASS
#define GEN_PASS_DECL_LINALGSTRATEGYLOWERVECTORSPASS
#define GEN_PASS_DECL_LINALGSTRATEGYREMOVEMARKERSPASS
#include "mlir/Dialect/Linalg/Passes.h.inc"
std::unique_ptr<Pass> createConvertElementwiseToLinalgPass();
std::unique_ptr<Pass> createLinalgFoldUnitExtentDimsPass();

View File

@ -112,7 +112,7 @@ def LinalgBufferize : Pass<"linalg-bufferize", "func::FuncOp"> {
];
}
def LinalgTiling : Pass<"linalg-tile", "func::FuncOp"> {
def LinalgTilingPass : Pass<"linalg-tile", "func::FuncOp"> {
let summary = "Tile operations in the linalg dialect";
let constructor = "mlir::createLinalgTilingPass()";
let dependentDialects = [

View File

@ -86,6 +86,13 @@ LogicalResult multiBuffer(memref::AllocOp allocOp, unsigned multiplier);
// Passes
//===----------------------------------------------------------------------===//
#define GEN_PASS_DECL_EXPANDOPS
#define GEN_PASS_DECL_FOLDMEMREFALIASOPS
#define GEN_PASS_DECL_NORMALIZEMEMREFS
#define GEN_PASS_DECL_RESOLVERANKEDSHAPETYPERESULTDIMS
#define GEN_PASS_DECL_RESOLVESHAPEDTYPERESULTDIMS
#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
/// Creates an instance of the ExpandOps pass that legalizes memref dialect ops
/// to be convertible to LLVM. For example, `memref.reshape` gets converted to
/// `memref_reinterpret_cast`.

View File

@ -17,6 +17,9 @@
namespace mlir {
namespace nvgpu {
#define GEN_PASS_DECL_OPTIMIZESHAREDMEMORY
#include "mlir/Dialect/NVGPU/Passes.h.inc"
/// Create a pass to optimize shared memory reads and writes.
std::unique_ptr<Pass> createOptimizeSharedMemoryPass();

View File

@ -17,6 +17,18 @@
namespace mlir {
#define GEN_PASS_DECL_SCFBUFFERIZE
#define GEN_PASS_DECL_SCFFORLOOPCANONICALIZATION
#define GEN_PASS_DECL_SCFFORLOOPPEELING
#define GEN_PASS_DECL_SCFFORLOOPSPECIALIZATION
#define GEN_PASS_DECL_SCFPARALLELLOOPFUSION
#define GEN_PASS_DECL_SCFPARALLELLOOPCOLLAPSING
#define GEN_PASS_DECL_SCFPARALLELLOOPSPECIALIZATION
#define GEN_PASS_DECL_SCFPARALLELLOOPTILING
#define GEN_PASS_DECL_SCFFORLOOPRANGEFOLDING
#define GEN_PASS_DECL_SCFFORTOWHILELOOP
#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
/// Creates a pass that bufferizes the SCF dialect.
std::unique_ptr<Pass> createSCFBufferizePass();

View File

@ -27,6 +27,14 @@ class ModuleOp;
// Passes
//===----------------------------------------------------------------------===//
#define GEN_PASS_DECL_SPIRVCOMPOSITETYPELAYOUT
#define GEN_PASS_DECL_SPIRVCANONICALIZEGL
#define GEN_PASS_DECL_SPIRVLOWERABIATTRIBUTES
#define GEN_PASS_DECL_SPIRVREWRITEINSERTSPASS
#define GEN_PASS_DECL_SPIRVUNIFYALIASEDRESOURCEPASS
#define GEN_PASS_DECL_SPIRVUPDATEVCE
#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
/// Creates a pass to run canoncalization patterns that involve GL ops.
/// These patterns cannot be run in default canonicalization because GL ops
/// aren't always available. So they should be involed specifically when needed.

View File

@ -12,7 +12,7 @@
include "mlir/Pass/PassBase.td"
def SPIRVCompositeTypeLayout
: Pass<"decorate-spirv-composite-type-layout", "ModuleOp"> {
: Pass<"decorate-spirv-composite-type-layout", "mlir::ModuleOp"> {
let summary = "Decorate SPIR-V composite type with layout info";
let constructor = "mlir::spirv::createDecorateSPIRVCompositeTypeLayoutPass()";
}

View File

@ -25,6 +25,12 @@ class FuncOp;
} // namespace mlir
namespace mlir {
#define GEN_PASS_DECL_SHAPETOSHAPELOWERING
#define GEN_PASS_DECL_REMOVESHAPECONSTRAINTS
#define GEN_PASS_DECL_SHAPEBUFFERIZE
#include "mlir/Dialect/Shape/Transforms/Passes.h.inc"
/// Creates an instance of the ShapeToShapeLowering pass that legalizes Shape
/// dialect to be convertible to Arithmetic. For example, `shape.num_elements`
/// get transformed to `shape.reduce`, which can be lowered to SCF and

View File

@ -26,6 +26,11 @@ namespace bufferization {
struct OneShotBufferizationOptions;
} // namespace bufferization
#define GEN_PASS_DECL_SPARSIFICATIONPASS
#define GEN_PASS_DECL_SPARSETENSORCONVERSIONPASS
#define GEN_PASS_DECL_SPARSETENSORCODEGEN
#include "mlir/Dialect/SparseTensor/Transforms/Passes.h.inc"
//===----------------------------------------------------------------------===//
// The Sparsification pass.
//===----------------------------------------------------------------------===//

View File

@ -11,7 +11,7 @@
include "mlir/Pass/PassBase.td"
def Sparsification : Pass<"sparsification", "ModuleOp"> {
def SparsificationPass : Pass<"sparsification", "ModuleOp"> {
let summary = "Automatically generate sparse tensor code from sparse tensor types";
let description = [{
A pass that implements the core functionality of a **sparse compiler**.
@ -76,7 +76,7 @@ def Sparsification : Pass<"sparsification", "ModuleOp"> {
];
}
def SparseTensorConversion : Pass<"sparse-tensor-conversion", "ModuleOp"> {
def SparseTensorConversionPass : Pass<"sparse-tensor-conversion", "ModuleOp"> {
let summary = "Convert sparse tensors and primitives to library calls";
let description = [{
A pass that converts sparse tensor primitives into calls into a runtime

View File

@ -12,6 +12,10 @@
#include "mlir/Pass/Pass.h"
namespace mlir {
#define GEN_PASS_DECL_TENSORBUFFERIZE
#include "mlir/Dialect/Tensor/Transforms/Passes.h.inc"
/// Creates an instance of `tensor` dialect bufferization pass.
std::unique_ptr<Pass> createTensorBufferizePass();

View File

@ -1,24 +0,0 @@
//===- PassDetail.h - TOSA Pass class details -------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_DIALECT_TOSA_TRANSFORMS_PASSDETAIL_H
#define MLIR_DIALECT_TOSA_TRANSFORMS_PASSDETAIL_H
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/Pass/Pass.h"
namespace mlir {
#define GEN_PASS_CLASSES
#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
} // namespace mlir
#endif // MLIR_DIALECT_TOSA_TRANSFORMS_PASSDETAIL_H

View File

@ -19,6 +19,12 @@
namespace mlir {
namespace tosa {
#define GEN_PASS_DECL_TOSALAYERWISECONSTANTFOLD
#define GEN_PASS_DECL_TOSAINFERSHAPES
#define GEN_PASS_DECL_TOSAMAKEBROADCASTABLE
#define GEN_PASS_DECL_TOSAOPTIONALDECOMPOSITIONS
#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
// Expose Rewrite Functions that decompose TOSA Ops into further TOSA Ops.
// The rewrites can be selectively added to a conversion pass.
void populateTosaDecomposeConv2D(MLIRContext *ctx, RewritePatternSet &patterns);

View File

@ -16,6 +16,9 @@ namespace mlir {
class Pass;
namespace transform {
#define GEN_PASS_DECL_CHECKUSES
#include "mlir/Dialect/Transform/Transforms/Passes.h.inc"
std::unique_ptr<Pass> createCheckUsesPass();
#define GEN_PASS_REGISTRATION

View File

@ -13,6 +13,9 @@
namespace mlir {
namespace vector {
#define GEN_PASS_DECL_VECTORBUFFERIZE
#include "mlir/Dialect/Vector/Transforms/Passes.h.inc"
/// Creates an instance of the `vector` dialect bufferization pass.
std::unique_ptr<Pass> createVectorBufferizePass();

View File

@ -1,22 +0,0 @@
//===- PassDetail.h - Reducer Pass class details ----------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_REDUCER_PASSDETAIL_H
#define MLIR_REDUCER_PASSDETAIL_H
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Pass/Pass.h"
namespace mlir {
#define GEN_PASS_CLASSES
#include "mlir/Reducer/Passes.h.inc"
} // namespace mlir
#endif // MLIR_REDUCER_PASSDETAIL_H

View File

@ -12,6 +12,10 @@
namespace mlir {
#define GEN_PASS_DECL_REDUCTIONTREE
#define GEN_PASS_DECL_OPTREDUCTION
#include "mlir/Reducer/Passes.h.inc"
std::unique_ptr<Pass> createReductionTreePass();
std::unique_ptr<Pass> createOptReductionPass();

View File

@ -26,6 +26,9 @@ class Operation;
class OpPrintingFlags;
class Pass;
#define GEN_PASS_DECL_LOCATIONSNAPSHOT
#include "mlir/Transforms/Passes.h.inc"
/// This function generates new locations from the given IR by snapshotting the
/// IR to the given stream, and using the printed locations within that stream.
/// The generated locations replace the current operation locations.

View File

@ -28,6 +28,19 @@ class GreedyRewriteConfig;
// Passes
//===----------------------------------------------------------------------===//
#define GEN_PASS_DECL_CANONICALIZER
#define GEN_PASS_DECL_CONTROLFLOWSINK
#define GEN_PASS_DECL_CSEPASS
#define GEN_PASS_DECL_LOOPINVARIANTCODEMOTION
#define GEN_PASS_DECL_STRIPDEBUGINFO
#define GEN_PASS_DECL_PRINTOPSTATS
#define GEN_PASS_DECL_INLINER
#define GEN_PASS_DECL_SCCP
#define GEN_PASS_DECL_SYMBOLDCE
#define GEN_PASS_DECL_SYMBOLPRIVATIZE
#define GEN_PASS_DECL_TOPOLOGICALSORT
#include "mlir/Transforms/Passes.h.inc"
/// Creates an instance of the Canonicalizer pass, configured with default
/// settings (which can be overridden by pass options on the command line).
std::unique_ptr<Pass> createCanonicalizerPass();

Some files were not shown because too many files have changed in this diff Show More