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 
12 #include "mlir/IR/PatternMatch.h"
14 #include "llvm/ADT/Statistic.h"
15 
16 namespace mlir {
17 
18 /// Statistics collected while applying mem2reg.
20  /// Total amount of memory slots promoted.
21  llvm::Statistic *promotedAmount = nullptr;
22  /// Total amount of new block arguments inserted in blocks.
23  llvm::Statistic *newBlockArgumentAmount = nullptr;
24 };
25 
26 /// Attempts to promote the memory slots of the provided allocators. Succeeds if
27 /// at least one memory slot was promoted.
30  RewriterBase &rewriter, const DataLayout &dataLayout,
31  Mem2RegStatistics statistics = {});
32 
33 } // namespace mlir
34 
35 #endif // MLIR_TRANSFORMS_MEM2REG_H
The main mechanism for performing data layout queries.
This class coordinates the application of a rewrite on a set of IR, providing a way for clients to tr...
Definition: PatternMatch.h:400
Include the generated interface declarations.
LogicalResult tryToPromoteMemorySlots(ArrayRef< PromotableAllocationOpInterface > allocators, RewriterBase &rewriter, const DataLayout &dataLayout, Mem2RegStatistics statistics={})
Attempts to promote the memory slots of the provided allocators.
Definition: Mem2Reg.cpp:633
This class represents an efficient way to signal success or failure.
Definition: LogicalResult.h:26
Statistics collected while applying mem2reg.
Definition: Mem2Reg.h:19
llvm::Statistic * promotedAmount
Total amount of memory slots promoted.
Definition: Mem2Reg.h:21
llvm::Statistic * newBlockArgumentAmount
Total amount of new block arguments inserted in blocks.
Definition: Mem2Reg.h:23