[flang-commits] [flang] 4152674 - [flang] Switch return to ExtendedValue in AbstractConverter and Bridge

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Wed Feb 2 09:44:35 PST 2022


Author: Valentin Clement
Date: 2022-02-02T18:44:28+01:00
New Revision: 415267407db27a6ca9818f1d269314fe92dd8042

URL: https://github.com/llvm/llvm-project/commit/415267407db27a6ca9818f1d269314fe92dd8042
DIFF: https://github.com/llvm/llvm-project/commit/415267407db27a6ca9818f1d269314fe92dd8042.diff

LOG: [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

Added: 
    

Modified: 
    flang/include/flang/Lower/AbstractConverter.h
    flang/lib/Lower/Bridge.cpp

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Lower/AbstractConverter.h b/flang/include/flang/Lower/AbstractConverter.h
index 4b6b7184345a4..99ee5aee2bb4b 100644
--- a/flang/include/flang/Lower/AbstractConverter.h
+++ b/flang/include/flang/Lower/AbstractConverter.h
@@ -78,19 +78,20 @@ class AbstractConverter {
   // 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);
   }
 

diff  --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index 7302f6c8ce663..c16a91b616988 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -71,12 +71,13 @@ class FirConverter : public Fortran::lower::AbstractConverter {
     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");
   }
 


        


More information about the flang-commits mailing list