[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:
parent
dead1c11ff
commit
22d332a0a2
|
|
@ -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.
|
/// Lower `fir.has_value` operation to `llvm.return` operation.
|
||||||
struct HasValueOpConversion : public FIROpConversion<fir::HasValueOp> {
|
struct HasValueOpConversion : public FIROpConversion<fir::HasValueOp> {
|
||||||
using FIROpConversion::FIROpConversion;
|
using FIROpConversion::FIROpConversion;
|
||||||
|
|
@ -2108,9 +2120,9 @@ public:
|
||||||
CmpcOpConversion, ConstcOpConversion, ConvertOpConversion,
|
CmpcOpConversion, ConstcOpConversion, ConvertOpConversion,
|
||||||
DispatchOpConversion, DispatchTableOpConversion, DTEntryOpConversion,
|
DispatchOpConversion, DispatchTableOpConversion, DTEntryOpConversion,
|
||||||
DivcOpConversion, EmboxOpConversion, EmboxCharOpConversion,
|
DivcOpConversion, EmboxOpConversion, EmboxCharOpConversion,
|
||||||
EmboxProcOpConversion, ExtractValueOpConversion, HasValueOpConversion,
|
EmboxProcOpConversion, ExtractValueOpConversion, FirEndOpConversion,
|
||||||
GenTypeDescOpConversion, GlobalLenOpConversion, GlobalOpConversion,
|
HasValueOpConversion, GenTypeDescOpConversion, GlobalLenOpConversion,
|
||||||
InsertOnRangeOpConversion, InsertValueOpConversion,
|
GlobalOpConversion, InsertOnRangeOpConversion, InsertValueOpConversion,
|
||||||
IsPresentOpConversion, LoadOpConversion, NegcOpConversion,
|
IsPresentOpConversion, LoadOpConversion, NegcOpConversion,
|
||||||
MulcOpConversion, SelectCaseOpConversion, SelectOpConversion,
|
MulcOpConversion, SelectCaseOpConversion, SelectOpConversion,
|
||||||
SelectRankOpConversion, SelectTypeOpConversion, ShapeOpConversion,
|
SelectRankOpConversion, SelectTypeOpConversion, ShapeOpConversion,
|
||||||
|
|
|
||||||
|
|
@ -173,3 +173,10 @@ func @emboxproc_test() {
|
||||||
|
|
||||||
// Test that `fir.unboxproc` and `fir.boxproc_host` also fails to be legalized.
|
// 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.
|
// 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"() : () -> ()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue