[flang-commits] [flang] fedc54b - [flang] Add genEval to the AbstractConverter (#75140)
via flang-commits
flang-commits at lists.llvm.org
Thu Dec 14 09:25:31 PST 2023
Author: Valentin Clement (バレンタイン クレメン)
Date: 2023-12-14T09:25:27-08:00
New Revision: fedc54bf35b378ab3418ba0f36c1df476aef5aca
URL: https://github.com/llvm/llvm-project/commit/fedc54bf35b378ab3418ba0f36c1df476aef5aca
DIFF: https://github.com/llvm/llvm-project/commit/fedc54bf35b378ab3418ba0f36c1df476aef5aca.diff
LOG: [flang] Add genEval to the AbstractConverter (#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
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 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..6ca910d2696742 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 final {
+ genFIR(eval, unstructuredContext);
+ }
+
//===--------------------------------------------------------------------===//
// Utility methods
//===--------------------------------------------------------------------===//
More information about the flang-commits
mailing list