-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flang] Add genEval to the AbstractConverter #75140
Conversation
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
@llvm/pr-subscribers-flang-fir-hlfir Author: Valentin Clement (バレンタイン クレメン) (clementval) ChangesThere 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 [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:
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
//===--------------------------------------------------------------------===//
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I favor this solution since it has a much smaller footprint and only exposes the core utility.
We also need access to the local symbol table. |
Add final
What for? It was not part of the discussion we had on discourse? What is the motivation here now that we know more abstraction in the dialect is the right direction to take? By the way there is no need to expose the local symbol table on the |
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 theAbstractConverter
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