File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
include/llvm/Frontend/OpenMP Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 15
15
16
16
#include " llvm/Frontend/OpenMP/OMP.h.inc"
17
17
18
+ namespace llvm ::omp {
19
+ bool isLeafConstruct (Directive D);
20
+ bool isCompositeConstruct (Directive D);
21
+ bool isCombinedConstruct (Directive D);
22
+ } // namespace llvm::omp
23
+
18
24
#endif // LLVM_FRONTEND_OPENMP_OMP_H
Original file line number Diff line number Diff line change 8
8
9
9
#include " llvm/Frontend/OpenMP/OMP.h"
10
10
11
+ #include " llvm/ADT/STLExtras.h"
11
12
#include " llvm/ADT/StringRef.h"
12
13
#include " llvm/ADT/StringSwitch.h"
13
14
#include " llvm/Support/ErrorHandling.h"
@@ -17,3 +18,24 @@ using namespace omp;
17
18
18
19
#define GEN_DIRECTIVES_IMPL
19
20
#include " llvm/Frontend/OpenMP/OMP.inc"
21
+
22
+ namespace llvm ::omp {
23
+ bool isLeafConstruct (Directive D) { return getLeafConstructs (D).empty (); }
24
+
25
+ bool isCompositeConstruct (Directive D) {
26
+ // OpenMP Spec 5.2: [17.3, 8-9]
27
+ // If directive-name-A and directive-name-B both correspond to loop-
28
+ // associated constructs then directive-name is a composite construct
29
+ size_t numLoopConstructs =
30
+ llvm::count_if (getLeafConstructs (D), [](Directive L) {
31
+ return getDirectiveAssociation (L) == Association::Loop;
32
+ });
33
+ return numLoopConstructs > 1 ;
34
+ }
35
+
36
+ bool isCombinedConstruct (Directive D) {
37
+ // OpenMP Spec 5.2: [17.3, 9-10]
38
+ // Otherwise directive-name is a combined construct.
39
+ return !getLeafConstructs (D).empty () && !isCompositeConstruct (D);
40
+ }
41
+ } // namespace llvm::omp
You can’t perform that action at this time.
0 commit comments