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/Transforms/AllocationPlacementPolicy.h"
13#include "mlir/Dialect/LLVMIR/LLVMAttrs.h"
14#include "mlir/Pass/Pass.h"
15#include "mlir/Pass/PassRegistry.h"
16#include <memory>
17
18namespace mlir {
19class IRMapping;
20class GreedyRewriteConfig;
21class Operation;
22class Pass;
23class Region;
24class ModuleOp;
25} // namespace mlir
26
27namespace fir {
28
36
37//===----------------------------------------------------------------------===//
38// Passes defined in Passes.td
39//===----------------------------------------------------------------------===//
40
41#define GEN_PASS_DECL
42
43#include "flang/Optimizer/Transforms/Passes.h.inc"
44
48std::unique_ptr<mlir::Pass>
49createAllocationPlacement(const AllocationPlacementOptions &options,
50 AllocationPlacementHook placementHook);
51
52std::unique_ptr<mlir::Pass> createAffineDemotionPass();
53std::unique_ptr<mlir::Pass> createMemDataFlowOptPass();
54std::unique_ptr<mlir::Pass> createPromoteToAffinePass();
55std::unique_ptr<mlir::Pass>
56createAddDebugInfoPass(fir::AddDebugInfoOptions options = {});
57
58std::unique_ptr<mlir::Pass> createAnnotateConstantOperandsPass();
59std::unique_ptr<mlir::Pass> createAlgebraicSimplificationPass();
60std::unique_ptr<mlir::Pass>
61createAlgebraicSimplificationPass(const mlir::GreedyRewriteConfig &config);
62
63std::unique_ptr<mlir::Pass> createVScaleAttrPass();
64std::unique_ptr<mlir::Pass>
65createVScaleAttrPass(std::pair<unsigned, unsigned> vscaleAttr);
66
67void populateFIRToSCFRewrites(mlir::RewritePatternSet &patterns,
68 bool parallelUnordered = false,
69 bool setNSW = true);
70
71void populateCfgConversionRewrites(mlir::RewritePatternSet &patterns,
72 bool forceLoopToExecuteOnce = false,
73 bool setNSW = true);
74
75void populateSimplifyFIROperationsPatterns(mlir::RewritePatternSet &patterns,
76 bool preferInlineImplementation);
77
78// declarative passes
79#define GEN_PASS_REGISTRATION
80#include "flang/Optimizer/Transforms/Passes.h.inc"
81
82} // namespace fir
83
84#endif // FORTRAN_OPTIMIZER_TRANSFORMS_PASSES_H
Definition AbstractConverter.h:37
std::function< AllocationPlacement( const AllocationInfo &, const AllocationPlacementThresholds &, std::size_t)> AllocationPlacementHook
Definition AllocationPlacementPolicy.h:83
std::unique_ptr< mlir::Pass > createAllocationPlacement(const AllocationPlacementOptions &options, AllocationPlacementHook placementHook)
LICMNestedHoistingMode
Definition Passes.h:31
@ Aggressive
Hoist all safe invariant ops.
Definition Passes.h:34
@ Cheap
Only hoist cheap ops like fir.convert.
Definition Passes.h:33
std::unique_ptr< mlir::Pass > createPromoteToAffinePass()
Convert FIR loop constructs to the Affine dialect.
Definition AffinePromotion.cpp:647
void populateCfgConversionRewrites(mlir::RewritePatternSet &patterns, bool forceLoopToExecuteOnce=false, bool setNSW=true)
Expose conversion rewriters to other passes.
Definition ControlFlowConverter.cpp:369
Definition AbstractConverter.h:32