[flang-commits] [flang] e0f549a - [flang] Added basic connect to lower OpenMP constructs
Shraiysh Vaishay via flang-commits
flang-commits at lists.llvm.org
Thu Mar 10 09:18:35 PST 2022
Author: Shraiysh Vaishay
Date: 2022-03-10T22:48:25+05:30
New Revision: e0f549a43ae02e65fce6c9c7a567fe3dc27bec9b
URL: https://github.com/llvm/llvm-project/commit/e0f549a43ae02e65fce6c9c7a567fe3dc27bec9b
DIFF: https://github.com/llvm/llvm-project/commit/e0f549a43ae02e65fce6c9c7a567fe3dc27bec9b.diff
LOG: [flang] Added basic connect to lower OpenMP constructs
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D121382
Added:
flang/test/Lower/OpenMP/simple-barrier.f90
Modified:
flang/lib/Lower/Bridge.cpp
Removed:
################################################################################
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index e904937317cc0..b062406f9eba4 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -20,6 +20,7 @@
#include "flang/Lower/IO.h"
#include "flang/Lower/IterationSpace.h"
#include "flang/Lower/Mangler.h"
+#include "flang/Lower/OpenMP.h"
#include "flang/Lower/PFTBuilder.h"
#include "flang/Lower/Runtime.h"
#include "flang/Lower/StatementContext.h"
@@ -1200,8 +1201,15 @@ class FirConverter : public Fortran::lower::AbstractConverter {
TODO(toLocation(), "OpenACCDeclarativeConstruct lowering");
}
- void genFIR(const Fortran::parser::OpenMPConstruct &) {
- TODO(toLocation(), "OpenMPConstruct lowering");
+ void genFIR(const Fortran::parser::OpenMPConstruct &omp) {
+ mlir::OpBuilder::InsertPoint insertPt = builder->saveInsertionPoint();
+ localSymbols.pushScope();
+ Fortran::lower::genOpenMPConstruct(*this, getEval(), omp);
+
+ for (Fortran::lower::pft::Evaluation &e : getEval().getNestedEvaluations())
+ genFIR(e);
+ localSymbols.popScope();
+ builder->restoreInsertionPoint(insertPt);
}
void genFIR(const Fortran::parser::OpenMPDeclarativeConstruct &) {
diff --git a/flang/test/Lower/OpenMP/simple-barrier.f90 b/flang/test/Lower/OpenMP/simple-barrier.f90
new file mode 100644
index 0000000000000..c621b8062eaaa
--- /dev/null
+++ b/flang/test/Lower/OpenMP/simple-barrier.f90
@@ -0,0 +1,6 @@
+! RUN: bbc -fopenmp -emit-fir -o - %s | FileCheck %s
+
+subroutine sample()
+! CHECK: omp.barrier
+!$omp barrier
+end subroutine sample
More information about the flang-commits
mailing list