[flang][codegen] Add `fir.end` conversion placeholder

This patch extends the FIRToLLVMLowering pass in Flang by adding a hook
to transform fir.end. This is just a placeholder for now as fir.end is
not required yet.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

Patch originally written by:
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>

Differential Revision: https://reviews.llvm.org/D113295
This commit is contained in:
Andrzej Warzynski 2021-11-05 16:04:23 +00:00
parent dead1c11ff
commit 22d332a0a2
2 changed files with 22 additions and 3 deletions

View File

@ -839,6 +839,18 @@ struct GenTypeDescOpConversion : public FIROpConversion<fir::GenTypeDescOp> {
}
};
/// Convert `fir.end`
struct FirEndOpConversion : public FIROpConversion<fir::FirEndOp> {
using FIROpConversion::FIROpConversion;
mlir::LogicalResult
matchAndRewrite(fir::FirEndOp firEnd, OpAdaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
return rewriter.notifyMatchFailure(
firEnd, "fir.end codegen is not implemented yet");
}
};
/// Lower `fir.has_value` operation to `llvm.return` operation.
struct HasValueOpConversion : public FIROpConversion<fir::HasValueOp> {
using FIROpConversion::FIROpConversion;
@ -2108,9 +2120,9 @@ public:
CmpcOpConversion, ConstcOpConversion, ConvertOpConversion,
DispatchOpConversion, DispatchTableOpConversion, DTEntryOpConversion,
DivcOpConversion, EmboxOpConversion, EmboxCharOpConversion,
EmboxProcOpConversion, ExtractValueOpConversion, HasValueOpConversion,
GenTypeDescOpConversion, GlobalLenOpConversion, GlobalOpConversion,
InsertOnRangeOpConversion, InsertValueOpConversion,
EmboxProcOpConversion, ExtractValueOpConversion, FirEndOpConversion,
HasValueOpConversion, GenTypeDescOpConversion, GlobalLenOpConversion,
GlobalOpConversion, InsertOnRangeOpConversion, InsertValueOpConversion,
IsPresentOpConversion, LoadOpConversion, NegcOpConversion,
MulcOpConversion, SelectCaseOpConversion, SelectOpConversion,
SelectRankOpConversion, SelectTypeOpConversion, ShapeOpConversion,

View File

@ -173,3 +173,10 @@ func @emboxproc_test() {
// Test that `fir.unboxproc` and `fir.boxproc_host` also fails to be legalized.
// At the moment these cannot be tested since the `fir.boxproc` type does not have a conversion.
// -----
// Test `fir.end` conversion failure. Not implemented yet.
// expected-error@+1{{failed to legalize operation 'fir.end'}}
"fir.end"() : () -> ()