[PATCH] D113766: [fir] Add fir.gentypedesc conversion
Valentin Clement via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 16 05:41:15 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3124618704c5: [fir] Add fir.gentypedesc conversion (authored by clementval).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113766/new/
https://reviews.llvm.org/D113766
Files:
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/test/Fir/convert-to-llvm-invalid.fir
Index: flang/test/Fir/convert-to-llvm-invalid.fir
===================================================================
--- flang/test/Fir/convert-to-llvm-invalid.fir
+++ flang/test/Fir/convert-to-llvm-invalid.fir
@@ -83,3 +83,13 @@
%0 = fir.undefined !fir.type<minez>
fir.has_value %0 : !fir.type<minez>
}
+
+// -----
+
+// Test `fir.gentypedesc` conversion failure. Not implemented yet.
+
+func @gentypedesc() {
+ // expected-error at +1{{failed to legalize operation 'fir.gentypedesc'}}
+ %0 = fir.gentypedesc !fir.type<derived3>
+ return
+}
Index: flang/lib/Optimizer/CodeGen/CodeGen.cpp
===================================================================
--- flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -694,6 +694,18 @@
}
};
+/// Lower `fir.gentypedesc` to a global constant.
+struct GenTypeDescOpConversion : public FIROpConversion<fir::GenTypeDescOp> {
+ using FIROpConversion::FIROpConversion;
+
+ mlir::LogicalResult
+ matchAndRewrite(fir::GenTypeDescOp gentypedesc, OpAdaptor adaptor,
+ mlir::ConversionPatternRewriter &rewriter) const override {
+ return rewriter.notifyMatchFailure(
+ gentypedesc, "fir.fir.gentypedesc codegen is not implemented yet");
+ }
+};
+
/// Lower `fir.has_value` operation to `llvm.return` operation.
struct HasValueOpConversion : public FIROpConversion<fir::HasValueOp> {
using FIROpConversion::FIROpConversion;
@@ -1563,14 +1575,13 @@
CmpcOpConversion, ConvertOpConversion, DispatchOpConversion,
DispatchTableOpConversion, DTEntryOpConversion, DivcOpConversion,
EmboxCharOpConversion, ExtractValueOpConversion, HasValueOpConversion,
- GlobalLenOpConversion, GlobalOpConversion, InsertOnRangeOpConversion,
- InsertValueOpConversion, IsPresentOpConversion, LoadOpConversion,
- NegcOpConversion, MulcOpConversion, SelectCaseOpConversion,
- SelectOpConversion, SelectRankOpConversion, SelectTypeOpConversion,
- StoreOpConversion, SubcOpConversion, UnboxCharOpConversion,
- UndefOpConversion, UnreachableOpConversion, ZeroOpConversion>(
- typeConverter);
-
+ GenTypeDescOpConversion, GlobalLenOpConversion, GlobalOpConversion,
+ InsertOnRangeOpConversion, InsertValueOpConversion,
+ IsPresentOpConversion, LoadOpConversion, NegcOpConversion,
+ MulcOpConversion, SelectCaseOpConversion, SelectOpConversion,
+ SelectRankOpConversion, SelectTypeOpConversion, StoreOpConversion,
+ SubcOpConversion, UnboxCharOpConversion, UndefOpConversion,
+ UnreachableOpConversion, ZeroOpConversion>(typeConverter);
mlir::populateStdToLLVMConversionPatterns(typeConverter, pattern);
mlir::arith::populateArithmeticToLLVMConversionPatterns(typeConverter,
pattern);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113766.387589.patch
Type: text/x-patch
Size: 2868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211116/b585bdba/attachment.bin>
More information about the llvm-commits
mailing list