[flang-commits] [flang] [flang] Add genEval to the AbstractConverter (PR #75140)
Valentin Clement バレンタイン クレメン via flang-commits
flang-commits at lists.llvm.org
Mon Dec 11 20:54:56 PST 2023
https://github.com/clementval created https://github.com/llvm/llvm-project/pull/75140
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
>From 0212daecc9484a4276822a19047a84c5f83d521f Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Mon, 11 Dec 2023 13:43:11 -0800
Subject: [PATCH] [flang] Add genEval to the AbstractConverter
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.
[1] https://discourse.llvm.org/t/openmp-lowering-from-pft-to-fir/75263
---
flang/include/flang/Lower/AbstractConverter.h | 4 ++++
flang/lib/Lower/Bridge.cpp | 5 +++++
2 files changed, 9 insertions(+)
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
//===--------------------------------------------------------------------===//
More information about the flang-commits
mailing list