MLIR  21.0.0git
ControlFlowToLLVM.h
Go to the documentation of this file.
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 class SymbolTableCollection;
24 
25 #define GEN_PASS_DECL_CONVERTCONTROLFLOWTOLLVMPASS
26 #include "mlir/Conversion/Passes.h.inc"
27 
28 namespace cf {
29 
30 /// Collect the patterns to convert from the ControlFlow dialect to LLVM. The
31 /// conversion patterns capture the LLVMTypeConverter by reference meaning the
32 /// references have to remain alive during the entire pattern lifetime.
33 ///
34 /// Note: This function does not populate the default cf.assert lowering. That
35 /// is because some platforms have a custom cf.assert lowering. The default
36 /// lowering can be populated with `populateAssertToLLVMConversionPattern`.
38  const LLVMTypeConverter &converter, RewritePatternSet &patterns);
39 
40 /// Populate the cf.assert to LLVM conversion pattern. If `abortOnFailure` is
41 /// set to false, the program execution continues when a condition is
42 /// unsatisfied.
44  const LLVMTypeConverter &converter, RewritePatternSet &patterns,
45  bool abortOnFailure = true, SymbolTableCollection *symbolTables = nullptr);
46 
48 
49 } // namespace cf
50 } // namespace mlir
51 
52 #endif // MLIR_CONVERSION_CONTROLFLOWTOLLVM_CONTROLFLOWTOLLVM_H
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
Conversion from types to the LLVM IR dialect.
Definition: TypeConverter.h:35
This class represents a collection of SymbolTables.
Definition: SymbolTable.h:283
void registerConvertControlFlowToLLVMInterface(DialectRegistry &registry)
void populateControlFlowToLLVMConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns)
Collect the patterns to convert from the ControlFlow dialect to LLVM.
void populateAssertToLLVMConversionPattern(const LLVMTypeConverter &converter, RewritePatternSet &patterns, bool abortOnFailure=true, SymbolTableCollection *symbolTables=nullptr)
Populate the cf.assert to LLVM conversion pattern.
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns