2013-03-22 06:34:35 +00:00
|
|
|
//===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===//
|
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// 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
|
2013-03-22 06:34:35 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// \file
|
2018-05-09 01:00:01 +00:00
|
|
|
/// This file implements the OpenMP enum and support functions.
|
2013-03-22 06:34:35 +00:00
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "clang/Basic/OpenMPKinds.h"
|
|
|
|
#include "clang/Basic/IdentifierTable.h"
|
2013-03-25 21:32:02 +00:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2013-03-22 06:34:35 +00:00
|
|
|
#include "llvm/ADT/StringSwitch.h"
|
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
using namespace clang;
|
[OpenMP][NFCI] Introduce llvm/IR/OpenMPConstants.h
Summary:
The new OpenMPConstants.h is a location for all OpenMP related constants
(and helpers) to live.
This patch moves the directives there (the enum OpenMPDirectiveKind) and
rewires Clang to use the new location.
Initially part of D69785.
Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim
Subscribers: jholewinski, ppenzin, penzn, llvm-commits, cfe-commits, jfb, guansong, bollu, hiraditya, mgorny
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D69853
2019-11-04 22:00:49 -06:00
|
|
|
using namespace llvm::omp;
|
2013-03-22 06:34:35 +00:00
|
|
|
|
2020-07-22 10:14:00 -04:00
|
|
|
unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, StringRef Str,
|
[OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2)
This patch implements Clang support for an original OpenMP extension
we have developed to support OpenACC: the `ompx_hold` map type
modifier. The next patch in this series, D106510, implements OpenMP
runtime support.
Consider the following example:
```
#pragma omp target data map(ompx_hold, tofrom: x) // holds onto mapping of x
{
foo(); // might have map(delete: x)
#pragma omp target map(present, alloc: x) // x is guaranteed to be present
printf("%d\n", x);
}
```
The `ompx_hold` map type modifier above specifies that the `target
data` directive holds onto the mapping for `x` throughout the
associated region regardless of any `target exit data` directives
executed during the call to `foo`. Thus, the presence assertion for
`x` at the enclosed `target` construct cannot fail. (As usual, the
standard OpenMP reference count for `x` must also reach zero before
the data is unmapped.)
Justification for inclusion in Clang and LLVM's OpenMP runtime:
* The `ompx_hold` modifier supports OpenACC functionality (structured
reference count) that cannot be achieved in standard OpenMP, as of
5.1.
* The runtime implementation for `ompx_hold` (next patch) will thus be
used by Flang's OpenACC support.
* The Clang implementation for `ompx_hold` (this patch) as well as the
runtime implementation are required for the Clang OpenACC support
being developed as part of the ECP Clacc project, which translates
OpenACC to OpenMP at the directive AST level. These patches are the
first step in upstreaming OpenACC functionality from Clacc.
* The Clang implementation for `ompx_hold` is also used by the tests
in the runtime implementation. That syntactic support makes the
tests more readable than low-level runtime calls can. Moreover,
upstream Flang and Clang do not yet support OpenACC syntax
sufficiently for writing the tests.
* More generally, the Clang implementation enables a clean separation
of concerns between OpenACC and OpenMP development in LLVM. That
is, LLVM's OpenMP developers can discuss, modify, and debug LLVM's
extended OpenMP implementation and test suite without directly
considering OpenACC's language and execution model, which can be
handled by LLVM's OpenACC developers.
* OpenMP users might find the `ompx_hold` modifier useful, as in the
above example.
See new documentation introduced by this patch in `openmp/docs` for
more detail on the functionality of this extension and its
relationship with OpenACC. For example, it explains how the runtime
must support two reference counts, as specified by OpenACC.
Clang recognizes `ompx_hold` unless `-fno-openmp-extensions`, a new
command-line option introduced by this patch, is specified.
Reviewed By: ABataev, jdoerfert, protze.joachim, grokos
Differential Revision: https://reviews.llvm.org/D106509
2021-08-31 15:17:07 -04:00
|
|
|
const LangOptions &LangOpts) {
|
2013-07-19 03:13:43 +00:00
|
|
|
switch (Kind) {
|
|
|
|
case OMPC_default:
|
2020-02-14 21:45:49 -06:00
|
|
|
return llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OMP_DEFAULT_KIND(Enum, Name) .Case(Name, unsigned(Enum))
|
|
|
|
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
|
|
|
.Default(unsigned(llvm::omp::OMP_DEFAULT_unknown));
|
2014-05-06 06:04:14 +00:00
|
|
|
case OMPC_proc_bind:
|
2019-12-25 18:15:36 -06:00
|
|
|
return llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OMP_PROC_BIND_KIND(Enum, Name, Value) .Case(Name, Value)
|
|
|
|
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
|
|
|
.Default(unsigned(llvm::omp::OMP_PROC_BIND_unknown));
|
2014-06-20 07:16:17 +00:00
|
|
|
case OMPC_schedule:
|
2015-12-28 07:25:51 +00:00
|
|
|
return llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OPENMP_SCHEDULE_KIND(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_##Name))
|
|
|
|
#define OPENMP_SCHEDULE_MODIFIER(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_SCHEDULE_MODIFIER_##Name))
|
2014-06-20 07:16:17 +00:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_SCHEDULE_unknown);
|
2022-02-08 08:33:52 -05:00
|
|
|
case OMPC_depend: {
|
|
|
|
unsigned Type = llvm::StringSwitch<unsigned>(Str)
|
2015-06-23 14:25:19 +00:00
|
|
|
#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
2022-02-08 08:33:52 -05:00
|
|
|
.Default(OMPC_DEPEND_unknown);
|
|
|
|
if (LangOpts.OpenMP < 51 && Type == OMPC_DEPEND_inoutset)
|
|
|
|
return OMPC_DEPEND_unknown;
|
|
|
|
return Type;
|
|
|
|
}
|
2023-06-21 16:26:35 -07:00
|
|
|
case OMPC_doacross:
|
|
|
|
return llvm::StringSwitch<OpenMPDoacrossClauseModifier>(Str)
|
|
|
|
#define OPENMP_DOACROSS_MODIFIER(Name) .Case(#Name, OMPC_DOACROSS_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_DOACROSS_unknown);
|
2015-08-20 10:54:39 +00:00
|
|
|
case OMPC_linear:
|
|
|
|
return llvm::StringSwitch<OpenMPLinearClauseKind>(Str)
|
|
|
|
#define OPENMP_LINEAR_KIND(Name) .Case(#Name, OMPC_LINEAR_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_LINEAR_unknown);
|
2020-07-22 10:14:00 -04:00
|
|
|
case OMPC_map: {
|
|
|
|
unsigned Type = llvm::StringSwitch<unsigned>(Str)
|
2018-12-18 22:18:41 +00:00
|
|
|
#define OPENMP_MAP_KIND(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_MAP_##Name))
|
|
|
|
#define OPENMP_MAP_MODIFIER_KIND(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_MAP_MODIFIER_##Name))
|
2015-11-23 05:32:03 +00:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_MAP_unknown);
|
[OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2)
This patch implements Clang support for an original OpenMP extension
we have developed to support OpenACC: the `ompx_hold` map type
modifier. The next patch in this series, D106510, implements OpenMP
runtime support.
Consider the following example:
```
#pragma omp target data map(ompx_hold, tofrom: x) // holds onto mapping of x
{
foo(); // might have map(delete: x)
#pragma omp target map(present, alloc: x) // x is guaranteed to be present
printf("%d\n", x);
}
```
The `ompx_hold` map type modifier above specifies that the `target
data` directive holds onto the mapping for `x` throughout the
associated region regardless of any `target exit data` directives
executed during the call to `foo`. Thus, the presence assertion for
`x` at the enclosed `target` construct cannot fail. (As usual, the
standard OpenMP reference count for `x` must also reach zero before
the data is unmapped.)
Justification for inclusion in Clang and LLVM's OpenMP runtime:
* The `ompx_hold` modifier supports OpenACC functionality (structured
reference count) that cannot be achieved in standard OpenMP, as of
5.1.
* The runtime implementation for `ompx_hold` (next patch) will thus be
used by Flang's OpenACC support.
* The Clang implementation for `ompx_hold` (this patch) as well as the
runtime implementation are required for the Clang OpenACC support
being developed as part of the ECP Clacc project, which translates
OpenACC to OpenMP at the directive AST level. These patches are the
first step in upstreaming OpenACC functionality from Clacc.
* The Clang implementation for `ompx_hold` is also used by the tests
in the runtime implementation. That syntactic support makes the
tests more readable than low-level runtime calls can. Moreover,
upstream Flang and Clang do not yet support OpenACC syntax
sufficiently for writing the tests.
* More generally, the Clang implementation enables a clean separation
of concerns between OpenACC and OpenMP development in LLVM. That
is, LLVM's OpenMP developers can discuss, modify, and debug LLVM's
extended OpenMP implementation and test suite without directly
considering OpenACC's language and execution model, which can be
handled by LLVM's OpenACC developers.
* OpenMP users might find the `ompx_hold` modifier useful, as in the
above example.
See new documentation introduced by this patch in `openmp/docs` for
more detail on the functionality of this extension and its
relationship with OpenACC. For example, it explains how the runtime
must support two reference counts, as specified by OpenACC.
Clang recognizes `ompx_hold` unless `-fno-openmp-extensions`, a new
command-line option introduced by this patch, is specified.
Reviewed By: ABataev, jdoerfert, protze.joachim, grokos
Differential Revision: https://reviews.llvm.org/D106509
2021-08-31 15:17:07 -04:00
|
|
|
if (LangOpts.OpenMP < 51 && Type == OMPC_MAP_MODIFIER_present)
|
|
|
|
return OMPC_MAP_MODIFIER_unknown;
|
|
|
|
if (!LangOpts.OpenMPExtensions && Type == OMPC_MAP_MODIFIER_ompx_hold)
|
2020-07-22 10:14:00 -04:00
|
|
|
return OMPC_MAP_MODIFIER_unknown;
|
|
|
|
return Type;
|
|
|
|
}
|
2019-02-22 22:29:42 +00:00
|
|
|
case OMPC_to:
|
2020-07-29 12:18:45 -04:00
|
|
|
case OMPC_from: {
|
|
|
|
unsigned Type = llvm::StringSwitch<unsigned>(Str)
|
2020-07-28 18:06:05 -04:00
|
|
|
#define OPENMP_MOTION_MODIFIER_KIND(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_MOTION_MODIFIER_##Name))
|
2019-02-25 20:34:15 +00:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
2020-07-28 18:06:05 -04:00
|
|
|
.Default(OMPC_MOTION_MODIFIER_unknown);
|
[OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2)
This patch implements Clang support for an original OpenMP extension
we have developed to support OpenACC: the `ompx_hold` map type
modifier. The next patch in this series, D106510, implements OpenMP
runtime support.
Consider the following example:
```
#pragma omp target data map(ompx_hold, tofrom: x) // holds onto mapping of x
{
foo(); // might have map(delete: x)
#pragma omp target map(present, alloc: x) // x is guaranteed to be present
printf("%d\n", x);
}
```
The `ompx_hold` map type modifier above specifies that the `target
data` directive holds onto the mapping for `x` throughout the
associated region regardless of any `target exit data` directives
executed during the call to `foo`. Thus, the presence assertion for
`x` at the enclosed `target` construct cannot fail. (As usual, the
standard OpenMP reference count for `x` must also reach zero before
the data is unmapped.)
Justification for inclusion in Clang and LLVM's OpenMP runtime:
* The `ompx_hold` modifier supports OpenACC functionality (structured
reference count) that cannot be achieved in standard OpenMP, as of
5.1.
* The runtime implementation for `ompx_hold` (next patch) will thus be
used by Flang's OpenACC support.
* The Clang implementation for `ompx_hold` (this patch) as well as the
runtime implementation are required for the Clang OpenACC support
being developed as part of the ECP Clacc project, which translates
OpenACC to OpenMP at the directive AST level. These patches are the
first step in upstreaming OpenACC functionality from Clacc.
* The Clang implementation for `ompx_hold` is also used by the tests
in the runtime implementation. That syntactic support makes the
tests more readable than low-level runtime calls can. Moreover,
upstream Flang and Clang do not yet support OpenACC syntax
sufficiently for writing the tests.
* More generally, the Clang implementation enables a clean separation
of concerns between OpenACC and OpenMP development in LLVM. That
is, LLVM's OpenMP developers can discuss, modify, and debug LLVM's
extended OpenMP implementation and test suite without directly
considering OpenACC's language and execution model, which can be
handled by LLVM's OpenACC developers.
* OpenMP users might find the `ompx_hold` modifier useful, as in the
above example.
See new documentation introduced by this patch in `openmp/docs` for
more detail on the functionality of this extension and its
relationship with OpenACC. For example, it explains how the runtime
must support two reference counts, as specified by OpenACC.
Clang recognizes `ompx_hold` unless `-fno-openmp-extensions`, a new
command-line option introduced by this patch, is specified.
Reviewed By: ABataev, jdoerfert, protze.joachim, grokos
Differential Revision: https://reviews.llvm.org/D106509
2021-08-31 15:17:07 -04:00
|
|
|
if (LangOpts.OpenMP < 51 && Type == OMPC_MOTION_MODIFIER_present)
|
2020-07-29 12:18:45 -04:00
|
|
|
return OMPC_MOTION_MODIFIER_unknown;
|
|
|
|
return Type;
|
|
|
|
}
|
2016-01-15 18:50:31 +00:00
|
|
|
case OMPC_dist_schedule:
|
|
|
|
return llvm::StringSwitch<OpenMPDistScheduleClauseKind>(Str)
|
|
|
|
#define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_DIST_SCHEDULE_unknown);
|
2016-01-26 16:37:23 +00:00
|
|
|
case OMPC_defaultmap:
|
|
|
|
return llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OPENMP_DEFAULTMAP_KIND(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_##Name))
|
|
|
|
#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_DEFAULTMAP_unknown);
|
2018-11-02 12:18:11 +00:00
|
|
|
case OMPC_atomic_default_mem_order:
|
|
|
|
return llvm::StringSwitch<OpenMPAtomicDefaultMemOrderClauseKind>(Str)
|
|
|
|
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
|
|
|
|
.Case(#Name, OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown);
|
2019-08-23 16:11:14 +00:00
|
|
|
case OMPC_device_type:
|
|
|
|
return llvm::StringSwitch<OpenMPDeviceType>(Str)
|
|
|
|
#define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_DEVICE_TYPE_unknown);
|
2022-11-10 18:12:35 -08:00
|
|
|
case OMPC_at:
|
|
|
|
return llvm::StringSwitch<OpenMPAtClauseKind>(Str)
|
|
|
|
#define OPENMP_AT_KIND(Name) .Case(#Name, OMPC_AT_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_AT_unknown);
|
2022-11-16 13:29:14 -08:00
|
|
|
case OMPC_severity:
|
|
|
|
return llvm::StringSwitch<OpenMPSeverityClauseKind>(Str)
|
|
|
|
#define OPENMP_SEVERITY_KIND(Name) .Case(#Name, OMPC_SEVERITY_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_SEVERITY_unknown);
|
2019-12-20 11:04:57 -05:00
|
|
|
case OMPC_lastprivate:
|
|
|
|
return llvm::StringSwitch<OpenMPLastprivateModifier>(Str)
|
|
|
|
#define OPENMP_LASTPRIVATE_KIND(Name) .Case(#Name, OMPC_LASTPRIVATE_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_LASTPRIVATE_unknown);
|
2020-01-31 16:09:26 -05:00
|
|
|
case OMPC_order:
|
2022-12-12 15:51:38 -06:00
|
|
|
return llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OPENMP_ORDER_KIND(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_ORDER_##Name))
|
|
|
|
#define OPENMP_ORDER_MODIFIER(Name) \
|
|
|
|
.Case(#Name, static_cast<unsigned>(OMPC_ORDER_MODIFIER_##Name))
|
2020-01-31 16:09:26 -05:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_ORDER_unknown);
|
2020-03-03 13:22:35 -05:00
|
|
|
case OMPC_update:
|
|
|
|
return llvm::StringSwitch<OpenMPDependClauseKind>(Str)
|
|
|
|
#define OPENMP_DEPEND_KIND(Name) .Case(#Name, OMPC_DEPEND_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_DEPEND_unknown);
|
2020-03-18 15:01:15 -04:00
|
|
|
case OMPC_device:
|
|
|
|
return llvm::StringSwitch<OpenMPDeviceClauseModifier>(Str)
|
|
|
|
#define OPENMP_DEVICE_MODIFIER(Name) .Case(#Name, OMPC_DEVICE_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_DEVICE_unknown);
|
2020-03-23 17:30:38 -04:00
|
|
|
case OMPC_reduction:
|
|
|
|
return llvm::StringSwitch<OpenMPReductionClauseModifier>(Str)
|
|
|
|
#define OPENMP_REDUCTION_MODIFIER(Name) .Case(#Name, OMPC_REDUCTION_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_REDUCTION_unknown);
|
2021-10-12 14:55:00 -07:00
|
|
|
case OMPC_adjust_args:
|
|
|
|
return llvm::StringSwitch<OpenMPAdjustArgsOpKind>(Str)
|
|
|
|
#define OPENMP_ADJUST_ARGS_KIND(Name) .Case(#Name, OMPC_ADJUST_ARGS_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_ADJUST_ARGS_unknown);
|
2021-11-03 14:57:01 -07:00
|
|
|
case OMPC_bind:
|
|
|
|
return llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OPENMP_BIND_KIND(Name) .Case(#Name, OMPC_BIND_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_BIND_unknown);
|
2022-11-17 16:20:14 -08:00
|
|
|
case OMPC_grainsize: {
|
|
|
|
unsigned Type = llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OPENMP_GRAINSIZE_MODIFIER(Name) .Case(#Name, OMPC_GRAINSIZE_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_GRAINSIZE_unknown);
|
|
|
|
if (LangOpts.OpenMP < 51)
|
|
|
|
return OMPC_GRAINSIZE_unknown;
|
|
|
|
return Type;
|
|
|
|
}
|
2022-11-18 15:21:49 -08:00
|
|
|
case OMPC_num_tasks: {
|
|
|
|
unsigned Type = llvm::StringSwitch<unsigned>(Str)
|
|
|
|
#define OPENMP_NUMTASKS_MODIFIER(Name) .Case(#Name, OMPC_NUMTASKS_##Name)
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
.Default(OMPC_NUMTASKS_unknown);
|
|
|
|
if (LangOpts.OpenMP < 51)
|
|
|
|
return OMPC_NUMTASKS_unknown;
|
|
|
|
return Type;
|
|
|
|
}
|
2013-07-19 03:13:43 +00:00
|
|
|
case OMPC_unknown:
|
|
|
|
case OMPC_threadprivate:
|
2014-02-13 05:29:23 +00:00
|
|
|
case OMPC_if:
|
2014-07-17 07:32:53 +00:00
|
|
|
case OMPC_final:
|
2014-03-06 06:15:19 +00:00
|
|
|
case OMPC_num_threads:
|
2014-03-21 04:51:18 +00:00
|
|
|
case OMPC_safelen:
|
2015-08-21 11:14:16 +00:00
|
|
|
case OMPC_simdlen:
|
2021-02-12 11:26:59 -08:00
|
|
|
case OMPC_sizes:
|
2019-03-12 18:52:33 +00:00
|
|
|
case OMPC_allocator:
|
2019-03-27 14:14:31 +00:00
|
|
|
case OMPC_allocate:
|
2014-05-27 15:12:19 +00:00
|
|
|
case OMPC_collapse:
|
2013-07-19 03:13:43 +00:00
|
|
|
case OMPC_private:
|
2013-10-01 05:32:34 +00:00
|
|
|
case OMPC_firstprivate:
|
2013-09-06 20:58:25 +00:00
|
|
|
case OMPC_shared:
|
2017-07-18 20:17:46 +00:00
|
|
|
case OMPC_task_reduction:
|
2017-07-21 18:48:21 +00:00
|
|
|
case OMPC_in_reduction:
|
2014-05-29 14:36:25 +00:00
|
|
|
case OMPC_aligned:
|
2014-03-31 03:36:38 +00:00
|
|
|
case OMPC_copyin:
|
2014-06-27 10:37:06 +00:00
|
|
|
case OMPC_copyprivate:
|
2014-06-20 09:44:06 +00:00
|
|
|
case OMPC_ordered:
|
2014-06-20 11:19:47 +00:00
|
|
|
case OMPC_nowait:
|
2014-07-17 12:19:31 +00:00
|
|
|
case OMPC_untied:
|
2014-07-17 12:47:03 +00:00
|
|
|
case OMPC_mergeable:
|
2014-07-21 11:26:11 +00:00
|
|
|
case OMPC_flush:
|
2020-02-28 09:52:15 -05:00
|
|
|
case OMPC_depobj:
|
2014-07-23 02:27:21 +00:00
|
|
|
case OMPC_read:
|
2014-07-23 07:46:59 +00:00
|
|
|
case OMPC_write:
|
2014-07-24 06:46:57 +00:00
|
|
|
case OMPC_capture:
|
2021-12-24 08:16:33 -05:00
|
|
|
case OMPC_compare:
|
2014-07-24 08:55:34 +00:00
|
|
|
case OMPC_seq_cst:
|
2020-02-06 16:30:23 -05:00
|
|
|
case OMPC_acq_rel:
|
2020-02-10 14:30:39 -05:00
|
|
|
case OMPC_acquire:
|
2020-02-10 15:49:05 -05:00
|
|
|
case OMPC_release:
|
2020-02-11 11:10:43 -05:00
|
|
|
case OMPC_relaxed:
|
2015-09-25 10:37:12 +00:00
|
|
|
case OMPC_threads:
|
2015-09-28 06:39:35 +00:00
|
|
|
case OMPC_simd:
|
2015-11-24 20:50:12 +00:00
|
|
|
case OMPC_num_teams:
|
2015-11-27 18:47:36 +00:00
|
|
|
case OMPC_thread_limit:
|
2015-12-01 10:17:31 +00:00
|
|
|
case OMPC_priority:
|
2015-12-07 10:51:44 +00:00
|
|
|
case OMPC_nogroup:
|
2015-12-15 08:19:24 +00:00
|
|
|
case OMPC_hint:
|
2016-04-12 05:28:34 +00:00
|
|
|
case OMPC_uniform:
|
2016-07-13 15:37:16 +00:00
|
|
|
case OMPC_use_device_ptr:
|
2020-05-21 08:30:23 -04:00
|
|
|
case OMPC_use_device_addr:
|
2016-07-13 17:16:49 +00:00
|
|
|
case OMPC_is_device_ptr:
|
2022-04-06 20:30:44 -07:00
|
|
|
case OMPC_has_device_addr:
|
2018-09-26 04:28:39 +00:00
|
|
|
case OMPC_unified_address:
|
2018-10-01 13:47:43 +00:00
|
|
|
case OMPC_unified_shared_memory:
|
2018-10-03 20:07:58 +00:00
|
|
|
case OMPC_reverse_offload:
|
2018-10-11 14:41:10 +00:00
|
|
|
case OMPC_dynamic_allocators:
|
2019-09-23 18:13:31 +00:00
|
|
|
case OMPC_match:
|
2019-12-16 15:54:17 -05:00
|
|
|
case OMPC_nontemporal:
|
2020-03-02 14:21:20 -05:00
|
|
|
case OMPC_destroy:
|
2021-03-31 12:26:47 -07:00
|
|
|
case OMPC_novariants:
|
2021-04-03 11:09:25 -07:00
|
|
|
case OMPC_nocontext:
|
2020-03-17 09:17:42 -04:00
|
|
|
case OMPC_detach:
|
2020-03-20 09:41:22 -04:00
|
|
|
case OMPC_inclusive:
|
2020-03-23 10:41:08 -04:00
|
|
|
case OMPC_exclusive:
|
2020-04-21 13:21:00 -04:00
|
|
|
case OMPC_uses_allocators:
|
2020-05-18 13:37:53 -04:00
|
|
|
case OMPC_affinity:
|
2021-09-17 16:03:01 -05:00
|
|
|
case OMPC_when:
|
2021-10-14 14:28:51 -07:00
|
|
|
case OMPC_append_args:
|
2013-07-19 03:13:43 +00:00
|
|
|
break;
|
[flang][openmp] Use common Directive and Clause enum from llvm/Frontend
Summary:
This patch is removing the custom enumeration for OpenMP Directives and Clauses and replace them
with the newly tablegen generated one from llvm/Frontend. This is a first patch and some will follow to share the same
infrastructure where possible. The next patch should use the clauses allowance defined in the tablegen file.
Reviewers: jdoerfert, DavidTruby, sscalpone, kiranchandramohan, ichoyjx
Reviewed By: DavidTruby, ichoyjx
Subscribers: jholewinski, cfe-commits, dblaikie, MaskRay, ymandel, ichoyjx, mgorny, yaxunl, guansong, jfb, sstefan1, aaron.ballman, llvm-commits
Tags: #llvm, #flang, #clang
Differential Revision: https://reviews.llvm.org/D82906
2020-07-01 20:57:11 -04:00
|
|
|
default:
|
|
|
|
break;
|
2013-07-19 03:13:43 +00:00
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP simple clause kind");
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
|
|
|
|
unsigned Type) {
|
|
|
|
switch (Kind) {
|
|
|
|
case OMPC_default:
|
2020-02-14 21:45:49 -06:00
|
|
|
switch (llvm::omp::DefaultKind(Type)) {
|
|
|
|
#define OMP_DEFAULT_KIND(Enum, Name) \
|
|
|
|
case Enum: \
|
|
|
|
return Name;
|
|
|
|
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
2013-07-19 03:13:43 +00:00
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'default' clause type");
|
2014-05-06 06:04:14 +00:00
|
|
|
case OMPC_proc_bind:
|
|
|
|
switch (Type) {
|
2019-12-25 18:15:36 -06:00
|
|
|
#define OMP_PROC_BIND_KIND(Enum, Name, Value) \
|
|
|
|
case Value: \
|
|
|
|
return Name;
|
|
|
|
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
2014-05-06 06:04:14 +00:00
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'proc_bind' clause type");
|
2014-06-20 07:16:17 +00:00
|
|
|
case OMPC_schedule:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_SCHEDULE_unknown:
|
2015-12-28 07:25:51 +00:00
|
|
|
case OMPC_SCHEDULE_MODIFIER_last:
|
2014-06-20 07:16:17 +00:00
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_SCHEDULE_KIND(Name) \
|
2015-12-28 07:25:51 +00:00
|
|
|
case OMPC_SCHEDULE_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#define OPENMP_SCHEDULE_MODIFIER(Name) \
|
|
|
|
case OMPC_SCHEDULE_MODIFIER_##Name: \
|
|
|
|
return #Name;
|
2015-06-23 14:25:19 +00:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
2015-12-28 07:25:51 +00:00
|
|
|
llvm_unreachable("Invalid OpenMP 'schedule' clause type");
|
2015-06-23 14:25:19 +00:00
|
|
|
case OMPC_depend:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_DEPEND_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_DEPEND_KIND(Name) \
|
|
|
|
case OMPC_DEPEND_##Name: \
|
|
|
|
return #Name;
|
2014-06-20 07:16:17 +00:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
2015-12-28 07:25:51 +00:00
|
|
|
llvm_unreachable("Invalid OpenMP 'depend' clause type");
|
2023-06-21 16:26:35 -07:00
|
|
|
case OMPC_doacross:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_DOACROSS_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_DOACROSS_MODIFIER(Name) \
|
|
|
|
case OMPC_DOACROSS_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'doacross' clause type");
|
2015-08-20 10:54:39 +00:00
|
|
|
case OMPC_linear:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_LINEAR_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_LINEAR_KIND(Name) \
|
|
|
|
case OMPC_LINEAR_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'linear' clause type");
|
2015-11-23 05:32:03 +00:00
|
|
|
case OMPC_map:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_MAP_unknown:
|
2018-12-18 22:18:41 +00:00
|
|
|
case OMPC_MAP_MODIFIER_last:
|
2015-11-23 05:32:03 +00:00
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_MAP_KIND(Name) \
|
|
|
|
case OMPC_MAP_##Name: \
|
|
|
|
return #Name;
|
2018-12-18 22:18:41 +00:00
|
|
|
#define OPENMP_MAP_MODIFIER_KIND(Name) \
|
|
|
|
case OMPC_MAP_MODIFIER_##Name: \
|
|
|
|
return #Name;
|
2015-11-23 05:32:03 +00:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'map' clause type");
|
2019-02-22 22:29:42 +00:00
|
|
|
case OMPC_to:
|
2019-02-25 20:34:15 +00:00
|
|
|
case OMPC_from:
|
|
|
|
switch (Type) {
|
2020-07-28 18:06:05 -04:00
|
|
|
case OMPC_MOTION_MODIFIER_unknown:
|
2019-02-25 20:34:15 +00:00
|
|
|
return "unknown";
|
2020-07-28 18:06:05 -04:00
|
|
|
#define OPENMP_MOTION_MODIFIER_KIND(Name) \
|
|
|
|
case OMPC_MOTION_MODIFIER_##Name: \
|
2019-02-25 20:34:15 +00:00
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2020-07-28 18:06:05 -04:00
|
|
|
llvm_unreachable("Invalid OpenMP 'to' or 'from' clause type");
|
2016-01-15 18:50:31 +00:00
|
|
|
case OMPC_dist_schedule:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_DIST_SCHEDULE_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_DIST_SCHEDULE_KIND(Name) \
|
|
|
|
case OMPC_DIST_SCHEDULE_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'dist_schedule' clause type");
|
2016-01-26 16:37:23 +00:00
|
|
|
case OMPC_defaultmap:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_DEFAULTMAP_unknown:
|
|
|
|
case OMPC_DEFAULTMAP_MODIFIER_last:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_DEFAULTMAP_KIND(Name) \
|
|
|
|
case OMPC_DEFAULTMAP_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
|
|
|
|
case OMPC_DEFAULTMAP_MODIFIER_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'schedule' clause type");
|
2018-11-02 12:18:11 +00:00
|
|
|
case OMPC_atomic_default_mem_order:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
|
|
|
|
case OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'atomic_default_mem_order' clause type");
|
2019-08-23 16:11:14 +00:00
|
|
|
case OMPC_device_type:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_DEVICE_TYPE_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_DEVICE_TYPE_KIND(Name) \
|
|
|
|
case OMPC_DEVICE_TYPE_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'device_type' clause type");
|
2022-11-10 18:12:35 -08:00
|
|
|
case OMPC_at:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_AT_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_AT_KIND(Name) \
|
|
|
|
case OMPC_AT_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'at' clause type");
|
2022-11-16 13:29:14 -08:00
|
|
|
case OMPC_severity:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_SEVERITY_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_SEVERITY_KIND(Name) \
|
|
|
|
case OMPC_SEVERITY_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'severity' clause type");
|
2019-12-20 11:04:57 -05:00
|
|
|
case OMPC_lastprivate:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_LASTPRIVATE_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_LASTPRIVATE_KIND(Name) \
|
|
|
|
case OMPC_LASTPRIVATE_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'lastprivate' clause type");
|
2020-01-31 16:09:26 -05:00
|
|
|
case OMPC_order:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_ORDER_unknown:
|
2022-12-12 15:51:38 -06:00
|
|
|
case OMPC_ORDER_MODIFIER_last:
|
2020-01-31 16:09:26 -05:00
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_ORDER_KIND(Name) \
|
2022-12-12 15:51:38 -06:00
|
|
|
case OMPC_ORDER_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#define OPENMP_ORDER_MODIFIER(Name) \
|
|
|
|
case OMPC_ORDER_MODIFIER_##Name: \
|
|
|
|
return #Name;
|
2020-01-31 16:09:26 -05:00
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'order' clause type");
|
2020-03-03 13:22:35 -05:00
|
|
|
case OMPC_update:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_DEPEND_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_DEPEND_KIND(Name) \
|
|
|
|
case OMPC_DEPEND_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'depend' clause type");
|
2020-03-18 15:01:15 -04:00
|
|
|
case OMPC_device:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_DEVICE_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_DEVICE_MODIFIER(Name) \
|
|
|
|
case OMPC_DEVICE_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'device' clause modifier");
|
2020-03-23 17:30:38 -04:00
|
|
|
case OMPC_reduction:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_REDUCTION_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_REDUCTION_MODIFIER(Name) \
|
|
|
|
case OMPC_REDUCTION_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'reduction' clause modifier");
|
2021-10-12 14:55:00 -07:00
|
|
|
case OMPC_adjust_args:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_ADJUST_ARGS_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_ADJUST_ARGS_KIND(Name) \
|
|
|
|
case OMPC_ADJUST_ARGS_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'adjust_args' clause kind");
|
2021-11-03 14:57:01 -07:00
|
|
|
case OMPC_bind:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_BIND_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_BIND_KIND(Name) \
|
|
|
|
case OMPC_BIND_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'bind' clause type");
|
2022-11-17 16:20:14 -08:00
|
|
|
case OMPC_grainsize:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_GRAINSIZE_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_GRAINSIZE_MODIFIER(Name) \
|
|
|
|
case OMPC_GRAINSIZE_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'grainsize' clause modifier");
|
2022-11-18 15:21:49 -08:00
|
|
|
case OMPC_num_tasks:
|
|
|
|
switch (Type) {
|
|
|
|
case OMPC_NUMTASKS_unknown:
|
|
|
|
return "unknown";
|
|
|
|
#define OPENMP_NUMTASKS_MODIFIER(Name) \
|
|
|
|
case OMPC_NUMTASKS_##Name: \
|
|
|
|
return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP 'num_tasks' clause modifier");
|
2013-07-19 03:13:43 +00:00
|
|
|
case OMPC_unknown:
|
|
|
|
case OMPC_threadprivate:
|
2014-02-13 05:29:23 +00:00
|
|
|
case OMPC_if:
|
2014-07-17 07:32:53 +00:00
|
|
|
case OMPC_final:
|
2014-03-06 06:15:19 +00:00
|
|
|
case OMPC_num_threads:
|
2014-03-21 04:51:18 +00:00
|
|
|
case OMPC_safelen:
|
2015-08-21 11:14:16 +00:00
|
|
|
case OMPC_simdlen:
|
2021-02-12 11:26:59 -08:00
|
|
|
case OMPC_sizes:
|
2019-03-12 18:52:33 +00:00
|
|
|
case OMPC_allocator:
|
2019-03-27 14:14:31 +00:00
|
|
|
case OMPC_allocate:
|
2014-05-27 15:12:19 +00:00
|
|
|
case OMPC_collapse:
|
2013-07-19 03:13:43 +00:00
|
|
|
case OMPC_private:
|
2013-10-01 05:32:34 +00:00
|
|
|
case OMPC_firstprivate:
|
2013-09-06 20:58:25 +00:00
|
|
|
case OMPC_shared:
|
2017-07-18 20:17:46 +00:00
|
|
|
case OMPC_task_reduction:
|
2017-07-21 18:48:21 +00:00
|
|
|
case OMPC_in_reduction:
|
2014-05-29 14:36:25 +00:00
|
|
|
case OMPC_aligned:
|
2014-03-31 03:36:38 +00:00
|
|
|
case OMPC_copyin:
|
2014-06-27 10:37:06 +00:00
|
|
|
case OMPC_copyprivate:
|
2014-06-20 09:44:06 +00:00
|
|
|
case OMPC_ordered:
|
2014-06-20 11:19:47 +00:00
|
|
|
case OMPC_nowait:
|
2014-07-17 12:19:31 +00:00
|
|
|
case OMPC_untied:
|
2014-07-17 12:47:03 +00:00
|
|
|
case OMPC_mergeable:
|
2014-07-21 11:26:11 +00:00
|
|
|
case OMPC_flush:
|
2020-02-28 09:52:15 -05:00
|
|
|
case OMPC_depobj:
|
2014-07-23 02:27:21 +00:00
|
|
|
case OMPC_read:
|
2014-07-23 07:46:59 +00:00
|
|
|
case OMPC_write:
|
2014-07-24 06:46:57 +00:00
|
|
|
case OMPC_capture:
|
2021-12-24 08:16:33 -05:00
|
|
|
case OMPC_compare:
|
2014-07-24 08:55:34 +00:00
|
|
|
case OMPC_seq_cst:
|
2020-02-06 16:30:23 -05:00
|
|
|
case OMPC_acq_rel:
|
2020-02-10 14:30:39 -05:00
|
|
|
case OMPC_acquire:
|
2020-02-10 15:49:05 -05:00
|
|
|
case OMPC_release:
|
2020-02-11 11:10:43 -05:00
|
|
|
case OMPC_relaxed:
|
2015-09-25 10:37:12 +00:00
|
|
|
case OMPC_threads:
|
2015-09-28 06:39:35 +00:00
|
|
|
case OMPC_simd:
|
2015-11-24 20:50:12 +00:00
|
|
|
case OMPC_num_teams:
|
2015-11-27 18:47:36 +00:00
|
|
|
case OMPC_thread_limit:
|
2015-12-01 10:17:31 +00:00
|
|
|
case OMPC_priority:
|
2015-12-07 10:51:44 +00:00
|
|
|
case OMPC_nogroup:
|
2015-12-15 08:19:24 +00:00
|
|
|
case OMPC_hint:
|
2016-04-12 05:28:34 +00:00
|
|
|
case OMPC_uniform:
|
2016-07-13 15:37:16 +00:00
|
|
|
case OMPC_use_device_ptr:
|
2020-05-21 08:30:23 -04:00
|
|
|
case OMPC_use_device_addr:
|
2016-07-13 17:16:49 +00:00
|
|
|
case OMPC_is_device_ptr:
|
2022-04-06 20:30:44 -07:00
|
|
|
case OMPC_has_device_addr:
|
2018-09-26 04:28:39 +00:00
|
|
|
case OMPC_unified_address:
|
2018-10-01 13:47:43 +00:00
|
|
|
case OMPC_unified_shared_memory:
|
2018-10-03 20:07:58 +00:00
|
|
|
case OMPC_reverse_offload:
|
2018-10-11 14:41:10 +00:00
|
|
|
case OMPC_dynamic_allocators:
|
2019-09-23 18:13:31 +00:00
|
|
|
case OMPC_match:
|
2019-12-16 15:54:17 -05:00
|
|
|
case OMPC_nontemporal:
|
2020-03-02 14:21:20 -05:00
|
|
|
case OMPC_destroy:
|
2020-03-17 09:17:42 -04:00
|
|
|
case OMPC_detach:
|
2021-03-31 12:26:47 -07:00
|
|
|
case OMPC_novariants:
|
2021-04-03 11:09:25 -07:00
|
|
|
case OMPC_nocontext:
|
2020-03-20 09:41:22 -04:00
|
|
|
case OMPC_inclusive:
|
2020-03-23 10:41:08 -04:00
|
|
|
case OMPC_exclusive:
|
2020-04-21 13:21:00 -04:00
|
|
|
case OMPC_uses_allocators:
|
2020-05-18 13:37:53 -04:00
|
|
|
case OMPC_affinity:
|
2021-09-17 16:03:01 -05:00
|
|
|
case OMPC_when:
|
2021-10-14 14:28:51 -07:00
|
|
|
case OMPC_append_args:
|
2013-07-19 03:13:43 +00:00
|
|
|
break;
|
[flang][openmp] Use common Directive and Clause enum from llvm/Frontend
Summary:
This patch is removing the custom enumeration for OpenMP Directives and Clauses and replace them
with the newly tablegen generated one from llvm/Frontend. This is a first patch and some will follow to share the same
infrastructure where possible. The next patch should use the clauses allowance defined in the tablegen file.
Reviewers: jdoerfert, DavidTruby, sscalpone, kiranchandramohan, ichoyjx
Reviewed By: DavidTruby, ichoyjx
Subscribers: jholewinski, cfe-commits, dblaikie, MaskRay, ymandel, ichoyjx, mgorny, yaxunl, guansong, jfb, sstefan1, aaron.ballman, llvm-commits
Tags: #llvm, #flang, #clang
Differential Revision: https://reviews.llvm.org/D82906
2020-07-01 20:57:11 -04:00
|
|
|
default:
|
|
|
|
break;
|
2013-07-19 03:13:43 +00:00
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP simple clause kind");
|
|
|
|
}
|
|
|
|
|
2014-06-18 04:14:57 +00:00
|
|
|
bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
|
2014-09-23 09:33:00 +00:00
|
|
|
return DKind == OMPD_simd || DKind == OMPD_for || DKind == OMPD_for_simd ||
|
2015-12-01 04:18:41 +00:00
|
|
|
DKind == OMPD_parallel_for || DKind == OMPD_parallel_for_simd ||
|
2016-02-03 15:46:42 +00:00
|
|
|
DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd ||
|
2019-10-18 16:47:35 +00:00
|
|
|
DKind == OMPD_master_taskloop || DKind == OMPD_master_taskloop_simd ||
|
2019-10-25 10:27:13 -04:00
|
|
|
DKind == OMPD_parallel_master_taskloop ||
|
|
|
|
DKind == OMPD_parallel_master_taskloop_simd ||
|
2022-06-28 14:35:43 -07:00
|
|
|
DKind == OMPD_masked_taskloop || DKind == OMPD_masked_taskloop_simd ||
|
2022-06-30 10:59:33 -07:00
|
|
|
DKind == OMPD_parallel_masked_taskloop || DKind == OMPD_distribute ||
|
2022-06-30 17:08:17 -07:00
|
|
|
DKind == OMPD_parallel_masked_taskloop_simd ||
|
2022-06-30 10:59:33 -07:00
|
|
|
DKind == OMPD_target_parallel_for ||
|
2016-07-05 05:00:15 +00:00
|
|
|
DKind == OMPD_distribute_parallel_for ||
|
2016-07-06 04:45:38 +00:00
|
|
|
DKind == OMPD_distribute_parallel_for_simd ||
|
2016-07-14 02:54:56 +00:00
|
|
|
DKind == OMPD_distribute_simd ||
|
2016-08-05 14:37:37 +00:00
|
|
|
DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
|
2016-11-30 23:51:03 +00:00
|
|
|
DKind == OMPD_teams_distribute ||
|
|
|
|
DKind == OMPD_teams_distribute_simd ||
|
2016-12-09 03:24:30 +00:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for_simd ||
|
2016-12-25 04:52:54 +00:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for ||
|
2016-12-29 22:16:30 +00:00
|
|
|
DKind == OMPD_target_teams_distribute ||
|
2017-01-03 05:23:48 +00:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for ||
|
2017-01-10 18:08:18 +00:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for_simd ||
|
2021-06-10 14:24:17 -05:00
|
|
|
DKind == OMPD_target_teams_distribute_simd || DKind == OMPD_tile ||
|
2022-03-18 11:02:02 -07:00
|
|
|
DKind == OMPD_unroll || DKind == OMPD_loop ||
|
2022-03-22 10:55:21 -07:00
|
|
|
DKind == OMPD_teams_loop || DKind == OMPD_target_teams_loop ||
|
2022-03-23 15:37:06 -07:00
|
|
|
DKind == OMPD_parallel_loop || DKind == OMPD_target_parallel_loop;
|
2014-06-18 04:14:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
|
2014-09-23 09:33:00 +00:00
|
|
|
return DKind == OMPD_for || DKind == OMPD_for_simd ||
|
|
|
|
DKind == OMPD_sections || DKind == OMPD_section ||
|
2014-07-08 08:12:03 +00:00
|
|
|
DKind == OMPD_single || DKind == OMPD_parallel_for ||
|
2016-02-03 15:46:42 +00:00
|
|
|
DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
|
2016-06-27 14:55:37 +00:00
|
|
|
DKind == OMPD_target_parallel_for ||
|
2016-07-05 05:00:15 +00:00
|
|
|
DKind == OMPD_distribute_parallel_for ||
|
2016-07-14 02:54:56 +00:00
|
|
|
DKind == OMPD_distribute_parallel_for_simd ||
|
2016-11-30 23:51:03 +00:00
|
|
|
DKind == OMPD_target_parallel_for_simd ||
|
2016-12-09 03:24:30 +00:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for_simd ||
|
2016-12-29 22:16:30 +00:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for ||
|
2017-01-03 05:23:48 +00:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for ||
|
2023-07-01 19:10:28 -05:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for_simd ||
|
|
|
|
DKind == OMPD_parallel_loop || DKind == OMPD_teams_loop ||
|
|
|
|
DKind == OMPD_target_parallel_loop || DKind == OMPD_target_teams_loop;
|
2014-06-18 04:14:57 +00:00
|
|
|
}
|
|
|
|
|
2015-12-03 09:40:15 +00:00
|
|
|
bool clang::isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind) {
|
2019-10-10 20:13:02 +00:00
|
|
|
return DKind == OMPD_taskloop || DKind == OMPD_taskloop_simd ||
|
2019-10-18 16:47:35 +00:00
|
|
|
DKind == OMPD_master_taskloop || DKind == OMPD_master_taskloop_simd ||
|
2019-10-25 10:27:13 -04:00
|
|
|
DKind == OMPD_parallel_master_taskloop ||
|
2022-06-28 14:35:43 -07:00
|
|
|
DKind == OMPD_masked_taskloop || DKind == OMPD_masked_taskloop_simd ||
|
2022-06-30 10:59:33 -07:00
|
|
|
DKind == OMPD_parallel_masked_taskloop ||
|
2022-06-30 17:08:17 -07:00
|
|
|
DKind == OMPD_parallel_masked_taskloop_simd ||
|
2019-10-25 10:27:13 -04:00
|
|
|
DKind == OMPD_parallel_master_taskloop_simd;
|
2015-12-03 09:40:15 +00:00
|
|
|
}
|
|
|
|
|
2014-06-18 04:14:57 +00:00
|
|
|
bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
|
2014-07-08 08:12:03 +00:00
|
|
|
return DKind == OMPD_parallel || DKind == OMPD_parallel_for ||
|
2016-02-03 15:46:42 +00:00
|
|
|
DKind == OMPD_parallel_for_simd || DKind == OMPD_parallel_sections ||
|
2016-06-27 14:55:37 +00:00
|
|
|
DKind == OMPD_target_parallel || DKind == OMPD_target_parallel_for ||
|
2016-07-05 05:00:15 +00:00
|
|
|
DKind == OMPD_distribute_parallel_for ||
|
2016-07-14 02:54:56 +00:00
|
|
|
DKind == OMPD_distribute_parallel_for_simd ||
|
2016-12-09 03:24:30 +00:00
|
|
|
DKind == OMPD_target_parallel_for_simd ||
|
|
|
|
DKind == OMPD_teams_distribute_parallel_for ||
|
2016-12-29 22:16:30 +00:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for_simd ||
|
2017-01-03 05:23:48 +00:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for ||
|
2019-10-14 17:17:41 +00:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for_simd ||
|
2022-06-16 16:32:30 -07:00
|
|
|
DKind == OMPD_parallel_master || DKind == OMPD_parallel_masked ||
|
2019-10-25 10:27:13 -04:00
|
|
|
DKind == OMPD_parallel_master_taskloop ||
|
2022-03-22 10:55:21 -07:00
|
|
|
DKind == OMPD_parallel_master_taskloop_simd ||
|
2022-06-30 10:59:33 -07:00
|
|
|
DKind == OMPD_parallel_masked_taskloop ||
|
2022-06-30 17:08:17 -07:00
|
|
|
DKind == OMPD_parallel_masked_taskloop_simd ||
|
2023-07-01 19:10:28 -05:00
|
|
|
DKind == OMPD_parallel_loop || DKind == OMPD_target_parallel_loop ||
|
|
|
|
DKind == OMPD_teams_loop;
|
2014-06-18 04:14:57 +00:00
|
|
|
}
|
|
|
|
|
2016-02-02 04:00:47 +00:00
|
|
|
bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) {
|
2016-02-03 15:46:42 +00:00
|
|
|
return DKind == OMPD_target || DKind == OMPD_target_parallel ||
|
2017-11-09 17:32:15 +00:00
|
|
|
DKind == OMPD_target_parallel_for ||
|
2016-12-17 05:48:59 +00:00
|
|
|
DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
|
2016-12-29 22:16:30 +00:00
|
|
|
DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute ||
|
2017-01-03 05:23:48 +00:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for ||
|
2017-01-10 18:08:18 +00:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for_simd ||
|
2022-03-18 11:02:02 -07:00
|
|
|
DKind == OMPD_target_teams_distribute_simd ||
|
2022-03-23 15:37:06 -07:00
|
|
|
DKind == OMPD_target_teams_loop || DKind == OMPD_target_parallel_loop;
|
2016-02-02 04:00:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) {
|
|
|
|
return DKind == OMPD_target_data || DKind == OMPD_target_enter_data ||
|
2016-05-26 17:30:50 +00:00
|
|
|
DKind == OMPD_target_exit_data || DKind == OMPD_target_update;
|
2015-10-02 17:14:03 +00:00
|
|
|
}
|
|
|
|
|
2016-12-17 05:48:59 +00:00
|
|
|
bool clang::isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind) {
|
2016-10-25 12:50:55 +00:00
|
|
|
return DKind == OMPD_teams || DKind == OMPD_teams_distribute ||
|
2016-11-30 23:51:03 +00:00
|
|
|
DKind == OMPD_teams_distribute_simd ||
|
2016-12-09 03:24:30 +00:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for_simd ||
|
2022-03-15 08:35:59 -07:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for ||
|
|
|
|
DKind == OMPD_teams_loop;
|
2016-12-17 05:48:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
|
2022-03-18 11:02:02 -07:00
|
|
|
return isOpenMPNestingTeamsDirective(DKind) || DKind == OMPD_target_teams ||
|
|
|
|
DKind == OMPD_target_teams_distribute ||
|
2017-01-03 05:23:48 +00:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for ||
|
2017-01-10 18:08:18 +00:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for_simd ||
|
2022-03-18 11:02:02 -07:00
|
|
|
DKind == OMPD_target_teams_distribute_simd ||
|
|
|
|
DKind == OMPD_target_teams_loop;
|
2014-10-09 04:18:56 +00:00
|
|
|
}
|
|
|
|
|
2014-06-18 04:14:57 +00:00
|
|
|
bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
|
2014-09-23 09:33:00 +00:00
|
|
|
return DKind == OMPD_simd || DKind == OMPD_for_simd ||
|
2016-07-05 05:00:15 +00:00
|
|
|
DKind == OMPD_parallel_for_simd || DKind == OMPD_taskloop_simd ||
|
2019-10-18 16:47:35 +00:00
|
|
|
DKind == OMPD_master_taskloop_simd ||
|
2022-06-28 14:35:43 -07:00
|
|
|
DKind == OMPD_masked_taskloop_simd ||
|
2019-10-25 10:27:13 -04:00
|
|
|
DKind == OMPD_parallel_master_taskloop_simd ||
|
2022-06-30 17:08:17 -07:00
|
|
|
DKind == OMPD_parallel_masked_taskloop_simd ||
|
2016-07-06 04:45:38 +00:00
|
|
|
DKind == OMPD_distribute_parallel_for_simd ||
|
2016-10-25 12:50:55 +00:00
|
|
|
DKind == OMPD_distribute_simd || DKind == OMPD_target_simd ||
|
2016-11-30 23:51:03 +00:00
|
|
|
DKind == OMPD_teams_distribute_simd ||
|
2017-01-03 05:23:48 +00:00
|
|
|
DKind == OMPD_teams_distribute_parallel_for_simd ||
|
2017-01-10 18:08:18 +00:00
|
|
|
DKind == OMPD_target_teams_distribute_parallel_for_simd ||
|
2017-11-09 17:01:35 +00:00
|
|
|
DKind == OMPD_target_teams_distribute_simd ||
|
|
|
|
DKind == OMPD_target_parallel_for_simd;
|
2014-06-18 04:14:57 +00:00
|
|
|
}
|
|
|
|
|
2016-08-05 14:37:37 +00:00
|
|
|
bool clang::isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind) {
|
2016-07-05 05:00:15 +00:00
|
|
|
return Kind == OMPD_distribute || Kind == OMPD_distribute_parallel_for ||
|
2016-07-06 04:45:38 +00:00
|
|
|
Kind == OMPD_distribute_parallel_for_simd ||
|
|
|
|
Kind == OMPD_distribute_simd;
|
2016-07-05 05:00:15 +00:00
|
|
|
// TODO add next directives.
|
2015-12-14 14:51:25 +00:00
|
|
|
}
|
|
|
|
|
2016-08-05 14:37:37 +00:00
|
|
|
bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) {
|
|
|
|
return isOpenMPNestingDistributeDirective(Kind) ||
|
2016-11-30 23:51:03 +00:00
|
|
|
Kind == OMPD_teams_distribute || Kind == OMPD_teams_distribute_simd ||
|
2016-12-09 03:24:30 +00:00
|
|
|
Kind == OMPD_teams_distribute_parallel_for_simd ||
|
2016-12-25 04:52:54 +00:00
|
|
|
Kind == OMPD_teams_distribute_parallel_for ||
|
2016-12-29 22:16:30 +00:00
|
|
|
Kind == OMPD_target_teams_distribute ||
|
2017-01-03 05:23:48 +00:00
|
|
|
Kind == OMPD_target_teams_distribute_parallel_for ||
|
2017-01-10 18:08:18 +00:00
|
|
|
Kind == OMPD_target_teams_distribute_parallel_for_simd ||
|
|
|
|
Kind == OMPD_target_teams_distribute_simd;
|
2016-08-05 14:37:37 +00:00
|
|
|
}
|
|
|
|
|
2021-10-28 08:10:40 -07:00
|
|
|
bool clang::isOpenMPGenericLoopDirective(OpenMPDirectiveKind Kind) {
|
2022-03-18 11:02:02 -07:00
|
|
|
return Kind == OMPD_loop || Kind == OMPD_teams_loop ||
|
2022-03-23 15:37:06 -07:00
|
|
|
Kind == OMPD_target_teams_loop || Kind == OMPD_parallel_loop ||
|
|
|
|
Kind == OMPD_target_parallel_loop;
|
2021-10-28 08:10:40 -07:00
|
|
|
}
|
|
|
|
|
2014-06-18 04:14:57 +00:00
|
|
|
bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
|
|
|
|
return Kind == OMPC_private || Kind == OMPC_firstprivate ||
|
|
|
|
Kind == OMPC_lastprivate || Kind == OMPC_linear ||
|
2017-07-21 18:48:21 +00:00
|
|
|
Kind == OMPC_reduction || Kind == OMPC_task_reduction ||
|
|
|
|
Kind == OMPC_in_reduction; // TODO add next clauses like 'reduction'.
|
2014-06-18 04:14:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool clang::isOpenMPThreadPrivate(OpenMPClauseKind Kind) {
|
2015-04-16 05:39:01 +00:00
|
|
|
return Kind == OMPC_threadprivate || Kind == OMPC_copyin;
|
2014-06-18 04:14:57 +00:00
|
|
|
}
|
|
|
|
|
2016-04-13 13:36:48 +00:00
|
|
|
bool clang::isOpenMPTaskingDirective(OpenMPDirectiveKind Kind) {
|
|
|
|
return Kind == OMPD_task || isOpenMPTaskLoopDirective(Kind);
|
|
|
|
}
|
2016-06-27 14:55:37 +00:00
|
|
|
|
|
|
|
bool clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) {
|
2016-07-05 05:00:15 +00:00
|
|
|
return Kind == OMPD_distribute_parallel_for ||
|
2016-07-06 04:45:38 +00:00
|
|
|
Kind == OMPD_distribute_parallel_for_simd ||
|
2016-12-09 03:24:30 +00:00
|
|
|
Kind == OMPD_teams_distribute_parallel_for_simd ||
|
2016-12-25 04:52:54 +00:00
|
|
|
Kind == OMPD_teams_distribute_parallel_for ||
|
2017-01-03 05:23:48 +00:00
|
|
|
Kind == OMPD_target_teams_distribute_parallel_for ||
|
2023-07-01 19:10:28 -05:00
|
|
|
Kind == OMPD_target_teams_distribute_parallel_for_simd ||
|
|
|
|
Kind == OMPD_teams_loop || Kind == OMPD_target_teams_loop;
|
2016-06-27 14:55:37 +00:00
|
|
|
}
|
2017-01-18 18:18:53 +00:00
|
|
|
|
2021-02-12 11:26:59 -08:00
|
|
|
bool clang::isOpenMPLoopTransformationDirective(OpenMPDirectiveKind DKind) {
|
2021-06-10 14:24:17 -05:00
|
|
|
return DKind == OMPD_tile || DKind == OMPD_unroll;
|
2021-02-12 11:26:59 -08:00
|
|
|
}
|
|
|
|
|
2022-12-12 15:51:38 -06:00
|
|
|
bool clang::isOpenMPCombinedParallelADirective(OpenMPDirectiveKind DKind) {
|
|
|
|
return DKind == OMPD_parallel_for || DKind == OMPD_parallel_for_simd ||
|
|
|
|
DKind == OMPD_parallel_master ||
|
|
|
|
DKind == OMPD_parallel_master_taskloop ||
|
|
|
|
DKind == OMPD_parallel_master_taskloop_simd ||
|
|
|
|
DKind == OMPD_parallel_sections;
|
|
|
|
}
|
|
|
|
|
2023-08-26 21:48:07 -05:00
|
|
|
bool clang::needsTaskBasedThreadLimit(OpenMPDirectiveKind DKind) {
|
|
|
|
return DKind == OMPD_target || DKind == OMPD_target_parallel ||
|
|
|
|
DKind == OMPD_target_parallel_for ||
|
|
|
|
DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd ||
|
|
|
|
DKind == OMPD_target_parallel_loop;
|
|
|
|
}
|
|
|
|
|
2017-01-18 18:18:53 +00:00
|
|
|
void clang::getOpenMPCaptureRegions(
|
|
|
|
SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
|
|
|
|
OpenMPDirectiveKind DKind) {
|
2020-06-25 09:17:15 -04:00
|
|
|
assert(unsigned(DKind) < llvm::omp::Directive_enumSize);
|
2017-01-18 18:18:53 +00:00
|
|
|
switch (DKind) {
|
2021-09-17 16:03:01 -05:00
|
|
|
case OMPD_metadirective:
|
|
|
|
CaptureRegions.push_back(OMPD_metadirective);
|
|
|
|
break;
|
2017-01-18 18:18:53 +00:00
|
|
|
case OMPD_parallel:
|
|
|
|
case OMPD_parallel_for:
|
|
|
|
case OMPD_parallel_for_simd:
|
2019-12-05 13:43:48 -05:00
|
|
|
case OMPD_parallel_master:
|
2022-06-16 16:32:30 -07:00
|
|
|
case OMPD_parallel_masked:
|
2017-01-18 18:18:53 +00:00
|
|
|
case OMPD_parallel_sections:
|
2017-02-17 21:29:13 +00:00
|
|
|
case OMPD_distribute_parallel_for:
|
2017-11-27 19:38:52 +00:00
|
|
|
case OMPD_distribute_parallel_for_simd:
|
2022-03-22 10:55:21 -07:00
|
|
|
case OMPD_parallel_loop:
|
2017-01-18 18:18:53 +00:00
|
|
|
CaptureRegions.push_back(OMPD_parallel);
|
|
|
|
break;
|
2017-01-25 01:45:59 +00:00
|
|
|
case OMPD_target_teams:
|
2017-12-08 15:03:50 +00:00
|
|
|
case OMPD_target_teams_distribute:
|
2017-12-13 19:45:06 +00:00
|
|
|
case OMPD_target_teams_distribute_simd:
|
2018-01-15 19:06:12 +00:00
|
|
|
CaptureRegions.push_back(OMPD_task);
|
2017-01-25 02:18:43 +00:00
|
|
|
CaptureRegions.push_back(OMPD_target);
|
|
|
|
CaptureRegions.push_back(OMPD_teams);
|
|
|
|
break;
|
2017-11-28 21:11:44 +00:00
|
|
|
case OMPD_teams:
|
2017-10-04 14:12:09 +00:00
|
|
|
case OMPD_teams_distribute:
|
2017-11-28 21:11:44 +00:00
|
|
|
case OMPD_teams_distribute_simd:
|
2017-10-04 14:12:09 +00:00
|
|
|
CaptureRegions.push_back(OMPD_teams);
|
|
|
|
break;
|
2017-11-28 21:11:44 +00:00
|
|
|
case OMPD_target:
|
2017-11-17 17:57:25 +00:00
|
|
|
case OMPD_target_simd:
|
2018-01-15 19:06:12 +00:00
|
|
|
CaptureRegions.push_back(OMPD_task);
|
2017-11-17 17:57:25 +00:00
|
|
|
CaptureRegions.push_back(OMPD_target);
|
|
|
|
break;
|
2023-07-01 19:10:28 -05:00
|
|
|
case OMPD_teams_loop:
|
2017-11-20 20:46:39 +00:00
|
|
|
case OMPD_teams_distribute_parallel_for:
|
2017-12-04 20:57:19 +00:00
|
|
|
case OMPD_teams_distribute_parallel_for_simd:
|
2017-11-20 20:46:39 +00:00
|
|
|
CaptureRegions.push_back(OMPD_teams);
|
|
|
|
CaptureRegions.push_back(OMPD_parallel);
|
|
|
|
break;
|
2017-11-22 17:19:31 +00:00
|
|
|
case OMPD_target_parallel:
|
|
|
|
case OMPD_target_parallel_for:
|
|
|
|
case OMPD_target_parallel_for_simd:
|
2022-03-23 15:37:06 -07:00
|
|
|
case OMPD_target_parallel_loop:
|
2018-01-15 19:06:12 +00:00
|
|
|
CaptureRegions.push_back(OMPD_task);
|
2017-11-22 17:19:31 +00:00
|
|
|
CaptureRegions.push_back(OMPD_target);
|
|
|
|
CaptureRegions.push_back(OMPD_parallel);
|
|
|
|
break;
|
2017-11-28 21:11:44 +00:00
|
|
|
case OMPD_task:
|
2017-11-22 17:19:31 +00:00
|
|
|
case OMPD_target_enter_data:
|
|
|
|
case OMPD_target_exit_data:
|
|
|
|
case OMPD_target_update:
|
|
|
|
CaptureRegions.push_back(OMPD_task);
|
|
|
|
break;
|
2017-11-28 21:11:44 +00:00
|
|
|
case OMPD_taskloop:
|
|
|
|
case OMPD_taskloop_simd:
|
2019-10-10 20:13:02 +00:00
|
|
|
case OMPD_master_taskloop:
|
2019-10-18 16:47:35 +00:00
|
|
|
case OMPD_master_taskloop_simd:
|
2022-06-24 08:42:21 -07:00
|
|
|
case OMPD_masked_taskloop:
|
2022-06-28 14:35:43 -07:00
|
|
|
case OMPD_masked_taskloop_simd:
|
2017-11-28 21:11:44 +00:00
|
|
|
CaptureRegions.push_back(OMPD_taskloop);
|
|
|
|
break;
|
2022-06-30 10:59:33 -07:00
|
|
|
case OMPD_parallel_masked_taskloop:
|
2022-06-30 17:08:17 -07:00
|
|
|
case OMPD_parallel_masked_taskloop_simd:
|
2019-10-14 17:17:41 +00:00
|
|
|
case OMPD_parallel_master_taskloop:
|
2019-10-25 10:27:13 -04:00
|
|
|
case OMPD_parallel_master_taskloop_simd:
|
2019-10-14 17:17:41 +00:00
|
|
|
CaptureRegions.push_back(OMPD_parallel);
|
|
|
|
CaptureRegions.push_back(OMPD_taskloop);
|
|
|
|
break;
|
2023-07-01 19:10:28 -05:00
|
|
|
case OMPD_target_teams_loop:
|
2018-01-03 21:12:44 +00:00
|
|
|
case OMPD_target_teams_distribute_parallel_for:
|
2018-01-15 20:59:40 +00:00
|
|
|
case OMPD_target_teams_distribute_parallel_for_simd:
|
2018-01-15 19:06:12 +00:00
|
|
|
CaptureRegions.push_back(OMPD_task);
|
2018-01-03 21:12:44 +00:00
|
|
|
CaptureRegions.push_back(OMPD_target);
|
|
|
|
CaptureRegions.push_back(OMPD_teams);
|
|
|
|
CaptureRegions.push_back(OMPD_parallel);
|
|
|
|
break;
|
2022-05-24 23:59:19 -05:00
|
|
|
case OMPD_nothing:
|
|
|
|
CaptureRegions.push_back(OMPD_nothing);
|
|
|
|
break;
|
2021-10-28 08:10:40 -07:00
|
|
|
case OMPD_loop:
|
|
|
|
// TODO: 'loop' may require different capture regions depending on the bind
|
|
|
|
// clause or the parent directive when there is no bind clause. Use
|
|
|
|
// OMPD_unknown for now.
|
2017-01-18 18:18:53 +00:00
|
|
|
case OMPD_simd:
|
|
|
|
case OMPD_for:
|
|
|
|
case OMPD_for_simd:
|
|
|
|
case OMPD_sections:
|
|
|
|
case OMPD_section:
|
|
|
|
case OMPD_single:
|
|
|
|
case OMPD_master:
|
|
|
|
case OMPD_critical:
|
|
|
|
case OMPD_taskgroup:
|
|
|
|
case OMPD_distribute:
|
|
|
|
case OMPD_ordered:
|
|
|
|
case OMPD_atomic:
|
|
|
|
case OMPD_target_data:
|
|
|
|
case OMPD_distribute_simd:
|
2023-08-09 15:28:09 -07:00
|
|
|
case OMPD_scope:
|
2021-03-22 18:13:29 -07:00
|
|
|
case OMPD_dispatch:
|
2017-11-28 21:11:44 +00:00
|
|
|
CaptureRegions.push_back(OMPD_unknown);
|
2017-01-18 18:18:53 +00:00
|
|
|
break;
|
2021-02-12 11:26:59 -08:00
|
|
|
case OMPD_tile:
|
2021-06-10 14:24:17 -05:00
|
|
|
case OMPD_unroll:
|
2021-02-12 11:26:59 -08:00
|
|
|
// loop transformations do not introduce captures.
|
|
|
|
break;
|
2017-01-18 18:18:53 +00:00
|
|
|
case OMPD_threadprivate:
|
2019-03-07 17:54:44 +00:00
|
|
|
case OMPD_allocate:
|
2017-01-18 18:18:53 +00:00
|
|
|
case OMPD_taskyield:
|
|
|
|
case OMPD_barrier:
|
2022-11-01 14:46:12 -07:00
|
|
|
case OMPD_error:
|
2017-01-18 18:18:53 +00:00
|
|
|
case OMPD_taskwait:
|
|
|
|
case OMPD_cancellation_point:
|
|
|
|
case OMPD_cancel:
|
|
|
|
case OMPD_flush:
|
2020-02-28 09:52:15 -05:00
|
|
|
case OMPD_depobj:
|
2020-03-20 07:03:01 -04:00
|
|
|
case OMPD_scan:
|
2017-01-18 18:18:53 +00:00
|
|
|
case OMPD_declare_reduction:
|
2019-02-01 20:25:04 +00:00
|
|
|
case OMPD_declare_mapper:
|
2017-01-18 18:18:53 +00:00
|
|
|
case OMPD_declare_simd:
|
|
|
|
case OMPD_declare_target:
|
|
|
|
case OMPD_end_declare_target:
|
2018-09-26 04:28:39 +00:00
|
|
|
case OMPD_requires:
|
2019-09-13 20:18:17 +00:00
|
|
|
case OMPD_declare_variant:
|
2020-02-20 19:50:47 -06:00
|
|
|
case OMPD_begin_declare_variant:
|
|
|
|
case OMPD_end_declare_variant:
|
2017-01-18 18:18:53 +00:00
|
|
|
llvm_unreachable("OpenMP Directive is not allowed");
|
|
|
|
case OMPD_unknown:
|
[flang][openmp] Use common Directive and Clause enum from llvm/Frontend
Summary:
This patch is removing the custom enumeration for OpenMP Directives and Clauses and replace them
with the newly tablegen generated one from llvm/Frontend. This is a first patch and some will follow to share the same
infrastructure where possible. The next patch should use the clauses allowance defined in the tablegen file.
Reviewers: jdoerfert, DavidTruby, sscalpone, kiranchandramohan, ichoyjx
Reviewed By: DavidTruby, ichoyjx
Subscribers: jholewinski, cfe-commits, dblaikie, MaskRay, ymandel, ichoyjx, mgorny, yaxunl, guansong, jfb, sstefan1, aaron.ballman, llvm-commits
Tags: #llvm, #flang, #clang
Differential Revision: https://reviews.llvm.org/D82906
2020-07-01 20:57:11 -04:00
|
|
|
default:
|
2017-01-18 18:18:53 +00:00
|
|
|
llvm_unreachable("Unknown OpenMP directive");
|
|
|
|
}
|
|
|
|
}
|