[flang] Switch return to ExtendedValue in AbstractConverter and Bridge

Change the signature of `genExprAddr`, `genExprValue` to return a `fir::ExtendedValue` instead of a simple `mlir::Value`

This patch is a preparation for more lowering to be upstream. It supports D118786 and D118787.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D118785
This commit is contained in:
Valentin Clement 2022-02-02 18:44:09 +01:00
parent c06b4bc89c
commit 415267407d
No known key found for this signature in database
GPG Key ID: 086D54783C928776
2 changed files with 13 additions and 11 deletions

View File

@ -78,19 +78,20 @@ public:
// Expressions
//===--------------------------------------------------------------------===//
/// Generate the address of the location holding the expression, someExpr.
virtual fir::ExtendedValue genExprAddr(const SomeExpr &,
mlir::Location *loc = nullptr) = 0;
/// Generate the address of the location holding the expression, someExpr
virtual mlir::Value genExprAddr(const SomeExpr &,
mlir::Location *loc = nullptr) = 0;
/// Generate the address of the location holding the expression, someExpr
mlir::Value genExprAddr(const SomeExpr *someExpr, mlir::Location loc) {
fir::ExtendedValue genExprAddr(const SomeExpr *someExpr, mlir::Location loc) {
return genExprAddr(*someExpr, &loc);
}
/// Generate the computations of the expression to produce a value
virtual mlir::Value genExprValue(const SomeExpr &,
mlir::Location *loc = nullptr) = 0;
virtual fir::ExtendedValue genExprValue(const SomeExpr &,
mlir::Location *loc = nullptr) = 0;
/// Generate the computations of the expression, someExpr, to produce a value
mlir::Value genExprValue(const SomeExpr *someExpr, mlir::Location loc) {
fir::ExtendedValue genExprValue(const SomeExpr *someExpr,
mlir::Location loc) {
return genExprValue(*someExpr, &loc);
}

View File

@ -71,12 +71,13 @@ public:
return lookupSymbol(sym).getAddr();
}
mlir::Value genExprAddr(const Fortran::lower::SomeExpr &expr,
mlir::Location *loc = nullptr) override final {
fir::ExtendedValue genExprAddr(const Fortran::lower::SomeExpr &expr,
mlir::Location *loc = nullptr) override final {
TODO_NOLOC("Not implemented. Needed for more complex expression lowering");
}
mlir::Value genExprValue(const Fortran::lower::SomeExpr &expr,
mlir::Location *loc = nullptr) override final {
fir::ExtendedValue
genExprValue(const Fortran::lower::SomeExpr &expr,
mlir::Location *loc = nullptr) override final {
TODO_NOLOC("Not implemented. Needed for more complex expression lowering");
}