MLIR  19.0.0git
DIExpressionLegalization.h
Go to the documentation of this file.
1 //===- DIExpressionLegalization.h - DIExpression Legalization Patterns ----===//
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 // Declarations for known legalization patterns for DIExpressions that should
10 // be performed before translation into llvm.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef MLIR_DIALECT_LLVMIR_TRANSFORMS_DIEXPRESSIONLEGALIZATION_H
15 #define MLIR_DIALECT_LLVMIR_TRANSFORMS_DIEXPRESSIONLEGALIZATION_H
16 
18 
19 namespace mlir {
20 namespace LLVM {
21 
22 //===----------------------------------------------------------------------===//
23 // Rewrite Patterns
24 //===----------------------------------------------------------------------===//
25 
26 /// Adjacent DW_OP_LLVM_fragment should be merged into one.
27 ///
28 /// E.g.
29 /// #llvm.di_expression<[
30 /// DW_OP_LLVM_fragment(32, 32), DW_OP_LLVM_fragment(32, 64)
31 /// ]>
32 /// =>
33 /// #llvm.di_expression<[DW_OP_LLVM_fragment(64, 32)]>
35 public:
36  OpIterT match(OpIterRange operators) const override;
37  SmallVector<OperatorT> replace(OpIterRange operators) const override;
38 };
39 
40 //===----------------------------------------------------------------------===//
41 // Runner
42 //===----------------------------------------------------------------------===//
43 
44 /// Register all known legalization patterns declared here and apply them to
45 /// all ops in `op`.
47 
48 } // namespace LLVM
49 } // namespace mlir
50 
51 #endif // MLIR_DIALECT_LLVMIR_TRANSFORMS_DIEXPRESSIONLEGALIZATION_H
std::deque< OperatorT >::const_iterator OpIterT
Adjacent DW_OP_LLVM_fragment should be merged into one.
OpIterT match(OpIterRange operators) const override
Checks whether a particular prefix of operators matches this pattern.
SmallVector< OperatorT > replace(OpIterRange operators) const override
Replace the operators with a new list of operators.
Operation is the basic unit of execution within MLIR.
Definition: Operation.h:88
void legalizeDIExpressionsRecursively(Operation *op)
Register all known legalization patterns declared here and apply them to all ops in op.
Include the generated interface declarations.