[flang-commits] [flang] [flang] Add genEval to the AbstractConverter (PR #75140)

via flang-commits flang-commits at lists.llvm.org
Mon Dec 11 20:55:24 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-fir-hlfir

Author: Valentin Clement (バレンタイン クレメン) (clementval)

<details>
<summary>Changes</summary>

There was some discussion on discourse[1] about allowing call to FIR generation functions from other part of lowering belonging to OpenMP.

This solution exposes a simple `genEval` member function on the `AbstractConverter` so that IR generation for PFT Evaluation objects can be called from lowering outside of the FirConverter but not exposing it.

[1] https://discourse.llvm.org/t/openmp-lowering-from-pft-to-fir/75263

---
Full diff: https://github.com/llvm/llvm-project/pull/75140.diff


2 Files Affected:

- (modified) flang/include/flang/Lower/AbstractConverter.h (+4) 
- (modified) flang/lib/Lower/Bridge.cpp (+5) 


``````````diff
diff --git a/flang/include/flang/Lower/AbstractConverter.h b/flang/include/flang/Lower/AbstractConverter.h
index 980fde88137324..b91303387f3d71 100644
--- a/flang/include/flang/Lower/AbstractConverter.h
+++ b/flang/include/flang/Lower/AbstractConverter.h
@@ -280,6 +280,10 @@ class AbstractConverter {
   // Miscellaneous
   //===--------------------------------------------------------------------===//
 
+  /// Generate IR for Evaluation \p eval.
+  virtual void genEval(pft::Evaluation &eval,
+                       bool unstructuredContext = true) = 0;
+
   /// Return options controlling lowering behavior.
   const Fortran::lower::LoweringOptions &getLoweringOptions() const {
     return loweringOptions;
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index 7e64adc3c144c9..9acdf524ba84b8 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -839,6 +839,11 @@ class FirConverter : public Fortran::lower::AbstractConverter {
     }
   }
 
+  void genEval(Fortran::lower::pft::Evaluation &eval,
+               bool unstructuredContext) override {
+    genFIR(eval, unstructuredContext);
+  }
+
   //===--------------------------------------------------------------------===//
   // Utility methods
   //===--------------------------------------------------------------------===//

``````````

</details>


https://github.com/llvm/llvm-project/pull/75140


More information about the flang-commits mailing list