Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 1
//===-- ACC.td - OpenACC directive definition file ---------*- tablegen -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This is the definition file for OpenACC 3.1 directives and clauses.
10
//
11
//===----------------------------------------------------------------------===//
12
 
13
include "llvm/Frontend/Directive/DirectiveBase.td"
14
 
15
//===----------------------------------------------------------------------===//
16
// Definition of general OpenACC information
17
//===----------------------------------------------------------------------===//
18
 
19
def OpenACC : DirectiveLanguage {
20
  let name = "OpenACC";
21
  let cppNamespace = "acc"; // final namespace will be llvm::acc
22
  let directivePrefix = "ACCD_";
23
  let clausePrefix = "ACCC_";
24
  let makeEnumAvailableInNamespace = true;
25
  let enableBitmaskEnumInNamespace = true;
26
  let clauseEnumSetClass = "AccClauseSet";
27
  let flangClauseBaseClass = "AccClause";
28
}
29
 
30
//===----------------------------------------------------------------------===//
31
// Definition of OpenACC clauses
32
//===----------------------------------------------------------------------===//
33
 
34
// 2.16.1
35
def ACCC_Async : Clause<"async"> {
36
  let flangClass = "ScalarIntExpr";
37
  let isValueOptional = true;
38
}
39
 
40
// 2.9.7
41
def ACCC_Auto : Clause<"auto"> {}
42
 
43
// 2.7.12
44
def ACCC_Attach : Clause<"attach"> {
45
  let flangClass = "AccObjectList";
46
}
47
 
48
// 2.15.1
49
def ACCC_Bind : Clause<"bind"> {
50
  let flangClass = "AccBindClause";
51
}
52
 
53
// 2.12
54
def ACCC_Capture : Clause<"capture"> {
55
}
56
 
57
// 2.9.1
58
def ACCC_Collapse : Clause<"collapse"> {
59
  let flangClass = "ScalarIntConstantExpr";
60
}
61
 
62
// 2.7.6
63
def ACCC_Copy : Clause<"copy"> {
64
  let flangClass = "AccObjectList";
65
  let aliases = ["present_or_copy", "pcopy"];
66
}
67
// 2.7.7
68
def ACCC_Copyin : Clause<"copyin"> {
69
  let flangClass = "AccObjectListWithModifier";
70
  let aliases = ["present_or_copyin", "pcopyin"];
71
}
72
 
73
// 2.7.8
74
def ACCC_Copyout : Clause<"copyout"> {
75
  let flangClass = "AccObjectListWithModifier";
76
  let aliases = ["present_or_copyout", "pcopyout"];
77
}
78
 
79
// 2.7.9
80
def ACCC_Create : Clause<"create"> {
81
  let flangClass = "AccObjectListWithModifier";
82
  let aliases = ["present_or_create", "pcreate"];
83
}
84
 
85
// 2.5.15
86
def ACC_Default_none : ClauseVal<"none", 1, 1> { let isDefault = 1; }
87
def ACC_Default_present : ClauseVal<"present", 0, 1> {}
88
 
89
def ACCC_Default : Clause<"default"> {
90
  let flangClass = "AccDefaultClause";
91
  let enumClauseValue = "DefaultValue";
92
  let allowedClauseValues = [
93
    ACC_Default_present,
94
    ACC_Default_none
95
  ];
96
}
97
 
98
// 2.14.3
99
def ACCC_DefaultAsync : Clause<"default_async"> {
100
  let flangClass = "ScalarIntExpr";
101
}
102
 
103
// 2.7.11
104
def ACCC_Delete : Clause<"delete"> {
105
  let flangClass = "AccObjectList";
106
}
107
 
108
// 2.7.13
109
def ACCC_Detach : Clause<"detach"> {
110
  let flangClass = "AccObjectList";
111
}
112
 
113
// 2.14.4
114
def ACCC_Device : Clause<"device"> {
115
  let flangClass = "AccObjectList";
116
}
117
 
118
// 2.14.1 - 2.14.2
119
def ACCC_DeviceNum : Clause<"device_num">  {
120
  let flangClass = "ScalarIntExpr";
121
}
122
 
123
// 2.7.4
124
def ACCC_DevicePtr : Clause<"deviceptr"> {
125
  let flangClass = "AccObjectList";
126
}
127
 
128
// 2.13.1
129
def ACCC_DeviceResident : Clause<"device_resident"> {
130
  let flangClass = "AccObjectList";
131
}
132
 
133
// 2.4
134
def ACCC_DeviceType : Clause<"device_type"> {
135
  let flangClass = "AccDeviceTypeExprList";
136
  let defaultValue = "*";
137
  let aliases = ["dtype"];
138
}
139
 
140
// 2.6.6
141
def ACCC_Finalize : Clause<"finalize"> {}
142
 
143
// 2.5.13
144
def ACCC_FirstPrivate : Clause<"firstprivate"> {
145
  let flangClass = "AccObjectList";
146
}
147
 
148
// 2.9.2
149
def ACCC_Gang : Clause<"gang"> {
150
  let flangClass = "AccGangArgument";
151
  let isValueOptional = true;
152
}
153
 
154
// 2.14.4
155
def ACCC_Host : Clause<"host"> {
156
  let flangClass = "AccObjectList";
157
}
158
 
159
// 2.5.5
160
def ACCC_If : Clause <"if"> {
161
  let flangClass = "ScalarLogicalExpr";
162
}
163
 
164
// 2.14.4
165
def ACCC_IfPresent : Clause<"if_present"> {}
166
 
167
// 2.9.6
168
def ACCC_Independent : Clause<"independent"> {}
169
 
170
// 2.13.3
171
def ACCC_Link : Clause<"link"> {
172
  let flangClass = "AccObjectList";
173
}
174
 
175
// 2.7.10
176
def ACCC_NoCreate : Clause<"no_create"> {
177
  let flangClass = "AccObjectList";
178
}
179
 
180
// 2.15.1
181
def ACCC_NoHost : Clause<"nohost"> {}
182
 
183
// 2.5.9
184
def ACCC_NumGangs : Clause<"num_gangs"> {
185
  let flangClass = "ScalarIntExpr";
186
}
187
 
188
// 2.5.10
189
def ACCC_NumWorkers : Clause<"num_workers"> {
190
  let flangClass = "ScalarIntExpr";
191
}
192
 
193
// 2.7.5
194
def ACCC_Present : Clause<"present"> {
195
  let flangClass = "AccObjectList";
196
}
197
 
198
// 2.5.12
199
def ACCC_Private : Clause<"private"> {
200
  let flangClass = "AccObjectList";
201
}
202
 
203
// 2.9.8
204
def ACCC_Tile : Clause <"tile"> {
205
  let flangClass = "AccTileExprList";
206
}
207
 
208
// 2.8.1
209
def ACCC_UseDevice : Clause <"use_device"> {
210
  let flangClass = "AccObjectList";
211
}
212
 
213
// 2.12
214
def ACCC_Read : Clause<"read"> {}
215
 
216
// 2.5.14
217
def ACCC_Reduction : Clause<"reduction"> {
218
  let flangClass = "AccObjectListWithReduction";
219
}
220
 
221
// 2.5.6
222
def ACCC_Self : Clause<"self"> {
223
  let flangClass = "AccSelfClause";
224
  let isValueOptional = true;
225
}
226
 
227
// 2.9.5
228
def ACCC_Seq : Clause<"seq"> {}
229
 
230
// 2.9.4
231
def ACCC_Vector : Clause<"vector"> {
232
  let flangClass = "ScalarIntExpr";
233
  let isValueOptional = true;
234
  let prefix = "length";
235
}
236
 
237
// 2.5.11
238
def ACCC_VectorLength : Clause<"vector_length"> {
239
  let flangClass = "ScalarIntExpr";
240
}
241
 
242
// 2.16.2
243
def ACCC_Wait : Clause<"wait"> {
244
  let flangClass = "AccWaitArgument";
245
  let isValueOptional = true;
246
}
247
 
248
// 2.9.3
249
def ACCC_Worker: Clause<"worker"> {
250
  let flangClass = "ScalarIntExpr";
251
  let isValueOptional = true;
252
  let prefix = "num";
253
}
254
 
255
// 2.12
256
def ACCC_Write : Clause<"write"> {}
257
 
258
def ACCC_Unknown : Clause<"unknown"> {
259
  let isDefault = true;
260
}
261
 
262
//===----------------------------------------------------------------------===//
263
// Definition of OpenACC directives
264
//===----------------------------------------------------------------------===//
265
 
266
// 2.12
267
def ACC_Atomic : Directive<"atomic"> {}
268
 
269
// 2.6.5
270
def ACC_Data : Directive<"data"> {
271
  let allowedOnceClauses = [
272
    VersionedClause<ACCC_If>,
273
    VersionedClause<ACCC_Default>
274
  ];
275
  let requiredClauses = [
276
    VersionedClause<ACCC_Attach>,
277
    VersionedClause<ACCC_Copy>,
278
    VersionedClause<ACCC_Copyin>,
279
    VersionedClause<ACCC_Copyout>,
280
    VersionedClause<ACCC_Create>,
281
    VersionedClause<ACCC_Default>,
282
    VersionedClause<ACCC_DevicePtr>,
283
    VersionedClause<ACCC_NoCreate>,
284
    VersionedClause<ACCC_Present>
285
  ];
286
}
287
 
288
// 2.13
289
def ACC_Declare : Directive<"declare"> {
290
  let allowedClauses = [
291
    VersionedClause<ACCC_Copy>,
292
    VersionedClause<ACCC_Copyin>,
293
    VersionedClause<ACCC_Copyout>,
294
    VersionedClause<ACCC_Create>,
295
    VersionedClause<ACCC_Present>,
296
    VersionedClause<ACCC_DevicePtr>,
297
    VersionedClause<ACCC_DeviceResident>,
298
    VersionedClause<ACCC_Link>
299
  ];
300
}
301
 
302
// 2.5.3
303
def ACC_Kernels : Directive<"kernels"> {
304
  let allowedClauses = [
305
    VersionedClause<ACCC_Attach>,
306
    VersionedClause<ACCC_Copy>,
307
    VersionedClause<ACCC_Copyin>,
308
    VersionedClause<ACCC_Copyout>,
309
    VersionedClause<ACCC_Create>,
310
    VersionedClause<ACCC_DeviceType>,
311
    VersionedClause<ACCC_NoCreate>,
312
    VersionedClause<ACCC_Present>,
313
    VersionedClause<ACCC_DevicePtr>,
314
    VersionedClause<ACCC_Wait>
315
  ];
316
  let allowedOnceClauses = [
317
    VersionedClause<ACCC_Async>,
318
    VersionedClause<ACCC_Default>,
319
    VersionedClause<ACCC_If>,
320
    VersionedClause<ACCC_NumGangs>,
321
    VersionedClause<ACCC_NumWorkers>,
322
    VersionedClause<ACCC_Self>,
323
    VersionedClause<ACCC_VectorLength>
324
  ];
325
}
326
 
327
// 2.5.1
328
def ACC_Parallel : Directive<"parallel"> {
329
  let allowedClauses = [
330
    VersionedClause<ACCC_Attach>,
331
    VersionedClause<ACCC_Copy>,
332
    VersionedClause<ACCC_Copyin>,
333
    VersionedClause<ACCC_Copyout>,
334
    VersionedClause<ACCC_Create>,
335
    VersionedClause<ACCC_DevicePtr>,
336
    VersionedClause<ACCC_DeviceType>,
337
    VersionedClause<ACCC_NoCreate>,
338
    VersionedClause<ACCC_Present>,
339
    VersionedClause<ACCC_Private>,
340
    VersionedClause<ACCC_FirstPrivate>,
341
    VersionedClause<ACCC_Wait>
342
  ];
343
  let allowedOnceClauses = [
344
    VersionedClause<ACCC_Async>,
345
    VersionedClause<ACCC_Default>,
346
    VersionedClause<ACCC_If>,
347
    VersionedClause<ACCC_NumGangs>,
348
    VersionedClause<ACCC_NumWorkers>,
349
    VersionedClause<ACCC_Reduction>,
350
    VersionedClause<ACCC_Self>,
351
    VersionedClause<ACCC_VectorLength>
352
  ];
353
}
354
 
355
// 2.5.2
356
def ACC_Serial : Directive<"serial"> {
357
  // Spec line 950-951: clause is as for the parallel construct except that the
358
  // num_gangs, num_workers, and vector_length clauses are not permitted.
359
  let allowedClauses = [
360
    VersionedClause<ACCC_Attach>,
361
    VersionedClause<ACCC_Copy>,
362
    VersionedClause<ACCC_Copyin>,
363
    VersionedClause<ACCC_Copyout>,
364
    VersionedClause<ACCC_Create>,
365
    VersionedClause<ACCC_DevicePtr>,
366
    VersionedClause<ACCC_DeviceType>,
367
    VersionedClause<ACCC_NoCreate>,
368
    VersionedClause<ACCC_Present>,
369
    VersionedClause<ACCC_Private>,
370
    VersionedClause<ACCC_FirstPrivate>,
371
    VersionedClause<ACCC_Wait>
372
  ];
373
  let allowedOnceClauses = [
374
    VersionedClause<ACCC_Async>,
375
    VersionedClause<ACCC_Default>,
376
    VersionedClause<ACCC_If>,
377
    VersionedClause<ACCC_Reduction>,
378
    VersionedClause<ACCC_Self>
379
  ];
380
}
381
 
382
// 2.9
383
def ACC_Loop : Directive<"loop"> {
384
  let allowedClauses = [
385
    VersionedClause<ACCC_DeviceType>,
386
    VersionedClause<ACCC_Private>
387
  ];
388
  let allowedOnceClauses = [
389
    VersionedClause<ACCC_Collapse>,
390
    VersionedClause<ACCC_Gang>,
391
    VersionedClause<ACCC_Reduction>,
392
    VersionedClause<ACCC_Tile>,
393
    VersionedClause<ACCC_Vector>,
394
    VersionedClause<ACCC_Worker>
395
  ];
396
  let allowedExclusiveClauses = [
397
    VersionedClause<ACCC_Auto>,
398
    VersionedClause<ACCC_Independent>,
399
    VersionedClause<ACCC_Seq>
400
  ];
401
}
402
 
403
// 2.10
404
def ACC_Cache : Directive<"cache"> {}
405
 
406
// 2.14.1
407
def ACC_Init : Directive<"init"> {
408
  let allowedOnceClauses = [
409
    VersionedClause<ACCC_DeviceNum>,
410
    VersionedClause<ACCC_DeviceType>,
411
    VersionedClause<ACCC_If>
412
  ];
413
}
414
 
415
// 2.15.1
416
def ACC_Routine : Directive<"routine"> {
417
  let allowedOnceClauses = [
418
    VersionedClause<ACCC_Bind>,
419
    VersionedClause<ACCC_DeviceType>,
420
    VersionedClause<ACCC_NoHost>
421
  ];
422
  let requiredClauses = [
423
    VersionedClause<ACCC_Gang>,
424
    VersionedClause<ACCC_Seq>,
425
    VersionedClause<ACCC_Vector>,
426
    VersionedClause<ACCC_Worker>
427
  ];
428
}
429
 
430
// 2.14.3
431
def ACC_Set : Directive<"set"> {
432
  let allowedOnceClauses = [
433
    VersionedClause<ACCC_DefaultAsync>,
434
    VersionedClause<ACCC_DeviceNum>,
435
    VersionedClause<ACCC_DeviceType>,
436
    VersionedClause<ACCC_If>
437
  ];
438
  let requiredClauses = [
439
    // The three following clauses are also in allowedOnceClauses list due to
440
    // restriction 2255 - Two instances of the same clause may not appear on the
441
    // same directive.
442
    VersionedClause<ACCC_DefaultAsync>,
443
    VersionedClause<ACCC_DeviceNum>,
444
    VersionedClause<ACCC_DeviceType>
445
  ];
446
}
447
 
448
// 2.14.2
449
def ACC_Shutdown : Directive<"shutdown"> {
450
  let allowedOnceClauses = [
451
    VersionedClause<ACCC_DeviceNum>,
452
    VersionedClause<ACCC_DeviceType>,
453
    VersionedClause<ACCC_If>
454
  ];
455
}
456
 
457
// 2.14.4
458
def ACC_Update : Directive<"update"> {
459
  let allowedClauses = [
460
    VersionedClause<ACCC_DeviceType>,
461
    VersionedClause<ACCC_Wait>
462
  ];
463
  let allowedOnceClauses = [
464
    VersionedClause<ACCC_Async>,
465
    VersionedClause<ACCC_If>,
466
    VersionedClause<ACCC_IfPresent>
467
  ];
468
  let requiredClauses = [
469
    VersionedClause<ACCC_Device>,
470
    VersionedClause<ACCC_Host>,
471
    VersionedClause<ACCC_Self>
472
  ];
473
}
474
 
475
// 2.16.3
476
def ACC_Wait : Directive<"wait"> {
477
  let allowedOnceClauses = [
478
    VersionedClause<ACCC_Async>,
479
    VersionedClause<ACCC_If>
480
  ];
481
}
482
 
483
// 2.14.6
484
def ACC_EnterData : Directive<"enter data"> {
485
  let allowedClauses = [
486
    VersionedClause<ACCC_Wait>
487
  ];
488
  let allowedOnceClauses = [
489
    VersionedClause<ACCC_Async>,
490
    VersionedClause<ACCC_If>
491
  ];
492
  let requiredClauses = [
493
    VersionedClause<ACCC_Attach>,
494
    VersionedClause<ACCC_Create>,
495
    VersionedClause<ACCC_Copyin>
496
  ];
497
}
498
 
499
// 2.14.7
500
def ACC_ExitData : Directive<"exit data"> {
501
  let allowedClauses = [
502
    VersionedClause<ACCC_Wait>
503
  ];
504
  let allowedOnceClauses = [
505
    VersionedClause<ACCC_Async>,
506
    VersionedClause<ACCC_If>,
507
    VersionedClause<ACCC_Finalize>
508
  ];
509
  let requiredClauses = [
510
    VersionedClause<ACCC_Copyout>,
511
    VersionedClause<ACCC_Delete>,
512
    VersionedClause<ACCC_Detach>
513
  ];
514
}
515
 
516
// 2.8
517
def ACC_HostData : Directive<"host_data"> {
518
  let allowedOnceClauses = [
519
    VersionedClause<ACCC_If>,
520
    VersionedClause<ACCC_IfPresent>
521
  ];
522
  let requiredClauses = [
523
    VersionedClause<ACCC_UseDevice>
524
  ];
525
}
526
 
527
// 2.11
528
def ACC_KernelsLoop : Directive<"kernels loop"> {
529
  let allowedClauses = [
530
    VersionedClause<ACCC_Copy>,
531
    VersionedClause<ACCC_Copyin>,
532
    VersionedClause<ACCC_Copyout>,
533
    VersionedClause<ACCC_Create>,
534
    VersionedClause<ACCC_DeviceType>,
535
    VersionedClause<ACCC_NoCreate>,
536
    VersionedClause<ACCC_Present>,
537
    VersionedClause<ACCC_Private>,
538
    VersionedClause<ACCC_DevicePtr>,
539
    VersionedClause<ACCC_Attach>,
540
    VersionedClause<ACCC_Wait>
541
  ];
542
  let allowedOnceClauses = [
543
    VersionedClause<ACCC_Async>,
544
    VersionedClause<ACCC_Collapse>,
545
    VersionedClause<ACCC_Default>,
546
    VersionedClause<ACCC_Gang>,
547
    VersionedClause<ACCC_If>,
548
    VersionedClause<ACCC_NumGangs>,
549
    VersionedClause<ACCC_NumWorkers>,
550
    VersionedClause<ACCC_Reduction>,
551
    VersionedClause<ACCC_Self>,
552
    VersionedClause<ACCC_Tile>,
553
    VersionedClause<ACCC_Vector>,
554
    VersionedClause<ACCC_VectorLength>,
555
    VersionedClause<ACCC_Worker>
556
  ];
557
  let allowedExclusiveClauses = [
558
    VersionedClause<ACCC_Auto>,
559
    VersionedClause<ACCC_Independent>,
560
    VersionedClause<ACCC_Seq>
561
  ];
562
}
563
 
564
// 2.11
565
def ACC_ParallelLoop : Directive<"parallel loop"> {
566
  let allowedClauses = [
567
    VersionedClause<ACCC_Attach>,
568
    VersionedClause<ACCC_Copy>,
569
    VersionedClause<ACCC_Copyin>,
570
    VersionedClause<ACCC_Copyout>,
571
    VersionedClause<ACCC_Create>,
572
    VersionedClause<ACCC_DevicePtr>,
573
    VersionedClause<ACCC_DeviceType>,
574
    VersionedClause<ACCC_FirstPrivate>,
575
    VersionedClause<ACCC_NoCreate>,
576
    VersionedClause<ACCC_Present>,
577
    VersionedClause<ACCC_Private>,
578
    VersionedClause<ACCC_Tile>,
579
    VersionedClause<ACCC_Wait>
580
  ];
581
  let allowedOnceClauses = [
582
    VersionedClause<ACCC_Async>,
583
    VersionedClause<ACCC_Collapse>,
584
    VersionedClause<ACCC_Default>,
585
    VersionedClause<ACCC_Gang>,
586
    VersionedClause<ACCC_If>,
587
    VersionedClause<ACCC_NumGangs>,
588
    VersionedClause<ACCC_NumWorkers>,
589
    VersionedClause<ACCC_Reduction>,
590
    VersionedClause<ACCC_Self>,
591
    VersionedClause<ACCC_Vector>,
592
    VersionedClause<ACCC_VectorLength>,
593
    VersionedClause<ACCC_Worker>
594
  ];
595
  let allowedExclusiveClauses = [
596
    VersionedClause<ACCC_Auto>,
597
    VersionedClause<ACCC_Independent>,
598
    VersionedClause<ACCC_Seq>
599
  ];
600
}
601
 
602
// 2.11
603
def ACC_SerialLoop : Directive<"serial loop"> {
604
  let allowedClauses = [
605
    VersionedClause<ACCC_Attach>,
606
    VersionedClause<ACCC_Copy>,
607
    VersionedClause<ACCC_Copyin>,
608
    VersionedClause<ACCC_Copyout>,
609
    VersionedClause<ACCC_Create>,
610
    VersionedClause<ACCC_DevicePtr>,
611
    VersionedClause<ACCC_DeviceType>,
612
    VersionedClause<ACCC_FirstPrivate>,
613
    VersionedClause<ACCC_NoCreate>,
614
    VersionedClause<ACCC_Present>,
615
    VersionedClause<ACCC_Private>,
616
    VersionedClause<ACCC_Wait>
617
  ];
618
  let allowedOnceClauses = [
619
    VersionedClause<ACCC_Async>,
620
    VersionedClause<ACCC_Collapse>,
621
    VersionedClause<ACCC_Default>,
622
    VersionedClause<ACCC_Gang>,
623
    VersionedClause<ACCC_If>,
624
    VersionedClause<ACCC_Reduction>,
625
    VersionedClause<ACCC_Self>,
626
    VersionedClause<ACCC_Tile>,
627
    VersionedClause<ACCC_Vector>,
628
    VersionedClause<ACCC_Worker>
629
  ];
630
  let allowedExclusiveClauses = [
631
    VersionedClause<ACCC_Auto>,
632
    VersionedClause<ACCC_Independent>,
633
    VersionedClause<ACCC_Seq>
634
  ];
635
}
636
 
637
def ACC_Unknown : Directive<"unknown"> {
638
  let isDefault = true;
639
}