10b57cec5SDimitry Andric //===--- OpenMPKinds.h - OpenMP enums ---------------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric ///
90b57cec5SDimitry Andric /// \file
100b57cec5SDimitry Andric /// Defines some OpenMP-specific enums and functions.
110b57cec5SDimitry Andric ///
120b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifndef LLVM_CLANG_BASIC_OPENMPKINDS_H
150b57cec5SDimitry Andric #define LLVM_CLANG_BASIC_OPENMPKINDS_H
160b57cec5SDimitry Andric 
17349cc55cSDimitry Andric #include "clang/Basic/LangOptions.h"
180b57cec5SDimitry Andric #include "llvm/ADT/StringRef.h"
19480093f4SDimitry Andric #include "llvm/Frontend/OpenMP/OMPConstants.h"
200b57cec5SDimitry Andric 
210b57cec5SDimitry Andric namespace clang {
220b57cec5SDimitry Andric 
23480093f4SDimitry Andric /// OpenMP directives.
24480093f4SDimitry Andric using OpenMPDirectiveKind = llvm::omp::Directive;
25480093f4SDimitry Andric 
260b57cec5SDimitry Andric /// OpenMP clauses.
275ffd83dbSDimitry Andric using OpenMPClauseKind = llvm::omp::Clause;
280b57cec5SDimitry Andric 
290b57cec5SDimitry Andric /// OpenMP attributes for 'schedule' clause.
300b57cec5SDimitry Andric enum OpenMPScheduleClauseKind {
310b57cec5SDimitry Andric #define OPENMP_SCHEDULE_KIND(Name) \
320b57cec5SDimitry Andric   OMPC_SCHEDULE_##Name,
330b57cec5SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
340b57cec5SDimitry Andric   OMPC_SCHEDULE_unknown
350b57cec5SDimitry Andric };
360b57cec5SDimitry Andric 
370b57cec5SDimitry Andric /// OpenMP modifiers for 'schedule' clause.
380b57cec5SDimitry Andric enum OpenMPScheduleClauseModifier {
390b57cec5SDimitry Andric   OMPC_SCHEDULE_MODIFIER_unknown = OMPC_SCHEDULE_unknown,
400b57cec5SDimitry Andric #define OPENMP_SCHEDULE_MODIFIER(Name) \
410b57cec5SDimitry Andric   OMPC_SCHEDULE_MODIFIER_##Name,
420b57cec5SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
430b57cec5SDimitry Andric   OMPC_SCHEDULE_MODIFIER_last
440b57cec5SDimitry Andric };
450b57cec5SDimitry Andric 
465ffd83dbSDimitry Andric /// OpenMP modifiers for 'device' clause.
475ffd83dbSDimitry Andric enum OpenMPDeviceClauseModifier {
485ffd83dbSDimitry Andric #define OPENMP_DEVICE_MODIFIER(Name) OMPC_DEVICE_##Name,
495ffd83dbSDimitry Andric #include "clang/Basic/OpenMPKinds.def"
505ffd83dbSDimitry Andric   OMPC_DEVICE_unknown,
515ffd83dbSDimitry Andric };
525ffd83dbSDimitry Andric 
530b57cec5SDimitry Andric /// OpenMP attributes for 'depend' clause.
540b57cec5SDimitry Andric enum OpenMPDependClauseKind {
550b57cec5SDimitry Andric #define OPENMP_DEPEND_KIND(Name) \
560b57cec5SDimitry Andric   OMPC_DEPEND_##Name,
570b57cec5SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
580b57cec5SDimitry Andric   OMPC_DEPEND_unknown
590b57cec5SDimitry Andric };
600b57cec5SDimitry Andric 
610b57cec5SDimitry Andric /// OpenMP attributes for 'linear' clause.
620b57cec5SDimitry Andric enum OpenMPLinearClauseKind {
630b57cec5SDimitry Andric #define OPENMP_LINEAR_KIND(Name) \
640b57cec5SDimitry Andric   OMPC_LINEAR_##Name,
650b57cec5SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
660b57cec5SDimitry Andric   OMPC_LINEAR_unknown
670b57cec5SDimitry Andric };
680b57cec5SDimitry Andric 
690b57cec5SDimitry Andric /// OpenMP mapping kind for 'map' clause.
700b57cec5SDimitry Andric enum OpenMPMapClauseKind {
710b57cec5SDimitry Andric #define OPENMP_MAP_KIND(Name) \
720b57cec5SDimitry Andric   OMPC_MAP_##Name,
730b57cec5SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
740b57cec5SDimitry Andric   OMPC_MAP_unknown
750b57cec5SDimitry Andric };
760b57cec5SDimitry Andric 
770b57cec5SDimitry Andric /// OpenMP modifier kind for 'map' clause.
780b57cec5SDimitry Andric enum OpenMPMapModifierKind {
790b57cec5SDimitry Andric   OMPC_MAP_MODIFIER_unknown = OMPC_MAP_unknown,
800b57cec5SDimitry Andric #define OPENMP_MAP_MODIFIER_KIND(Name) \
810b57cec5SDimitry Andric   OMPC_MAP_MODIFIER_##Name,
820b57cec5SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
830b57cec5SDimitry Andric   OMPC_MAP_MODIFIER_last
840b57cec5SDimitry Andric };
850b57cec5SDimitry Andric 
865ffd83dbSDimitry Andric /// Number of allowed map-type-modifiers.
875ffd83dbSDimitry Andric static constexpr unsigned NumberOfOMPMapClauseModifiers =
885ffd83dbSDimitry Andric     OMPC_MAP_MODIFIER_last - OMPC_MAP_MODIFIER_unknown - 1;
895ffd83dbSDimitry Andric 
90e8d8bef9SDimitry Andric /// OpenMP modifier kind for 'to' or 'from' clause.
91e8d8bef9SDimitry Andric enum OpenMPMotionModifierKind {
92e8d8bef9SDimitry Andric #define OPENMP_MOTION_MODIFIER_KIND(Name) \
93e8d8bef9SDimitry Andric   OMPC_MOTION_MODIFIER_##Name,
940b57cec5SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
95e8d8bef9SDimitry Andric   OMPC_MOTION_MODIFIER_unknown
960b57cec5SDimitry Andric };
970b57cec5SDimitry Andric 
98e8d8bef9SDimitry Andric /// Number of allowed motion-modifiers.
99e8d8bef9SDimitry Andric static constexpr unsigned NumberOfOMPMotionModifiers =
100e8d8bef9SDimitry Andric     OMPC_MOTION_MODIFIER_unknown;
1010b57cec5SDimitry Andric 
1020b57cec5SDimitry Andric /// OpenMP attributes for 'dist_schedule' clause.
1030b57cec5SDimitry Andric enum OpenMPDistScheduleClauseKind {
1040b57cec5SDimitry Andric #define OPENMP_DIST_SCHEDULE_KIND(Name) OMPC_DIST_SCHEDULE_##Name,
1050b57cec5SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
1060b57cec5SDimitry Andric   OMPC_DIST_SCHEDULE_unknown
1070b57cec5SDimitry Andric };
1080b57cec5SDimitry Andric 
1090b57cec5SDimitry Andric /// OpenMP attributes for 'defaultmap' clause.
1100b57cec5SDimitry Andric enum OpenMPDefaultmapClauseKind {
1110b57cec5SDimitry Andric #define OPENMP_DEFAULTMAP_KIND(Name) \
1120b57cec5SDimitry Andric   OMPC_DEFAULTMAP_##Name,
1130b57cec5SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
1140b57cec5SDimitry Andric   OMPC_DEFAULTMAP_unknown
1150b57cec5SDimitry Andric };
1160b57cec5SDimitry Andric 
1170b57cec5SDimitry Andric /// OpenMP modifiers for 'defaultmap' clause.
1180b57cec5SDimitry Andric enum OpenMPDefaultmapClauseModifier {
1190b57cec5SDimitry Andric   OMPC_DEFAULTMAP_MODIFIER_unknown = OMPC_DEFAULTMAP_unknown,
1200b57cec5SDimitry Andric #define OPENMP_DEFAULTMAP_MODIFIER(Name) \
1210b57cec5SDimitry Andric   OMPC_DEFAULTMAP_MODIFIER_##Name,
1220b57cec5SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
1230b57cec5SDimitry Andric   OMPC_DEFAULTMAP_MODIFIER_last
1240b57cec5SDimitry Andric };
1250b57cec5SDimitry Andric 
1260b57cec5SDimitry Andric /// OpenMP attributes for 'atomic_default_mem_order' clause.
1270b57cec5SDimitry Andric enum OpenMPAtomicDefaultMemOrderClauseKind {
1280b57cec5SDimitry Andric #define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)  \
1290b57cec5SDimitry Andric   OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name,
1300b57cec5SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
1310b57cec5SDimitry Andric   OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown
1320b57cec5SDimitry Andric };
1330b57cec5SDimitry Andric 
134bdd1243dSDimitry Andric /// OpenMP attributes for 'at' clause.
135bdd1243dSDimitry Andric enum OpenMPAtClauseKind {
136bdd1243dSDimitry Andric #define OPENMP_AT_KIND(Name) OMPC_AT_##Name,
137bdd1243dSDimitry Andric #include "clang/Basic/OpenMPKinds.def"
138bdd1243dSDimitry Andric   OMPC_AT_unknown
139bdd1243dSDimitry Andric };
140bdd1243dSDimitry Andric 
141bdd1243dSDimitry Andric /// OpenMP attributes for 'severity' clause.
142bdd1243dSDimitry Andric enum OpenMPSeverityClauseKind {
143bdd1243dSDimitry Andric #define OPENMP_SEVERITY_KIND(Name) OMPC_SEVERITY_##Name,
144bdd1243dSDimitry Andric #include "clang/Basic/OpenMPKinds.def"
145bdd1243dSDimitry Andric   OMPC_SEVERITY_unknown
146bdd1243dSDimitry Andric };
147bdd1243dSDimitry Andric 
148a7dea167SDimitry Andric /// OpenMP device type for 'device_type' clause.
149a7dea167SDimitry Andric enum OpenMPDeviceType {
150a7dea167SDimitry Andric #define OPENMP_DEVICE_TYPE_KIND(Name) \
151a7dea167SDimitry Andric   OMPC_DEVICE_TYPE_##Name,
152a7dea167SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
153a7dea167SDimitry Andric   OMPC_DEVICE_TYPE_unknown
154a7dea167SDimitry Andric };
155a7dea167SDimitry Andric 
156480093f4SDimitry Andric /// OpenMP 'lastprivate' clause modifier.
157480093f4SDimitry Andric enum OpenMPLastprivateModifier {
158480093f4SDimitry Andric #define OPENMP_LASTPRIVATE_KIND(Name) OMPC_LASTPRIVATE_##Name,
159480093f4SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
160480093f4SDimitry Andric   OMPC_LASTPRIVATE_unknown,
161480093f4SDimitry Andric };
162480093f4SDimitry Andric 
1635ffd83dbSDimitry Andric /// OpenMP attributes for 'order' clause.
1645ffd83dbSDimitry Andric enum OpenMPOrderClauseKind {
1655ffd83dbSDimitry Andric #define OPENMP_ORDER_KIND(Name) OMPC_ORDER_##Name,
1665ffd83dbSDimitry Andric #include "clang/Basic/OpenMPKinds.def"
1675ffd83dbSDimitry Andric   OMPC_ORDER_unknown,
1685ffd83dbSDimitry Andric };
1695ffd83dbSDimitry Andric 
170bdd1243dSDimitry Andric /// OpenMP modifiers for 'order' clause.
171bdd1243dSDimitry Andric enum OpenMPOrderClauseModifier {
172bdd1243dSDimitry Andric   OMPC_ORDER_MODIFIER_unknown = OMPC_ORDER_unknown,
173bdd1243dSDimitry Andric #define OPENMP_ORDER_MODIFIER(Name) OMPC_ORDER_MODIFIER_##Name,
174bdd1243dSDimitry Andric #include "clang/Basic/OpenMPKinds.def"
175bdd1243dSDimitry Andric   OMPC_ORDER_MODIFIER_last
176bdd1243dSDimitry Andric };
177bdd1243dSDimitry Andric 
1780b57cec5SDimitry Andric /// Scheduling data for loop-based OpenMP directives.
1790b57cec5SDimitry Andric struct OpenMPScheduleTy final {
1800b57cec5SDimitry Andric   OpenMPScheduleClauseKind Schedule = OMPC_SCHEDULE_unknown;
1810b57cec5SDimitry Andric   OpenMPScheduleClauseModifier M1 = OMPC_SCHEDULE_MODIFIER_unknown;
1820b57cec5SDimitry Andric   OpenMPScheduleClauseModifier M2 = OMPC_SCHEDULE_MODIFIER_unknown;
1830b57cec5SDimitry Andric };
1840b57cec5SDimitry Andric 
1855ffd83dbSDimitry Andric /// OpenMP modifiers for 'reduction' clause.
1865ffd83dbSDimitry Andric enum OpenMPReductionClauseModifier {
1875ffd83dbSDimitry Andric #define OPENMP_REDUCTION_MODIFIER(Name) OMPC_REDUCTION_##Name,
1885ffd83dbSDimitry Andric #include "clang/Basic/OpenMPKinds.def"
1895ffd83dbSDimitry Andric   OMPC_REDUCTION_unknown,
1905ffd83dbSDimitry Andric };
1910b57cec5SDimitry Andric 
192349cc55cSDimitry Andric /// OpenMP adjust-op kinds for 'adjust_args' clause.
193349cc55cSDimitry Andric enum OpenMPAdjustArgsOpKind {
194349cc55cSDimitry Andric #define OPENMP_ADJUST_ARGS_KIND(Name) OMPC_ADJUST_ARGS_##Name,
195349cc55cSDimitry Andric #include "clang/Basic/OpenMPKinds.def"
196349cc55cSDimitry Andric   OMPC_ADJUST_ARGS_unknown,
197349cc55cSDimitry Andric };
198349cc55cSDimitry Andric 
199349cc55cSDimitry Andric /// OpenMP bindings for the 'bind' clause.
200349cc55cSDimitry Andric enum OpenMPBindClauseKind {
201349cc55cSDimitry Andric #define OPENMP_BIND_KIND(Name) OMPC_BIND_##Name,
202349cc55cSDimitry Andric #include "clang/Basic/OpenMPKinds.def"
203349cc55cSDimitry Andric   OMPC_BIND_unknown
204349cc55cSDimitry Andric };
205349cc55cSDimitry Andric 
206bdd1243dSDimitry Andric enum OpenMPGrainsizeClauseModifier {
207bdd1243dSDimitry Andric #define OPENMP_GRAINSIZE_MODIFIER(Name) OMPC_GRAINSIZE_##Name,
208bdd1243dSDimitry Andric #include "clang/Basic/OpenMPKinds.def"
209bdd1243dSDimitry Andric   OMPC_GRAINSIZE_unknown
210bdd1243dSDimitry Andric };
211bdd1243dSDimitry Andric 
212bdd1243dSDimitry Andric enum OpenMPNumTasksClauseModifier {
213bdd1243dSDimitry Andric #define OPENMP_NUMTASKS_MODIFIER(Name) OMPC_NUMTASKS_##Name,
214bdd1243dSDimitry Andric #include "clang/Basic/OpenMPKinds.def"
215bdd1243dSDimitry Andric   OMPC_NUMTASKS_unknown
216bdd1243dSDimitry Andric };
217bdd1243dSDimitry Andric 
21806c3fb27SDimitry Andric /// OpenMP dependence types for 'doacross' clause.
21906c3fb27SDimitry Andric enum OpenMPDoacrossClauseModifier {
22006c3fb27SDimitry Andric #define OPENMP_DOACROSS_MODIFIER(Name) OMPC_DOACROSS_##Name,
22106c3fb27SDimitry Andric #include "clang/Basic/OpenMPKinds.def"
22206c3fb27SDimitry Andric   OMPC_DOACROSS_unknown
22306c3fb27SDimitry Andric };
22406c3fb27SDimitry Andric 
225bdd1243dSDimitry Andric /// Contains 'interop' data for 'append_args' and 'init' clauses.
226bdd1243dSDimitry Andric class Expr;
227bdd1243dSDimitry Andric struct OMPInteropInfo final {
228bdd1243dSDimitry Andric   OMPInteropInfo(bool IsTarget = false, bool IsTargetSync = false)
IsTargetfinal229bdd1243dSDimitry Andric       : IsTarget(IsTarget), IsTargetSync(IsTargetSync) {}
230bdd1243dSDimitry Andric   bool IsTarget;
231bdd1243dSDimitry Andric   bool IsTargetSync;
232bdd1243dSDimitry Andric   llvm::SmallVector<Expr *, 4> PreferTypes;
233bdd1243dSDimitry Andric };
234bdd1243dSDimitry Andric 
235e8d8bef9SDimitry Andric unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str,
236349cc55cSDimitry Andric                                    const LangOptions &LangOpts);
2370b57cec5SDimitry Andric const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type);
2380b57cec5SDimitry Andric 
2390b57cec5SDimitry Andric /// Checks if the specified directive is a directive with an associated
2400b57cec5SDimitry Andric /// loop construct.
2410b57cec5SDimitry Andric /// \param DKind Specified directive.
2420b57cec5SDimitry Andric /// \return true - the directive is a loop-associated directive like 'omp simd'
2430b57cec5SDimitry Andric /// or 'omp for' directive, otherwise - false.
2440b57cec5SDimitry Andric bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind);
2450b57cec5SDimitry Andric 
2460b57cec5SDimitry Andric /// Checks if the specified directive is a worksharing directive.
2470b57cec5SDimitry Andric /// \param DKind Specified directive.
2480b57cec5SDimitry Andric /// \return true - the directive is a worksharing directive like 'omp for',
2490b57cec5SDimitry Andric /// otherwise - false.
2500b57cec5SDimitry Andric bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind);
2510b57cec5SDimitry Andric 
2520b57cec5SDimitry Andric /// Checks if the specified directive is a taskloop directive.
2530b57cec5SDimitry Andric /// \param DKind Specified directive.
2540b57cec5SDimitry Andric /// \return true - the directive is a worksharing directive like 'omp taskloop',
2550b57cec5SDimitry Andric /// otherwise - false.
2560b57cec5SDimitry Andric bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind);
2570b57cec5SDimitry Andric 
2580b57cec5SDimitry Andric /// Checks if the specified directive is a parallel-kind directive.
2590b57cec5SDimitry Andric /// \param DKind Specified directive.
2600b57cec5SDimitry Andric /// \return true - the directive is a parallel-like directive like 'omp
2610b57cec5SDimitry Andric /// parallel', otherwise - false.
2620b57cec5SDimitry Andric bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind);
2630b57cec5SDimitry Andric 
2640b57cec5SDimitry Andric /// Checks if the specified directive is a target code offload directive.
2650b57cec5SDimitry Andric /// \param DKind Specified directive.
2660b57cec5SDimitry Andric /// \return true - the directive is a target code offload directive like
2670b57cec5SDimitry Andric /// 'omp target', 'omp target parallel', 'omp target xxx'
2680b57cec5SDimitry Andric /// otherwise - false.
2690b57cec5SDimitry Andric bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind);
2700b57cec5SDimitry Andric 
2710b57cec5SDimitry Andric /// Checks if the specified directive is a target data offload directive.
2720b57cec5SDimitry Andric /// \param DKind Specified directive.
2730b57cec5SDimitry Andric /// \return true - the directive is a target data offload directive like
2740b57cec5SDimitry Andric /// 'omp target data', 'omp target update', 'omp target enter data',
2750b57cec5SDimitry Andric /// 'omp target exit data'
2760b57cec5SDimitry Andric /// otherwise - false.
2770b57cec5SDimitry Andric bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind);
2780b57cec5SDimitry Andric 
2790b57cec5SDimitry Andric /// Checks if the specified composite/combined directive constitutes a teams
2800b57cec5SDimitry Andric /// directive in the outermost nest.  For example
2810b57cec5SDimitry Andric /// 'omp teams distribute' or 'omp teams distribute parallel for'.
2820b57cec5SDimitry Andric /// \param DKind Specified directive.
2830b57cec5SDimitry Andric /// \return true - the directive has teams on the outermost nest, otherwise -
2840b57cec5SDimitry Andric /// false.
2850b57cec5SDimitry Andric bool isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind);
2860b57cec5SDimitry Andric 
2870b57cec5SDimitry Andric /// Checks if the specified directive is a teams-kind directive.  For example,
2880b57cec5SDimitry Andric /// 'omp teams distribute' or 'omp target teams'.
2890b57cec5SDimitry Andric /// \param DKind Specified directive.
2900b57cec5SDimitry Andric /// \return true - the directive is a teams-like directive, otherwise - false.
2910b57cec5SDimitry Andric bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind);
2920b57cec5SDimitry Andric 
2930b57cec5SDimitry Andric /// Checks if the specified directive is a simd directive.
2940b57cec5SDimitry Andric /// \param DKind Specified directive.
2950b57cec5SDimitry Andric /// \return true - the directive is a simd directive like 'omp simd',
2960b57cec5SDimitry Andric /// otherwise - false.
2970b57cec5SDimitry Andric bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind);
2980b57cec5SDimitry Andric 
2990b57cec5SDimitry Andric /// Checks if the specified directive is a distribute directive.
3000b57cec5SDimitry Andric /// \param DKind Specified directive.
3010b57cec5SDimitry Andric /// \return true - the directive is a distribute-directive like 'omp
3020b57cec5SDimitry Andric /// distribute',
3030b57cec5SDimitry Andric /// otherwise - false.
3040b57cec5SDimitry Andric bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind);
3050b57cec5SDimitry Andric 
3060b57cec5SDimitry Andric /// Checks if the specified composite/combined directive constitutes a
3070b57cec5SDimitry Andric /// distribute directive in the outermost nest.  For example,
3080b57cec5SDimitry Andric /// 'omp distribute parallel for' or 'omp distribute'.
3090b57cec5SDimitry Andric /// \param DKind Specified directive.
3100b57cec5SDimitry Andric /// \return true - the directive has distribute on the outermost nest.
3110b57cec5SDimitry Andric /// otherwise - false.
3120b57cec5SDimitry Andric bool isOpenMPNestingDistributeDirective(OpenMPDirectiveKind DKind);
3130b57cec5SDimitry Andric 
314349cc55cSDimitry Andric /// Checks if the specified directive constitutes a 'loop' directive in the
315349cc55cSDimitry Andric /// outermost nest.  For example, 'omp teams loop' or 'omp loop'.
316349cc55cSDimitry Andric /// \param DKind Specified directive.
317349cc55cSDimitry Andric /// \return true - the directive has loop on the outermost nest.
318349cc55cSDimitry Andric /// otherwise - false.
319349cc55cSDimitry Andric bool isOpenMPGenericLoopDirective(OpenMPDirectiveKind DKind);
320349cc55cSDimitry Andric 
3210b57cec5SDimitry Andric /// Checks if the specified clause is one of private clauses like
3220b57cec5SDimitry Andric /// 'private', 'firstprivate', 'reduction' etc..
3230b57cec5SDimitry Andric /// \param Kind Clause kind.
3240b57cec5SDimitry Andric /// \return true - the clause is a private clause, otherwise - false.
3250b57cec5SDimitry Andric bool isOpenMPPrivate(OpenMPClauseKind Kind);
3260b57cec5SDimitry Andric 
3270b57cec5SDimitry Andric /// Checks if the specified clause is one of threadprivate clauses like
3280b57cec5SDimitry Andric /// 'threadprivate', 'copyin' or 'copyprivate'.
3290b57cec5SDimitry Andric /// \param Kind Clause kind.
3300b57cec5SDimitry Andric /// \return true - the clause is a threadprivate clause, otherwise - false.
3310b57cec5SDimitry Andric bool isOpenMPThreadPrivate(OpenMPClauseKind Kind);
3320b57cec5SDimitry Andric 
3330b57cec5SDimitry Andric /// Checks if the specified directive kind is one of tasking directives - task,
334480093f4SDimitry Andric /// taskloop, taksloop simd, master taskloop, parallel master taskloop, master
335480093f4SDimitry Andric /// taskloop simd, or parallel master taskloop simd.
3360b57cec5SDimitry Andric bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind);
3370b57cec5SDimitry Andric 
3380b57cec5SDimitry Andric /// Checks if the specified directive kind is one of the composite or combined
3390b57cec5SDimitry Andric /// directives that need loop bound sharing across loops outlined in nested
3400b57cec5SDimitry Andric /// functions
3410b57cec5SDimitry Andric bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind);
3420b57cec5SDimitry Andric 
343fe6060f1SDimitry Andric /// Checks if the specified directive is a loop transformation directive.
344fe6060f1SDimitry Andric /// \param DKind Specified directive.
345fe6060f1SDimitry Andric /// \return True iff the directive is a loop transformation.
346fe6060f1SDimitry Andric bool isOpenMPLoopTransformationDirective(OpenMPDirectiveKind DKind);
347fe6060f1SDimitry Andric 
3480b57cec5SDimitry Andric /// Return the captured regions of an OpenMP directive.
3490b57cec5SDimitry Andric void getOpenMPCaptureRegions(
3500b57cec5SDimitry Andric     llvm::SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
3510b57cec5SDimitry Andric     OpenMPDirectiveKind DKind);
352bdd1243dSDimitry Andric 
353bdd1243dSDimitry Andric /// Checks if the specified directive is a combined construct for which
354bdd1243dSDimitry Andric /// the first construct is a parallel construct.
355bdd1243dSDimitry Andric /// \param DKind Specified directive.
356bdd1243dSDimitry Andric /// \return true - if the above condition is met for this directive
357bdd1243dSDimitry Andric /// otherwise - false.
358bdd1243dSDimitry Andric bool isOpenMPCombinedParallelADirective(OpenMPDirectiveKind DKind);
3595f757f3fSDimitry Andric 
3605f757f3fSDimitry Andric /// Checks if the specified target directive, combined or not, needs task based
3615f757f3fSDimitry Andric /// thread_limit
3625f757f3fSDimitry Andric /// \param DKind Specified directive.
3635f757f3fSDimitry Andric /// \return true - if the above condition is met for this directive
3645f757f3fSDimitry Andric /// otherwise - false.
3655f757f3fSDimitry Andric bool needsTaskBasedThreadLimit(OpenMPDirectiveKind DKind);
3665f757f3fSDimitry Andric 
3675f757f3fSDimitry Andric /// Checks if the parameter to the fail clause in "#pragma atomic compare fail"
3685f757f3fSDimitry Andric /// is restricted only to memory order clauses of "OMPC_acquire",
3695f757f3fSDimitry Andric /// "OMPC_relaxed" and "OMPC_seq_cst".
3705f757f3fSDimitry Andric bool checkFailClauseParameter(OpenMPClauseKind FailClauseParameter);
3710b57cec5SDimitry Andric }
3720b57cec5SDimitry Andric 
3730b57cec5SDimitry Andric #endif
3740b57cec5SDimitry Andric 
375