1 | //===- ControlFlowToLLVM.h - ControlFlow to LLVM -----------*- 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 | // Define conversions from the ControlFlow dialect to the LLVM IR dialect. |
10 | // |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #ifndef MLIR_CONVERSION_CONTROLFLOWTOLLVM_CONTROLFLOWTOLLVM_H |
14 | #define MLIR_CONVERSION_CONTROLFLOWTOLLVM_CONTROLFLOWTOLLVM_H |
15 | |
16 | #include <memory> |
17 | |
18 | namespace mlir { |
19 | class DialectRegistry; |
20 | class LLVMTypeConverter; |
21 | class RewritePatternSet; |
22 | class Pass; |
23 | |
24 | #define GEN_PASS_DECL_CONVERTCONTROLFLOWTOLLVMPASS |
25 | #include "mlir/Conversion/Passes.h.inc" |
26 | |
27 | namespace cf { |
28 | |
29 | /// Collect the patterns to convert from the ControlFlow dialect to LLVM. The |
30 | /// conversion patterns capture the LLVMTypeConverter by reference meaning the |
31 | /// references have to remain alive during the entire pattern lifetime. |
32 | void populateControlFlowToLLVMConversionPatterns(LLVMTypeConverter &converter, |
33 | RewritePatternSet &patterns); |
34 | |
35 | /// Populate the cf.assert to LLVM conversion pattern. If `abortOnFailure` is |
36 | /// set to false, the program execution continues when a condition is |
37 | /// unsatisfied. |
38 | void populateAssertToLLVMConversionPattern(LLVMTypeConverter &converter, |
39 | RewritePatternSet &patterns, |
40 | bool abortOnFailure = true); |
41 | |
42 | void registerConvertControlFlowToLLVMInterface(DialectRegistry ®istry); |
43 | |
44 | } // namespace cf |
45 | } // namespace mlir |
46 | |
47 | #endif // MLIR_CONVERSION_CONTROLFLOWTOLLVM_CONTROLFLOWTOLLVM_H |
48 | |