1#ifndef LLVM_OpenACC_INC
2#define LLVM_OpenACC_INC
3
4#include "llvm/ADT/ArrayRef.h"
5#include "llvm/ADT/BitmaskEnum.h"
6#include <cstddef>
7
8namespace llvm {
9class StringRef;
10namespace acc {
11
12LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
13
14enum class Association {
15 Block,
16 Declaration,
17 Delimited,
18 Loop,
19 None,
20 Separating,
21};
22
23static constexpr std::size_t Association_enumSize = 6;
24
25enum class Category {
26 Declarative,
27 Executable,
28 Informational,
29 Meta,
30 Subsidiary,
31 Utility,
32};
33
34static constexpr std::size_t Category_enumSize = 6;
35
36enum class Directive {
37 ACCD_atomic,
38 ACCD_cache,
39 ACCD_data,
40 ACCD_declare,
41 ACCD_enter_data,
42 ACCD_exit_data,
43 ACCD_host_data,
44 ACCD_init,
45 ACCD_kernels,
46 ACCD_kernels_loop,
47 ACCD_loop,
48 ACCD_parallel,
49 ACCD_parallel_loop,
50 ACCD_routine,
51 ACCD_serial,
52 ACCD_serial_loop,
53 ACCD_set,
54 ACCD_shutdown,
55 ACCD_unknown,
56 ACCD_update,
57 ACCD_wait,
58};
59
60static constexpr std::size_t Directive_enumSize = 21;
61
62constexpr auto ACCD_atomic = llvm::acc::Directive::ACCD_atomic;
63constexpr auto ACCD_cache = llvm::acc::Directive::ACCD_cache;
64constexpr auto ACCD_data = llvm::acc::Directive::ACCD_data;
65constexpr auto ACCD_declare = llvm::acc::Directive::ACCD_declare;
66constexpr auto ACCD_enter_data = llvm::acc::Directive::ACCD_enter_data;
67constexpr auto ACCD_exit_data = llvm::acc::Directive::ACCD_exit_data;
68constexpr auto ACCD_host_data = llvm::acc::Directive::ACCD_host_data;
69constexpr auto ACCD_init = llvm::acc::Directive::ACCD_init;
70constexpr auto ACCD_kernels = llvm::acc::Directive::ACCD_kernels;
71constexpr auto ACCD_kernels_loop = llvm::acc::Directive::ACCD_kernels_loop;
72constexpr auto ACCD_loop = llvm::acc::Directive::ACCD_loop;
73constexpr auto ACCD_parallel = llvm::acc::Directive::ACCD_parallel;
74constexpr auto ACCD_parallel_loop = llvm::acc::Directive::ACCD_parallel_loop;
75constexpr auto ACCD_routine = llvm::acc::Directive::ACCD_routine;
76constexpr auto ACCD_serial = llvm::acc::Directive::ACCD_serial;
77constexpr auto ACCD_serial_loop = llvm::acc::Directive::ACCD_serial_loop;
78constexpr auto ACCD_set = llvm::acc::Directive::ACCD_set;
79constexpr auto ACCD_shutdown = llvm::acc::Directive::ACCD_shutdown;
80constexpr auto ACCD_unknown = llvm::acc::Directive::ACCD_unknown;
81constexpr auto ACCD_update = llvm::acc::Directive::ACCD_update;
82constexpr auto ACCD_wait = llvm::acc::Directive::ACCD_wait;
83
84enum class Clause {
85 ACCC_async,
86 ACCC_attach,
87 ACCC_auto,
88 ACCC_bind,
89 ACCC_capture,
90 ACCC_collapse,
91 ACCC_copy,
92 ACCC_copyin,
93 ACCC_copyout,
94 ACCC_create,
95 ACCC_default,
96 ACCC_default_async,
97 ACCC_delete,
98 ACCC_detach,
99 ACCC_device,
100 ACCC_device_num,
101 ACCC_deviceptr,
102 ACCC_device_resident,
103 ACCC_device_type,
104 ACCC_finalize,
105 ACCC_firstprivate,
106 ACCC_gang,
107 ACCC_host,
108 ACCC_if,
109 ACCC_if_present,
110 ACCC_independent,
111 ACCC_link,
112 ACCC_no_create,
113 ACCC_nohost,
114 ACCC_num_gangs,
115 ACCC_num_workers,
116 ACCC_present,
117 ACCC_private,
118 ACCC_read,
119 ACCC_reduction,
120 ACCC_self,
121 ACCC_seq,
122 ACCC_tile,
123 ACCC_unknown,
124 ACCC_use_device,
125 ACCC_vector,
126 ACCC_vector_length,
127 ACCC_wait,
128 ACCC_worker,
129 ACCC_write,
130};
131
132static constexpr std::size_t Clause_enumSize = 45;
133
134constexpr auto ACCC_async = llvm::acc::Clause::ACCC_async;
135constexpr auto ACCC_attach = llvm::acc::Clause::ACCC_attach;
136constexpr auto ACCC_auto = llvm::acc::Clause::ACCC_auto;
137constexpr auto ACCC_bind = llvm::acc::Clause::ACCC_bind;
138constexpr auto ACCC_capture = llvm::acc::Clause::ACCC_capture;
139constexpr auto ACCC_collapse = llvm::acc::Clause::ACCC_collapse;
140constexpr auto ACCC_copy = llvm::acc::Clause::ACCC_copy;
141constexpr auto ACCC_copyin = llvm::acc::Clause::ACCC_copyin;
142constexpr auto ACCC_copyout = llvm::acc::Clause::ACCC_copyout;
143constexpr auto ACCC_create = llvm::acc::Clause::ACCC_create;
144constexpr auto ACCC_default = llvm::acc::Clause::ACCC_default;
145constexpr auto ACCC_default_async = llvm::acc::Clause::ACCC_default_async;
146constexpr auto ACCC_delete = llvm::acc::Clause::ACCC_delete;
147constexpr auto ACCC_detach = llvm::acc::Clause::ACCC_detach;
148constexpr auto ACCC_device = llvm::acc::Clause::ACCC_device;
149constexpr auto ACCC_device_num = llvm::acc::Clause::ACCC_device_num;
150constexpr auto ACCC_deviceptr = llvm::acc::Clause::ACCC_deviceptr;
151constexpr auto ACCC_device_resident = llvm::acc::Clause::ACCC_device_resident;
152constexpr auto ACCC_device_type = llvm::acc::Clause::ACCC_device_type;
153constexpr auto ACCC_finalize = llvm::acc::Clause::ACCC_finalize;
154constexpr auto ACCC_firstprivate = llvm::acc::Clause::ACCC_firstprivate;
155constexpr auto ACCC_gang = llvm::acc::Clause::ACCC_gang;
156constexpr auto ACCC_host = llvm::acc::Clause::ACCC_host;
157constexpr auto ACCC_if = llvm::acc::Clause::ACCC_if;
158constexpr auto ACCC_if_present = llvm::acc::Clause::ACCC_if_present;
159constexpr auto ACCC_independent = llvm::acc::Clause::ACCC_independent;
160constexpr auto ACCC_link = llvm::acc::Clause::ACCC_link;
161constexpr auto ACCC_no_create = llvm::acc::Clause::ACCC_no_create;
162constexpr auto ACCC_nohost = llvm::acc::Clause::ACCC_nohost;
163constexpr auto ACCC_num_gangs = llvm::acc::Clause::ACCC_num_gangs;
164constexpr auto ACCC_num_workers = llvm::acc::Clause::ACCC_num_workers;
165constexpr auto ACCC_present = llvm::acc::Clause::ACCC_present;
166constexpr auto ACCC_private = llvm::acc::Clause::ACCC_private;
167constexpr auto ACCC_read = llvm::acc::Clause::ACCC_read;
168constexpr auto ACCC_reduction = llvm::acc::Clause::ACCC_reduction;
169constexpr auto ACCC_self = llvm::acc::Clause::ACCC_self;
170constexpr auto ACCC_seq = llvm::acc::Clause::ACCC_seq;
171constexpr auto ACCC_tile = llvm::acc::Clause::ACCC_tile;
172constexpr auto ACCC_unknown = llvm::acc::Clause::ACCC_unknown;
173constexpr auto ACCC_use_device = llvm::acc::Clause::ACCC_use_device;
174constexpr auto ACCC_vector = llvm::acc::Clause::ACCC_vector;
175constexpr auto ACCC_vector_length = llvm::acc::Clause::ACCC_vector_length;
176constexpr auto ACCC_wait = llvm::acc::Clause::ACCC_wait;
177constexpr auto ACCC_worker = llvm::acc::Clause::ACCC_worker;
178constexpr auto ACCC_write = llvm::acc::Clause::ACCC_write;
179
180enum class DefaultValue {
181 ACC_Default_present=0,
182 ACC_Default_none=1,
183};
184
185constexpr auto ACC_Default_present = llvm::acc::DefaultValue::ACC_Default_present;
186constexpr auto ACC_Default_none = llvm::acc::DefaultValue::ACC_Default_none;
187
188// Enumeration helper functions
189Directive getOpenACCDirectiveKind(llvm::StringRef Str);
190
191llvm::StringRef getOpenACCDirectiveName(Directive D);
192
193Clause getOpenACCClauseKind(llvm::StringRef Str);
194
195llvm::StringRef getOpenACCClauseName(Clause C);
196
197/// Return true if \p C is a valid clause for \p D in version \p Version.
198bool isAllowedClauseForDirective(Directive D, Clause C, unsigned Version);
199
200constexpr std::size_t getMaxLeafCount() { return 2; }
201Association getDirectiveAssociation(Directive D);
202Category getDirectiveCategory(Directive D);
203DefaultValue getDefaultValue(StringRef);
204llvm::StringRef getOpenACCDefaultValueName(DefaultValue);
205
206} // namespace acc
207} // namespace llvm
208#endif // LLVM_OpenACC_INC
209