//===--- OpenMPKinds.h - OpenMP enums ---------------------------*- C++ -*-===// // // 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 // //===----------------------------------------------------------------------===// /// /// \file /// Defines some OpenMP-specific enums and functions. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_OPENMPKINDS_H #define LLVM_CLANG_BASIC_OPENMPKINDS_H #include "clang/Basic/LangOptions.h" #include "llvm/ADT/StringRef.h" #include "llvm/Frontend/OpenMP/OMPConstants.h" namespace clang { /// OpenMP directives. OpenMPDirectiveKind; /// OpenMP clauses. OpenMPClauseKind; /// OpenMP attributes for 'schedule' clause. enum OpenMPScheduleClauseKind { … }; /// OpenMP modifiers for 'schedule' clause. enum OpenMPScheduleClauseModifier { … }; /// OpenMP modifiers for 'device' clause. enum OpenMPDeviceClauseModifier { … }; /// OpenMP attributes for 'depend' clause. enum OpenMPDependClauseKind { … }; /// OpenMP attributes for 'linear' clause. enum OpenMPLinearClauseKind { … }; /// OpenMP mapping kind for 'map' clause. enum OpenMPMapClauseKind { … }; /// OpenMP modifier kind for 'map' clause. enum OpenMPMapModifierKind { … }; /// Number of allowed map-type-modifiers. static constexpr unsigned NumberOfOMPMapClauseModifiers = …; /// OpenMP modifier kind for 'to' or 'from' clause. enum OpenMPMotionModifierKind { … }; /// Number of allowed motion-modifiers. static constexpr unsigned NumberOfOMPMotionModifiers = …; /// OpenMP attributes for 'dist_schedule' clause. enum OpenMPDistScheduleClauseKind { … }; /// OpenMP attributes for 'defaultmap' clause. enum OpenMPDefaultmapClauseKind { … }; /// OpenMP modifiers for 'defaultmap' clause. enum OpenMPDefaultmapClauseModifier { … }; /// OpenMP attributes for 'atomic_default_mem_order' clause. enum OpenMPAtomicDefaultMemOrderClauseKind { … }; /// OpenMP attributes for 'at' clause. enum OpenMPAtClauseKind { … }; /// OpenMP attributes for 'severity' clause. enum OpenMPSeverityClauseKind { … }; /// OpenMP device type for 'device_type' clause. enum OpenMPDeviceType { … }; /// OpenMP 'lastprivate' clause modifier. enum OpenMPLastprivateModifier { … }; /// OpenMP attributes for 'order' clause. enum OpenMPOrderClauseKind { … }; /// OpenMP modifiers for 'order' clause. enum OpenMPOrderClauseModifier { … }; /// Scheduling data for loop-based OpenMP directives. struct OpenMPScheduleTy final { … }; /// OpenMP modifiers for 'reduction' clause. enum OpenMPReductionClauseModifier { … }; /// OpenMP adjust-op kinds for 'adjust_args' clause. enum OpenMPAdjustArgsOpKind { … }; /// OpenMP bindings for the 'bind' clause. enum OpenMPBindClauseKind { … }; enum OpenMPGrainsizeClauseModifier { … }; enum OpenMPNumTasksClauseModifier { … }; /// OpenMP dependence types for 'doacross' clause. enum OpenMPDoacrossClauseModifier { … }; /// Contains 'interop' data for 'append_args' and 'init' clauses. class Expr; struct OMPInteropInfo final { … }; unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str, const LangOptions &LangOpts); const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type); /// Checks if the specified directive is a directive with an associated /// loop construct. /// \param DKind Specified directive. /// \return true - the directive is a loop-associated directive like 'omp simd' /// or 'omp for' directive, otherwise - false. bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind); /// Checks if the specified directive is a worksharing directive. /// \param DKind Specified directive. /// \return true - the directive is a worksharing directive like 'omp for', /// otherwise - false. bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind); /// Checks if the specified directive is a taskloop directive. /// \param DKind Specified directive. /// \return true - the directive is a worksharing directive like 'omp taskloop', /// otherwise - false. bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind); /// Checks if the specified directive is a parallel-kind directive. /// \param DKind Specified directive. /// \return true - the directive is a parallel-like directive like 'omp /// parallel', otherwise - false. bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind); /// Checks if the specified directive is a target code offload directive. /// \param DKind Specified directive. /// \return true - the directive is a target code offload directive like /// 'omp target', 'omp target parallel', 'omp target xxx' /// otherwise - false. bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind); /// Checks if the specified directive is a target data offload directive. /// \param DKind Specified directive. /// \return true - the directive is a target data offload directive like /// 'omp target data', 'omp target update', 'omp target enter data', /// 'omp target exit data' /// otherwise - false. bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind); /// Checks if the specified composite/combined directive constitutes a teams /// directive in the outermost nest. For example /// 'omp teams distribute' or 'omp teams distribute parallel for'. /// \param DKind Specified directive. /// \return true - the directive has teams on the outermost nest, otherwise - /// false. bool isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind); /// Checks if the specified directive is a teams-kind directive. For example, /// 'omp teams distribute' or 'omp target teams'. /// \param DKind Specified directive. /// \return true - the directive is a teams-like directive, otherwise - false. bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind); /// Checks if the specified directive is a simd directive. /// \param DKind Specified directive. /// \return true - the directive is a simd directive like 'omp simd', /// otherwise - false. bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind); /// Checks if the specified directive is a distribute directive. /// \param DKind Specified directive. /// \return true - the directive is a distribute-directive like 'omp /// distribute', /// otherwise - false. bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind); /// Checks if the specified composite/combined directive constitutes a /// distribute directive in the outermost nest. For example, /// 'omp distribute parallel for' or 'omp distribute'. /// \param DKind Specified directive. /// \return true - the directive has distribute on the outermost nest. /// otherwise - false. bool isOpenMPNestingDistributeDirective(OpenMPDirectiveKind DKind); /// Checks if the specified directive constitutes a 'loop' directive in the /// outermost nest. For example, 'omp teams loop' or 'omp loop'. /// \param DKind Specified directive. /// \return true - the directive has loop on the outermost nest. /// otherwise - false. bool isOpenMPGenericLoopDirective(OpenMPDirectiveKind DKind); /// Checks if the specified clause is one of private clauses like /// 'private', 'firstprivate', 'reduction' etc.. /// \param Kind Clause kind. /// \return true - the clause is a private clause, otherwise - false. bool isOpenMPPrivate(OpenMPClauseKind Kind); /// Checks if the specified clause is one of threadprivate clauses like /// 'threadprivate', 'copyin' or 'copyprivate'. /// \param Kind Clause kind. /// \return true - the clause is a threadprivate clause, otherwise - false. bool isOpenMPThreadPrivate(OpenMPClauseKind Kind); /// Checks if the specified directive kind is one of tasking directives - task, /// taskloop, taksloop simd, master taskloop, parallel master taskloop, master /// taskloop simd, or parallel master taskloop simd. bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind); /// Checks if the specified directive kind is one of the composite or combined /// directives that need loop bound sharing across loops outlined in nested /// functions bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind); /// Checks if the specified directive is a loop transformation directive. /// \param DKind Specified directive. /// \return True iff the directive is a loop transformation. bool isOpenMPLoopTransformationDirective(OpenMPDirectiveKind DKind); /// Return the captured regions of an OpenMP directive. void getOpenMPCaptureRegions( llvm::SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions, OpenMPDirectiveKind DKind); /// Checks if the specified directive is a combined construct for which /// the first construct is a parallel construct. /// \param DKind Specified directive. /// \return true - if the above condition is met for this directive /// otherwise - false. bool isOpenMPCombinedParallelADirective(OpenMPDirectiveKind DKind); /// Checks if the specified target directive, combined or not, needs task based /// thread_limit /// \param DKind Specified directive. /// \return true - if the above condition is met for this directive /// otherwise - false. bool needsTaskBasedThreadLimit(OpenMPDirectiveKind DKind); /// Checks if the parameter to the fail clause in "#pragma atomic compare fail" /// is restricted only to memory order clauses of "OMPC_acquire", /// "OMPC_relaxed" and "OMPC_seq_cst". bool checkFailClauseParameter(OpenMPClauseKind FailClauseParameter); /// Checks if the specified directive is considered as "executable". This /// combines the OpenMP categories of "executable" and "subsidiary", plus /// any other directives that should be treated as executable. /// \param DKind Specified directive. /// \return true - if the above condition is met for this directive /// otherwise - false. bool isOpenMPExecutableDirective(OpenMPDirectiveKind DKind); /// Checks if the specified directive is considered as "informational". /// \param DKind Specified directive. /// \return true if it is an informational directive, false otherwise. bool isOpenMPInformationalDirective(OpenMPDirectiveKind DKind); /// Checks if the specified directive can capture variables. /// \param DKind Specified directive. /// \return true - if the above condition is met for this directive /// otherwise - false. bool isOpenMPCapturingDirective(OpenMPDirectiveKind DKind); } #endif