llvm.call @foo(%16) : (!llvm<"{ float*, float*, i64, [1 x i64], [1 x i64] }*">) -> ()
llvm.return
}
-
-
-
```
+*This convention may or may not apply if the conversion of MemRef types is
+overridden by the user.*
+
## Repeated Successor Removal
Since the goal of the LLVM IR dialect is to reflect LLVM IR in MLIR, the dialect
llvm.br ^bb1(%2 : !llvm.i32)
```
-## Memref Model
+## Default Memref Model
### Memref Descriptor
using LLVMTypeConverterMaker =
std::function<std::unique_ptr<LLVMTypeConverter>(MLIRContext *)>;
+/// Collect a set of patterns to convert memory-related operations from the
+/// Standard dialect to the LLVM dialect, excluding the memory-related
+/// operations.
+void populateStdToLLVMMemoryConversionPatters(
+ LLVMTypeConverter &converter, OwningRewritePatternList &patterns);
+
+/// Collect a set of patterns to convert from the Standard dialect to the LLVM
+/// dialect, excluding the memory-related operations.
+void populateStdToLLVMNonMemoryConversionPatterns(
+ LLVMTypeConverter &converter, OwningRewritePatternList &patterns);
+
/// Collect a set of patterns to convert from the Standard dialect to LLVM.
void populateStdToLLVMConversionPatterns(LLVMTypeConverter &converter,
OwningRewritePatternList &patterns);
}
/// Collect a set of patterns to convert from the Standard dialect to LLVM.
-void mlir::populateStdToLLVMConversionPatterns(
+void mlir::populateStdToLLVMNonMemoryConversionPatterns(
LLVMTypeConverter &converter, OwningRewritePatternList &patterns) {
// FIXME: this should be tablegen'ed
// clang-format off
CmpIOpLowering,
CondBranchOpLowering,
ConstLLVMOpLowering,
- DimOpLowering,
DivFOpLowering,
DivISOpLowering,
DivIUOpLowering,
Log2OpLowering,
FPExtLowering,
FPTruncLowering,
- FuncOpConversion,
IndexCastOpLowering,
- LoadOpLowering,
- MemRefCastOpLowering,
MulFOpLowering,
MulIOpLowering,
OrOpLowering,
SignExtendIOpLowering,
SplatOpLowering,
SplatNdOpLowering,
- StoreOpLowering,
SubFOpLowering,
SubIOpLowering,
- SubViewOpLowering,
TanhOpLowering,
TruncateIOpLowering,
- ViewOpLowering,
XOrOpLowering,
ZeroExtendIOpLowering>(*converter.getDialect(), converter);
- patterns.insert<
- AllocOpLowering,
- DeallocOpLowering>(
- *converter.getDialect(), converter, clUseAlloca.getValue());
// clang-format on
}
+void mlir::populateStdToLLVMMemoryConversionPatters(
+ LLVMTypeConverter &converter, OwningRewritePatternList &patterns) {
+ // clang-format off
+ patterns.insert<
+ DimOpLowering,
+ FuncOpConversion,
+ LoadOpLowering,
+ MemRefCastOpLowering,
+ StoreOpLowering,
+ SubViewOpLowering,
+ ViewOpLowering>(*converter.getDialect(), converter);
+ patterns.insert<
+ AllocOpLowering,
+ DeallocOpLowering>(
+ *converter.getDialect(), converter, clUseAlloca.getValue());
+ // clang-format on
+}
+
+void mlir::populateStdToLLVMConversionPatterns(
+ LLVMTypeConverter &converter, OwningRewritePatternList &patterns) {
+ populateStdToLLVMNonMemoryConversionPatterns(converter, patterns);
+ populateStdToLLVMMemoryConversionPatters(converter, patterns);
+}
+
// Convert types using the stored LLVM IR module.
Type LLVMTypeConverter::convertType(Type t) { return convertStandardType(t); }