MLIR  19.0.0git
Mem2Reg.h
Go to the documentation of this file.
1 //===-- Mem2Reg.h - Mem2Reg definitions -------------------------*- 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 MLIR_TRANSFORMS_MEM2REG_H
10 #define MLIR_TRANSFORMS_MEM2REG_H
11 
13 #include "llvm/ADT/Statistic.h"
14 
15 namespace mlir {
16 
17 /// Statistics collected while applying mem2reg.
19  /// Total amount of memory slots promoted.
20  llvm::Statistic *promotedAmount = nullptr;
21  /// Total amount of new block arguments inserted in blocks.
22  llvm::Statistic *newBlockArgumentAmount = nullptr;
23 };
24 
25 /// Attempts to promote the memory slots of the provided allocators. Iteratively
26 /// retries the promotion of all slots as promoting one slot might enable
27 /// subsequent promotions. Succeeds if at least one memory slot was promoted.
30  OpBuilder &builder, const DataLayout &dataLayout,
31  DominanceInfo &dominance,
32  Mem2RegStatistics statistics = {});
33 
34 } // namespace mlir
35 
36 #endif // MLIR_TRANSFORMS_MEM2REG_H
The main mechanism for performing data layout queries.
A class for computing basic dominance information.
Definition: Dominance.h:136
This class helps build Operations.
Definition: Builders.h:209
Include the generated interface declarations.
LogicalResult tryToPromoteMemorySlots(ArrayRef< PromotableAllocationOpInterface > allocators, OpBuilder &builder, const DataLayout &dataLayout, DominanceInfo &dominance, Mem2RegStatistics statistics={})
Attempts to promote the memory slots of the provided allocators.
Definition: Mem2Reg.cpp:631
This class represents an efficient way to signal success or failure.
Definition: LogicalResult.h:26
Statistics collected while applying mem2reg.
Definition: Mem2Reg.h:18
llvm::Statistic * promotedAmount
Total amount of memory slots promoted.
Definition: Mem2Reg.h:20
llvm::Statistic * newBlockArgumentAmount
Total amount of new block arguments inserted in blocks.
Definition: Mem2Reg.h:22