FLANG
Passes.h
1//===-- Optimizer/Transforms/Passes.h ---------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef FORTRAN_OPTIMIZER_TRANSFORMS_PASSES_H
10#define FORTRAN_OPTIMIZER_TRANSFORMS_PASSES_H
11
12#include "flang/Optimizer/Support/AllocationPolicy.h"
13#include "mlir/Dialect/LLVMIR/LLVMAttrs.h"
14#include "mlir/Pass/Pass.h"
15#include "mlir/Pass/PassRegistry.h"
16#include "llvm/ADT/STLFunctionalExtras.h"
17#include <memory>
18#include <utility>
19
20namespace mlir {
21class IRMapping;
22class GreedyRewriteConfig;
23class Operation;
24class Pass;
25class Region;
26class ModuleOp;
27} // namespace mlir
28
29namespace fir {
30
38
39//===----------------------------------------------------------------------===//
40// Passes defined in Passes.td
41//===----------------------------------------------------------------------===//
42
43#define GEN_PASS_DECL
44
45#include "flang/Optimizer/Transforms/Passes.h.inc"
46
50std::unique_ptr<mlir::Pass>
51createAllocationPlacement(const AllocationPlacementOptions &options,
52 AllocationPlacementHook placementHook);
53
54std::unique_ptr<mlir::Pass> createAffineDemotionPass();
55std::unique_ptr<mlir::Pass> createMemDataFlowOptPass();
56std::unique_ptr<mlir::Pass> createPromoteToAffinePass();
57std::unique_ptr<mlir::Pass>
58createAddDebugInfoPass(fir::AddDebugInfoOptions options = {});
59
60std::unique_ptr<mlir::Pass> createAnnotateConstantOperandsPass();
61std::unique_ptr<mlir::Pass> createAlgebraicSimplificationPass();
62std::unique_ptr<mlir::Pass>
63createAlgebraicSimplificationPass(const mlir::GreedyRewriteConfig &config);
64
65std::unique_ptr<mlir::Pass> createVScaleAttrPass();
66std::unique_ptr<mlir::Pass>
67createVScaleAttrPass(std::pair<unsigned, unsigned> vscaleAttr);
68
75 mlir::RewritePatternSet &patterns, bool includeCFPatterns,
76 llvm::function_ref<bool(mlir::RegisteredOperationName)> shouldCollect = {});
77
78void populateFIRToSCFRewrites(mlir::RewritePatternSet &patterns,
79 bool parallelUnordered = false,
80 bool setNSW = true);
81
82void populateCfgConversionRewrites(mlir::RewritePatternSet &patterns,
83 bool forceLoopToExecuteOnce = false,
84 bool setNSW = true);
85
86void populateSimplifyFIROperationsPatterns(mlir::RewritePatternSet &patterns,
87 bool preferInlineImplementation);
88
89// declarative passes
90#define GEN_PASS_REGISTRATION
91#include "flang/Optimizer/Transforms/Passes.h.inc"
92
93} // namespace fir
94
95#endif // FORTRAN_OPTIMIZER_TRANSFORMS_PASSES_H
Definition AbstractConverter.h:37
std::unique_ptr< mlir::Pass > createAllocationPlacement(const AllocationPlacementOptions &options, AllocationPlacementHook placementHook)
std::function< AllocationPlacement( const AllocationInfo &, const AllocationPolicy &, std::size_t)> AllocationPlacementHook
Definition AllocationPolicy.h:144
LICMNestedHoistingMode
Definition Passes.h:33
@ Aggressive
Hoist all safe invariant ops.
Definition Passes.h:36
@ Cheap
Only hoist cheap ops like fir.convert.
Definition Passes.h:35
std::unique_ptr< mlir::Pass > createPromoteToAffinePass()
Convert FIR loop constructs to the Affine dialect.
Definition AffinePromotion.cpp:647
void populateCanonicalizationPatterns(mlir::RewritePatternSet &patterns, bool includeCFPatterns, llvm::function_ref< bool(mlir::RegisteredOperationName)> shouldCollect={})
Definition O0CanonicalizerPass.cpp:22
void populateCfgConversionRewrites(mlir::RewritePatternSet &patterns, bool forceLoopToExecuteOnce=false, bool setNSW=true)
Expose conversion rewriters to other passes.
Definition ControlFlowConverter.cpp:370
Definition AbstractConverter.h:32