[flang-commits] [flang] [llvm] [flang][OpenMP] Decompose compound constructs, do recursive lowering (PR #90098)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Tue May 7 06:12:42 PDT 2024
================
@@ -0,0 +1,1002 @@
+//===- ConstructDecompositionT.h -- Decomposing compound constructs -------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// Given a compound construct with a set of clauses, generate the list of
+// constituent leaf constructs, each with a list of clauses that apply to it.
+//
+// Note: Clauses that are not originally present, but that are implied by the
+// OpenMP spec are materialized, and are present in the output.
+//
+// Note: Composite constructs will also be broken up into leaf constructs.
+// If composite constructs require processing as a whole, the lists of clauses
+// for each leaf constituent should be concatenated.
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_FRONTEND_OPENMP_CONSTRUCTDECOMPOSITIONT_H
+#define LLVM_FRONTEND_OPENMP_CONSTRUCTDECOMPOSITIONT_H
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/iterator_range.h"
+#include "llvm/Frontend/OpenMP/ClauseT.h"
+#include "llvm/Frontend/OpenMP/OMP.h"
+
+#include <iterator>
+#include <list>
+#include <optional>
+#include <tuple>
+#include <type_traits>
+#include <utility>
+#include <variant>
+
+static inline llvm::ArrayRef<llvm::omp::Directive> getWorksharing() {
+ static llvm::omp::Directive worksharing[] = {
+ llvm::omp::Directive::OMPD_do, llvm::omp::Directive::OMPD_for,
+ llvm::omp::Directive::OMPD_scope, llvm::omp::Directive::OMPD_sections,
+ llvm::omp::Directive::OMPD_single, llvm::omp::Directive::OMPD_workshare,
+ };
+ return worksharing;
+}
+
+static inline llvm::ArrayRef<llvm::omp::Directive> getWorksharingLoop() {
+ static llvm::omp::Directive worksharingLoop[] = {
+ llvm::omp::Directive::OMPD_do,
+ llvm::omp::Directive::OMPD_for,
+ };
+ return worksharingLoop;
+}
----------------
kparzysz wrote:
I'm planning to have these properties encoded in OMP.td, and have functions in OMP.h that return sets of clauses with a given property (or properties). I don't really like these functions here all that much.
https://github.com/llvm/llvm-project/pull/90098
More information about the flang-commits
mailing list