/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/AST/OpenMPClause.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===- OpenMPClause.h - Classes for OpenMP clauses --------------*- C++ -*-===// |
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 | | /// \file |
10 | | /// This file defines OpenMP AST classes for clauses. |
11 | | /// There are clauses for executable directives, clauses for declarative |
12 | | /// directives and clauses which can be used in both kinds of directives. |
13 | | // |
14 | | //===----------------------------------------------------------------------===// |
15 | | |
16 | | #ifndef LLVM_CLANG_AST_OPENMPCLAUSE_H |
17 | | #define LLVM_CLANG_AST_OPENMPCLAUSE_H |
18 | | |
19 | | #include "clang/AST/Decl.h" |
20 | | #include "clang/AST/DeclarationName.h" |
21 | | #include "clang/AST/Expr.h" |
22 | | #include "clang/AST/NestedNameSpecifier.h" |
23 | | #include "clang/AST/Stmt.h" |
24 | | #include "clang/AST/StmtIterator.h" |
25 | | #include "clang/Basic/LLVM.h" |
26 | | #include "clang/Basic/OpenMPKinds.h" |
27 | | #include "clang/Basic/SourceLocation.h" |
28 | | #include "llvm/ADT/ArrayRef.h" |
29 | | #include "llvm/ADT/MapVector.h" |
30 | | #include "llvm/ADT/SmallVector.h" |
31 | | #include "llvm/ADT/iterator.h" |
32 | | #include "llvm/ADT/iterator_range.h" |
33 | | #include "llvm/Support/Casting.h" |
34 | | #include "llvm/Support/Compiler.h" |
35 | | #include "llvm/Support/TrailingObjects.h" |
36 | | #include <cassert> |
37 | | #include <cstddef> |
38 | | #include <iterator> |
39 | | #include <utility> |
40 | | |
41 | | namespace clang { |
42 | | |
43 | | class ASTContext; |
44 | | |
45 | | //===----------------------------------------------------------------------===// |
46 | | // AST classes for clauses. |
47 | | //===----------------------------------------------------------------------===// |
48 | | |
49 | | /// This is a basic class for representing single OpenMP clause. |
50 | | class OMPClause { |
51 | | /// Starting location of the clause (the clause keyword). |
52 | | SourceLocation StartLoc; |
53 | | |
54 | | /// Ending location of the clause. |
55 | | SourceLocation EndLoc; |
56 | | |
57 | | /// Kind of the clause. |
58 | | OpenMPClauseKind Kind; |
59 | | |
60 | | protected: |
61 | | OMPClause(OpenMPClauseKind K, SourceLocation StartLoc, SourceLocation EndLoc) |
62 | 119k | : StartLoc(StartLoc), EndLoc(EndLoc), Kind(K) {} |
63 | | |
64 | | public: |
65 | | /// Returns the starting location of the clause. |
66 | 45.3k | SourceLocation getBeginLoc() const { return StartLoc; } |
67 | | |
68 | | /// Returns the ending location of the clause. |
69 | 42.8k | SourceLocation getEndLoc() const { return EndLoc; } |
70 | | |
71 | | /// Sets the starting location of the clause. |
72 | 12.7k | void setLocStart(SourceLocation Loc) { StartLoc = Loc; } |
73 | | |
74 | | /// Sets the ending location of the clause. |
75 | 12.7k | void setLocEnd(SourceLocation Loc) { EndLoc = Loc; } |
76 | | |
77 | | /// Returns kind of OpenMP clause (private, shared, reduction, etc.). |
78 | 1.41M | OpenMPClauseKind getClauseKind() const { return Kind; } |
79 | | |
80 | 18.9k | bool isImplicit() const { return StartLoc.isInvalid(); } |
81 | | |
82 | | using child_iterator = StmtIterator; |
83 | | using const_child_iterator = ConstStmtIterator; |
84 | | using child_range = llvm::iterator_range<child_iterator>; |
85 | | using const_child_range = llvm::iterator_range<const_child_iterator>; |
86 | | |
87 | | child_range children(); |
88 | 8 | const_child_range children() const { |
89 | 8 | auto Children = const_cast<OMPClause *>(this)->children(); |
90 | 8 | return const_child_range(Children.begin(), Children.end()); |
91 | 8 | } |
92 | | |
93 | | static bool classof(const OMPClause *) { return true; } |
94 | | }; |
95 | | |
96 | | /// Class that handles pre-initialization statement for some clauses, like |
97 | | /// 'shedule', 'firstprivate' etc. |
98 | | class OMPClauseWithPreInit { |
99 | | friend class OMPClauseReader; |
100 | | |
101 | | /// Pre-initialization statement for the clause. |
102 | | Stmt *PreInit = nullptr; |
103 | | |
104 | | /// Region that captures the associated stmt. |
105 | | OpenMPDirectiveKind CaptureRegion = OMPD_unknown; |
106 | | |
107 | | protected: |
108 | 68.2k | OMPClauseWithPreInit(const OMPClause *This) { |
109 | 68.2k | assert(get(This) && "get is not tuned for pre-init."); |
110 | 68.2k | } |
111 | | |
112 | | /// Set pre-initialization statement for the clause. |
113 | 68.2k | void setPreInitStmt(Stmt *S, OpenMPDirectiveKind ThisRegion = OMPD_unknown) { |
114 | 68.2k | PreInit = S; |
115 | 68.2k | CaptureRegion = ThisRegion; |
116 | 68.2k | } |
117 | | |
118 | | public: |
119 | | /// Get pre-initialization statement for the clause. |
120 | 42.9k | const Stmt *getPreInitStmt() const { return PreInit; } |
121 | | |
122 | | /// Get pre-initialization statement for the clause. |
123 | 6.98k | Stmt *getPreInitStmt() { return PreInit; } |
124 | | |
125 | | /// Get capture region for the stmt in the clause. |
126 | 37.8k | OpenMPDirectiveKind getCaptureRegion() const { return CaptureRegion; } |
127 | | |
128 | | static OMPClauseWithPreInit *get(OMPClause *C); |
129 | | static const OMPClauseWithPreInit *get(const OMPClause *C); |
130 | | }; |
131 | | |
132 | | /// Class that handles post-update expression for some clauses, like |
133 | | /// 'lastprivate', 'reduction' etc. |
134 | | class OMPClauseWithPostUpdate : public OMPClauseWithPreInit { |
135 | | friend class OMPClauseReader; |
136 | | |
137 | | /// Post-update expression for the clause. |
138 | | Expr *PostUpdate = nullptr; |
139 | | |
140 | | protected: |
141 | 18.6k | OMPClauseWithPostUpdate(const OMPClause *This) : OMPClauseWithPreInit(This) { |
142 | 18.6k | assert(get(This) && "get is not tuned for post-update."); |
143 | 18.6k | } |
144 | | |
145 | | /// Set pre-initialization statement for the clause. |
146 | 18.6k | void setPostUpdateExpr(Expr *S) { PostUpdate = S; } |
147 | | |
148 | | public: |
149 | | /// Get post-update expression for the clause. |
150 | 1.96k | const Expr *getPostUpdateExpr() const { return PostUpdate; } |
151 | | |
152 | | /// Get post-update expression for the clause. |
153 | 1.20k | Expr *getPostUpdateExpr() { return PostUpdate; } |
154 | | |
155 | | static OMPClauseWithPostUpdate *get(OMPClause *C); |
156 | | static const OMPClauseWithPostUpdate *get(const OMPClause *C); |
157 | | }; |
158 | | |
159 | | /// This structure contains most locations needed for by an OMPVarListClause. |
160 | | struct OMPVarListLocTy { |
161 | | /// Starting location of the clause (the clause keyword). |
162 | | SourceLocation StartLoc; |
163 | | /// Location of '('. |
164 | | SourceLocation LParenLoc; |
165 | | /// Ending location of the clause. |
166 | | SourceLocation EndLoc; |
167 | 7.68k | OMPVarListLocTy() = default; |
168 | | OMPVarListLocTy(SourceLocation StartLoc, SourceLocation LParenLoc, |
169 | | SourceLocation EndLoc) |
170 | 47.1k | : StartLoc(StartLoc), LParenLoc(LParenLoc), EndLoc(EndLoc) {} |
171 | | }; |
172 | | |
173 | | /// This represents clauses with the list of variables like 'private', |
174 | | /// 'firstprivate', 'copyin', 'shared', or 'reduction' clauses in the |
175 | | /// '#pragma omp ...' directives. |
176 | | template <class T> class OMPVarListClause : public OMPClause { |
177 | | friend class OMPClauseReader; |
178 | | |
179 | | /// Location of '('. |
180 | | SourceLocation LParenLoc; |
181 | | |
182 | | /// Number of variables in the list. |
183 | | unsigned NumVars; |
184 | | |
185 | | protected: |
186 | | /// Build a clause with \a N variables |
187 | | /// |
188 | | /// \param K Kind of the clause. |
189 | | /// \param StartLoc Starting location of the clause (the clause keyword). |
190 | | /// \param LParenLoc Location of '('. |
191 | | /// \param EndLoc Ending location of the clause. |
192 | | /// \param N Number of the variables in the clause. |
193 | | OMPVarListClause(OpenMPClauseKind K, SourceLocation StartLoc, |
194 | | SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N) |
195 | 86.7k | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} clang::OMPVarListClause<clang::OMPPrivateClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 8.53k | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPFirstprivateClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 31.5k | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPLastprivateClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 3.02k | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPSharedClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 2.25k | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPLinearClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 2.05k | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPAlignedClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 1.27k | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPCopyinClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 380 | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 158 | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPReductionClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 11.2k | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 1.46k | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPInReductionClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 862 | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPFlushClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 60 | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPDependClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 2.71k | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPMapClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 16.8k | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPToClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 818 | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPFromClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 394 | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 428 | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int) Line | Count | Source | 195 | 2.54k | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
|
196 | | |
197 | | /// Fetches list of variables associated with this clause. |
198 | 384k | MutableArrayRef<Expr *> getVarRefs() { |
199 | 384k | return MutableArrayRef<Expr *>( |
200 | 384k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); |
201 | 384k | } clang::OMPVarListClause<clang::OMPFirstprivateClause>::getVarRefs() Line | Count | Source | 198 | 94.5k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 94.5k | return MutableArrayRef<Expr *>( | 200 | 94.5k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 94.5k | } |
clang::OMPVarListClause<clang::OMPLastprivateClause>::getVarRefs() Line | Count | Source | 198 | 30.5k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 30.5k | return MutableArrayRef<Expr *>( | 200 | 30.5k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 30.5k | } |
clang::OMPVarListClause<clang::OMPReductionClause>::getVarRefs() Line | Count | Source | 198 | 110k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 110k | return MutableArrayRef<Expr *>( | 200 | 110k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 110k | } |
clang::OMPVarListClause<clang::OMPPrivateClause>::getVarRefs() Line | Count | Source | 198 | 41.4k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 41.4k | return MutableArrayRef<Expr *>( | 200 | 41.4k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 41.4k | } |
clang::OMPVarListClause<clang::OMPCopyinClause>::getVarRefs() Line | Count | Source | 198 | 2.61k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 2.61k | return MutableArrayRef<Expr *>( | 200 | 2.61k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 2.61k | } |
clang::OMPVarListClause<clang::OMPLinearClause>::getVarRefs() Line | Count | Source | 198 | 38.4k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 38.4k | return MutableArrayRef<Expr *>( | 200 | 38.4k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 38.4k | } |
clang::OMPVarListClause<clang::OMPAlignedClause>::getVarRefs() Line | Count | Source | 198 | 4.19k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 4.19k | return MutableArrayRef<Expr *>( | 200 | 4.19k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 4.19k | } |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::getVarRefs() Line | Count | Source | 198 | 1.23k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 1.23k | return MutableArrayRef<Expr *>( | 200 | 1.23k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 1.23k | } |
clang::OMPVarListClause<clang::OMPDependClause>::getVarRefs() Line | Count | Source | 198 | 5.45k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 5.45k | return MutableArrayRef<Expr *>( | 200 | 5.45k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 5.45k | } |
clang::OMPVarListClause<clang::OMPInReductionClause>::getVarRefs() Line | Count | Source | 198 | 12.6k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 12.6k | return MutableArrayRef<Expr *>( | 200 | 12.6k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 12.6k | } |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::getVarRefs() Line | Count | Source | 198 | 12.7k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 12.7k | return MutableArrayRef<Expr *>( | 200 | 12.7k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 12.7k | } |
clang::OMPVarListClause<clang::OMPFlushClause>::getVarRefs() Line | Count | Source | 198 | 104 | MutableArrayRef<Expr *> getVarRefs() { | 199 | 104 | return MutableArrayRef<Expr *>( | 200 | 104 | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 104 | } |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::getVarRefs() Line | Count | Source | 198 | 1.76k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 1.76k | return MutableArrayRef<Expr *>( | 200 | 1.76k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 1.76k | } |
clang::OMPVarListClause<clang::OMPSharedClause>::getVarRefs() Line | Count | Source | 198 | 3.72k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 3.72k | return MutableArrayRef<Expr *>( | 200 | 3.72k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 3.72k | } |
clang::OMPVarListClause<clang::OMPMapClause>::getVarRefs() Line | Count | Source | 198 | 17.9k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 17.9k | return MutableArrayRef<Expr *>( | 200 | 17.9k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 17.9k | } |
clang::OMPVarListClause<clang::OMPToClause>::getVarRefs() Line | Count | Source | 198 | 800 | MutableArrayRef<Expr *> getVarRefs() { | 199 | 800 | return MutableArrayRef<Expr *>( | 200 | 800 | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 800 | } |
clang::OMPVarListClause<clang::OMPFromClause>::getVarRefs() Line | Count | Source | 198 | 424 | MutableArrayRef<Expr *> getVarRefs() { | 199 | 424 | return MutableArrayRef<Expr *>( | 200 | 424 | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 424 | } |
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::getVarRefs() Line | Count | Source | 198 | 5.79k | MutableArrayRef<Expr *> getVarRefs() { | 199 | 5.79k | return MutableArrayRef<Expr *>( | 200 | 5.79k | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); | 201 | 5.79k | } |
|
202 | | |
203 | | /// Sets the list of variables for this clause. |
204 | 86.7k | void setVarRefs(ArrayRef<Expr *> VL) { |
205 | 86.7k | assert(VL.size() == NumVars && |
206 | 86.7k | "Number of variables is not the same as the preallocated buffer"); |
207 | 86.7k | std::copy(VL.begin(), VL.end(), |
208 | 86.7k | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); |
209 | 86.7k | } clang::OMPVarListClause<clang::OMPPrivateClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 8.53k | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 8.53k | assert(VL.size() == NumVars && | 206 | 8.53k | "Number of variables is not the same as the preallocated buffer"); | 207 | 8.53k | std::copy(VL.begin(), VL.end(), | 208 | 8.53k | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 8.53k | } |
clang::OMPVarListClause<clang::OMPFirstprivateClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 31.5k | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 31.5k | assert(VL.size() == NumVars && | 206 | 31.5k | "Number of variables is not the same as the preallocated buffer"); | 207 | 31.5k | std::copy(VL.begin(), VL.end(), | 208 | 31.5k | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 31.5k | } |
clang::OMPVarListClause<clang::OMPLastprivateClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 3.02k | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 3.02k | assert(VL.size() == NumVars && | 206 | 3.02k | "Number of variables is not the same as the preallocated buffer"); | 207 | 3.02k | std::copy(VL.begin(), VL.end(), | 208 | 3.02k | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 3.02k | } |
clang::OMPVarListClause<clang::OMPSharedClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 2.25k | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 2.25k | assert(VL.size() == NumVars && | 206 | 2.25k | "Number of variables is not the same as the preallocated buffer"); | 207 | 2.25k | std::copy(VL.begin(), VL.end(), | 208 | 2.25k | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 2.25k | } |
clang::OMPVarListClause<clang::OMPReductionClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 11.2k | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 11.2k | assert(VL.size() == NumVars && | 206 | 11.2k | "Number of variables is not the same as the preallocated buffer"); | 207 | 11.2k | std::copy(VL.begin(), VL.end(), | 208 | 11.2k | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 11.2k | } |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 1.46k | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 1.46k | assert(VL.size() == NumVars && | 206 | 1.46k | "Number of variables is not the same as the preallocated buffer"); | 207 | 1.46k | std::copy(VL.begin(), VL.end(), | 208 | 1.46k | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 1.46k | } |
clang::OMPVarListClause<clang::OMPInReductionClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 862 | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 862 | assert(VL.size() == NumVars && | 206 | 862 | "Number of variables is not the same as the preallocated buffer"); | 207 | 862 | std::copy(VL.begin(), VL.end(), | 208 | 862 | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 862 | } |
clang::OMPVarListClause<clang::OMPLinearClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 2.05k | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 2.05k | assert(VL.size() == NumVars && | 206 | 2.05k | "Number of variables is not the same as the preallocated buffer"); | 207 | 2.05k | std::copy(VL.begin(), VL.end(), | 208 | 2.05k | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 2.05k | } |
clang::OMPVarListClause<clang::OMPAlignedClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 1.27k | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 1.27k | assert(VL.size() == NumVars && | 206 | 1.27k | "Number of variables is not the same as the preallocated buffer"); | 207 | 1.27k | std::copy(VL.begin(), VL.end(), | 208 | 1.27k | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 1.27k | } |
clang::OMPVarListClause<clang::OMPCopyinClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 380 | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 380 | assert(VL.size() == NumVars && | 206 | 380 | "Number of variables is not the same as the preallocated buffer"); | 207 | 380 | std::copy(VL.begin(), VL.end(), | 208 | 380 | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 380 | } |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 158 | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 158 | assert(VL.size() == NumVars && | 206 | 158 | "Number of variables is not the same as the preallocated buffer"); | 207 | 158 | std::copy(VL.begin(), VL.end(), | 208 | 158 | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 158 | } |
clang::OMPVarListClause<clang::OMPFlushClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 60 | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 60 | assert(VL.size() == NumVars && | 206 | 60 | "Number of variables is not the same as the preallocated buffer"); | 207 | 60 | std::copy(VL.begin(), VL.end(), | 208 | 60 | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 60 | } |
clang::OMPVarListClause<clang::OMPDependClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 2.71k | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 2.71k | assert(VL.size() == NumVars && | 206 | 2.71k | "Number of variables is not the same as the preallocated buffer"); | 207 | 2.71k | std::copy(VL.begin(), VL.end(), | 208 | 2.71k | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 2.71k | } |
clang::OMPVarListClause<clang::OMPMapClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 16.8k | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 16.8k | assert(VL.size() == NumVars && | 206 | 16.8k | "Number of variables is not the same as the preallocated buffer"); | 207 | 16.8k | std::copy(VL.begin(), VL.end(), | 208 | 16.8k | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 16.8k | } |
clang::OMPVarListClause<clang::OMPToClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 818 | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 818 | assert(VL.size() == NumVars && | 206 | 818 | "Number of variables is not the same as the preallocated buffer"); | 207 | 818 | std::copy(VL.begin(), VL.end(), | 208 | 818 | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 818 | } |
clang::OMPVarListClause<clang::OMPFromClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 394 | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 394 | assert(VL.size() == NumVars && | 206 | 394 | "Number of variables is not the same as the preallocated buffer"); | 207 | 394 | std::copy(VL.begin(), VL.end(), | 208 | 394 | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 394 | } |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 428 | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 428 | assert(VL.size() == NumVars && | 206 | 428 | "Number of variables is not the same as the preallocated buffer"); | 207 | 428 | std::copy(VL.begin(), VL.end(), | 208 | 428 | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 428 | } |
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>) Line | Count | Source | 204 | 2.54k | void setVarRefs(ArrayRef<Expr *> VL) { | 205 | 2.54k | assert(VL.size() == NumVars && | 206 | 2.54k | "Number of variables is not the same as the preallocated buffer"); | 207 | 2.54k | std::copy(VL.begin(), VL.end(), | 208 | 2.54k | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); | 209 | 2.54k | } |
|
210 | | |
211 | | public: |
212 | | using varlist_iterator = MutableArrayRef<Expr *>::iterator; |
213 | | using varlist_const_iterator = ArrayRef<const Expr *>::iterator; |
214 | | using varlist_range = llvm::iterator_range<varlist_iterator>; |
215 | | using varlist_const_range = llvm::iterator_range<varlist_const_iterator>; |
216 | | |
217 | 700k | unsigned varlist_size() const { return NumVars; } clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlist_size() const Line | Count | Source | 217 | 13.6k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPMapClause>::varlist_size() const Line | Count | Source | 217 | 175k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPToClause>::varlist_size() const Line | Count | Source | 217 | 6.66k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPFromClause>::varlist_size() const Line | Count | Source | 217 | 2.07k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlist_size() const Line | Count | Source | 217 | 4.13k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPReductionClause>::varlist_size() const Line | Count | Source | 217 | 185k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlist_size() const Line | Count | Source | 217 | 121k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPPrivateClause>::varlist_size() const Line | Count | Source | 217 | 8.87k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPCopyinClause>::varlist_size() const Line | Count | Source | 217 | 2.63k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlist_size() const Line | Count | Source | 217 | 42.5k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPLinearClause>::varlist_size() const Line | Count | Source | 217 | 85.9k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlist_size() const Line | Count | Source | 217 | 1.23k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPInReductionClause>::varlist_size() const Line | Count | Source | 217 | 28.7k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlist_size() const Line | Count | Source | 217 | 18.3k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPSharedClause>::varlist_size() const Line | Count | Source | 217 | 1.03k | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPAlignedClause>::varlist_size() const Line | Count | Source | 217 | 604 | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPFlushClause>::varlist_size() const Line | Count | Source | 217 | 36 | unsigned varlist_size() const { return NumVars; } |
clang::OMPVarListClause<clang::OMPDependClause>::varlist_size() const Line | Count | Source | 217 | 1.43k | unsigned varlist_size() const { return NumVars; } |
|
218 | 8.04k | bool varlist_empty() const { return NumVars == 0; } clang::OMPVarListClause<clang::OMPPrivateClause>::varlist_empty() const Line | Count | Source | 218 | 1.71k | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlist_empty() const Line | Count | Source | 218 | 648 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlist_empty() const Line | Count | Source | 218 | 264 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPSharedClause>::varlist_empty() const Line | Count | Source | 218 | 400 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPReductionClause>::varlist_empty() const Line | Count | Source | 218 | 912 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlist_empty() const Line | Count | Source | 218 | 104 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPInReductionClause>::varlist_empty() const Line | Count | Source | 218 | 60 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPLinearClause>::varlist_empty() const Line | Count | Source | 218 | 224 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPAlignedClause>::varlist_empty() const Line | Count | Source | 218 | 192 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPCopyinClause>::varlist_empty() const Line | Count | Source | 218 | 100 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlist_empty() const Line | Count | Source | 218 | 32 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPFlushClause>::varlist_empty() const Line | Count | Source | 218 | 16 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPDependClause>::varlist_empty() const Line | Count | Source | 218 | 404 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPMapClause>::varlist_empty() const Line | Count | Source | 218 | 1.76k | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPToClause>::varlist_empty() const Line | Count | Source | 218 | 44 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPFromClause>::varlist_empty() const Line | Count | Source | 218 | 16 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlist_empty() const Line | Count | Source | 218 | 20 | bool varlist_empty() const { return NumVars == 0; } |
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlist_empty() const Line | Count | Source | 218 | 1.13k | bool varlist_empty() const { return NumVars == 0; } |
|
219 | | |
220 | 32.3k | varlist_range varlists() { |
221 | 32.3k | return varlist_range(varlist_begin(), varlist_end()); |
222 | 32.3k | } clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlists() Line | Count | Source | 220 | 3.57k | varlist_range varlists() { | 221 | 3.57k | return varlist_range(varlist_begin(), varlist_end()); | 222 | 3.57k | } |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlists() Line | Count | Source | 220 | 254 | varlist_range varlists() { | 221 | 254 | return varlist_range(varlist_begin(), varlist_end()); | 222 | 254 | } |
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlists() Line | Count | Source | 220 | 3.65k | varlist_range varlists() { | 221 | 3.65k | return varlist_range(varlist_begin(), varlist_end()); | 222 | 3.65k | } |
clang::OMPVarListClause<clang::OMPReductionClause>::varlists() Line | Count | Source | 220 | 8.23k | varlist_range varlists() { | 221 | 8.23k | return varlist_range(varlist_begin(), varlist_end()); | 222 | 8.23k | } |
clang::OMPVarListClause<clang::OMPAlignedClause>::varlists() Line | Count | Source | 220 | 472 | varlist_range varlists() { | 221 | 472 | return varlist_range(varlist_begin(), varlist_end()); | 222 | 472 | } |
clang::OMPVarListClause<clang::OMPLinearClause>::varlists() Line | Count | Source | 220 | 1.98k | varlist_range varlists() { | 221 | 1.98k | return varlist_range(varlist_begin(), varlist_end()); | 222 | 1.98k | } |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlists() Line | Count | Source | 220 | 74 | varlist_range varlists() { | 221 | 74 | return varlist_range(varlist_begin(), varlist_end()); | 222 | 74 | } |
clang::OMPVarListClause<clang::OMPDependClause>::varlists() Line | Count | Source | 220 | 908 | varlist_range varlists() { | 221 | 908 | return varlist_range(varlist_begin(), varlist_end()); | 222 | 908 | } |
clang::OMPVarListClause<clang::OMPInReductionClause>::varlists() Line | Count | Source | 220 | 692 | varlist_range varlists() { | 221 | 692 | return varlist_range(varlist_begin(), varlist_end()); | 222 | 692 | } |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlists() Line | Count | Source | 220 | 854 | varlist_range varlists() { | 221 | 854 | return varlist_range(varlist_begin(), varlist_end()); | 222 | 854 | } |
clang::OMPVarListClause<clang::OMPFlushClause>::varlists() Line | Count | Source | 220 | 28 | varlist_range varlists() { | 221 | 28 | return varlist_range(varlist_begin(), varlist_end()); | 222 | 28 | } |
clang::OMPVarListClause<clang::OMPPrivateClause>::varlists() Line | Count | Source | 220 | 3.49k | varlist_range varlists() { | 221 | 3.49k | return varlist_range(varlist_begin(), varlist_end()); | 222 | 3.49k | } |
clang::OMPVarListClause<clang::OMPSharedClause>::varlists() Line | Count | Source | 220 | 862 | varlist_range varlists() { | 221 | 862 | return varlist_range(varlist_begin(), varlist_end()); | 222 | 862 | } |
clang::OMPVarListClause<clang::OMPCopyinClause>::varlists() Line | Count | Source | 220 | 146 | varlist_range varlists() { | 221 | 146 | return varlist_range(varlist_begin(), varlist_end()); | 222 | 146 | } |
clang::OMPVarListClause<clang::OMPMapClause>::varlists() Line | Count | Source | 220 | 5.45k | varlist_range varlists() { | 221 | 5.45k | return varlist_range(varlist_begin(), varlist_end()); | 222 | 5.45k | } |
clang::OMPVarListClause<clang::OMPToClause>::varlists() Line | Count | Source | 220 | 282 | varlist_range varlists() { | 221 | 282 | return varlist_range(varlist_begin(), varlist_end()); | 222 | 282 | } |
clang::OMPVarListClause<clang::OMPFromClause>::varlists() Line | Count | Source | 220 | 182 | varlist_range varlists() { | 221 | 182 | return varlist_range(varlist_begin(), varlist_end()); | 222 | 182 | } |
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlists() Line | Count | Source | 220 | 1.20k | varlist_range varlists() { | 221 | 1.20k | return varlist_range(varlist_begin(), varlist_end()); | 222 | 1.20k | } |
|
223 | 11.4k | varlist_const_range varlists() const { |
224 | 11.4k | return varlist_const_range(varlist_begin(), varlist_end()); |
225 | 11.4k | } clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlists() const Line | Count | Source | 223 | 5.14k | varlist_const_range varlists() const { | 224 | 5.14k | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 5.14k | } |
clang::OMPVarListClause<clang::OMPAlignedClause>::varlists() const Line | Count | Source | 223 | 322 | varlist_const_range varlists() const { | 224 | 322 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 322 | } |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlists() const Line | Count | Source | 223 | 156 | varlist_const_range varlists() const { | 224 | 156 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 156 | } |
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlists() const Line | Count | Source | 223 | 479 | varlist_const_range varlists() const { | 224 | 479 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 479 | } |
clang::OMPVarListClause<clang::OMPReductionClause>::varlists() const Line | Count | Source | 223 | 836 | varlist_const_range varlists() const { | 224 | 836 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 836 | } |
clang::OMPVarListClause<clang::OMPLinearClause>::varlists() const Line | Count | Source | 223 | 494 | varlist_const_range varlists() const { | 224 | 494 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 494 | } |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlists() const Line | Count | Source | 223 | 38 | varlist_const_range varlists() const { | 224 | 38 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 38 | } |
clang::OMPVarListClause<clang::OMPDependClause>::varlists() const Line | Count | Source | 223 | 868 | varlist_const_range varlists() const { | 224 | 868 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 868 | } |
clang::OMPVarListClause<clang::OMPInReductionClause>::varlists() const Line | Count | Source | 223 | 12 | varlist_const_range varlists() const { | 224 | 12 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 12 | } |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlists() const Line | Count | Source | 223 | 60 | varlist_const_range varlists() const { | 224 | 60 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 60 | } |
clang::OMPVarListClause<clang::OMPFlushClause>::varlists() const Line | Count | Source | 223 | 8 | varlist_const_range varlists() const { | 224 | 8 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 8 | } |
clang::OMPVarListClause<clang::OMPPrivateClause>::varlists() const Line | Count | Source | 223 | 526 | varlist_const_range varlists() const { | 224 | 526 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 526 | } |
clang::OMPVarListClause<clang::OMPSharedClause>::varlists() const Line | Count | Source | 223 | 108 | varlist_const_range varlists() const { | 224 | 108 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 108 | } |
clang::OMPVarListClause<clang::OMPCopyinClause>::varlists() const Line | Count | Source | 223 | 28 | varlist_const_range varlists() const { | 224 | 28 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 28 | } |
clang::OMPVarListClause<clang::OMPMapClause>::varlists() const Line | Count | Source | 223 | 1.85k | varlist_const_range varlists() const { | 224 | 1.85k | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 1.85k | } |
clang::OMPVarListClause<clang::OMPToClause>::varlists() const Line | Count | Source | 223 | 46 | varlist_const_range varlists() const { | 224 | 46 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 46 | } |
clang::OMPVarListClause<clang::OMPFromClause>::varlists() const Line | Count | Source | 223 | 32 | varlist_const_range varlists() const { | 224 | 32 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 32 | } |
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlists() const Line | Count | Source | 223 | 396 | varlist_const_range varlists() const { | 224 | 396 | return varlist_const_range(varlist_begin(), varlist_end()); | 225 | 396 | } |
|
226 | | |
227 | 89.0k | varlist_iterator varlist_begin() { return getVarRefs().begin(); } clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlist_begin() Line | Count | Source | 227 | 10.6k | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPPrivateClause>::varlist_begin() Line | Count | Source | 227 | 16.5k | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPCopyinClause>::varlist_begin() Line | Count | Source | 227 | 619 | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlist_begin() Line | Count | Source | 227 | 8.20k | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPLinearClause>::varlist_begin() Line | Count | Source | 227 | 4.50k | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPFlushClause>::varlist_begin() Line | Count | Source | 227 | 60 | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlist_begin() Line | Count | Source | 227 | 294 | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPReductionClause>::varlist_begin() Line | Count | Source | 227 | 23.3k | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPAlignedClause>::varlist_begin() Line | Count | Source | 227 | 1.14k | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlist_begin() Line | Count | Source | 227 | 348 | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPDependClause>::varlist_begin() Line | Count | Source | 227 | 2.61k | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPInReductionClause>::varlist_begin() Line | Count | Source | 227 | 2.08k | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlist_begin() Line | Count | Source | 227 | 2.51k | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPSharedClause>::varlist_begin() Line | Count | Source | 227 | 2.06k | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPMapClause>::varlist_begin() Line | Count | Source | 227 | 9.97k | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPToClause>::varlist_begin() Line | Count | Source | 227 | 422 | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPFromClause>::varlist_begin() Line | Count | Source | 227 | 220 | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlist_begin() Line | Count | Source | 227 | 3.46k | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
|
228 | 294k | varlist_iterator varlist_end() { return getVarRefs().end(); } clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlist_end() Line | Count | Source | 228 | 83.9k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPReductionClause>::varlist_end() Line | Count | Source | 228 | 87.1k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPFlushClause>::varlist_end() Line | Count | Source | 228 | 44 | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlist_end() Line | Count | Source | 228 | 1.46k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlist_end() Line | Count | Source | 228 | 22.3k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPAlignedClause>::varlist_end() Line | Count | Source | 228 | 3.04k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPLinearClause>::varlist_end() Line | Count | Source | 228 | 33.9k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlist_end() Line | Count | Source | 228 | 890 | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPDependClause>::varlist_end() Line | Count | Source | 228 | 1.53k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPInReductionClause>::varlist_end() Line | Count | Source | 228 | 10.5k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlist_end() Line | Count | Source | 228 | 10.2k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPPrivateClause>::varlist_end() Line | Count | Source | 228 | 24.8k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPCopyinClause>::varlist_end() Line | Count | Source | 228 | 1.99k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPSharedClause>::varlist_end() Line | Count | Source | 228 | 1.66k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPMapClause>::varlist_end() Line | Count | Source | 228 | 7.99k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPToClause>::varlist_end() Line | Count | Source | 228 | 378 | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPFromClause>::varlist_end() Line | Count | Source | 228 | 204 | varlist_iterator varlist_end() { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlist_end() Line | Count | Source | 228 | 2.33k | varlist_iterator varlist_end() { return getVarRefs().end(); } |
|
229 | 17.7k | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlist_begin() const Line | Count | Source | 229 | 9.48k | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPAlignedClause>::varlist_begin() const Line | Count | Source | 229 | 322 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPFlushClause>::varlist_begin() const Line | Count | Source | 229 | 12 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPPrivateClause>::varlist_begin() const Line | Count | Source | 229 | 1.28k | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPCopyinClause>::varlist_begin() const Line | Count | Source | 229 | 50 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlist_begin() const Line | Count | Source | 229 | 1.33k | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPReductionClause>::varlist_begin() const Line | Count | Source | 229 | 836 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPLinearClause>::varlist_begin() const Line | Count | Source | 229 | 824 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlist_begin() const Line | Count | Source | 229 | 38 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPDependClause>::varlist_begin() const Line | Count | Source | 229 | 868 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPInReductionClause>::varlist_begin() const Line | Count | Source | 229 | 12 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlist_begin() const Line | Count | Source | 229 | 60 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlist_begin() const Line | Count | Source | 229 | 224 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPSharedClause>::varlist_begin() const Line | Count | Source | 229 | 108 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPMapClause>::varlist_begin() const Line | Count | Source | 229 | 1.85k | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPToClause>::varlist_begin() const Line | Count | Source | 229 | 46 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPFromClause>::varlist_begin() const Line | Count | Source | 229 | 32 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlist_begin() const Line | Count | Source | 229 | 396 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
|
230 | 68.2k | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlist_end() const Line | Count | Source | 230 | 33.3k | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPReductionClause>::varlist_end() const Line | Count | Source | 230 | 15.3k | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPPrivateClause>::varlist_end() const Line | Count | Source | 230 | 3.10k | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPCopyinClause>::varlist_end() const Line | Count | Source | 230 | 328 | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlist_end() const Line | Count | Source | 230 | 5.75k | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPLinearClause>::varlist_end() const Line | Count | Source | 230 | 5.09k | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPAlignedClause>::varlist_end() const Line | Count | Source | 230 | 696 | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlist_end() const Line | Count | Source | 230 | 266 | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPFlushClause>::varlist_end() const Line | Count | Source | 230 | 12 | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlist_end() const Line | Count | Source | 230 | 428 | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPDependClause>::varlist_end() const Line | Count | Source | 230 | 868 | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPInReductionClause>::varlist_end() const Line | Count | Source | 230 | 84 | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlist_end() const Line | Count | Source | 230 | 540 | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPSharedClause>::varlist_end() const Line | Count | Source | 230 | 108 | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPMapClause>::varlist_end() const Line | Count | Source | 230 | 1.85k | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPToClause>::varlist_end() const Line | Count | Source | 230 | 46 | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPFromClause>::varlist_end() const Line | Count | Source | 230 | 32 | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlist_end() const Line | Count | Source | 230 | 396 | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
|
231 | | |
232 | | /// Sets the location of '('. |
233 | 8.13k | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } clang::OMPVarListClause<clang::OMPPrivateClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 906 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPFirstprivateClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 2.74k | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPLastprivateClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 270 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPSharedClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 172 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPReductionClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 576 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 50 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPInReductionClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 28 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPLinearClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 216 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPAlignedClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 132 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPCopyinClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 56 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 18 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPFlushClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 8 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPDependClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 528 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPMapClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 1.87k | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPToClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 46 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPFromClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 32 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 84 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::setLParenLoc(clang::SourceLocation) Line | Count | Source | 233 | 396 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
|
234 | | |
235 | | /// Returns the location of '('. |
236 | 28.2k | SourceLocation getLParenLoc() const { return LParenLoc; } clang::OMPVarListClause<clang::OMPPrivateClause>::getLParenLoc() const Line | Count | Source | 236 | 3.49k | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPFirstprivateClause>::getLParenLoc() const Line | Count | Source | 236 | 3.57k | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPLastprivateClause>::getLParenLoc() const Line | Count | Source | 236 | 944 | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPSharedClause>::getLParenLoc() const Line | Count | Source | 236 | 862 | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPReductionClause>::getLParenLoc() const Line | Count | Source | 236 | 8.23k | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::getLParenLoc() const Line | Count | Source | 236 | 854 | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPInReductionClause>::getLParenLoc() const Line | Count | Source | 236 | 692 | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPLinearClause>::getLParenLoc() const Line | Count | Source | 236 | 642 | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPAlignedClause>::getLParenLoc() const Line | Count | Source | 236 | 472 | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPCopyinClause>::getLParenLoc() const Line | Count | Source | 236 | 146 | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::getLParenLoc() const Line | Count | Source | 236 | 74 | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPFlushClause>::getLParenLoc() const Line | Count | Source | 236 | 28 | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPDependClause>::getLParenLoc() const Line | Count | Source | 236 | 872 | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPMapClause>::getLParenLoc() const Line | Count | Source | 236 | 5.45k | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPToClause>::getLParenLoc() const Line | Count | Source | 236 | 282 | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPFromClause>::getLParenLoc() const Line | Count | Source | 236 | 182 | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::getLParenLoc() const Line | Count | Source | 236 | 254 | SourceLocation getLParenLoc() const { return LParenLoc; } |
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::getLParenLoc() const Line | Count | Source | 236 | 1.20k | SourceLocation getLParenLoc() const { return LParenLoc; } |
|
237 | | |
238 | | /// Fetches list of all variables in the clause. |
239 | 86.1k | ArrayRef<const Expr *> getVarRefs() const { |
240 | 86.1k | return llvm::makeArrayRef( |
241 | 86.1k | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), |
242 | 86.1k | NumVars); |
243 | 86.1k | } clang::OMPVarListClause<clang::OMPFirstprivateClause>::getVarRefs() const Line | Count | Source | 239 | 42.8k | ArrayRef<const Expr *> getVarRefs() const { | 240 | 42.8k | return llvm::makeArrayRef( | 241 | 42.8k | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 42.8k | NumVars); | 243 | 42.8k | } |
clang::OMPVarListClause<clang::OMPReductionClause>::getVarRefs() const Line | Count | Source | 239 | 16.1k | ArrayRef<const Expr *> getVarRefs() const { | 240 | 16.1k | return llvm::makeArrayRef( | 241 | 16.1k | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 16.1k | NumVars); | 243 | 16.1k | } |
clang::OMPVarListClause<clang::OMPLastprivateClause>::getVarRefs() const Line | Count | Source | 239 | 7.11k | ArrayRef<const Expr *> getVarRefs() const { | 240 | 7.11k | return llvm::makeArrayRef( | 241 | 7.11k | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 7.11k | NumVars); | 243 | 7.11k | } |
clang::OMPVarListClause<clang::OMPPrivateClause>::getVarRefs() const Line | Count | Source | 239 | 4.39k | ArrayRef<const Expr *> getVarRefs() const { | 240 | 4.39k | return llvm::makeArrayRef( | 241 | 4.39k | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 4.39k | NumVars); | 243 | 4.39k | } |
clang::OMPVarListClause<clang::OMPCopyinClause>::getVarRefs() const Line | Count | Source | 239 | 378 | ArrayRef<const Expr *> getVarRefs() const { | 240 | 378 | return llvm::makeArrayRef( | 241 | 378 | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 378 | NumVars); | 243 | 378 | } |
clang::OMPVarListClause<clang::OMPLinearClause>::getVarRefs() const Line | Count | Source | 239 | 5.92k | ArrayRef<const Expr *> getVarRefs() const { | 240 | 5.92k | return llvm::makeArrayRef( | 241 | 5.92k | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 5.92k | NumVars); | 243 | 5.92k | } |
clang::OMPVarListClause<clang::OMPAlignedClause>::getVarRefs() const Line | Count | Source | 239 | 1.01k | ArrayRef<const Expr *> getVarRefs() const { | 240 | 1.01k | return llvm::makeArrayRef( | 241 | 1.01k | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 1.01k | NumVars); | 243 | 1.01k | } |
clang::OMPVarListClause<clang::OMPCopyprivateClause>::getVarRefs() const Line | Count | Source | 239 | 304 | ArrayRef<const Expr *> getVarRefs() const { | 240 | 304 | return llvm::makeArrayRef( | 241 | 304 | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 304 | NumVars); | 243 | 304 | } |
clang::OMPVarListClause<clang::OMPFlushClause>::getVarRefs() const Line | Count | Source | 239 | 24 | ArrayRef<const Expr *> getVarRefs() const { | 240 | 24 | return llvm::makeArrayRef( | 241 | 24 | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 24 | NumVars); | 243 | 24 | } |
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::getVarRefs() const Line | Count | Source | 239 | 652 | ArrayRef<const Expr *> getVarRefs() const { | 240 | 652 | return llvm::makeArrayRef( | 241 | 652 | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 652 | NumVars); | 243 | 652 | } |
clang::OMPVarListClause<clang::OMPDependClause>::getVarRefs() const Line | Count | Source | 239 | 1.75k | ArrayRef<const Expr *> getVarRefs() const { | 240 | 1.75k | return llvm::makeArrayRef( | 241 | 1.75k | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 1.75k | NumVars); | 243 | 1.75k | } |
clang::OMPVarListClause<clang::OMPInReductionClause>::getVarRefs() const Line | Count | Source | 239 | 96 | ArrayRef<const Expr *> getVarRefs() const { | 240 | 96 | return llvm::makeArrayRef( | 241 | 96 | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 96 | NumVars); | 243 | 96 | } |
clang::OMPVarListClause<clang::OMPTaskReductionClause>::getVarRefs() const Line | Count | Source | 239 | 600 | ArrayRef<const Expr *> getVarRefs() const { | 240 | 600 | return llvm::makeArrayRef( | 241 | 600 | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 600 | NumVars); | 243 | 600 | } |
clang::OMPVarListClause<clang::OMPSharedClause>::getVarRefs() const Line | Count | Source | 239 | 216 | ArrayRef<const Expr *> getVarRefs() const { | 240 | 216 | return llvm::makeArrayRef( | 241 | 216 | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 216 | NumVars); | 243 | 216 | } |
clang::OMPVarListClause<clang::OMPMapClause>::getVarRefs() const Line | Count | Source | 239 | 3.71k | ArrayRef<const Expr *> getVarRefs() const { | 240 | 3.71k | return llvm::makeArrayRef( | 241 | 3.71k | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 3.71k | NumVars); | 243 | 3.71k | } |
clang::OMPVarListClause<clang::OMPToClause>::getVarRefs() const Line | Count | Source | 239 | 92 | ArrayRef<const Expr *> getVarRefs() const { | 240 | 92 | return llvm::makeArrayRef( | 241 | 92 | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 92 | NumVars); | 243 | 92 | } |
clang::OMPVarListClause<clang::OMPFromClause>::getVarRefs() const Line | Count | Source | 239 | 64 | ArrayRef<const Expr *> getVarRefs() const { | 240 | 64 | return llvm::makeArrayRef( | 241 | 64 | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 64 | NumVars); | 243 | 64 | } |
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::getVarRefs() const Line | Count | Source | 239 | 792 | ArrayRef<const Expr *> getVarRefs() const { | 240 | 792 | return llvm::makeArrayRef( | 241 | 792 | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), | 242 | 792 | NumVars); | 243 | 792 | } |
|
244 | | }; |
245 | | |
246 | | /// This represents 'if' clause in the '#pragma omp ...' directive. |
247 | | /// |
248 | | /// \code |
249 | | /// #pragma omp parallel if(parallel:a > 5) |
250 | | /// \endcode |
251 | | /// In this example directive '#pragma omp parallel' has simple 'if' clause with |
252 | | /// condition 'a > 5' and directive name modifier 'parallel'. |
253 | | class OMPIfClause : public OMPClause, public OMPClauseWithPreInit { |
254 | | friend class OMPClauseReader; |
255 | | |
256 | | /// Location of '('. |
257 | | SourceLocation LParenLoc; |
258 | | |
259 | | /// Condition of the 'if' clause. |
260 | | Stmt *Condition = nullptr; |
261 | | |
262 | | /// Location of ':' (if any). |
263 | | SourceLocation ColonLoc; |
264 | | |
265 | | /// Directive name modifier for the clause. |
266 | | OpenMPDirectiveKind NameModifier = OMPD_unknown; |
267 | | |
268 | | /// Name modifier location. |
269 | | SourceLocation NameModifierLoc; |
270 | | |
271 | | /// Set condition. |
272 | 1.28k | void setCondition(Expr *Cond) { Condition = Cond; } |
273 | | |
274 | | /// Set directive name modifier for the clause. |
275 | 1.28k | void setNameModifier(OpenMPDirectiveKind NM) { NameModifier = NM; } |
276 | | |
277 | | /// Set location of directive name modifier for the clause. |
278 | 1.28k | void setNameModifierLoc(SourceLocation Loc) { NameModifierLoc = Loc; } |
279 | | |
280 | | /// Set location of ':'. |
281 | 1.28k | void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; } |
282 | | |
283 | | public: |
284 | | /// Build 'if' clause with condition \a Cond. |
285 | | /// |
286 | | /// \param NameModifier [OpenMP 4.1] Directive name modifier of clause. |
287 | | /// \param Cond Condition of the clause. |
288 | | /// \param HelperCond Helper condition for the clause. |
289 | | /// \param CaptureRegion Innermost OpenMP region where expressions in this |
290 | | /// clause must be captured. |
291 | | /// \param StartLoc Starting location of the clause. |
292 | | /// \param LParenLoc Location of '('. |
293 | | /// \param NameModifierLoc Location of directive name modifier. |
294 | | /// \param ColonLoc [OpenMP 4.1] Location of ':'. |
295 | | /// \param EndLoc Ending location of the clause. |
296 | | OMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Cond, Stmt *HelperCond, |
297 | | OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, |
298 | | SourceLocation LParenLoc, SourceLocation NameModifierLoc, |
299 | | SourceLocation ColonLoc, SourceLocation EndLoc) |
300 | | : OMPClause(OMPC_if, StartLoc, EndLoc), OMPClauseWithPreInit(this), |
301 | | LParenLoc(LParenLoc), Condition(Cond), ColonLoc(ColonLoc), |
302 | 5.93k | NameModifier(NameModifier), NameModifierLoc(NameModifierLoc) { |
303 | 5.93k | setPreInitStmt(HelperCond, CaptureRegion); |
304 | 5.93k | } |
305 | | |
306 | | /// Build an empty clause. |
307 | | OMPIfClause() |
308 | | : OMPClause(OMPC_if, SourceLocation(), SourceLocation()), |
309 | 1.28k | OMPClauseWithPreInit(this) {} |
310 | | |
311 | | /// Sets the location of '('. |
312 | 1.28k | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
313 | | |
314 | | /// Returns the location of '('. |
315 | 2.51k | SourceLocation getLParenLoc() const { return LParenLoc; } |
316 | | |
317 | | /// Return the location of ':'. |
318 | 2.51k | SourceLocation getColonLoc() const { return ColonLoc; } |
319 | | |
320 | | /// Returns condition. |
321 | 6.80k | Expr *getCondition() const { return cast_or_null<Expr>(Condition); } |
322 | | |
323 | | /// Return directive name modifier associated with the clause. |
324 | 11.9k | OpenMPDirectiveKind getNameModifier() const { return NameModifier; } |
325 | | |
326 | | /// Return the location of directive name modifier. |
327 | 5.61k | SourceLocation getNameModifierLoc() const { return NameModifierLoc; } |
328 | | |
329 | 448 | child_range children() { return child_range(&Condition, &Condition + 1); } |
330 | | |
331 | 69.8k | static bool classof(const OMPClause *T) { |
332 | 69.8k | return T->getClauseKind() == OMPC_if; |
333 | 69.8k | } |
334 | | }; |
335 | | |
336 | | /// This represents 'final' clause in the '#pragma omp ...' directive. |
337 | | /// |
338 | | /// \code |
339 | | /// #pragma omp task final(a > 5) |
340 | | /// \endcode |
341 | | /// In this example directive '#pragma omp task' has simple 'final' |
342 | | /// clause with condition 'a > 5'. |
343 | | class OMPFinalClause : public OMPClause { |
344 | | friend class OMPClauseReader; |
345 | | |
346 | | /// Location of '('. |
347 | | SourceLocation LParenLoc; |
348 | | |
349 | | /// Condition of the 'if' clause. |
350 | | Stmt *Condition = nullptr; |
351 | | |
352 | | /// Set condition. |
353 | 20 | void setCondition(Expr *Cond) { Condition = Cond; } |
354 | | |
355 | | public: |
356 | | /// Build 'final' clause with condition \a Cond. |
357 | | /// |
358 | | /// \param StartLoc Starting location of the clause. |
359 | | /// \param LParenLoc Location of '('. |
360 | | /// \param Cond Condition of the clause. |
361 | | /// \param EndLoc Ending location of the clause. |
362 | | OMPFinalClause(Expr *Cond, SourceLocation StartLoc, SourceLocation LParenLoc, |
363 | | SourceLocation EndLoc) |
364 | | : OMPClause(OMPC_final, StartLoc, EndLoc), LParenLoc(LParenLoc), |
365 | 202 | Condition(Cond) {} |
366 | | |
367 | | /// Build an empty clause. |
368 | | OMPFinalClause() |
369 | 20 | : OMPClause(OMPC_final, SourceLocation(), SourceLocation()) {} |
370 | | |
371 | | /// Sets the location of '('. |
372 | 20 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
373 | | |
374 | | /// Returns the location of '('. |
375 | 86 | SourceLocation getLParenLoc() const { return LParenLoc; } |
376 | | |
377 | | /// Returns condition. |
378 | 162 | Expr *getCondition() const { return cast_or_null<Expr>(Condition); } |
379 | | |
380 | 56 | child_range children() { return child_range(&Condition, &Condition + 1); } |
381 | | |
382 | 188 | static bool classof(const OMPClause *T) { |
383 | 188 | return T->getClauseKind() == OMPC_final; |
384 | 188 | } |
385 | | }; |
386 | | |
387 | | /// This represents 'num_threads' clause in the '#pragma omp ...' |
388 | | /// directive. |
389 | | /// |
390 | | /// \code |
391 | | /// #pragma omp parallel num_threads(6) |
392 | | /// \endcode |
393 | | /// In this example directive '#pragma omp parallel' has simple 'num_threads' |
394 | | /// clause with number of threads '6'. |
395 | | class OMPNumThreadsClause : public OMPClause, public OMPClauseWithPreInit { |
396 | | friend class OMPClauseReader; |
397 | | |
398 | | /// Location of '('. |
399 | | SourceLocation LParenLoc; |
400 | | |
401 | | /// Condition of the 'num_threads' clause. |
402 | | Stmt *NumThreads = nullptr; |
403 | | |
404 | | /// Set condition. |
405 | 144 | void setNumThreads(Expr *NThreads) { NumThreads = NThreads; } |
406 | | |
407 | | public: |
408 | | /// Build 'num_threads' clause with condition \a NumThreads. |
409 | | /// |
410 | | /// \param NumThreads Number of threads for the construct. |
411 | | /// \param HelperNumThreads Helper Number of threads for the construct. |
412 | | /// \param CaptureRegion Innermost OpenMP region where expressions in this |
413 | | /// clause must be captured. |
414 | | /// \param StartLoc Starting location of the clause. |
415 | | /// \param LParenLoc Location of '('. |
416 | | /// \param EndLoc Ending location of the clause. |
417 | | OMPNumThreadsClause(Expr *NumThreads, Stmt *HelperNumThreads, |
418 | | OpenMPDirectiveKind CaptureRegion, |
419 | | SourceLocation StartLoc, SourceLocation LParenLoc, |
420 | | SourceLocation EndLoc) |
421 | | : OMPClause(OMPC_num_threads, StartLoc, EndLoc), |
422 | | OMPClauseWithPreInit(this), LParenLoc(LParenLoc), |
423 | 1.23k | NumThreads(NumThreads) { |
424 | 1.23k | setPreInitStmt(HelperNumThreads, CaptureRegion); |
425 | 1.23k | } |
426 | | |
427 | | /// Build an empty clause. |
428 | | OMPNumThreadsClause() |
429 | | : OMPClause(OMPC_num_threads, SourceLocation(), SourceLocation()), |
430 | 144 | OMPClauseWithPreInit(this) {} |
431 | | |
432 | | /// Sets the location of '('. |
433 | 144 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
434 | | |
435 | | /// Returns the location of '('. |
436 | 726 | SourceLocation getLParenLoc() const { return LParenLoc; } |
437 | | |
438 | | /// Returns number of threads. |
439 | 1.32k | Expr *getNumThreads() const { return cast_or_null<Expr>(NumThreads); } |
440 | | |
441 | 269 | child_range children() { return child_range(&NumThreads, &NumThreads + 1); } |
442 | | |
443 | 8.65k | static bool classof(const OMPClause *T) { |
444 | 8.65k | return T->getClauseKind() == OMPC_num_threads; |
445 | 8.65k | } |
446 | | }; |
447 | | |
448 | | /// This represents 'safelen' clause in the '#pragma omp ...' |
449 | | /// directive. |
450 | | /// |
451 | | /// \code |
452 | | /// #pragma omp simd safelen(4) |
453 | | /// \endcode |
454 | | /// In this example directive '#pragma omp simd' has clause 'safelen' |
455 | | /// with single expression '4'. |
456 | | /// If the safelen clause is used then no two iterations executed |
457 | | /// concurrently with SIMD instructions can have a greater distance |
458 | | /// in the logical iteration space than its value. The parameter of |
459 | | /// the safelen clause must be a constant positive integer expression. |
460 | | class OMPSafelenClause : public OMPClause { |
461 | | friend class OMPClauseReader; |
462 | | |
463 | | /// Location of '('. |
464 | | SourceLocation LParenLoc; |
465 | | |
466 | | /// Safe iteration space distance. |
467 | | Stmt *Safelen = nullptr; |
468 | | |
469 | | /// Set safelen. |
470 | 120 | void setSafelen(Expr *Len) { Safelen = Len; } |
471 | | |
472 | | public: |
473 | | /// Build 'safelen' clause. |
474 | | /// |
475 | | /// \param Len Expression associated with this clause. |
476 | | /// \param StartLoc Starting location of the clause. |
477 | | /// \param EndLoc Ending location of the clause. |
478 | | OMPSafelenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc, |
479 | | SourceLocation EndLoc) |
480 | | : OMPClause(OMPC_safelen, StartLoc, EndLoc), LParenLoc(LParenLoc), |
481 | 2.44k | Safelen(Len) {} |
482 | | |
483 | | /// Build an empty clause. |
484 | | explicit OMPSafelenClause() |
485 | 120 | : OMPClause(OMPC_safelen, SourceLocation(), SourceLocation()) {} |
486 | | |
487 | | /// Sets the location of '('. |
488 | 120 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
489 | | |
490 | | /// Returns the location of '('. |
491 | 1.83k | SourceLocation getLParenLoc() const { return LParenLoc; } |
492 | | |
493 | | /// Return safe iteration space distance. |
494 | 2.55k | Expr *getSafelen() const { return cast_or_null<Expr>(Safelen); } |
495 | | |
496 | 562 | child_range children() { return child_range(&Safelen, &Safelen + 1); } |
497 | | |
498 | 7.45k | static bool classof(const OMPClause *T) { |
499 | 7.45k | return T->getClauseKind() == OMPC_safelen; |
500 | 7.45k | } |
501 | | }; |
502 | | |
503 | | /// This represents 'simdlen' clause in the '#pragma omp ...' |
504 | | /// directive. |
505 | | /// |
506 | | /// \code |
507 | | /// #pragma omp simd simdlen(4) |
508 | | /// \endcode |
509 | | /// In this example directive '#pragma omp simd' has clause 'simdlen' |
510 | | /// with single expression '4'. |
511 | | /// If the 'simdlen' clause is used then it specifies the preferred number of |
512 | | /// iterations to be executed concurrently. The parameter of the 'simdlen' |
513 | | /// clause must be a constant positive integer expression. |
514 | | class OMPSimdlenClause : public OMPClause { |
515 | | friend class OMPClauseReader; |
516 | | |
517 | | /// Location of '('. |
518 | | SourceLocation LParenLoc; |
519 | | |
520 | | /// Safe iteration space distance. |
521 | | Stmt *Simdlen = nullptr; |
522 | | |
523 | | /// Set simdlen. |
524 | 120 | void setSimdlen(Expr *Len) { Simdlen = Len; } |
525 | | |
526 | | public: |
527 | | /// Build 'simdlen' clause. |
528 | | /// |
529 | | /// \param Len Expression associated with this clause. |
530 | | /// \param StartLoc Starting location of the clause. |
531 | | /// \param EndLoc Ending location of the clause. |
532 | | OMPSimdlenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc, |
533 | | SourceLocation EndLoc) |
534 | | : OMPClause(OMPC_simdlen, StartLoc, EndLoc), LParenLoc(LParenLoc), |
535 | 1.32k | Simdlen(Len) {} |
536 | | |
537 | | /// Build an empty clause. |
538 | | explicit OMPSimdlenClause() |
539 | 120 | : OMPClause(OMPC_simdlen, SourceLocation(), SourceLocation()) {} |
540 | | |
541 | | /// Sets the location of '('. |
542 | 120 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
543 | | |
544 | | /// Returns the location of '('. |
545 | 860 | SourceLocation getLParenLoc() const { return LParenLoc; } |
546 | | |
547 | | /// Return safe iteration space distance. |
548 | 1.65k | Expr *getSimdlen() const { return cast_or_null<Expr>(Simdlen); } |
549 | | |
550 | 162 | child_range children() { return child_range(&Simdlen, &Simdlen + 1); } |
551 | | |
552 | 7.89k | static bool classof(const OMPClause *T) { |
553 | 7.89k | return T->getClauseKind() == OMPC_simdlen; |
554 | 7.89k | } |
555 | | }; |
556 | | |
557 | | /// This represents 'collapse' clause in the '#pragma omp ...' |
558 | | /// directive. |
559 | | /// |
560 | | /// \code |
561 | | /// #pragma omp simd collapse(3) |
562 | | /// \endcode |
563 | | /// In this example directive '#pragma omp simd' has clause 'collapse' |
564 | | /// with single expression '3'. |
565 | | /// The parameter must be a constant positive integer expression, it specifies |
566 | | /// the number of nested loops that should be collapsed into a single iteration |
567 | | /// space. |
568 | | class OMPCollapseClause : public OMPClause { |
569 | | friend class OMPClauseReader; |
570 | | |
571 | | /// Location of '('. |
572 | | SourceLocation LParenLoc; |
573 | | |
574 | | /// Number of for-loops. |
575 | | Stmt *NumForLoops = nullptr; |
576 | | |
577 | | /// Set the number of associated for-loops. |
578 | 236 | void setNumForLoops(Expr *Num) { NumForLoops = Num; } |
579 | | |
580 | | public: |
581 | | /// Build 'collapse' clause. |
582 | | /// |
583 | | /// \param Num Expression associated with this clause. |
584 | | /// \param StartLoc Starting location of the clause. |
585 | | /// \param LParenLoc Location of '('. |
586 | | /// \param EndLoc Ending location of the clause. |
587 | | OMPCollapseClause(Expr *Num, SourceLocation StartLoc, |
588 | | SourceLocation LParenLoc, SourceLocation EndLoc) |
589 | | : OMPClause(OMPC_collapse, StartLoc, EndLoc), LParenLoc(LParenLoc), |
590 | 3.58k | NumForLoops(Num) {} |
591 | | |
592 | | /// Build an empty clause. |
593 | | explicit OMPCollapseClause() |
594 | 236 | : OMPClause(OMPC_collapse, SourceLocation(), SourceLocation()) {} |
595 | | |
596 | | /// Sets the location of '('. |
597 | 236 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
598 | | |
599 | | /// Returns the location of '('. |
600 | 2.54k | SourceLocation getLParenLoc() const { return LParenLoc; } |
601 | | |
602 | | /// Return the number of associated for-loops. |
603 | 6.62k | Expr *getNumForLoops() const { return cast_or_null<Expr>(NumForLoops); } |
604 | | |
605 | 448 | child_range children() { return child_range(&NumForLoops, &NumForLoops + 1); } |
606 | | |
607 | 59.0k | static bool classof(const OMPClause *T) { |
608 | 59.0k | return T->getClauseKind() == OMPC_collapse; |
609 | 59.0k | } |
610 | | }; |
611 | | |
612 | | /// This represents 'default' clause in the '#pragma omp ...' directive. |
613 | | /// |
614 | | /// \code |
615 | | /// #pragma omp parallel default(shared) |
616 | | /// \endcode |
617 | | /// In this example directive '#pragma omp parallel' has simple 'default' |
618 | | /// clause with kind 'shared'. |
619 | | class OMPDefaultClause : public OMPClause { |
620 | | friend class OMPClauseReader; |
621 | | |
622 | | /// Location of '('. |
623 | | SourceLocation LParenLoc; |
624 | | |
625 | | /// A kind of the 'default' clause. |
626 | | OpenMPDefaultClauseKind Kind = OMPC_DEFAULT_unknown; |
627 | | |
628 | | /// Start location of the kind in source code. |
629 | | SourceLocation KindKwLoc; |
630 | | |
631 | | /// Set kind of the clauses. |
632 | | /// |
633 | | /// \param K Argument of clause. |
634 | 140 | void setDefaultKind(OpenMPDefaultClauseKind K) { Kind = K; } |
635 | | |
636 | | /// Set argument location. |
637 | | /// |
638 | | /// \param KLoc Argument location. |
639 | 140 | void setDefaultKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; } |
640 | | |
641 | | public: |
642 | | /// Build 'default' clause with argument \a A ('none' or 'shared'). |
643 | | /// |
644 | | /// \param A Argument of the clause ('none' or 'shared'). |
645 | | /// \param ALoc Starting location of the argument. |
646 | | /// \param StartLoc Starting location of the clause. |
647 | | /// \param LParenLoc Location of '('. |
648 | | /// \param EndLoc Ending location of the clause. |
649 | | OMPDefaultClause(OpenMPDefaultClauseKind A, SourceLocation ALoc, |
650 | | SourceLocation StartLoc, SourceLocation LParenLoc, |
651 | | SourceLocation EndLoc) |
652 | | : OMPClause(OMPC_default, StartLoc, EndLoc), LParenLoc(LParenLoc), |
653 | 845 | Kind(A), KindKwLoc(ALoc) {} |
654 | | |
655 | | /// Build an empty clause. |
656 | | OMPDefaultClause() |
657 | 140 | : OMPClause(OMPC_default, SourceLocation(), SourceLocation()) {} |
658 | | |
659 | | /// Sets the location of '('. |
660 | 140 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
661 | | |
662 | | /// Returns the location of '('. |
663 | 360 | SourceLocation getLParenLoc() const { return LParenLoc; } |
664 | | |
665 | | /// Returns kind of the clause. |
666 | 784 | OpenMPDefaultClauseKind getDefaultKind() const { return Kind; } |
667 | | |
668 | | /// Returns location of clause kind. |
669 | 360 | SourceLocation getDefaultKindKwLoc() const { return KindKwLoc; } |
670 | | |
671 | 234 | child_range children() { |
672 | 234 | return child_range(child_iterator(), child_iterator()); |
673 | 234 | } |
674 | | |
675 | | static bool classof(const OMPClause *T) { |
676 | | return T->getClauseKind() == OMPC_default; |
677 | | } |
678 | | }; |
679 | | |
680 | | /// This represents 'proc_bind' clause in the '#pragma omp ...' |
681 | | /// directive. |
682 | | /// |
683 | | /// \code |
684 | | /// #pragma omp parallel proc_bind(master) |
685 | | /// \endcode |
686 | | /// In this example directive '#pragma omp parallel' has simple 'proc_bind' |
687 | | /// clause with kind 'master'. |
688 | | class OMPProcBindClause : public OMPClause { |
689 | | friend class OMPClauseReader; |
690 | | |
691 | | /// Location of '('. |
692 | | SourceLocation LParenLoc; |
693 | | |
694 | | /// A kind of the 'proc_bind' clause. |
695 | | OpenMPProcBindClauseKind Kind = OMPC_PROC_BIND_unknown; |
696 | | |
697 | | /// Start location of the kind in source code. |
698 | | SourceLocation KindKwLoc; |
699 | | |
700 | | /// Set kind of the clause. |
701 | | /// |
702 | | /// \param K Kind of clause. |
703 | 76 | void setProcBindKind(OpenMPProcBindClauseKind K) { Kind = K; } |
704 | | |
705 | | /// Set clause kind location. |
706 | | /// |
707 | | /// \param KLoc Kind location. |
708 | 76 | void setProcBindKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; } |
709 | | |
710 | | public: |
711 | | /// Build 'proc_bind' clause with argument \a A ('master', 'close' or |
712 | | /// 'spread'). |
713 | | /// |
714 | | /// \param A Argument of the clause ('master', 'close' or 'spread'). |
715 | | /// \param ALoc Starting location of the argument. |
716 | | /// \param StartLoc Starting location of the clause. |
717 | | /// \param LParenLoc Location of '('. |
718 | | /// \param EndLoc Ending location of the clause. |
719 | | OMPProcBindClause(OpenMPProcBindClauseKind A, SourceLocation ALoc, |
720 | | SourceLocation StartLoc, SourceLocation LParenLoc, |
721 | | SourceLocation EndLoc) |
722 | | : OMPClause(OMPC_proc_bind, StartLoc, EndLoc), LParenLoc(LParenLoc), |
723 | 592 | Kind(A), KindKwLoc(ALoc) {} |
724 | | |
725 | | /// Build an empty clause. |
726 | | OMPProcBindClause() |
727 | 76 | : OMPClause(OMPC_proc_bind, SourceLocation(), SourceLocation()) {} |
728 | | |
729 | | /// Sets the location of '('. |
730 | 76 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
731 | | |
732 | | /// Returns the location of '('. |
733 | 262 | SourceLocation getLParenLoc() const { return LParenLoc; } |
734 | | |
735 | | /// Returns kind of the clause. |
736 | 470 | OpenMPProcBindClauseKind getProcBindKind() const { return Kind; } |
737 | | |
738 | | /// Returns location of clause kind. |
739 | 262 | SourceLocation getProcBindKindKwLoc() const { return KindKwLoc; } |
740 | | |
741 | 136 | child_range children() { |
742 | 136 | return child_range(child_iterator(), child_iterator()); |
743 | 136 | } |
744 | | |
745 | 4.70k | static bool classof(const OMPClause *T) { |
746 | 4.70k | return T->getClauseKind() == OMPC_proc_bind; |
747 | 4.70k | } |
748 | | }; |
749 | | |
750 | | /// This represents 'unified_address' clause in the '#pragma omp requires' |
751 | | /// directive. |
752 | | /// |
753 | | /// \code |
754 | | /// #pragma omp requires unified_address |
755 | | /// \endcode |
756 | | /// In this example directive '#pragma omp requires' has 'unified_address' |
757 | | /// clause. |
758 | | class OMPUnifiedAddressClause final : public OMPClause { |
759 | | public: |
760 | | friend class OMPClauseReader; |
761 | | /// Build 'unified_address' clause. |
762 | | /// |
763 | | /// \param StartLoc Starting location of the clause. |
764 | | /// \param EndLoc Ending location of the clause. |
765 | | OMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc) |
766 | 13 | : OMPClause(OMPC_unified_address, StartLoc, EndLoc) {} |
767 | | |
768 | | /// Build an empty clause. |
769 | | OMPUnifiedAddressClause() |
770 | 2 | : OMPClause(OMPC_unified_address, SourceLocation(), SourceLocation()) {} |
771 | | |
772 | 0 | child_range children() { |
773 | 0 | return child_range(child_iterator(), child_iterator()); |
774 | 0 | } |
775 | | |
776 | | static bool classof(const OMPClause *T) { |
777 | | return T->getClauseKind() == OMPC_unified_address; |
778 | | } |
779 | | }; |
780 | | |
781 | | /// This represents 'unified_shared_memory' clause in the '#pragma omp requires' |
782 | | /// directive. |
783 | | /// |
784 | | /// \code |
785 | | /// #pragma omp requires unified_shared_memory |
786 | | /// \endcode |
787 | | /// In this example directive '#pragma omp requires' has 'unified_shared_memory' |
788 | | /// clause. |
789 | | class OMPUnifiedSharedMemoryClause final : public OMPClause { |
790 | | public: |
791 | | friend class OMPClauseReader; |
792 | | /// Build 'unified_shared_memory' clause. |
793 | | /// |
794 | | /// \param StartLoc Starting location of the clause. |
795 | | /// \param EndLoc Ending location of the clause. |
796 | | OMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc) |
797 | 24 | : OMPClause(OMPC_unified_shared_memory, StartLoc, EndLoc) {} |
798 | | |
799 | | /// Build an empty clause. |
800 | | OMPUnifiedSharedMemoryClause() |
801 | 2 | : OMPClause(OMPC_unified_shared_memory, SourceLocation(), SourceLocation()) {} |
802 | | |
803 | 0 | child_range children() { |
804 | 0 | return child_range(child_iterator(), child_iterator()); |
805 | 0 | } |
806 | | |
807 | | static bool classof(const OMPClause *T) { |
808 | | return T->getClauseKind() == OMPC_unified_shared_memory; |
809 | | } |
810 | | }; |
811 | | |
812 | | /// This represents 'reverse_offload' clause in the '#pragma omp requires' |
813 | | /// directive. |
814 | | /// |
815 | | /// \code |
816 | | /// #pragma omp requires reverse_offload |
817 | | /// \endcode |
818 | | /// In this example directive '#pragma omp requires' has 'reverse_offload' |
819 | | /// clause. |
820 | | class OMPReverseOffloadClause final : public OMPClause { |
821 | | public: |
822 | | friend class OMPClauseReader; |
823 | | /// Build 'reverse_offload' clause. |
824 | | /// |
825 | | /// \param StartLoc Starting location of the clause. |
826 | | /// \param EndLoc Ending location of the clause. |
827 | | OMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc) |
828 | 8 | : OMPClause(OMPC_reverse_offload, StartLoc, EndLoc) {} |
829 | | |
830 | | /// Build an empty clause. |
831 | | OMPReverseOffloadClause() |
832 | 2 | : OMPClause(OMPC_reverse_offload, SourceLocation(), SourceLocation()) {} |
833 | | |
834 | 0 | child_range children() { |
835 | 0 | return child_range(child_iterator(), child_iterator()); |
836 | 0 | } |
837 | | |
838 | | static bool classof(const OMPClause *T) { |
839 | | return T->getClauseKind() == OMPC_reverse_offload; |
840 | | } |
841 | | }; |
842 | | |
843 | | /// This represents 'dynamic_allocators' clause in the '#pragma omp requires' |
844 | | /// directive. |
845 | | /// |
846 | | /// \code |
847 | | /// #pragma omp requires dynamic_allocators |
848 | | /// \endcode |
849 | | /// In this example directive '#pragma omp requires' has 'dynamic_allocators' |
850 | | /// clause. |
851 | | class OMPDynamicAllocatorsClause final : public OMPClause { |
852 | | public: |
853 | | friend class OMPClauseReader; |
854 | | /// Build 'dynamic_allocators' clause. |
855 | | /// |
856 | | /// \param StartLoc Starting location of the clause. |
857 | | /// \param EndLoc Ending location of the clause. |
858 | | OMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc) |
859 | 8 | : OMPClause(OMPC_dynamic_allocators, StartLoc, EndLoc) {} |
860 | | |
861 | | /// Build an empty clause. |
862 | | OMPDynamicAllocatorsClause() |
863 | 2 | : OMPClause(OMPC_dynamic_allocators, SourceLocation(), SourceLocation()) { |
864 | 2 | } |
865 | | |
866 | 0 | child_range children() { |
867 | 0 | return child_range(child_iterator(), child_iterator()); |
868 | 0 | } |
869 | | |
870 | | static bool classof(const OMPClause *T) { |
871 | | return T->getClauseKind() == OMPC_dynamic_allocators; |
872 | | } |
873 | | }; |
874 | | |
875 | | /// This represents 'atomic_default_mem_order' clause in the '#pragma omp |
876 | | /// requires' directive. |
877 | | /// |
878 | | /// \code |
879 | | /// #pragma omp requires atomic_default_mem_order(seq_cst) |
880 | | /// \endcode |
881 | | /// In this example directive '#pragma omp requires' has simple |
882 | | /// atomic_default_mem_order' clause with kind 'seq_cst'. |
883 | | class OMPAtomicDefaultMemOrderClause final : public OMPClause { |
884 | | friend class OMPClauseReader; |
885 | | |
886 | | /// Location of '(' |
887 | | SourceLocation LParenLoc; |
888 | | |
889 | | /// A kind of the 'atomic_default_mem_order' clause. |
890 | | OpenMPAtomicDefaultMemOrderClauseKind Kind = |
891 | | OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown; |
892 | | |
893 | | /// Start location of the kind in source code. |
894 | | SourceLocation KindKwLoc; |
895 | | |
896 | | /// Set kind of the clause. |
897 | | /// |
898 | | /// \param K Kind of clause. |
899 | 6 | void setAtomicDefaultMemOrderKind(OpenMPAtomicDefaultMemOrderClauseKind K) { |
900 | 6 | Kind = K; |
901 | 6 | } |
902 | | |
903 | | /// Set clause kind location. |
904 | | /// |
905 | | /// \param KLoc Kind location. |
906 | 6 | void setAtomicDefaultMemOrderKindKwLoc(SourceLocation KLoc) { |
907 | 6 | KindKwLoc = KLoc; |
908 | 6 | } |
909 | | |
910 | | public: |
911 | | /// Build 'atomic_default_mem_order' clause with argument \a A ('seq_cst', |
912 | | /// 'acq_rel' or 'relaxed'). |
913 | | /// |
914 | | /// \param A Argument of the clause ('seq_cst', 'acq_rel' or 'relaxed'). |
915 | | /// \param ALoc Starting location of the argument. |
916 | | /// \param StartLoc Starting location of the clause. |
917 | | /// \param LParenLoc Location of '('. |
918 | | /// \param EndLoc Ending location of the clause. |
919 | | OMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind A, |
920 | | SourceLocation ALoc, SourceLocation StartLoc, |
921 | | SourceLocation LParenLoc, |
922 | | SourceLocation EndLoc) |
923 | | : OMPClause(OMPC_atomic_default_mem_order, StartLoc, EndLoc), |
924 | 19 | LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {} |
925 | | |
926 | | /// Build an empty clause. |
927 | | OMPAtomicDefaultMemOrderClause() |
928 | | : OMPClause(OMPC_atomic_default_mem_order, SourceLocation(), |
929 | 6 | SourceLocation()) {} |
930 | | |
931 | | /// Sets the location of '('. |
932 | 6 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
933 | | |
934 | | /// Returns the locaiton of '('. |
935 | 6 | SourceLocation getLParenLoc() const { return LParenLoc; } |
936 | | |
937 | | /// Returns kind of the clause. |
938 | 18 | OpenMPAtomicDefaultMemOrderClauseKind getAtomicDefaultMemOrderKind() const { |
939 | 18 | return Kind; |
940 | 18 | } |
941 | | |
942 | | /// Returns location of clause kind. |
943 | 6 | SourceLocation getAtomicDefaultMemOrderKindKwLoc() const { return KindKwLoc; } |
944 | | |
945 | 0 | child_range children() { |
946 | 0 | return child_range(child_iterator(), child_iterator()); |
947 | 0 | } |
948 | | |
949 | | static bool classof(const OMPClause *T) { |
950 | | return T->getClauseKind() == OMPC_atomic_default_mem_order; |
951 | | } |
952 | | }; |
953 | | |
954 | | /// This represents 'schedule' clause in the '#pragma omp ...' directive. |
955 | | /// |
956 | | /// \code |
957 | | /// #pragma omp for schedule(static, 3) |
958 | | /// \endcode |
959 | | /// In this example directive '#pragma omp for' has 'schedule' clause with |
960 | | /// arguments 'static' and '3'. |
961 | | class OMPScheduleClause : public OMPClause, public OMPClauseWithPreInit { |
962 | | friend class OMPClauseReader; |
963 | | |
964 | | /// Location of '('. |
965 | | SourceLocation LParenLoc; |
966 | | |
967 | | /// A kind of the 'schedule' clause. |
968 | | OpenMPScheduleClauseKind Kind = OMPC_SCHEDULE_unknown; |
969 | | |
970 | | /// Modifiers for 'schedule' clause. |
971 | | enum {FIRST, SECOND, NUM_MODIFIERS}; |
972 | | OpenMPScheduleClauseModifier Modifiers[NUM_MODIFIERS]; |
973 | | |
974 | | /// Locations of modifiers. |
975 | | SourceLocation ModifiersLoc[NUM_MODIFIERS]; |
976 | | |
977 | | /// Start location of the schedule ind in source code. |
978 | | SourceLocation KindLoc; |
979 | | |
980 | | /// Location of ',' (if any). |
981 | | SourceLocation CommaLoc; |
982 | | |
983 | | /// Chunk size. |
984 | | Expr *ChunkSize = nullptr; |
985 | | |
986 | | /// Set schedule kind. |
987 | | /// |
988 | | /// \param K Schedule kind. |
989 | 388 | void setScheduleKind(OpenMPScheduleClauseKind K) { Kind = K; } |
990 | | |
991 | | /// Set the first schedule modifier. |
992 | | /// |
993 | | /// \param M Schedule modifier. |
994 | 388 | void setFirstScheduleModifier(OpenMPScheduleClauseModifier M) { |
995 | 388 | Modifiers[FIRST] = M; |
996 | 388 | } |
997 | | |
998 | | /// Set the second schedule modifier. |
999 | | /// |
1000 | | /// \param M Schedule modifier. |
1001 | 388 | void setSecondScheduleModifier(OpenMPScheduleClauseModifier M) { |
1002 | 388 | Modifiers[SECOND] = M; |
1003 | 388 | } |
1004 | | |
1005 | | /// Set location of the first schedule modifier. |
1006 | 388 | void setFirstScheduleModifierLoc(SourceLocation Loc) { |
1007 | 388 | ModifiersLoc[FIRST] = Loc; |
1008 | 388 | } |
1009 | | |
1010 | | /// Set location of the second schedule modifier. |
1011 | 388 | void setSecondScheduleModifierLoc(SourceLocation Loc) { |
1012 | 388 | ModifiersLoc[SECOND] = Loc; |
1013 | 388 | } |
1014 | | |
1015 | | /// Set schedule modifier location. |
1016 | | /// |
1017 | | /// \param M Schedule modifier location. |
1018 | | void setScheduleModifer(OpenMPScheduleClauseModifier M) { |
1019 | | if (Modifiers[FIRST] == OMPC_SCHEDULE_MODIFIER_unknown) |
1020 | | Modifiers[FIRST] = M; |
1021 | | else { |
1022 | | assert(Modifiers[SECOND] == OMPC_SCHEDULE_MODIFIER_unknown); |
1023 | | Modifiers[SECOND] = M; |
1024 | | } |
1025 | | } |
1026 | | |
1027 | | /// Sets the location of '('. |
1028 | | /// |
1029 | | /// \param Loc Location of '('. |
1030 | 388 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
1031 | | |
1032 | | /// Set schedule kind start location. |
1033 | | /// |
1034 | | /// \param KLoc Schedule kind location. |
1035 | 388 | void setScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; } |
1036 | | |
1037 | | /// Set location of ','. |
1038 | | /// |
1039 | | /// \param Loc Location of ','. |
1040 | 388 | void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; } |
1041 | | |
1042 | | /// Set chunk size. |
1043 | | /// |
1044 | | /// \param E Chunk size. |
1045 | 388 | void setChunkSize(Expr *E) { ChunkSize = E; } |
1046 | | |
1047 | | public: |
1048 | | /// Build 'schedule' clause with schedule kind \a Kind and chunk size |
1049 | | /// expression \a ChunkSize. |
1050 | | /// |
1051 | | /// \param StartLoc Starting location of the clause. |
1052 | | /// \param LParenLoc Location of '('. |
1053 | | /// \param KLoc Starting location of the argument. |
1054 | | /// \param CommaLoc Location of ','. |
1055 | | /// \param EndLoc Ending location of the clause. |
1056 | | /// \param Kind Schedule kind. |
1057 | | /// \param ChunkSize Chunk size. |
1058 | | /// \param HelperChunkSize Helper chunk size for combined directives. |
1059 | | /// \param M1 The first modifier applied to 'schedule' clause. |
1060 | | /// \param M1Loc Location of the first modifier |
1061 | | /// \param M2 The second modifier applied to 'schedule' clause. |
1062 | | /// \param M2Loc Location of the second modifier |
1063 | | OMPScheduleClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
1064 | | SourceLocation KLoc, SourceLocation CommaLoc, |
1065 | | SourceLocation EndLoc, OpenMPScheduleClauseKind Kind, |
1066 | | Expr *ChunkSize, Stmt *HelperChunkSize, |
1067 | | OpenMPScheduleClauseModifier M1, SourceLocation M1Loc, |
1068 | | OpenMPScheduleClauseModifier M2, SourceLocation M2Loc) |
1069 | | : OMPClause(OMPC_schedule, StartLoc, EndLoc), OMPClauseWithPreInit(this), |
1070 | | LParenLoc(LParenLoc), Kind(Kind), KindLoc(KLoc), CommaLoc(CommaLoc), |
1071 | 2.86k | ChunkSize(ChunkSize) { |
1072 | 2.86k | setPreInitStmt(HelperChunkSize); |
1073 | 2.86k | Modifiers[FIRST] = M1; |
1074 | 2.86k | Modifiers[SECOND] = M2; |
1075 | 2.86k | ModifiersLoc[FIRST] = M1Loc; |
1076 | 2.86k | ModifiersLoc[SECOND] = M2Loc; |
1077 | 2.86k | } |
1078 | | |
1079 | | /// Build an empty clause. |
1080 | | explicit OMPScheduleClause() |
1081 | | : OMPClause(OMPC_schedule, SourceLocation(), SourceLocation()), |
1082 | 388 | OMPClauseWithPreInit(this) { |
1083 | 388 | Modifiers[FIRST] = OMPC_SCHEDULE_MODIFIER_unknown; |
1084 | 388 | Modifiers[SECOND] = OMPC_SCHEDULE_MODIFIER_unknown; |
1085 | 388 | } |
1086 | | |
1087 | | /// Get kind of the clause. |
1088 | 2.66k | OpenMPScheduleClauseKind getScheduleKind() const { return Kind; } |
1089 | | |
1090 | | /// Get the first modifier of the clause. |
1091 | 5.31k | OpenMPScheduleClauseModifier getFirstScheduleModifier() const { |
1092 | 5.31k | return Modifiers[FIRST]; |
1093 | 5.31k | } |
1094 | | |
1095 | | /// Get the second modifier of the clause. |
1096 | 5.09k | OpenMPScheduleClauseModifier getSecondScheduleModifier() const { |
1097 | 5.09k | return Modifiers[SECOND]; |
1098 | 5.09k | } |
1099 | | |
1100 | | /// Get location of '('. |
1101 | 1.33k | SourceLocation getLParenLoc() { return LParenLoc; } |
1102 | | |
1103 | | /// Get kind location. |
1104 | 1.33k | SourceLocation getScheduleKindLoc() { return KindLoc; } |
1105 | | |
1106 | | /// Get the first modifier location. |
1107 | 1.33k | SourceLocation getFirstScheduleModifierLoc() const { |
1108 | 1.33k | return ModifiersLoc[FIRST]; |
1109 | 1.33k | } |
1110 | | |
1111 | | /// Get the second modifier location. |
1112 | 1.33k | SourceLocation getSecondScheduleModifierLoc() const { |
1113 | 1.33k | return ModifiersLoc[SECOND]; |
1114 | 1.33k | } |
1115 | | |
1116 | | /// Get location of ','. |
1117 | 1.33k | SourceLocation getCommaLoc() { return CommaLoc; } |
1118 | | |
1119 | | /// Get chunk size. |
1120 | 1.53k | Expr *getChunkSize() { return ChunkSize; } |
1121 | | |
1122 | | /// Get chunk size. |
1123 | 1.14k | const Expr *getChunkSize() const { return ChunkSize; } |
1124 | | |
1125 | 954 | child_range children() { |
1126 | 954 | return child_range(reinterpret_cast<Stmt **>(&ChunkSize), |
1127 | 954 | reinterpret_cast<Stmt **>(&ChunkSize) + 1); |
1128 | 954 | } |
1129 | | |
1130 | 4.29k | static bool classof(const OMPClause *T) { |
1131 | 4.29k | return T->getClauseKind() == OMPC_schedule; |
1132 | 4.29k | } |
1133 | | }; |
1134 | | |
1135 | | /// This represents 'ordered' clause in the '#pragma omp ...' directive. |
1136 | | /// |
1137 | | /// \code |
1138 | | /// #pragma omp for ordered (2) |
1139 | | /// \endcode |
1140 | | /// In this example directive '#pragma omp for' has 'ordered' clause with |
1141 | | /// parameter 2. |
1142 | | class OMPOrderedClause final |
1143 | | : public OMPClause, |
1144 | | private llvm::TrailingObjects<OMPOrderedClause, Expr *> { |
1145 | | friend class OMPClauseReader; |
1146 | | friend TrailingObjects; |
1147 | | |
1148 | | /// Location of '('. |
1149 | | SourceLocation LParenLoc; |
1150 | | |
1151 | | /// Number of for-loops. |
1152 | | Stmt *NumForLoops = nullptr; |
1153 | | |
1154 | | /// Real number of loops. |
1155 | | unsigned NumberOfLoops = 0; |
1156 | | |
1157 | | /// Build 'ordered' clause. |
1158 | | /// |
1159 | | /// \param Num Expression, possibly associated with this clause. |
1160 | | /// \param NumLoops Number of loops, associated with this clause. |
1161 | | /// \param StartLoc Starting location of the clause. |
1162 | | /// \param LParenLoc Location of '('. |
1163 | | /// \param EndLoc Ending location of the clause. |
1164 | | OMPOrderedClause(Expr *Num, unsigned NumLoops, SourceLocation StartLoc, |
1165 | | SourceLocation LParenLoc, SourceLocation EndLoc) |
1166 | | : OMPClause(OMPC_ordered, StartLoc, EndLoc), LParenLoc(LParenLoc), |
1167 | 924 | NumForLoops(Num), NumberOfLoops(NumLoops) {} |
1168 | | |
1169 | | /// Build an empty clause. |
1170 | | explicit OMPOrderedClause(unsigned NumLoops) |
1171 | | : OMPClause(OMPC_ordered, SourceLocation(), SourceLocation()), |
1172 | 52 | NumberOfLoops(NumLoops) {} |
1173 | | |
1174 | | /// Set the number of associated for-loops. |
1175 | 52 | void setNumForLoops(Expr *Num) { NumForLoops = Num; } |
1176 | | |
1177 | | public: |
1178 | | /// Build 'ordered' clause. |
1179 | | /// |
1180 | | /// \param Num Expression, possibly associated with this clause. |
1181 | | /// \param NumLoops Number of loops, associated with this clause. |
1182 | | /// \param StartLoc Starting location of the clause. |
1183 | | /// \param LParenLoc Location of '('. |
1184 | | /// \param EndLoc Ending location of the clause. |
1185 | | static OMPOrderedClause *Create(const ASTContext &C, Expr *Num, |
1186 | | unsigned NumLoops, SourceLocation StartLoc, |
1187 | | SourceLocation LParenLoc, |
1188 | | SourceLocation EndLoc); |
1189 | | |
1190 | | /// Build an empty clause. |
1191 | | static OMPOrderedClause* CreateEmpty(const ASTContext &C, unsigned NumLoops); |
1192 | | |
1193 | | /// Sets the location of '('. |
1194 | 52 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
1195 | | |
1196 | | /// Returns the location of '('. |
1197 | 512 | SourceLocation getLParenLoc() const { return LParenLoc; } |
1198 | | |
1199 | | /// Return the number of associated for-loops. |
1200 | 2.44k | Expr *getNumForLoops() const { return cast_or_null<Expr>(NumForLoops); } |
1201 | | |
1202 | | /// Set number of iterations for the specified loop. |
1203 | | void setLoopNumIterations(unsigned NumLoop, Expr *NumIterations); |
1204 | | /// Get number of iterations for all the loops. |
1205 | | ArrayRef<Expr *> getLoopNumIterations() const; |
1206 | | |
1207 | | /// Set loop counter for the specified loop. |
1208 | | void setLoopCounter(unsigned NumLoop, Expr *Counter); |
1209 | | /// Get loops counter for the specified loop. |
1210 | | Expr *getLoopCounter(unsigned NumLoop); |
1211 | | const Expr *getLoopCounter(unsigned NumLoop) const; |
1212 | | |
1213 | 36 | child_range children() { return child_range(&NumForLoops, &NumForLoops + 1); } |
1214 | | |
1215 | 46.7k | static bool classof(const OMPClause *T) { |
1216 | 46.7k | return T->getClauseKind() == OMPC_ordered; |
1217 | 46.7k | } |
1218 | | }; |
1219 | | |
1220 | | /// This represents 'nowait' clause in the '#pragma omp ...' directive. |
1221 | | /// |
1222 | | /// \code |
1223 | | /// #pragma omp for nowait |
1224 | | /// \endcode |
1225 | | /// In this example directive '#pragma omp for' has 'nowait' clause. |
1226 | | class OMPNowaitClause : public OMPClause { |
1227 | | public: |
1228 | | /// Build 'nowait' clause. |
1229 | | /// |
1230 | | /// \param StartLoc Starting location of the clause. |
1231 | | /// \param EndLoc Ending location of the clause. |
1232 | | OMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1233 | 970 | : OMPClause(OMPC_nowait, StartLoc, EndLoc) {} |
1234 | | |
1235 | | /// Build an empty clause. |
1236 | | OMPNowaitClause() |
1237 | 356 | : OMPClause(OMPC_nowait, SourceLocation(), SourceLocation()) {} |
1238 | | |
1239 | 54 | child_range children() { |
1240 | 54 | return child_range(child_iterator(), child_iterator()); |
1241 | 54 | } |
1242 | | |
1243 | 7.78k | static bool classof(const OMPClause *T) { |
1244 | 7.78k | return T->getClauseKind() == OMPC_nowait; |
1245 | 7.78k | } |
1246 | | }; |
1247 | | |
1248 | | /// This represents 'untied' clause in the '#pragma omp ...' directive. |
1249 | | /// |
1250 | | /// \code |
1251 | | /// #pragma omp task untied |
1252 | | /// \endcode |
1253 | | /// In this example directive '#pragma omp task' has 'untied' clause. |
1254 | | class OMPUntiedClause : public OMPClause { |
1255 | | public: |
1256 | | /// Build 'untied' clause. |
1257 | | /// |
1258 | | /// \param StartLoc Starting location of the clause. |
1259 | | /// \param EndLoc Ending location of the clause. |
1260 | | OMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1261 | 40 | : OMPClause(OMPC_untied, StartLoc, EndLoc) {} |
1262 | | |
1263 | | /// Build an empty clause. |
1264 | | OMPUntiedClause() |
1265 | 16 | : OMPClause(OMPC_untied, SourceLocation(), SourceLocation()) {} |
1266 | | |
1267 | 16 | child_range children() { |
1268 | 16 | return child_range(child_iterator(), child_iterator()); |
1269 | 16 | } |
1270 | | |
1271 | 85 | static bool classof(const OMPClause *T) { |
1272 | 85 | return T->getClauseKind() == OMPC_untied; |
1273 | 85 | } |
1274 | | }; |
1275 | | |
1276 | | /// This represents 'mergeable' clause in the '#pragma omp ...' |
1277 | | /// directive. |
1278 | | /// |
1279 | | /// \code |
1280 | | /// #pragma omp task mergeable |
1281 | | /// \endcode |
1282 | | /// In this example directive '#pragma omp task' has 'mergeable' clause. |
1283 | | class OMPMergeableClause : public OMPClause { |
1284 | | public: |
1285 | | /// Build 'mergeable' clause. |
1286 | | /// |
1287 | | /// \param StartLoc Starting location of the clause. |
1288 | | /// \param EndLoc Ending location of the clause. |
1289 | | OMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1290 | 32 | : OMPClause(OMPC_mergeable, StartLoc, EndLoc) {} |
1291 | | |
1292 | | /// Build an empty clause. |
1293 | | OMPMergeableClause() |
1294 | 12 | : OMPClause(OMPC_mergeable, SourceLocation(), SourceLocation()) {} |
1295 | | |
1296 | 32 | child_range children() { |
1297 | 32 | return child_range(child_iterator(), child_iterator()); |
1298 | 32 | } |
1299 | | |
1300 | | static bool classof(const OMPClause *T) { |
1301 | | return T->getClauseKind() == OMPC_mergeable; |
1302 | | } |
1303 | | }; |
1304 | | |
1305 | | /// This represents 'read' clause in the '#pragma omp atomic' directive. |
1306 | | /// |
1307 | | /// \code |
1308 | | /// #pragma omp atomic read |
1309 | | /// \endcode |
1310 | | /// In this example directive '#pragma omp atomic' has 'read' clause. |
1311 | | class OMPReadClause : public OMPClause { |
1312 | | public: |
1313 | | /// Build 'read' clause. |
1314 | | /// |
1315 | | /// \param StartLoc Starting location of the clause. |
1316 | | /// \param EndLoc Ending location of the clause. |
1317 | | OMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1318 | 278 | : OMPClause(OMPC_read, StartLoc, EndLoc) {} |
1319 | | |
1320 | | /// Build an empty clause. |
1321 | 102 | OMPReadClause() : OMPClause(OMPC_read, SourceLocation(), SourceLocation()) {} |
1322 | | |
1323 | 16 | child_range children() { |
1324 | 16 | return child_range(child_iterator(), child_iterator()); |
1325 | 16 | } |
1326 | | |
1327 | | static bool classof(const OMPClause *T) { |
1328 | | return T->getClauseKind() == OMPC_read; |
1329 | | } |
1330 | | }; |
1331 | | |
1332 | | /// This represents 'write' clause in the '#pragma omp atomic' directive. |
1333 | | /// |
1334 | | /// \code |
1335 | | /// #pragma omp atomic write |
1336 | | /// \endcode |
1337 | | /// In this example directive '#pragma omp atomic' has 'write' clause. |
1338 | | class OMPWriteClause : public OMPClause { |
1339 | | public: |
1340 | | /// Build 'write' clause. |
1341 | | /// |
1342 | | /// \param StartLoc Starting location of the clause. |
1343 | | /// \param EndLoc Ending location of the clause. |
1344 | | OMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1345 | 282 | : OMPClause(OMPC_write, StartLoc, EndLoc) {} |
1346 | | |
1347 | | /// Build an empty clause. |
1348 | | OMPWriteClause() |
1349 | 104 | : OMPClause(OMPC_write, SourceLocation(), SourceLocation()) {} |
1350 | | |
1351 | 16 | child_range children() { |
1352 | 16 | return child_range(child_iterator(), child_iterator()); |
1353 | 16 | } |
1354 | | |
1355 | | static bool classof(const OMPClause *T) { |
1356 | | return T->getClauseKind() == OMPC_write; |
1357 | | } |
1358 | | }; |
1359 | | |
1360 | | /// This represents 'update' clause in the '#pragma omp atomic' |
1361 | | /// directive. |
1362 | | /// |
1363 | | /// \code |
1364 | | /// #pragma omp atomic update |
1365 | | /// \endcode |
1366 | | /// In this example directive '#pragma omp atomic' has 'update' clause. |
1367 | | class OMPUpdateClause : public OMPClause { |
1368 | | public: |
1369 | | /// Build 'update' clause. |
1370 | | /// |
1371 | | /// \param StartLoc Starting location of the clause. |
1372 | | /// \param EndLoc Ending location of the clause. |
1373 | | OMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1374 | 228 | : OMPClause(OMPC_update, StartLoc, EndLoc) {} |
1375 | | |
1376 | | /// Build an empty clause. |
1377 | | OMPUpdateClause() |
1378 | 54 | : OMPClause(OMPC_update, SourceLocation(), SourceLocation()) {} |
1379 | | |
1380 | 8 | child_range children() { |
1381 | 8 | return child_range(child_iterator(), child_iterator()); |
1382 | 8 | } |
1383 | | |
1384 | | static bool classof(const OMPClause *T) { |
1385 | | return T->getClauseKind() == OMPC_update; |
1386 | | } |
1387 | | }; |
1388 | | |
1389 | | /// This represents 'capture' clause in the '#pragma omp atomic' |
1390 | | /// directive. |
1391 | | /// |
1392 | | /// \code |
1393 | | /// #pragma omp atomic capture |
1394 | | /// \endcode |
1395 | | /// In this example directive '#pragma omp atomic' has 'capture' clause. |
1396 | | class OMPCaptureClause : public OMPClause { |
1397 | | public: |
1398 | | /// Build 'capture' clause. |
1399 | | /// |
1400 | | /// \param StartLoc Starting location of the clause. |
1401 | | /// \param EndLoc Ending location of the clause. |
1402 | | OMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1403 | 660 | : OMPClause(OMPC_capture, StartLoc, EndLoc) {} |
1404 | | |
1405 | | /// Build an empty clause. |
1406 | | OMPCaptureClause() |
1407 | 112 | : OMPClause(OMPC_capture, SourceLocation(), SourceLocation()) {} |
1408 | | |
1409 | 16 | child_range children() { |
1410 | 16 | return child_range(child_iterator(), child_iterator()); |
1411 | 16 | } |
1412 | | |
1413 | | static bool classof(const OMPClause *T) { |
1414 | | return T->getClauseKind() == OMPC_capture; |
1415 | | } |
1416 | | }; |
1417 | | |
1418 | | /// This represents 'seq_cst' clause in the '#pragma omp atomic' |
1419 | | /// directive. |
1420 | | /// |
1421 | | /// \code |
1422 | | /// #pragma omp atomic seq_cst |
1423 | | /// \endcode |
1424 | | /// In this example directive '#pragma omp atomic' has 'seq_cst' clause. |
1425 | | class OMPSeqCstClause : public OMPClause { |
1426 | | public: |
1427 | | /// Build 'seq_cst' clause. |
1428 | | /// |
1429 | | /// \param StartLoc Starting location of the clause. |
1430 | | /// \param EndLoc Ending location of the clause. |
1431 | | OMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1432 | 128 | : OMPClause(OMPC_seq_cst, StartLoc, EndLoc) {} |
1433 | | |
1434 | | /// Build an empty clause. |
1435 | | OMPSeqCstClause() |
1436 | 56 | : OMPClause(OMPC_seq_cst, SourceLocation(), SourceLocation()) {} |
1437 | | |
1438 | 0 | child_range children() { |
1439 | 0 | return child_range(child_iterator(), child_iterator()); |
1440 | 0 | } |
1441 | | |
1442 | 380 | static bool classof(const OMPClause *T) { |
1443 | 380 | return T->getClauseKind() == OMPC_seq_cst; |
1444 | 380 | } |
1445 | | }; |
1446 | | |
1447 | | /// This represents clause 'private' in the '#pragma omp ...' directives. |
1448 | | /// |
1449 | | /// \code |
1450 | | /// #pragma omp parallel private(a,b) |
1451 | | /// \endcode |
1452 | | /// In this example directive '#pragma omp parallel' has clause 'private' |
1453 | | /// with the variables 'a' and 'b'. |
1454 | | class OMPPrivateClause final |
1455 | | : public OMPVarListClause<OMPPrivateClause>, |
1456 | | private llvm::TrailingObjects<OMPPrivateClause, Expr *> { |
1457 | | friend class OMPClauseReader; |
1458 | | friend OMPVarListClause; |
1459 | | friend TrailingObjects; |
1460 | | |
1461 | | /// Build clause with number of variables \a N. |
1462 | | /// |
1463 | | /// \param StartLoc Starting location of the clause. |
1464 | | /// \param LParenLoc Location of '('. |
1465 | | /// \param EndLoc Ending location of the clause. |
1466 | | /// \param N Number of the variables in the clause. |
1467 | | OMPPrivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
1468 | | SourceLocation EndLoc, unsigned N) |
1469 | | : OMPVarListClause<OMPPrivateClause>(OMPC_private, StartLoc, LParenLoc, |
1470 | 7.63k | EndLoc, N) {} |
1471 | | |
1472 | | /// Build an empty clause. |
1473 | | /// |
1474 | | /// \param N Number of variables. |
1475 | | explicit OMPPrivateClause(unsigned N) |
1476 | | : OMPVarListClause<OMPPrivateClause>(OMPC_private, SourceLocation(), |
1477 | | SourceLocation(), SourceLocation(), |
1478 | 906 | N) {} |
1479 | | |
1480 | | /// Sets the list of references to private copies with initializers for |
1481 | | /// new private variables. |
1482 | | /// \param VL List of references. |
1483 | | void setPrivateCopies(ArrayRef<Expr *> VL); |
1484 | | |
1485 | | /// Gets the list of references to private copies with initializers for |
1486 | | /// new private variables. |
1487 | 1.89k | MutableArrayRef<Expr *> getPrivateCopies() { |
1488 | 1.89k | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
1489 | 1.89k | } |
1490 | 2.57k | ArrayRef<const Expr *> getPrivateCopies() const { |
1491 | 2.57k | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
1492 | 2.57k | } |
1493 | | |
1494 | | public: |
1495 | | /// Creates clause with a list of variables \a VL. |
1496 | | /// |
1497 | | /// \param C AST context. |
1498 | | /// \param StartLoc Starting location of the clause. |
1499 | | /// \param LParenLoc Location of '('. |
1500 | | /// \param EndLoc Ending location of the clause. |
1501 | | /// \param VL List of references to the variables. |
1502 | | /// \param PrivateVL List of references to private copies with initializers. |
1503 | | static OMPPrivateClause *Create(const ASTContext &C, SourceLocation StartLoc, |
1504 | | SourceLocation LParenLoc, |
1505 | | SourceLocation EndLoc, ArrayRef<Expr *> VL, |
1506 | | ArrayRef<Expr *> PrivateVL); |
1507 | | |
1508 | | /// Creates an empty clause with the place for \a N variables. |
1509 | | /// |
1510 | | /// \param C AST context. |
1511 | | /// \param N The number of variables. |
1512 | | static OMPPrivateClause *CreateEmpty(const ASTContext &C, unsigned N); |
1513 | | |
1514 | | using private_copies_iterator = MutableArrayRef<Expr *>::iterator; |
1515 | | using private_copies_const_iterator = ArrayRef<const Expr *>::iterator; |
1516 | | using private_copies_range = llvm::iterator_range<private_copies_iterator>; |
1517 | | using private_copies_const_range = |
1518 | | llvm::iterator_range<private_copies_const_iterator>; |
1519 | | |
1520 | 946 | private_copies_range private_copies() { |
1521 | 946 | return private_copies_range(getPrivateCopies().begin(), |
1522 | 946 | getPrivateCopies().end()); |
1523 | 946 | } |
1524 | | |
1525 | 1.28k | private_copies_const_range private_copies() const { |
1526 | 1.28k | return private_copies_const_range(getPrivateCopies().begin(), |
1527 | 1.28k | getPrivateCopies().end()); |
1528 | 1.28k | } |
1529 | | |
1530 | 9.22k | child_range children() { |
1531 | 9.22k | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
1532 | 9.22k | reinterpret_cast<Stmt **>(varlist_end())); |
1533 | 9.22k | } |
1534 | | |
1535 | 25.6k | static bool classof(const OMPClause *T) { |
1536 | 25.6k | return T->getClauseKind() == OMPC_private; |
1537 | 25.6k | } |
1538 | | }; |
1539 | | |
1540 | | /// This represents clause 'firstprivate' in the '#pragma omp ...' |
1541 | | /// directives. |
1542 | | /// |
1543 | | /// \code |
1544 | | /// #pragma omp parallel firstprivate(a,b) |
1545 | | /// \endcode |
1546 | | /// In this example directive '#pragma omp parallel' has clause 'firstprivate' |
1547 | | /// with the variables 'a' and 'b'. |
1548 | | class OMPFirstprivateClause final |
1549 | | : public OMPVarListClause<OMPFirstprivateClause>, |
1550 | | public OMPClauseWithPreInit, |
1551 | | private llvm::TrailingObjects<OMPFirstprivateClause, Expr *> { |
1552 | | friend class OMPClauseReader; |
1553 | | friend OMPVarListClause; |
1554 | | friend TrailingObjects; |
1555 | | |
1556 | | /// Build clause with number of variables \a N. |
1557 | | /// |
1558 | | /// \param StartLoc Starting location of the clause. |
1559 | | /// \param LParenLoc Location of '('. |
1560 | | /// \param EndLoc Ending location of the clause. |
1561 | | /// \param N Number of the variables in the clause. |
1562 | | OMPFirstprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
1563 | | SourceLocation EndLoc, unsigned N) |
1564 | | : OMPVarListClause<OMPFirstprivateClause>(OMPC_firstprivate, StartLoc, |
1565 | | LParenLoc, EndLoc, N), |
1566 | 28.8k | OMPClauseWithPreInit(this) {} |
1567 | | |
1568 | | /// Build an empty clause. |
1569 | | /// |
1570 | | /// \param N Number of variables. |
1571 | | explicit OMPFirstprivateClause(unsigned N) |
1572 | | : OMPVarListClause<OMPFirstprivateClause>( |
1573 | | OMPC_firstprivate, SourceLocation(), SourceLocation(), |
1574 | | SourceLocation(), N), |
1575 | 2.74k | OMPClauseWithPreInit(this) {} |
1576 | | |
1577 | | /// Sets the list of references to private copies with initializers for |
1578 | | /// new private variables. |
1579 | | /// \param VL List of references. |
1580 | | void setPrivateCopies(ArrayRef<Expr *> VL); |
1581 | | |
1582 | | /// Gets the list of references to private copies with initializers for |
1583 | | /// new private variables. |
1584 | 42.6k | MutableArrayRef<Expr *> getPrivateCopies() { |
1585 | 42.6k | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
1586 | 42.6k | } |
1587 | 28.1k | ArrayRef<const Expr *> getPrivateCopies() const { |
1588 | 28.1k | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
1589 | 28.1k | } |
1590 | | |
1591 | | /// Sets the list of references to initializer variables for new |
1592 | | /// private variables. |
1593 | | /// \param VL List of references. |
1594 | | void setInits(ArrayRef<Expr *> VL); |
1595 | | |
1596 | | /// Gets the list of references to initializer variables for new |
1597 | | /// private variables. |
1598 | 5.55k | MutableArrayRef<Expr *> getInits() { |
1599 | 5.55k | return MutableArrayRef<Expr *>(getPrivateCopies().end(), varlist_size()); |
1600 | 5.55k | } |
1601 | 14.0k | ArrayRef<const Expr *> getInits() const { |
1602 | 14.0k | return llvm::makeArrayRef(getPrivateCopies().end(), varlist_size()); |
1603 | 14.0k | } |
1604 | | |
1605 | | public: |
1606 | | /// Creates clause with a list of variables \a VL. |
1607 | | /// |
1608 | | /// \param C AST context. |
1609 | | /// \param StartLoc Starting location of the clause. |
1610 | | /// \param LParenLoc Location of '('. |
1611 | | /// \param EndLoc Ending location of the clause. |
1612 | | /// \param VL List of references to the original variables. |
1613 | | /// \param PrivateVL List of references to private copies with initializers. |
1614 | | /// \param InitVL List of references to auto generated variables used for |
1615 | | /// initialization of a single array element. Used if firstprivate variable is |
1616 | | /// of array type. |
1617 | | /// \param PreInit Statement that must be executed before entering the OpenMP |
1618 | | /// region with this clause. |
1619 | | static OMPFirstprivateClause * |
1620 | | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
1621 | | SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> PrivateVL, |
1622 | | ArrayRef<Expr *> InitVL, Stmt *PreInit); |
1623 | | |
1624 | | /// Creates an empty clause with the place for \a N variables. |
1625 | | /// |
1626 | | /// \param C AST context. |
1627 | | /// \param N The number of variables. |
1628 | | static OMPFirstprivateClause *CreateEmpty(const ASTContext &C, unsigned N); |
1629 | | |
1630 | | using private_copies_iterator = MutableArrayRef<Expr *>::iterator; |
1631 | | using private_copies_const_iterator = ArrayRef<const Expr *>::iterator; |
1632 | | using private_copies_range = llvm::iterator_range<private_copies_iterator>; |
1633 | | using private_copies_const_range = |
1634 | | llvm::iterator_range<private_copies_const_iterator>; |
1635 | | |
1636 | 2.77k | private_copies_range private_copies() { |
1637 | 2.77k | return private_copies_range(getPrivateCopies().begin(), |
1638 | 2.77k | getPrivateCopies().end()); |
1639 | 2.77k | } |
1640 | 7.04k | private_copies_const_range private_copies() const { |
1641 | 7.04k | return private_copies_const_range(getPrivateCopies().begin(), |
1642 | 7.04k | getPrivateCopies().end()); |
1643 | 7.04k | } |
1644 | | |
1645 | | using inits_iterator = MutableArrayRef<Expr *>::iterator; |
1646 | | using inits_const_iterator = ArrayRef<const Expr *>::iterator; |
1647 | | using inits_range = llvm::iterator_range<inits_iterator>; |
1648 | | using inits_const_range = llvm::iterator_range<inits_const_iterator>; |
1649 | | |
1650 | 2.77k | inits_range inits() { |
1651 | 2.77k | return inits_range(getInits().begin(), getInits().end()); |
1652 | 2.77k | } |
1653 | 7.04k | inits_const_range inits() const { |
1654 | 7.04k | return inits_const_range(getInits().begin(), getInits().end()); |
1655 | 7.04k | } |
1656 | | |
1657 | 5.45k | child_range children() { |
1658 | 5.45k | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
1659 | 5.45k | reinterpret_cast<Stmt **>(varlist_end())); |
1660 | 5.45k | } |
1661 | | |
1662 | 37.0k | static bool classof(const OMPClause *T) { |
1663 | 37.0k | return T->getClauseKind() == OMPC_firstprivate; |
1664 | 37.0k | } |
1665 | | }; |
1666 | | |
1667 | | /// This represents clause 'lastprivate' in the '#pragma omp ...' |
1668 | | /// directives. |
1669 | | /// |
1670 | | /// \code |
1671 | | /// #pragma omp simd lastprivate(a,b) |
1672 | | /// \endcode |
1673 | | /// In this example directive '#pragma omp simd' has clause 'lastprivate' |
1674 | | /// with the variables 'a' and 'b'. |
1675 | | class OMPLastprivateClause final |
1676 | | : public OMPVarListClause<OMPLastprivateClause>, |
1677 | | public OMPClauseWithPostUpdate, |
1678 | | private llvm::TrailingObjects<OMPLastprivateClause, Expr *> { |
1679 | | // There are 4 additional tail-allocated arrays at the end of the class: |
1680 | | // 1. Contains list of pseudo variables with the default initialization for |
1681 | | // each non-firstprivate variables. Used in codegen for initialization of |
1682 | | // lastprivate copies. |
1683 | | // 2. List of helper expressions for proper generation of assignment operation |
1684 | | // required for lastprivate clause. This list represents private variables |
1685 | | // (for arrays, single array element). |
1686 | | // 3. List of helper expressions for proper generation of assignment operation |
1687 | | // required for lastprivate clause. This list represents original variables |
1688 | | // (for arrays, single array element). |
1689 | | // 4. List of helper expressions that represents assignment operation: |
1690 | | // \code |
1691 | | // DstExprs = SrcExprs; |
1692 | | // \endcode |
1693 | | // Required for proper codegen of final assignment performed by the |
1694 | | // lastprivate clause. |
1695 | | friend class OMPClauseReader; |
1696 | | friend OMPVarListClause; |
1697 | | friend TrailingObjects; |
1698 | | |
1699 | | /// Build clause with number of variables \a N. |
1700 | | /// |
1701 | | /// \param StartLoc Starting location of the clause. |
1702 | | /// \param LParenLoc Location of '('. |
1703 | | /// \param EndLoc Ending location of the clause. |
1704 | | /// \param N Number of the variables in the clause. |
1705 | | OMPLastprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
1706 | | SourceLocation EndLoc, unsigned N) |
1707 | | : OMPVarListClause<OMPLastprivateClause>(OMPC_lastprivate, StartLoc, |
1708 | | LParenLoc, EndLoc, N), |
1709 | 2.75k | OMPClauseWithPostUpdate(this) {} |
1710 | | |
1711 | | /// Build an empty clause. |
1712 | | /// |
1713 | | /// \param N Number of variables. |
1714 | | explicit OMPLastprivateClause(unsigned N) |
1715 | | : OMPVarListClause<OMPLastprivateClause>( |
1716 | | OMPC_lastprivate, SourceLocation(), SourceLocation(), |
1717 | | SourceLocation(), N), |
1718 | 270 | OMPClauseWithPostUpdate(this) {} |
1719 | | |
1720 | | /// Get the list of helper expressions for initialization of private |
1721 | | /// copies for lastprivate variables. |
1722 | 11.6k | MutableArrayRef<Expr *> getPrivateCopies() { |
1723 | 11.6k | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
1724 | 11.6k | } |
1725 | 5.27k | ArrayRef<const Expr *> getPrivateCopies() const { |
1726 | 5.27k | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
1727 | 5.27k | } |
1728 | | |
1729 | | /// Set list of helper expressions, required for proper codegen of the |
1730 | | /// clause. These expressions represent private variables (for arrays, single |
1731 | | /// array element) in the final assignment statement performed by the |
1732 | | /// lastprivate clause. |
1733 | | void setSourceExprs(ArrayRef<Expr *> SrcExprs); |
1734 | | |
1735 | | /// Get the list of helper source expressions. |
1736 | 7.96k | MutableArrayRef<Expr *> getSourceExprs() { |
1737 | 7.96k | return MutableArrayRef<Expr *>(getPrivateCopies().end(), varlist_size()); |
1738 | 7.96k | } |
1739 | 4.41k | ArrayRef<const Expr *> getSourceExprs() const { |
1740 | 4.41k | return llvm::makeArrayRef(getPrivateCopies().end(), varlist_size()); |
1741 | 4.41k | } |
1742 | | |
1743 | | /// Set list of helper expressions, required for proper codegen of the |
1744 | | /// clause. These expressions represent original variables (for arrays, single |
1745 | | /// array element) in the final assignment statement performed by the |
1746 | | /// lastprivate clause. |
1747 | | void setDestinationExprs(ArrayRef<Expr *> DstExprs); |
1748 | | |
1749 | | /// Get the list of helper destination expressions. |
1750 | 4.30k | MutableArrayRef<Expr *> getDestinationExprs() { |
1751 | 4.30k | return MutableArrayRef<Expr *>(getSourceExprs().end(), varlist_size()); |
1752 | 4.30k | } |
1753 | 3.23k | ArrayRef<const Expr *> getDestinationExprs() const { |
1754 | 3.23k | return llvm::makeArrayRef(getSourceExprs().end(), varlist_size()); |
1755 | 3.23k | } |
1756 | | |
1757 | | /// Set list of helper assignment expressions, required for proper |
1758 | | /// codegen of the clause. These expressions are assignment expressions that |
1759 | | /// assign private copy of the variable to original variable. |
1760 | | void setAssignmentOps(ArrayRef<Expr *> AssignmentOps); |
1761 | | |
1762 | | /// Get the list of helper assignment expressions. |
1763 | 636 | MutableArrayRef<Expr *> getAssignmentOps() { |
1764 | 636 | return MutableArrayRef<Expr *>(getDestinationExprs().end(), varlist_size()); |
1765 | 636 | } |
1766 | 1.18k | ArrayRef<const Expr *> getAssignmentOps() const { |
1767 | 1.18k | return llvm::makeArrayRef(getDestinationExprs().end(), varlist_size()); |
1768 | 1.18k | } |
1769 | | |
1770 | | public: |
1771 | | /// Creates clause with a list of variables \a VL. |
1772 | | /// |
1773 | | /// \param C AST context. |
1774 | | /// \param StartLoc Starting location of the clause. |
1775 | | /// \param LParenLoc Location of '('. |
1776 | | /// \param EndLoc Ending location of the clause. |
1777 | | /// \param VL List of references to the variables. |
1778 | | /// \param SrcExprs List of helper expressions for proper generation of |
1779 | | /// assignment operation required for lastprivate clause. This list represents |
1780 | | /// private variables (for arrays, single array element). |
1781 | | /// \param DstExprs List of helper expressions for proper generation of |
1782 | | /// assignment operation required for lastprivate clause. This list represents |
1783 | | /// original variables (for arrays, single array element). |
1784 | | /// \param AssignmentOps List of helper expressions that represents assignment |
1785 | | /// operation: |
1786 | | /// \code |
1787 | | /// DstExprs = SrcExprs; |
1788 | | /// \endcode |
1789 | | /// Required for proper codegen of final assignment performed by the |
1790 | | /// lastprivate clause. |
1791 | | /// \param PreInit Statement that must be executed before entering the OpenMP |
1792 | | /// region with this clause. |
1793 | | /// \param PostUpdate Expression that must be executed after exit from the |
1794 | | /// OpenMP region with this clause. |
1795 | | static OMPLastprivateClause * |
1796 | | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
1797 | | SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs, |
1798 | | ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps, |
1799 | | Stmt *PreInit, Expr *PostUpdate); |
1800 | | |
1801 | | /// Creates an empty clause with the place for \a N variables. |
1802 | | /// |
1803 | | /// \param C AST context. |
1804 | | /// \param N The number of variables. |
1805 | | static OMPLastprivateClause *CreateEmpty(const ASTContext &C, unsigned N); |
1806 | | |
1807 | | using helper_expr_iterator = MutableArrayRef<Expr *>::iterator; |
1808 | | using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator; |
1809 | | using helper_expr_range = llvm::iterator_range<helper_expr_iterator>; |
1810 | | using helper_expr_const_range = |
1811 | | llvm::iterator_range<helper_expr_const_iterator>; |
1812 | | |
1813 | | /// Set list of helper expressions, required for generation of private |
1814 | | /// copies of original lastprivate variables. |
1815 | | void setPrivateCopies(ArrayRef<Expr *> PrivateCopies); |
1816 | | |
1817 | 429 | helper_expr_const_range private_copies() const { |
1818 | 429 | return helper_expr_const_range(getPrivateCopies().begin(), |
1819 | 429 | getPrivateCopies().end()); |
1820 | 429 | } |
1821 | | |
1822 | 318 | helper_expr_range private_copies() { |
1823 | 318 | return helper_expr_range(getPrivateCopies().begin(), |
1824 | 318 | getPrivateCopies().end()); |
1825 | 318 | } |
1826 | | |
1827 | 593 | helper_expr_const_range source_exprs() const { |
1828 | 593 | return helper_expr_const_range(getSourceExprs().begin(), |
1829 | 593 | getSourceExprs().end()); |
1830 | 593 | } |
1831 | | |
1832 | 318 | helper_expr_range source_exprs() { |
1833 | 318 | return helper_expr_range(getSourceExprs().begin(), getSourceExprs().end()); |
1834 | 318 | } |
1835 | | |
1836 | 1.02k | helper_expr_const_range destination_exprs() const { |
1837 | 1.02k | return helper_expr_const_range(getDestinationExprs().begin(), |
1838 | 1.02k | getDestinationExprs().end()); |
1839 | 1.02k | } |
1840 | | |
1841 | 318 | helper_expr_range destination_exprs() { |
1842 | 318 | return helper_expr_range(getDestinationExprs().begin(), |
1843 | 318 | getDestinationExprs().end()); |
1844 | 318 | } |
1845 | | |
1846 | 593 | helper_expr_const_range assignment_ops() const { |
1847 | 593 | return helper_expr_const_range(getAssignmentOps().begin(), |
1848 | 593 | getAssignmentOps().end()); |
1849 | 593 | } |
1850 | | |
1851 | 318 | helper_expr_range assignment_ops() { |
1852 | 318 | return helper_expr_range(getAssignmentOps().begin(), |
1853 | 318 | getAssignmentOps().end()); |
1854 | 318 | } |
1855 | | |
1856 | 3.85k | child_range children() { |
1857 | 3.85k | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
1858 | 3.85k | reinterpret_cast<Stmt **>(varlist_end())); |
1859 | 3.85k | } |
1860 | | |
1861 | 126k | static bool classof(const OMPClause *T) { |
1862 | 126k | return T->getClauseKind() == OMPC_lastprivate; |
1863 | 126k | } |
1864 | | }; |
1865 | | |
1866 | | /// This represents clause 'shared' in the '#pragma omp ...' directives. |
1867 | | /// |
1868 | | /// \code |
1869 | | /// #pragma omp parallel shared(a,b) |
1870 | | /// \endcode |
1871 | | /// In this example directive '#pragma omp parallel' has clause 'shared' |
1872 | | /// with the variables 'a' and 'b'. |
1873 | | class OMPSharedClause final |
1874 | | : public OMPVarListClause<OMPSharedClause>, |
1875 | | private llvm::TrailingObjects<OMPSharedClause, Expr *> { |
1876 | | friend OMPVarListClause; |
1877 | | friend TrailingObjects; |
1878 | | |
1879 | | /// Build clause with number of variables \a N. |
1880 | | /// |
1881 | | /// \param StartLoc Starting location of the clause. |
1882 | | /// \param LParenLoc Location of '('. |
1883 | | /// \param EndLoc Ending location of the clause. |
1884 | | /// \param N Number of the variables in the clause. |
1885 | | OMPSharedClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
1886 | | SourceLocation EndLoc, unsigned N) |
1887 | | : OMPVarListClause<OMPSharedClause>(OMPC_shared, StartLoc, LParenLoc, |
1888 | 2.08k | EndLoc, N) {} |
1889 | | |
1890 | | /// Build an empty clause. |
1891 | | /// |
1892 | | /// \param N Number of variables. |
1893 | | explicit OMPSharedClause(unsigned N) |
1894 | | : OMPVarListClause<OMPSharedClause>(OMPC_shared, SourceLocation(), |
1895 | | SourceLocation(), SourceLocation(), |
1896 | 172 | N) {} |
1897 | | |
1898 | | public: |
1899 | | /// Creates clause with a list of variables \a VL. |
1900 | | /// |
1901 | | /// \param C AST context. |
1902 | | /// \param StartLoc Starting location of the clause. |
1903 | | /// \param LParenLoc Location of '('. |
1904 | | /// \param EndLoc Ending location of the clause. |
1905 | | /// \param VL List of references to the variables. |
1906 | | static OMPSharedClause *Create(const ASTContext &C, SourceLocation StartLoc, |
1907 | | SourceLocation LParenLoc, |
1908 | | SourceLocation EndLoc, ArrayRef<Expr *> VL); |
1909 | | |
1910 | | /// Creates an empty clause with \a N variables. |
1911 | | /// |
1912 | | /// \param C AST context. |
1913 | | /// \param N The number of variables. |
1914 | | static OMPSharedClause *CreateEmpty(const ASTContext &C, unsigned N); |
1915 | | |
1916 | 399 | child_range children() { |
1917 | 399 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
1918 | 399 | reinterpret_cast<Stmt **>(varlist_end())); |
1919 | 399 | } |
1920 | | |
1921 | | static bool classof(const OMPClause *T) { |
1922 | | return T->getClauseKind() == OMPC_shared; |
1923 | | } |
1924 | | }; |
1925 | | |
1926 | | /// This represents clause 'reduction' in the '#pragma omp ...' |
1927 | | /// directives. |
1928 | | /// |
1929 | | /// \code |
1930 | | /// #pragma omp parallel reduction(+:a,b) |
1931 | | /// \endcode |
1932 | | /// In this example directive '#pragma omp parallel' has clause 'reduction' |
1933 | | /// with operator '+' and the variables 'a' and 'b'. |
1934 | | class OMPReductionClause final |
1935 | | : public OMPVarListClause<OMPReductionClause>, |
1936 | | public OMPClauseWithPostUpdate, |
1937 | | private llvm::TrailingObjects<OMPReductionClause, Expr *> { |
1938 | | friend class OMPClauseReader; |
1939 | | friend OMPVarListClause; |
1940 | | friend TrailingObjects; |
1941 | | |
1942 | | /// Location of ':'. |
1943 | | SourceLocation ColonLoc; |
1944 | | |
1945 | | /// Nested name specifier for C++. |
1946 | | NestedNameSpecifierLoc QualifierLoc; |
1947 | | |
1948 | | /// Name of custom operator. |
1949 | | DeclarationNameInfo NameInfo; |
1950 | | |
1951 | | /// Build clause with number of variables \a N. |
1952 | | /// |
1953 | | /// \param StartLoc Starting location of the clause. |
1954 | | /// \param LParenLoc Location of '('. |
1955 | | /// \param EndLoc Ending location of the clause. |
1956 | | /// \param ColonLoc Location of ':'. |
1957 | | /// \param N Number of the variables in the clause. |
1958 | | /// \param QualifierLoc The nested-name qualifier with location information |
1959 | | /// \param NameInfo The full name info for reduction identifier. |
1960 | | OMPReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
1961 | | SourceLocation ColonLoc, SourceLocation EndLoc, unsigned N, |
1962 | | NestedNameSpecifierLoc QualifierLoc, |
1963 | | const DeclarationNameInfo &NameInfo) |
1964 | | : OMPVarListClause<OMPReductionClause>(OMPC_reduction, StartLoc, |
1965 | | LParenLoc, EndLoc, N), |
1966 | | OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc), |
1967 | 10.6k | QualifierLoc(QualifierLoc), NameInfo(NameInfo) {} |
1968 | | |
1969 | | /// Build an empty clause. |
1970 | | /// |
1971 | | /// \param N Number of variables. |
1972 | | explicit OMPReductionClause(unsigned N) |
1973 | | : OMPVarListClause<OMPReductionClause>(OMPC_reduction, SourceLocation(), |
1974 | | SourceLocation(), SourceLocation(), |
1975 | | N), |
1976 | 576 | OMPClauseWithPostUpdate(this) {} |
1977 | | |
1978 | | /// Sets location of ':' symbol in clause. |
1979 | 576 | void setColonLoc(SourceLocation CL) { ColonLoc = CL; } |
1980 | | |
1981 | | /// Sets the name info for specified reduction identifier. |
1982 | 576 | void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; } |
1983 | | |
1984 | | /// Sets the nested name specifier. |
1985 | 576 | void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; } |
1986 | | |
1987 | | /// Set list of helper expressions, required for proper codegen of the |
1988 | | /// clause. These expressions represent private copy of the reduction |
1989 | | /// variable. |
1990 | | void setPrivates(ArrayRef<Expr *> Privates); |
1991 | | |
1992 | | /// Get the list of helper privates. |
1993 | 53.8k | MutableArrayRef<Expr *> getPrivates() { |
1994 | 53.8k | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
1995 | 53.8k | } |
1996 | 14.4k | ArrayRef<const Expr *> getPrivates() const { |
1997 | 14.4k | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
1998 | 14.4k | } |
1999 | | |
2000 | | /// Set list of helper expressions, required for proper codegen of the |
2001 | | /// clause. These expressions represent LHS expression in the final |
2002 | | /// reduction expression performed by the reduction clause. |
2003 | | void setLHSExprs(ArrayRef<Expr *> LHSExprs); |
2004 | | |
2005 | | /// Get the list of helper LHS expressions. |
2006 | 41.3k | MutableArrayRef<Expr *> getLHSExprs() { |
2007 | 41.3k | return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size()); |
2008 | 41.3k | } |
2009 | 10.8k | ArrayRef<const Expr *> getLHSExprs() const { |
2010 | 10.8k | return llvm::makeArrayRef(getPrivates().end(), varlist_size()); |
2011 | 10.8k | } |
2012 | | |
2013 | | /// Set list of helper expressions, required for proper codegen of the |
2014 | | /// clause. These expressions represent RHS expression in the final |
2015 | | /// reduction expression performed by the reduction clause. |
2016 | | /// Also, variables in these expressions are used for proper initialization of |
2017 | | /// reduction copies. |
2018 | | void setRHSExprs(ArrayRef<Expr *> RHSExprs); |
2019 | | |
2020 | | /// Get the list of helper destination expressions. |
2021 | 28.9k | MutableArrayRef<Expr *> getRHSExprs() { |
2022 | 28.9k | return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size()); |
2023 | 28.9k | } |
2024 | 7.23k | ArrayRef<const Expr *> getRHSExprs() const { |
2025 | 7.23k | return llvm::makeArrayRef(getLHSExprs().end(), varlist_size()); |
2026 | 7.23k | } |
2027 | | |
2028 | | /// Set list of helper reduction expressions, required for proper |
2029 | | /// codegen of the clause. These expressions are binary expressions or |
2030 | | /// operator/custom reduction call that calculates new value from source |
2031 | | /// helper expressions to destination helper expressions. |
2032 | | void setReductionOps(ArrayRef<Expr *> ReductionOps); |
2033 | | |
2034 | | /// Get the list of helper reduction expressions. |
2035 | 16.4k | MutableArrayRef<Expr *> getReductionOps() { |
2036 | 16.4k | return MutableArrayRef<Expr *>(getRHSExprs().end(), varlist_size()); |
2037 | 16.4k | } |
2038 | 3.61k | ArrayRef<const Expr *> getReductionOps() const { |
2039 | 3.61k | return llvm::makeArrayRef(getRHSExprs().end(), varlist_size()); |
2040 | 3.61k | } |
2041 | | |
2042 | | public: |
2043 | | /// Creates clause with a list of variables \a VL. |
2044 | | /// |
2045 | | /// \param StartLoc Starting location of the clause. |
2046 | | /// \param LParenLoc Location of '('. |
2047 | | /// \param ColonLoc Location of ':'. |
2048 | | /// \param EndLoc Ending location of the clause. |
2049 | | /// \param VL The variables in the clause. |
2050 | | /// \param QualifierLoc The nested-name qualifier with location information |
2051 | | /// \param NameInfo The full name info for reduction identifier. |
2052 | | /// \param Privates List of helper expressions for proper generation of |
2053 | | /// private copies. |
2054 | | /// \param LHSExprs List of helper expressions for proper generation of |
2055 | | /// assignment operation required for copyprivate clause. This list represents |
2056 | | /// LHSs of the reduction expressions. |
2057 | | /// \param RHSExprs List of helper expressions for proper generation of |
2058 | | /// assignment operation required for copyprivate clause. This list represents |
2059 | | /// RHSs of the reduction expressions. |
2060 | | /// Also, variables in these expressions are used for proper initialization of |
2061 | | /// reduction copies. |
2062 | | /// \param ReductionOps List of helper expressions that represents reduction |
2063 | | /// expressions: |
2064 | | /// \code |
2065 | | /// LHSExprs binop RHSExprs; |
2066 | | /// operator binop(LHSExpr, RHSExpr); |
2067 | | /// <CutomReduction>(LHSExpr, RHSExpr); |
2068 | | /// \endcode |
2069 | | /// Required for proper codegen of final reduction operation performed by the |
2070 | | /// reduction clause. |
2071 | | /// \param PreInit Statement that must be executed before entering the OpenMP |
2072 | | /// region with this clause. |
2073 | | /// \param PostUpdate Expression that must be executed after exit from the |
2074 | | /// OpenMP region with this clause. |
2075 | | static OMPReductionClause * |
2076 | | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
2077 | | SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL, |
2078 | | NestedNameSpecifierLoc QualifierLoc, |
2079 | | const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates, |
2080 | | ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs, |
2081 | | ArrayRef<Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate); |
2082 | | |
2083 | | /// Creates an empty clause with the place for \a N variables. |
2084 | | /// |
2085 | | /// \param C AST context. |
2086 | | /// \param N The number of variables. |
2087 | | static OMPReductionClause *CreateEmpty(const ASTContext &C, unsigned N); |
2088 | | |
2089 | | /// Gets location of ':' symbol in clause. |
2090 | 8.23k | SourceLocation getColonLoc() const { return ColonLoc; } |
2091 | | |
2092 | | /// Gets the name info for specified reduction identifier. |
2093 | 9.72k | const DeclarationNameInfo &getNameInfo() const { return NameInfo; } |
2094 | | |
2095 | | /// Gets the nested name specifier. |
2096 | 9.48k | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
2097 | | |
2098 | | using helper_expr_iterator = MutableArrayRef<Expr *>::iterator; |
2099 | | using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator; |
2100 | | using helper_expr_range = llvm::iterator_range<helper_expr_iterator>; |
2101 | | using helper_expr_const_range = |
2102 | | llvm::iterator_range<helper_expr_const_iterator>; |
2103 | | |
2104 | 1.81k | helper_expr_const_range privates() const { |
2105 | 1.81k | return helper_expr_const_range(getPrivates().begin(), getPrivates().end()); |
2106 | 1.81k | } |
2107 | | |
2108 | 595 | helper_expr_range privates() { |
2109 | 595 | return helper_expr_range(getPrivates().begin(), getPrivates().end()); |
2110 | 595 | } |
2111 | | |
2112 | 1.80k | helper_expr_const_range lhs_exprs() const { |
2113 | 1.80k | return helper_expr_const_range(getLHSExprs().begin(), getLHSExprs().end()); |
2114 | 1.80k | } |
2115 | | |
2116 | 595 | helper_expr_range lhs_exprs() { |
2117 | 595 | return helper_expr_range(getLHSExprs().begin(), getLHSExprs().end()); |
2118 | 595 | } |
2119 | | |
2120 | 1.80k | helper_expr_const_range rhs_exprs() const { |
2121 | 1.80k | return helper_expr_const_range(getRHSExprs().begin(), getRHSExprs().end()); |
2122 | 1.80k | } |
2123 | | |
2124 | 595 | helper_expr_range rhs_exprs() { |
2125 | 595 | return helper_expr_range(getRHSExprs().begin(), getRHSExprs().end()); |
2126 | 595 | } |
2127 | | |
2128 | 1.80k | helper_expr_const_range reduction_ops() const { |
2129 | 1.80k | return helper_expr_const_range(getReductionOps().begin(), |
2130 | 1.80k | getReductionOps().end()); |
2131 | 1.80k | } |
2132 | | |
2133 | 8.23k | helper_expr_range reduction_ops() { |
2134 | 8.23k | return helper_expr_range(getReductionOps().begin(), |
2135 | 8.23k | getReductionOps().end()); |
2136 | 8.23k | } |
2137 | | |
2138 | 12.9k | child_range children() { |
2139 | 12.9k | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
2140 | 12.9k | reinterpret_cast<Stmt **>(varlist_end())); |
2141 | 12.9k | } |
2142 | | |
2143 | 41.0k | static bool classof(const OMPClause *T) { |
2144 | 41.0k | return T->getClauseKind() == OMPC_reduction; |
2145 | 41.0k | } |
2146 | | }; |
2147 | | |
2148 | | /// This represents clause 'task_reduction' in the '#pragma omp taskgroup' |
2149 | | /// directives. |
2150 | | /// |
2151 | | /// \code |
2152 | | /// #pragma omp taskgroup task_reduction(+:a,b) |
2153 | | /// \endcode |
2154 | | /// In this example directive '#pragma omp taskgroup' has clause |
2155 | | /// 'task_reduction' with operator '+' and the variables 'a' and 'b'. |
2156 | | class OMPTaskReductionClause final |
2157 | | : public OMPVarListClause<OMPTaskReductionClause>, |
2158 | | public OMPClauseWithPostUpdate, |
2159 | | private llvm::TrailingObjects<OMPTaskReductionClause, Expr *> { |
2160 | | friend class OMPClauseReader; |
2161 | | friend OMPVarListClause; |
2162 | | friend TrailingObjects; |
2163 | | |
2164 | | /// Location of ':'. |
2165 | | SourceLocation ColonLoc; |
2166 | | |
2167 | | /// Nested name specifier for C++. |
2168 | | NestedNameSpecifierLoc QualifierLoc; |
2169 | | |
2170 | | /// Name of custom operator. |
2171 | | DeclarationNameInfo NameInfo; |
2172 | | |
2173 | | /// Build clause with number of variables \a N. |
2174 | | /// |
2175 | | /// \param StartLoc Starting location of the clause. |
2176 | | /// \param LParenLoc Location of '('. |
2177 | | /// \param EndLoc Ending location of the clause. |
2178 | | /// \param ColonLoc Location of ':'. |
2179 | | /// \param N Number of the variables in the clause. |
2180 | | /// \param QualifierLoc The nested-name qualifier with location information |
2181 | | /// \param NameInfo The full name info for reduction identifier. |
2182 | | OMPTaskReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
2183 | | SourceLocation ColonLoc, SourceLocation EndLoc, |
2184 | | unsigned N, NestedNameSpecifierLoc QualifierLoc, |
2185 | | const DeclarationNameInfo &NameInfo) |
2186 | | : OMPVarListClause<OMPTaskReductionClause>(OMPC_task_reduction, StartLoc, |
2187 | | LParenLoc, EndLoc, N), |
2188 | | OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc), |
2189 | 1.41k | QualifierLoc(QualifierLoc), NameInfo(NameInfo) {} |
2190 | | |
2191 | | /// Build an empty clause. |
2192 | | /// |
2193 | | /// \param N Number of variables. |
2194 | | explicit OMPTaskReductionClause(unsigned N) |
2195 | | : OMPVarListClause<OMPTaskReductionClause>( |
2196 | | OMPC_task_reduction, SourceLocation(), SourceLocation(), |
2197 | | SourceLocation(), N), |
2198 | 50 | OMPClauseWithPostUpdate(this) {} |
2199 | | |
2200 | | /// Sets location of ':' symbol in clause. |
2201 | 50 | void setColonLoc(SourceLocation CL) { ColonLoc = CL; } |
2202 | | |
2203 | | /// Sets the name info for specified reduction identifier. |
2204 | 50 | void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; } |
2205 | | |
2206 | | /// Sets the nested name specifier. |
2207 | 50 | void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; } |
2208 | | |
2209 | | /// Set list of helper expressions, required for proper codegen of the clause. |
2210 | | /// These expressions represent private copy of the reduction variable. |
2211 | | void setPrivates(ArrayRef<Expr *> Privates); |
2212 | | |
2213 | | /// Get the list of helper privates. |
2214 | 6.41k | MutableArrayRef<Expr *> getPrivates() { |
2215 | 6.41k | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
2216 | 6.41k | } |
2217 | 480 | ArrayRef<const Expr *> getPrivates() const { |
2218 | 480 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
2219 | 480 | } |
2220 | | |
2221 | | /// Set list of helper expressions, required for proper codegen of the clause. |
2222 | | /// These expressions represent LHS expression in the final reduction |
2223 | | /// expression performed by the reduction clause. |
2224 | | void setLHSExprs(ArrayRef<Expr *> LHSExprs); |
2225 | | |
2226 | | /// Get the list of helper LHS expressions. |
2227 | 4.84k | MutableArrayRef<Expr *> getLHSExprs() { |
2228 | 4.84k | return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size()); |
2229 | 4.84k | } |
2230 | 360 | ArrayRef<const Expr *> getLHSExprs() const { |
2231 | 360 | return llvm::makeArrayRef(getPrivates().end(), varlist_size()); |
2232 | 360 | } |
2233 | | |
2234 | | /// Set list of helper expressions, required for proper codegen of the clause. |
2235 | | /// These expressions represent RHS expression in the final reduction |
2236 | | /// expression performed by the reduction clause. Also, variables in these |
2237 | | /// expressions are used for proper initialization of reduction copies. |
2238 | | void setRHSExprs(ArrayRef<Expr *> RHSExprs); |
2239 | | |
2240 | | /// Get the list of helper destination expressions. |
2241 | 3.27k | MutableArrayRef<Expr *> getRHSExprs() { |
2242 | 3.27k | return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size()); |
2243 | 3.27k | } |
2244 | 240 | ArrayRef<const Expr *> getRHSExprs() const { |
2245 | 240 | return llvm::makeArrayRef(getLHSExprs().end(), varlist_size()); |
2246 | 240 | } |
2247 | | |
2248 | | /// Set list of helper reduction expressions, required for proper |
2249 | | /// codegen of the clause. These expressions are binary expressions or |
2250 | | /// operator/custom reduction call that calculates new value from source |
2251 | | /// helper expressions to destination helper expressions. |
2252 | | void setReductionOps(ArrayRef<Expr *> ReductionOps); |
2253 | | |
2254 | | /// Get the list of helper reduction expressions. |
2255 | 1.70k | MutableArrayRef<Expr *> getReductionOps() { |
2256 | 1.70k | return MutableArrayRef<Expr *>(getRHSExprs().end(), varlist_size()); |
2257 | 1.70k | } |
2258 | 120 | ArrayRef<const Expr *> getReductionOps() const { |
2259 | 120 | return llvm::makeArrayRef(getRHSExprs().end(), varlist_size()); |
2260 | 120 | } |
2261 | | |
2262 | | public: |
2263 | | /// Creates clause with a list of variables \a VL. |
2264 | | /// |
2265 | | /// \param StartLoc Starting location of the clause. |
2266 | | /// \param LParenLoc Location of '('. |
2267 | | /// \param ColonLoc Location of ':'. |
2268 | | /// \param EndLoc Ending location of the clause. |
2269 | | /// \param VL The variables in the clause. |
2270 | | /// \param QualifierLoc The nested-name qualifier with location information |
2271 | | /// \param NameInfo The full name info for reduction identifier. |
2272 | | /// \param Privates List of helper expressions for proper generation of |
2273 | | /// private copies. |
2274 | | /// \param LHSExprs List of helper expressions for proper generation of |
2275 | | /// assignment operation required for copyprivate clause. This list represents |
2276 | | /// LHSs of the reduction expressions. |
2277 | | /// \param RHSExprs List of helper expressions for proper generation of |
2278 | | /// assignment operation required for copyprivate clause. This list represents |
2279 | | /// RHSs of the reduction expressions. |
2280 | | /// Also, variables in these expressions are used for proper initialization of |
2281 | | /// reduction copies. |
2282 | | /// \param ReductionOps List of helper expressions that represents reduction |
2283 | | /// expressions: |
2284 | | /// \code |
2285 | | /// LHSExprs binop RHSExprs; |
2286 | | /// operator binop(LHSExpr, RHSExpr); |
2287 | | /// <CutomReduction>(LHSExpr, RHSExpr); |
2288 | | /// \endcode |
2289 | | /// Required for proper codegen of final reduction operation performed by the |
2290 | | /// reduction clause. |
2291 | | /// \param PreInit Statement that must be executed before entering the OpenMP |
2292 | | /// region with this clause. |
2293 | | /// \param PostUpdate Expression that must be executed after exit from the |
2294 | | /// OpenMP region with this clause. |
2295 | | static OMPTaskReductionClause * |
2296 | | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
2297 | | SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL, |
2298 | | NestedNameSpecifierLoc QualifierLoc, |
2299 | | const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates, |
2300 | | ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs, |
2301 | | ArrayRef<Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate); |
2302 | | |
2303 | | /// Creates an empty clause with the place for \a N variables. |
2304 | | /// |
2305 | | /// \param C AST context. |
2306 | | /// \param N The number of variables. |
2307 | | static OMPTaskReductionClause *CreateEmpty(const ASTContext &C, unsigned N); |
2308 | | |
2309 | | /// Gets location of ':' symbol in clause. |
2310 | 854 | SourceLocation getColonLoc() const { return ColonLoc; } |
2311 | | |
2312 | | /// Gets the name info for specified reduction identifier. |
2313 | 1.01k | const DeclarationNameInfo &getNameInfo() const { return NameInfo; } |
2314 | | |
2315 | | /// Gets the nested name specifier. |
2316 | 1.00k | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
2317 | | |
2318 | | using helper_expr_iterator = MutableArrayRef<Expr *>::iterator; |
2319 | | using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator; |
2320 | | using helper_expr_range = llvm::iterator_range<helper_expr_iterator>; |
2321 | | using helper_expr_const_range = |
2322 | | llvm::iterator_range<helper_expr_const_iterator>; |
2323 | | |
2324 | 60 | helper_expr_const_range privates() const { |
2325 | 60 | return helper_expr_const_range(getPrivates().begin(), getPrivates().end()); |
2326 | 60 | } |
2327 | | |
2328 | 50 | helper_expr_range privates() { |
2329 | 50 | return helper_expr_range(getPrivates().begin(), getPrivates().end()); |
2330 | 50 | } |
2331 | | |
2332 | 60 | helper_expr_const_range lhs_exprs() const { |
2333 | 60 | return helper_expr_const_range(getLHSExprs().begin(), getLHSExprs().end()); |
2334 | 60 | } |
2335 | | |
2336 | 50 | helper_expr_range lhs_exprs() { |
2337 | 50 | return helper_expr_range(getLHSExprs().begin(), getLHSExprs().end()); |
2338 | 50 | } |
2339 | | |
2340 | 60 | helper_expr_const_range rhs_exprs() const { |
2341 | 60 | return helper_expr_const_range(getRHSExprs().begin(), getRHSExprs().end()); |
2342 | 60 | } |
2343 | | |
2344 | 50 | helper_expr_range rhs_exprs() { |
2345 | 50 | return helper_expr_range(getRHSExprs().begin(), getRHSExprs().end()); |
2346 | 50 | } |
2347 | | |
2348 | 60 | helper_expr_const_range reduction_ops() const { |
2349 | 60 | return helper_expr_const_range(getReductionOps().begin(), |
2350 | 60 | getReductionOps().end()); |
2351 | 60 | } |
2352 | | |
2353 | 854 | helper_expr_range reduction_ops() { |
2354 | 854 | return helper_expr_range(getReductionOps().begin(), |
2355 | 854 | getReductionOps().end()); |
2356 | 854 | } |
2357 | | |
2358 | 1.44k | child_range children() { |
2359 | 1.44k | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
2360 | 1.44k | reinterpret_cast<Stmt **>(varlist_end())); |
2361 | 1.44k | } |
2362 | | |
2363 | 18 | static bool classof(const OMPClause *T) { |
2364 | 18 | return T->getClauseKind() == OMPC_task_reduction; |
2365 | 18 | } |
2366 | | }; |
2367 | | |
2368 | | /// This represents clause 'in_reduction' in the '#pragma omp task' directives. |
2369 | | /// |
2370 | | /// \code |
2371 | | /// #pragma omp task in_reduction(+:a,b) |
2372 | | /// \endcode |
2373 | | /// In this example directive '#pragma omp task' has clause 'in_reduction' with |
2374 | | /// operator '+' and the variables 'a' and 'b'. |
2375 | | class OMPInReductionClause final |
2376 | | : public OMPVarListClause<OMPInReductionClause>, |
2377 | | public OMPClauseWithPostUpdate, |
2378 | | private llvm::TrailingObjects<OMPInReductionClause, Expr *> { |
2379 | | friend class OMPClauseReader; |
2380 | | friend OMPVarListClause; |
2381 | | friend TrailingObjects; |
2382 | | |
2383 | | /// Location of ':'. |
2384 | | SourceLocation ColonLoc; |
2385 | | |
2386 | | /// Nested name specifier for C++. |
2387 | | NestedNameSpecifierLoc QualifierLoc; |
2388 | | |
2389 | | /// Name of custom operator. |
2390 | | DeclarationNameInfo NameInfo; |
2391 | | |
2392 | | /// Build clause with number of variables \a N. |
2393 | | /// |
2394 | | /// \param StartLoc Starting location of the clause. |
2395 | | /// \param LParenLoc Location of '('. |
2396 | | /// \param EndLoc Ending location of the clause. |
2397 | | /// \param ColonLoc Location of ':'. |
2398 | | /// \param N Number of the variables in the clause. |
2399 | | /// \param QualifierLoc The nested-name qualifier with location information |
2400 | | /// \param NameInfo The full name info for reduction identifier. |
2401 | | OMPInReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
2402 | | SourceLocation ColonLoc, SourceLocation EndLoc, |
2403 | | unsigned N, NestedNameSpecifierLoc QualifierLoc, |
2404 | | const DeclarationNameInfo &NameInfo) |
2405 | | : OMPVarListClause<OMPInReductionClause>(OMPC_in_reduction, StartLoc, |
2406 | | LParenLoc, EndLoc, N), |
2407 | | OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc), |
2408 | 834 | QualifierLoc(QualifierLoc), NameInfo(NameInfo) {} |
2409 | | |
2410 | | /// Build an empty clause. |
2411 | | /// |
2412 | | /// \param N Number of variables. |
2413 | | explicit OMPInReductionClause(unsigned N) |
2414 | | : OMPVarListClause<OMPInReductionClause>( |
2415 | | OMPC_in_reduction, SourceLocation(), SourceLocation(), |
2416 | | SourceLocation(), N), |
2417 | 28 | OMPClauseWithPostUpdate(this) {} |
2418 | | |
2419 | | /// Sets location of ':' symbol in clause. |
2420 | 28 | void setColonLoc(SourceLocation CL) { ColonLoc = CL; } |
2421 | | |
2422 | | /// Sets the name info for specified reduction identifier. |
2423 | 28 | void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; } |
2424 | | |
2425 | | /// Sets the nested name specifier. |
2426 | 28 | void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; } |
2427 | | |
2428 | | /// Set list of helper expressions, required for proper codegen of the clause. |
2429 | | /// These expressions represent private copy of the reduction variable. |
2430 | | void setPrivates(ArrayRef<Expr *> Privates); |
2431 | | |
2432 | | /// Get the list of helper privates. |
2433 | 7.65k | MutableArrayRef<Expr *> getPrivates() { |
2434 | 7.65k | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
2435 | 7.65k | } |
2436 | 72 | ArrayRef<const Expr *> getPrivates() const { |
2437 | 72 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
2438 | 72 | } |
2439 | | |
2440 | | /// Set list of helper expressions, required for proper codegen of the clause. |
2441 | | /// These expressions represent LHS expression in the final reduction |
2442 | | /// expression performed by the reduction clause. |
2443 | | void setLHSExprs(ArrayRef<Expr *> LHSExprs); |
2444 | | |
2445 | | /// Get the list of helper LHS expressions. |
2446 | 6.73k | MutableArrayRef<Expr *> getLHSExprs() { |
2447 | 6.73k | return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size()); |
2448 | 6.73k | } |
2449 | 48 | ArrayRef<const Expr *> getLHSExprs() const { |
2450 | 48 | return llvm::makeArrayRef(getPrivates().end(), varlist_size()); |
2451 | 48 | } |
2452 | | |
2453 | | /// Set list of helper expressions, required for proper codegen of the clause. |
2454 | | /// These expressions represent RHS expression in the final reduction |
2455 | | /// expression performed by the reduction clause. Also, variables in these |
2456 | | /// expressions are used for proper initialization of reduction copies. |
2457 | | void setRHSExprs(ArrayRef<Expr *> RHSExprs); |
2458 | | |
2459 | | /// Get the list of helper destination expressions. |
2460 | 5.81k | MutableArrayRef<Expr *> getRHSExprs() { |
2461 | 5.81k | return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size()); |
2462 | 5.81k | } |
2463 | 48 | ArrayRef<const Expr *> getRHSExprs() const { |
2464 | 48 | return llvm::makeArrayRef(getLHSExprs().end(), varlist_size()); |
2465 | 48 | } |
2466 | | |
2467 | | /// Set list of helper reduction expressions, required for proper |
2468 | | /// codegen of the clause. These expressions are binary expressions or |
2469 | | /// operator/custom reduction call that calculates new value from source |
2470 | | /// helper expressions to destination helper expressions. |
2471 | | void setReductionOps(ArrayRef<Expr *> ReductionOps); |
2472 | | |
2473 | | /// Get the list of helper reduction expressions. |
2474 | 4.89k | MutableArrayRef<Expr *> getReductionOps() { |
2475 | 4.89k | return MutableArrayRef<Expr *>(getRHSExprs().end(), varlist_size()); |
2476 | 4.89k | } |
2477 | 48 | ArrayRef<const Expr *> getReductionOps() const { |
2478 | 48 | return llvm::makeArrayRef(getRHSExprs().end(), varlist_size()); |
2479 | 48 | } |
2480 | | |
2481 | | /// Set list of helper reduction taskgroup descriptors. |
2482 | | void setTaskgroupDescriptors(ArrayRef<Expr *> ReductionOps); |
2483 | | |
2484 | | /// Get the list of helper reduction taskgroup descriptors. |
2485 | 2.65k | MutableArrayRef<Expr *> getTaskgroupDescriptors() { |
2486 | 2.65k | return MutableArrayRef<Expr *>(getReductionOps().end(), varlist_size()); |
2487 | 2.65k | } |
2488 | 24 | ArrayRef<const Expr *> getTaskgroupDescriptors() const { |
2489 | 24 | return llvm::makeArrayRef(getReductionOps().end(), varlist_size()); |
2490 | 24 | } |
2491 | | |
2492 | | public: |
2493 | | /// Creates clause with a list of variables \a VL. |
2494 | | /// |
2495 | | /// \param StartLoc Starting location of the clause. |
2496 | | /// \param LParenLoc Location of '('. |
2497 | | /// \param ColonLoc Location of ':'. |
2498 | | /// \param EndLoc Ending location of the clause. |
2499 | | /// \param VL The variables in the clause. |
2500 | | /// \param QualifierLoc The nested-name qualifier with location information |
2501 | | /// \param NameInfo The full name info for reduction identifier. |
2502 | | /// \param Privates List of helper expressions for proper generation of |
2503 | | /// private copies. |
2504 | | /// \param LHSExprs List of helper expressions for proper generation of |
2505 | | /// assignment operation required for copyprivate clause. This list represents |
2506 | | /// LHSs of the reduction expressions. |
2507 | | /// \param RHSExprs List of helper expressions for proper generation of |
2508 | | /// assignment operation required for copyprivate clause. This list represents |
2509 | | /// RHSs of the reduction expressions. |
2510 | | /// Also, variables in these expressions are used for proper initialization of |
2511 | | /// reduction copies. |
2512 | | /// \param ReductionOps List of helper expressions that represents reduction |
2513 | | /// expressions: |
2514 | | /// \code |
2515 | | /// LHSExprs binop RHSExprs; |
2516 | | /// operator binop(LHSExpr, RHSExpr); |
2517 | | /// <CutomReduction>(LHSExpr, RHSExpr); |
2518 | | /// \endcode |
2519 | | /// Required for proper codegen of final reduction operation performed by the |
2520 | | /// reduction clause. |
2521 | | /// \param TaskgroupDescriptors List of helper taskgroup descriptors for |
2522 | | /// corresponding items in parent taskgroup task_reduction clause. |
2523 | | /// \param PreInit Statement that must be executed before entering the OpenMP |
2524 | | /// region with this clause. |
2525 | | /// \param PostUpdate Expression that must be executed after exit from the |
2526 | | /// OpenMP region with this clause. |
2527 | | static OMPInReductionClause * |
2528 | | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
2529 | | SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL, |
2530 | | NestedNameSpecifierLoc QualifierLoc, |
2531 | | const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates, |
2532 | | ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs, |
2533 | | ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> TaskgroupDescriptors, |
2534 | | Stmt *PreInit, Expr *PostUpdate); |
2535 | | |
2536 | | /// Creates an empty clause with the place for \a N variables. |
2537 | | /// |
2538 | | /// \param C AST context. |
2539 | | /// \param N The number of variables. |
2540 | | static OMPInReductionClause *CreateEmpty(const ASTContext &C, unsigned N); |
2541 | | |
2542 | | /// Gets location of ':' symbol in clause. |
2543 | 692 | SourceLocation getColonLoc() const { return ColonLoc; } |
2544 | | |
2545 | | /// Gets the name info for specified reduction identifier. |
2546 | 760 | const DeclarationNameInfo &getNameInfo() const { return NameInfo; } |
2547 | | |
2548 | | /// Gets the nested name specifier. |
2549 | 752 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
2550 | | |
2551 | | using helper_expr_iterator = MutableArrayRef<Expr *>::iterator; |
2552 | | using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator; |
2553 | | using helper_expr_range = llvm::iterator_range<helper_expr_iterator>; |
2554 | | using helper_expr_const_range = |
2555 | | llvm::iterator_range<helper_expr_const_iterator>; |
2556 | | |
2557 | 12 | helper_expr_const_range privates() const { |
2558 | 12 | return helper_expr_const_range(getPrivates().begin(), getPrivates().end()); |
2559 | 12 | } |
2560 | | |
2561 | 28 | helper_expr_range privates() { |
2562 | 28 | return helper_expr_range(getPrivates().begin(), getPrivates().end()); |
2563 | 28 | } |
2564 | | |
2565 | 0 | helper_expr_const_range lhs_exprs() const { |
2566 | 0 | return helper_expr_const_range(getLHSExprs().begin(), getLHSExprs().end()); |
2567 | 0 | } |
2568 | | |
2569 | 28 | helper_expr_range lhs_exprs() { |
2570 | 28 | return helper_expr_range(getLHSExprs().begin(), getLHSExprs().end()); |
2571 | 28 | } |
2572 | | |
2573 | 0 | helper_expr_const_range rhs_exprs() const { |
2574 | 0 | return helper_expr_const_range(getRHSExprs().begin(), getRHSExprs().end()); |
2575 | 0 | } |
2576 | | |
2577 | 28 | helper_expr_range rhs_exprs() { |
2578 | 28 | return helper_expr_range(getRHSExprs().begin(), getRHSExprs().end()); |
2579 | 28 | } |
2580 | | |
2581 | 12 | helper_expr_const_range reduction_ops() const { |
2582 | 12 | return helper_expr_const_range(getReductionOps().begin(), |
2583 | 12 | getReductionOps().end()); |
2584 | 12 | } |
2585 | | |
2586 | 692 | helper_expr_range reduction_ops() { |
2587 | 692 | return helper_expr_range(getReductionOps().begin(), |
2588 | 692 | getReductionOps().end()); |
2589 | 692 | } |
2590 | | |
2591 | 12 | helper_expr_const_range taskgroup_descriptors() const { |
2592 | 12 | return helper_expr_const_range(getTaskgroupDescriptors().begin(), |
2593 | 12 | getTaskgroupDescriptors().end()); |
2594 | 12 | } |
2595 | | |
2596 | 1.32k | helper_expr_range taskgroup_descriptors() { |
2597 | 1.32k | return helper_expr_range(getTaskgroupDescriptors().begin(), |
2598 | 1.32k | getTaskgroupDescriptors().end()); |
2599 | 1.32k | } |
2600 | | |
2601 | 1.27k | child_range children() { |
2602 | 1.27k | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
2603 | 1.27k | reinterpret_cast<Stmt **>(varlist_end())); |
2604 | 1.27k | } |
2605 | | |
2606 | 52.1k | static bool classof(const OMPClause *T) { |
2607 | 52.1k | return T->getClauseKind() == OMPC_in_reduction; |
2608 | 52.1k | } |
2609 | | }; |
2610 | | |
2611 | | /// This represents clause 'linear' in the '#pragma omp ...' |
2612 | | /// directives. |
2613 | | /// |
2614 | | /// \code |
2615 | | /// #pragma omp simd linear(a,b : 2) |
2616 | | /// \endcode |
2617 | | /// In this example directive '#pragma omp simd' has clause 'linear' |
2618 | | /// with variables 'a', 'b' and linear step '2'. |
2619 | | class OMPLinearClause final |
2620 | | : public OMPVarListClause<OMPLinearClause>, |
2621 | | public OMPClauseWithPostUpdate, |
2622 | | private llvm::TrailingObjects<OMPLinearClause, Expr *> { |
2623 | | friend class OMPClauseReader; |
2624 | | friend OMPVarListClause; |
2625 | | friend TrailingObjects; |
2626 | | |
2627 | | /// Modifier of 'linear' clause. |
2628 | | OpenMPLinearClauseKind Modifier = OMPC_LINEAR_val; |
2629 | | |
2630 | | /// Location of linear modifier if any. |
2631 | | SourceLocation ModifierLoc; |
2632 | | |
2633 | | /// Location of ':'. |
2634 | | SourceLocation ColonLoc; |
2635 | | |
2636 | | /// Sets the linear step for clause. |
2637 | 2.05k | void setStep(Expr *Step) { *(getFinals().end()) = Step; } |
2638 | | |
2639 | | /// Sets the expression to calculate linear step for clause. |
2640 | 2.05k | void setCalcStep(Expr *CalcStep) { *(getFinals().end() + 1) = CalcStep; } |
2641 | | |
2642 | | /// Build 'linear' clause with given number of variables \a NumVars. |
2643 | | /// |
2644 | | /// \param StartLoc Starting location of the clause. |
2645 | | /// \param LParenLoc Location of '('. |
2646 | | /// \param ColonLoc Location of ':'. |
2647 | | /// \param EndLoc Ending location of the clause. |
2648 | | /// \param NumVars Number of variables. |
2649 | | OMPLinearClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
2650 | | OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, |
2651 | | SourceLocation ColonLoc, SourceLocation EndLoc, |
2652 | | unsigned NumVars) |
2653 | | : OMPVarListClause<OMPLinearClause>(OMPC_linear, StartLoc, LParenLoc, |
2654 | | EndLoc, NumVars), |
2655 | | OMPClauseWithPostUpdate(this), Modifier(Modifier), |
2656 | 1.84k | ModifierLoc(ModifierLoc), ColonLoc(ColonLoc) {} |
2657 | | |
2658 | | /// Build an empty clause. |
2659 | | /// |
2660 | | /// \param NumVars Number of variables. |
2661 | | explicit OMPLinearClause(unsigned NumVars) |
2662 | | : OMPVarListClause<OMPLinearClause>(OMPC_linear, SourceLocation(), |
2663 | | SourceLocation(), SourceLocation(), |
2664 | | NumVars), |
2665 | 216 | OMPClauseWithPostUpdate(this) {} |
2666 | | |
2667 | | /// Gets the list of initial values for linear variables. |
2668 | | /// |
2669 | | /// There are NumVars expressions with initial values allocated after the |
2670 | | /// varlist, they are followed by NumVars update expressions (used to update |
2671 | | /// the linear variable's value on current iteration) and they are followed by |
2672 | | /// NumVars final expressions (used to calculate the linear variable's |
2673 | | /// value after the loop body). After these lists, there are 2 helper |
2674 | | /// expressions - linear step and a helper to calculate it before the |
2675 | | /// loop body (used when the linear step is not constant): |
2676 | | /// |
2677 | | /// { Vars[] /* in OMPVarListClause */; Privates[]; Inits[]; Updates[]; |
2678 | | /// Finals[]; Step; CalcStep; } |
2679 | 27.6k | MutableArrayRef<Expr *> getPrivates() { |
2680 | 27.6k | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
2681 | 27.6k | } |
2682 | 4.60k | ArrayRef<const Expr *> getPrivates() const { |
2683 | 4.60k | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
2684 | 4.60k | } |
2685 | | |
2686 | 22.4k | MutableArrayRef<Expr *> getInits() { |
2687 | 22.4k | return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size()); |
2688 | 22.4k | } |
2689 | 3.61k | ArrayRef<const Expr *> getInits() const { |
2690 | 3.61k | return llvm::makeArrayRef(getPrivates().end(), varlist_size()); |
2691 | 3.61k | } |
2692 | | |
2693 | | /// Sets the list of update expressions for linear variables. |
2694 | 14.0k | MutableArrayRef<Expr *> getUpdates() { |
2695 | 14.0k | return MutableArrayRef<Expr *>(getInits().end(), varlist_size()); |
2696 | 14.0k | } |
2697 | 2.62k | ArrayRef<const Expr *> getUpdates() const { |
2698 | 2.62k | return llvm::makeArrayRef(getInits().end(), varlist_size()); |
2699 | 2.62k | } |
2700 | | |
2701 | | /// Sets the list of final update expressions for linear variables. |
2702 | 8.39k | MutableArrayRef<Expr *> getFinals() { |
2703 | 8.39k | return MutableArrayRef<Expr *>(getUpdates().end(), varlist_size()); |
2704 | 8.39k | } |
2705 | 1.79k | ArrayRef<const Expr *> getFinals() const { |
2706 | 1.79k | return llvm::makeArrayRef(getUpdates().end(), varlist_size()); |
2707 | 1.79k | } |
2708 | | |
2709 | | /// Sets the list of the copies of original linear variables. |
2710 | | /// \param PL List of expressions. |
2711 | | void setPrivates(ArrayRef<Expr *> PL); |
2712 | | |
2713 | | /// Sets the list of the initial values for linear variables. |
2714 | | /// \param IL List of expressions. |
2715 | | void setInits(ArrayRef<Expr *> IL); |
2716 | | |
2717 | | public: |
2718 | | /// Creates clause with a list of variables \a VL and a linear step |
2719 | | /// \a Step. |
2720 | | /// |
2721 | | /// \param C AST Context. |
2722 | | /// \param StartLoc Starting location of the clause. |
2723 | | /// \param LParenLoc Location of '('. |
2724 | | /// \param Modifier Modifier of 'linear' clause. |
2725 | | /// \param ModifierLoc Modifier location. |
2726 | | /// \param ColonLoc Location of ':'. |
2727 | | /// \param EndLoc Ending location of the clause. |
2728 | | /// \param VL List of references to the variables. |
2729 | | /// \param PL List of private copies of original variables. |
2730 | | /// \param IL List of initial values for the variables. |
2731 | | /// \param Step Linear step. |
2732 | | /// \param CalcStep Calculation of the linear step. |
2733 | | /// \param PreInit Statement that must be executed before entering the OpenMP |
2734 | | /// region with this clause. |
2735 | | /// \param PostUpdate Expression that must be executed after exit from the |
2736 | | /// OpenMP region with this clause. |
2737 | | static OMPLinearClause * |
2738 | | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
2739 | | OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, |
2740 | | SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL, |
2741 | | ArrayRef<Expr *> PL, ArrayRef<Expr *> IL, Expr *Step, Expr *CalcStep, |
2742 | | Stmt *PreInit, Expr *PostUpdate); |
2743 | | |
2744 | | /// Creates an empty clause with the place for \a NumVars variables. |
2745 | | /// |
2746 | | /// \param C AST context. |
2747 | | /// \param NumVars Number of variables. |
2748 | | static OMPLinearClause *CreateEmpty(const ASTContext &C, unsigned NumVars); |
2749 | | |
2750 | | /// Set modifier. |
2751 | 216 | void setModifier(OpenMPLinearClauseKind Kind) { Modifier = Kind; } |
2752 | | |
2753 | | /// Return modifier. |
2754 | 2.01k | OpenMPLinearClauseKind getModifier() const { return Modifier; } |
2755 | | |
2756 | | /// Set modifier location. |
2757 | 216 | void setModifierLoc(SourceLocation Loc) { ModifierLoc = Loc; } |
2758 | | |
2759 | | /// Return modifier location. |
2760 | 1.09k | SourceLocation getModifierLoc() const { return ModifierLoc; } |
2761 | | |
2762 | | /// Sets the location of ':'. |
2763 | 216 | void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; } |
2764 | | |
2765 | | /// Returns the location of ':'. |
2766 | 642 | SourceLocation getColonLoc() const { return ColonLoc; } |
2767 | | |
2768 | | /// Returns linear step. |
2769 | 2.29k | Expr *getStep() { return *(getFinals().end()); } |
2770 | | |
2771 | | /// Returns linear step. |
2772 | 272 | const Expr *getStep() const { return *(getFinals().end()); } |
2773 | | |
2774 | | /// Returns expression to calculate linear step. |
2775 | 1.56k | Expr *getCalcStep() { return *(getFinals().end() + 1); } |
2776 | | |
2777 | | /// Returns expression to calculate linear step. |
2778 | 532 | const Expr *getCalcStep() const { return *(getFinals().end() + 1); } |
2779 | | |
2780 | | /// Sets the list of update expressions for linear variables. |
2781 | | /// \param UL List of expressions. |
2782 | | void setUpdates(ArrayRef<Expr *> UL); |
2783 | | |
2784 | | /// Sets the list of final update expressions for linear variables. |
2785 | | /// \param FL List of expressions. |
2786 | | void setFinals(ArrayRef<Expr *> FL); |
2787 | | |
2788 | | using privates_iterator = MutableArrayRef<Expr *>::iterator; |
2789 | | using privates_const_iterator = ArrayRef<const Expr *>::iterator; |
2790 | | using privates_range = llvm::iterator_range<privates_iterator>; |
2791 | | using privates_const_range = llvm::iterator_range<privates_const_iterator>; |
2792 | | |
2793 | 1.56k | privates_range privates() { |
2794 | 1.56k | return privates_range(getPrivates().begin(), getPrivates().end()); |
2795 | 1.56k | } |
2796 | | |
2797 | 494 | privates_const_range privates() const { |
2798 | 494 | return privates_const_range(getPrivates().begin(), getPrivates().end()); |
2799 | 494 | } |
2800 | | |
2801 | | using inits_iterator = MutableArrayRef<Expr *>::iterator; |
2802 | | using inits_const_iterator = ArrayRef<const Expr *>::iterator; |
2803 | | using inits_range = llvm::iterator_range<inits_iterator>; |
2804 | | using inits_const_range = llvm::iterator_range<inits_const_iterator>; |
2805 | | |
2806 | 1.56k | inits_range inits() { |
2807 | 1.56k | return inits_range(getInits().begin(), getInits().end()); |
2808 | 1.56k | } |
2809 | | |
2810 | 494 | inits_const_range inits() const { |
2811 | 494 | return inits_const_range(getInits().begin(), getInits().end()); |
2812 | 494 | } |
2813 | | |
2814 | | using updates_iterator = MutableArrayRef<Expr *>::iterator; |
2815 | | using updates_const_iterator = ArrayRef<const Expr *>::iterator; |
2816 | | using updates_range = llvm::iterator_range<updates_iterator>; |
2817 | | using updates_const_range = llvm::iterator_range<updates_const_iterator>; |
2818 | | |
2819 | 216 | updates_range updates() { |
2820 | 216 | return updates_range(getUpdates().begin(), getUpdates().end()); |
2821 | 216 | } |
2822 | | |
2823 | 418 | updates_const_range updates() const { |
2824 | 418 | return updates_const_range(getUpdates().begin(), getUpdates().end()); |
2825 | 418 | } |
2826 | | |
2827 | | using finals_iterator = MutableArrayRef<Expr *>::iterator; |
2828 | | using finals_const_iterator = ArrayRef<const Expr *>::iterator; |
2829 | | using finals_range = llvm::iterator_range<finals_iterator>; |
2830 | | using finals_const_range = llvm::iterator_range<finals_const_iterator>; |
2831 | | |
2832 | 216 | finals_range finals() { |
2833 | 216 | return finals_range(getFinals().begin(), getFinals().end()); |
2834 | 216 | } |
2835 | | |
2836 | 494 | finals_const_range finals() const { |
2837 | 494 | return finals_const_range(getFinals().begin(), getFinals().end()); |
2838 | 494 | } |
2839 | | |
2840 | 2.04k | child_range children() { |
2841 | 2.04k | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
2842 | 2.04k | reinterpret_cast<Stmt **>(varlist_end())); |
2843 | 2.04k | } |
2844 | | |
2845 | 63.7k | static bool classof(const OMPClause *T) { |
2846 | 63.7k | return T->getClauseKind() == OMPC_linear; |
2847 | 63.7k | } |
2848 | | }; |
2849 | | |
2850 | | /// This represents clause 'aligned' in the '#pragma omp ...' |
2851 | | /// directives. |
2852 | | /// |
2853 | | /// \code |
2854 | | /// #pragma omp simd aligned(a,b : 8) |
2855 | | /// \endcode |
2856 | | /// In this example directive '#pragma omp simd' has clause 'aligned' |
2857 | | /// with variables 'a', 'b' and alignment '8'. |
2858 | | class OMPAlignedClause final |
2859 | | : public OMPVarListClause<OMPAlignedClause>, |
2860 | | private llvm::TrailingObjects<OMPAlignedClause, Expr *> { |
2861 | | friend class OMPClauseReader; |
2862 | | friend OMPVarListClause; |
2863 | | friend TrailingObjects; |
2864 | | |
2865 | | /// Location of ':'. |
2866 | | SourceLocation ColonLoc; |
2867 | | |
2868 | | /// Sets the alignment for clause. |
2869 | 1.27k | void setAlignment(Expr *A) { *varlist_end() = A; } |
2870 | | |
2871 | | /// Build 'aligned' clause with given number of variables \a NumVars. |
2872 | | /// |
2873 | | /// \param StartLoc Starting location of the clause. |
2874 | | /// \param LParenLoc Location of '('. |
2875 | | /// \param ColonLoc Location of ':'. |
2876 | | /// \param EndLoc Ending location of the clause. |
2877 | | /// \param NumVars Number of variables. |
2878 | | OMPAlignedClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
2879 | | SourceLocation ColonLoc, SourceLocation EndLoc, |
2880 | | unsigned NumVars) |
2881 | | : OMPVarListClause<OMPAlignedClause>(OMPC_aligned, StartLoc, LParenLoc, |
2882 | | EndLoc, NumVars), |
2883 | 1.14k | ColonLoc(ColonLoc) {} |
2884 | | |
2885 | | /// Build an empty clause. |
2886 | | /// |
2887 | | /// \param NumVars Number of variables. |
2888 | | explicit OMPAlignedClause(unsigned NumVars) |
2889 | | : OMPVarListClause<OMPAlignedClause>(OMPC_aligned, SourceLocation(), |
2890 | | SourceLocation(), SourceLocation(), |
2891 | 132 | NumVars) {} |
2892 | | |
2893 | | public: |
2894 | | /// Creates clause with a list of variables \a VL and alignment \a A. |
2895 | | /// |
2896 | | /// \param C AST Context. |
2897 | | /// \param StartLoc Starting location of the clause. |
2898 | | /// \param LParenLoc Location of '('. |
2899 | | /// \param ColonLoc Location of ':'. |
2900 | | /// \param EndLoc Ending location of the clause. |
2901 | | /// \param VL List of references to the variables. |
2902 | | /// \param A Alignment. |
2903 | | static OMPAlignedClause *Create(const ASTContext &C, SourceLocation StartLoc, |
2904 | | SourceLocation LParenLoc, |
2905 | | SourceLocation ColonLoc, |
2906 | | SourceLocation EndLoc, ArrayRef<Expr *> VL, |
2907 | | Expr *A); |
2908 | | |
2909 | | /// Creates an empty clause with the place for \a NumVars variables. |
2910 | | /// |
2911 | | /// \param C AST context. |
2912 | | /// \param NumVars Number of variables. |
2913 | | static OMPAlignedClause *CreateEmpty(const ASTContext &C, unsigned NumVars); |
2914 | | |
2915 | | /// Sets the location of ':'. |
2916 | 132 | void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; } |
2917 | | |
2918 | | /// Returns the location of ':'. |
2919 | 472 | SourceLocation getColonLoc() const { return ColonLoc; } |
2920 | | |
2921 | | /// Returns alignment. |
2922 | 816 | Expr *getAlignment() { return *varlist_end(); } |
2923 | | |
2924 | | /// Returns alignment. |
2925 | 374 | const Expr *getAlignment() const { return *varlist_end(); } |
2926 | | |
2927 | 288 | child_range children() { |
2928 | 288 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
2929 | 288 | reinterpret_cast<Stmt **>(varlist_end())); |
2930 | 288 | } |
2931 | | |
2932 | 12.0k | static bool classof(const OMPClause *T) { |
2933 | 12.0k | return T->getClauseKind() == OMPC_aligned; |
2934 | 12.0k | } |
2935 | | }; |
2936 | | |
2937 | | /// This represents clause 'copyin' in the '#pragma omp ...' directives. |
2938 | | /// |
2939 | | /// \code |
2940 | | /// #pragma omp parallel copyin(a,b) |
2941 | | /// \endcode |
2942 | | /// In this example directive '#pragma omp parallel' has clause 'copyin' |
2943 | | /// with the variables 'a' and 'b'. |
2944 | | class OMPCopyinClause final |
2945 | | : public OMPVarListClause<OMPCopyinClause>, |
2946 | | private llvm::TrailingObjects<OMPCopyinClause, Expr *> { |
2947 | | // Class has 3 additional tail allocated arrays: |
2948 | | // 1. List of helper expressions for proper generation of assignment operation |
2949 | | // required for copyin clause. This list represents sources. |
2950 | | // 2. List of helper expressions for proper generation of assignment operation |
2951 | | // required for copyin clause. This list represents destinations. |
2952 | | // 3. List of helper expressions that represents assignment operation: |
2953 | | // \code |
2954 | | // DstExprs = SrcExprs; |
2955 | | // \endcode |
2956 | | // Required for proper codegen of propagation of master's thread values of |
2957 | | // threadprivate variables to local instances of that variables in other |
2958 | | // implicit threads. |
2959 | | |
2960 | | friend class OMPClauseReader; |
2961 | | friend OMPVarListClause; |
2962 | | friend TrailingObjects; |
2963 | | |
2964 | | /// Build clause with number of variables \a N. |
2965 | | /// |
2966 | | /// \param StartLoc Starting location of the clause. |
2967 | | /// \param LParenLoc Location of '('. |
2968 | | /// \param EndLoc Ending location of the clause. |
2969 | | /// \param N Number of the variables in the clause. |
2970 | | OMPCopyinClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
2971 | | SourceLocation EndLoc, unsigned N) |
2972 | | : OMPVarListClause<OMPCopyinClause>(OMPC_copyin, StartLoc, LParenLoc, |
2973 | 324 | EndLoc, N) {} |
2974 | | |
2975 | | /// Build an empty clause. |
2976 | | /// |
2977 | | /// \param N Number of variables. |
2978 | | explicit OMPCopyinClause(unsigned N) |
2979 | | : OMPVarListClause<OMPCopyinClause>(OMPC_copyin, SourceLocation(), |
2980 | | SourceLocation(), SourceLocation(), |
2981 | 56 | N) {} |
2982 | | |
2983 | | /// Set list of helper expressions, required for proper codegen of the |
2984 | | /// clause. These expressions represent source expression in the final |
2985 | | /// assignment statement performed by the copyin clause. |
2986 | | void setSourceExprs(ArrayRef<Expr *> SrcExprs); |
2987 | | |
2988 | | /// Get the list of helper source expressions. |
2989 | 1.10k | MutableArrayRef<Expr *> getSourceExprs() { |
2990 | 1.10k | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
2991 | 1.10k | } |
2992 | 300 | ArrayRef<const Expr *> getSourceExprs() const { |
2993 | 300 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
2994 | 300 | } |
2995 | | |
2996 | | /// Set list of helper expressions, required for proper codegen of the |
2997 | | /// clause. These expressions represent destination expression in the final |
2998 | | /// assignment statement performed by the copyin clause. |
2999 | | void setDestinationExprs(ArrayRef<Expr *> DstExprs); |
3000 | | |
3001 | | /// Get the list of helper destination expressions. |
3002 | 612 | MutableArrayRef<Expr *> getDestinationExprs() { |
3003 | 612 | return MutableArrayRef<Expr *>(getSourceExprs().end(), varlist_size()); |
3004 | 612 | } |
3005 | 200 | ArrayRef<const Expr *> getDestinationExprs() const { |
3006 | 200 | return llvm::makeArrayRef(getSourceExprs().end(), varlist_size()); |
3007 | 200 | } |
3008 | | |
3009 | | /// Set list of helper assignment expressions, required for proper |
3010 | | /// codegen of the clause. These expressions are assignment expressions that |
3011 | | /// assign source helper expressions to destination helper expressions |
3012 | | /// correspondingly. |
3013 | | void setAssignmentOps(ArrayRef<Expr *> AssignmentOps); |
3014 | | |
3015 | | /// Get the list of helper assignment expressions. |
3016 | 116 | MutableArrayRef<Expr *> getAssignmentOps() { |
3017 | 116 | return MutableArrayRef<Expr *>(getDestinationExprs().end(), varlist_size()); |
3018 | 116 | } |
3019 | 100 | ArrayRef<const Expr *> getAssignmentOps() const { |
3020 | 100 | return llvm::makeArrayRef(getDestinationExprs().end(), varlist_size()); |
3021 | 100 | } |
3022 | | |
3023 | | public: |
3024 | | /// Creates clause with a list of variables \a VL. |
3025 | | /// |
3026 | | /// \param C AST context. |
3027 | | /// \param StartLoc Starting location of the clause. |
3028 | | /// \param LParenLoc Location of '('. |
3029 | | /// \param EndLoc Ending location of the clause. |
3030 | | /// \param VL List of references to the variables. |
3031 | | /// \param SrcExprs List of helper expressions for proper generation of |
3032 | | /// assignment operation required for copyin clause. This list represents |
3033 | | /// sources. |
3034 | | /// \param DstExprs List of helper expressions for proper generation of |
3035 | | /// assignment operation required for copyin clause. This list represents |
3036 | | /// destinations. |
3037 | | /// \param AssignmentOps List of helper expressions that represents assignment |
3038 | | /// operation: |
3039 | | /// \code |
3040 | | /// DstExprs = SrcExprs; |
3041 | | /// \endcode |
3042 | | /// Required for proper codegen of propagation of master's thread values of |
3043 | | /// threadprivate variables to local instances of that variables in other |
3044 | | /// implicit threads. |
3045 | | static OMPCopyinClause * |
3046 | | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
3047 | | SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs, |
3048 | | ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps); |
3049 | | |
3050 | | /// Creates an empty clause with \a N variables. |
3051 | | /// |
3052 | | /// \param C AST context. |
3053 | | /// \param N The number of variables. |
3054 | | static OMPCopyinClause *CreateEmpty(const ASTContext &C, unsigned N); |
3055 | | |
3056 | | using helper_expr_iterator = MutableArrayRef<Expr *>::iterator; |
3057 | | using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator; |
3058 | | using helper_expr_range = llvm::iterator_range<helper_expr_iterator>; |
3059 | | using helper_expr_const_range = |
3060 | | llvm::iterator_range<helper_expr_const_iterator>; |
3061 | | |
3062 | 50 | helper_expr_const_range source_exprs() const { |
3063 | 50 | return helper_expr_const_range(getSourceExprs().begin(), |
3064 | 50 | getSourceExprs().end()); |
3065 | 50 | } |
3066 | | |
3067 | 58 | helper_expr_range source_exprs() { |
3068 | 58 | return helper_expr_range(getSourceExprs().begin(), getSourceExprs().end()); |
3069 | 58 | } |
3070 | | |
3071 | 50 | helper_expr_const_range destination_exprs() const { |
3072 | 50 | return helper_expr_const_range(getDestinationExprs().begin(), |
3073 | 50 | getDestinationExprs().end()); |
3074 | 50 | } |
3075 | | |
3076 | 58 | helper_expr_range destination_exprs() { |
3077 | 58 | return helper_expr_range(getDestinationExprs().begin(), |
3078 | 58 | getDestinationExprs().end()); |
3079 | 58 | } |
3080 | | |
3081 | 50 | helper_expr_const_range assignment_ops() const { |
3082 | 50 | return helper_expr_const_range(getAssignmentOps().begin(), |
3083 | 50 | getAssignmentOps().end()); |
3084 | 50 | } |
3085 | | |
3086 | 58 | helper_expr_range assignment_ops() { |
3087 | 58 | return helper_expr_range(getAssignmentOps().begin(), |
3088 | 58 | getAssignmentOps().end()); |
3089 | 58 | } |
3090 | | |
3091 | 261 | child_range children() { |
3092 | 261 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
3093 | 261 | reinterpret_cast<Stmt **>(varlist_end())); |
3094 | 261 | } |
3095 | | |
3096 | 280 | static bool classof(const OMPClause *T) { |
3097 | 280 | return T->getClauseKind() == OMPC_copyin; |
3098 | 280 | } |
3099 | | }; |
3100 | | |
3101 | | /// This represents clause 'copyprivate' in the '#pragma omp ...' |
3102 | | /// directives. |
3103 | | /// |
3104 | | /// \code |
3105 | | /// #pragma omp single copyprivate(a,b) |
3106 | | /// \endcode |
3107 | | /// In this example directive '#pragma omp single' has clause 'copyprivate' |
3108 | | /// with the variables 'a' and 'b'. |
3109 | | class OMPCopyprivateClause final |
3110 | | : public OMPVarListClause<OMPCopyprivateClause>, |
3111 | | private llvm::TrailingObjects<OMPCopyprivateClause, Expr *> { |
3112 | | friend class OMPClauseReader; |
3113 | | friend OMPVarListClause; |
3114 | | friend TrailingObjects; |
3115 | | |
3116 | | /// Build clause with number of variables \a N. |
3117 | | /// |
3118 | | /// \param StartLoc Starting location of the clause. |
3119 | | /// \param LParenLoc Location of '('. |
3120 | | /// \param EndLoc Ending location of the clause. |
3121 | | /// \param N Number of the variables in the clause. |
3122 | | OMPCopyprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
3123 | | SourceLocation EndLoc, unsigned N) |
3124 | | : OMPVarListClause<OMPCopyprivateClause>(OMPC_copyprivate, StartLoc, |
3125 | 140 | LParenLoc, EndLoc, N) {} |
3126 | | |
3127 | | /// Build an empty clause. |
3128 | | /// |
3129 | | /// \param N Number of variables. |
3130 | | explicit OMPCopyprivateClause(unsigned N) |
3131 | | : OMPVarListClause<OMPCopyprivateClause>( |
3132 | | OMPC_copyprivate, SourceLocation(), SourceLocation(), |
3133 | 18 | SourceLocation(), N) {} |
3134 | | |
3135 | | /// Set list of helper expressions, required for proper codegen of the |
3136 | | /// clause. These expressions represent source expression in the final |
3137 | | /// assignment statement performed by the copyprivate clause. |
3138 | | void setSourceExprs(ArrayRef<Expr *> SrcExprs); |
3139 | | |
3140 | | /// Get the list of helper source expressions. |
3141 | 424 | MutableArrayRef<Expr *> getSourceExprs() { |
3142 | 424 | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
3143 | 424 | } |
3144 | 228 | ArrayRef<const Expr *> getSourceExprs() const { |
3145 | 228 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
3146 | 228 | } |
3147 | | |
3148 | | /// Set list of helper expressions, required for proper codegen of the |
3149 | | /// clause. These expressions represent destination expression in the final |
3150 | | /// assignment statement performed by the copyprivate clause. |
3151 | | void setDestinationExprs(ArrayRef<Expr *> DstExprs); |
3152 | | |
3153 | | /// Get the list of helper destination expressions. |
3154 | 230 | MutableArrayRef<Expr *> getDestinationExprs() { |
3155 | 230 | return MutableArrayRef<Expr *>(getSourceExprs().end(), varlist_size()); |
3156 | 230 | } |
3157 | 152 | ArrayRef<const Expr *> getDestinationExprs() const { |
3158 | 152 | return llvm::makeArrayRef(getSourceExprs().end(), varlist_size()); |
3159 | 152 | } |
3160 | | |
3161 | | /// Set list of helper assignment expressions, required for proper |
3162 | | /// codegen of the clause. These expressions are assignment expressions that |
3163 | | /// assign source helper expressions to destination helper expressions |
3164 | | /// correspondingly. |
3165 | | void setAssignmentOps(ArrayRef<Expr *> AssignmentOps); |
3166 | | |
3167 | | /// Get the list of helper assignment expressions. |
3168 | 36 | MutableArrayRef<Expr *> getAssignmentOps() { |
3169 | 36 | return MutableArrayRef<Expr *>(getDestinationExprs().end(), varlist_size()); |
3170 | 36 | } |
3171 | 76 | ArrayRef<const Expr *> getAssignmentOps() const { |
3172 | 76 | return llvm::makeArrayRef(getDestinationExprs().end(), varlist_size()); |
3173 | 76 | } |
3174 | | |
3175 | | public: |
3176 | | /// Creates clause with a list of variables \a VL. |
3177 | | /// |
3178 | | /// \param C AST context. |
3179 | | /// \param StartLoc Starting location of the clause. |
3180 | | /// \param LParenLoc Location of '('. |
3181 | | /// \param EndLoc Ending location of the clause. |
3182 | | /// \param VL List of references to the variables. |
3183 | | /// \param SrcExprs List of helper expressions for proper generation of |
3184 | | /// assignment operation required for copyprivate clause. This list represents |
3185 | | /// sources. |
3186 | | /// \param DstExprs List of helper expressions for proper generation of |
3187 | | /// assignment operation required for copyprivate clause. This list represents |
3188 | | /// destinations. |
3189 | | /// \param AssignmentOps List of helper expressions that represents assignment |
3190 | | /// operation: |
3191 | | /// \code |
3192 | | /// DstExprs = SrcExprs; |
3193 | | /// \endcode |
3194 | | /// Required for proper codegen of final assignment performed by the |
3195 | | /// copyprivate clause. |
3196 | | static OMPCopyprivateClause * |
3197 | | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
3198 | | SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs, |
3199 | | ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps); |
3200 | | |
3201 | | /// Creates an empty clause with \a N variables. |
3202 | | /// |
3203 | | /// \param C AST context. |
3204 | | /// \param N The number of variables. |
3205 | | static OMPCopyprivateClause *CreateEmpty(const ASTContext &C, unsigned N); |
3206 | | |
3207 | | using helper_expr_iterator = MutableArrayRef<Expr *>::iterator; |
3208 | | using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator; |
3209 | | using helper_expr_range = llvm::iterator_range<helper_expr_iterator>; |
3210 | | using helper_expr_const_range = |
3211 | | llvm::iterator_range<helper_expr_const_iterator>; |
3212 | | |
3213 | 38 | helper_expr_const_range source_exprs() const { |
3214 | 38 | return helper_expr_const_range(getSourceExprs().begin(), |
3215 | 38 | getSourceExprs().end()); |
3216 | 38 | } |
3217 | | |
3218 | 18 | helper_expr_range source_exprs() { |
3219 | 18 | return helper_expr_range(getSourceExprs().begin(), getSourceExprs().end()); |
3220 | 18 | } |
3221 | | |
3222 | 38 | helper_expr_const_range destination_exprs() const { |
3223 | 38 | return helper_expr_const_range(getDestinationExprs().begin(), |
3224 | 38 | getDestinationExprs().end()); |
3225 | 38 | } |
3226 | | |
3227 | 18 | helper_expr_range destination_exprs() { |
3228 | 18 | return helper_expr_range(getDestinationExprs().begin(), |
3229 | 18 | getDestinationExprs().end()); |
3230 | 18 | } |
3231 | | |
3232 | 38 | helper_expr_const_range assignment_ops() const { |
3233 | 38 | return helper_expr_const_range(getAssignmentOps().begin(), |
3234 | 38 | getAssignmentOps().end()); |
3235 | 38 | } |
3236 | | |
3237 | 18 | helper_expr_range assignment_ops() { |
3238 | 18 | return helper_expr_range(getAssignmentOps().begin(), |
3239 | 18 | getAssignmentOps().end()); |
3240 | 18 | } |
3241 | | |
3242 | 202 | child_range children() { |
3243 | 202 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
3244 | 202 | reinterpret_cast<Stmt **>(varlist_end())); |
3245 | 202 | } |
3246 | | |
3247 | 35 | static bool classof(const OMPClause *T) { |
3248 | 35 | return T->getClauseKind() == OMPC_copyprivate; |
3249 | 35 | } |
3250 | | }; |
3251 | | |
3252 | | /// This represents implicit clause 'flush' for the '#pragma omp flush' |
3253 | | /// directive. |
3254 | | /// This clause does not exist by itself, it can be only as a part of 'omp |
3255 | | /// flush' directive. This clause is introduced to keep the original structure |
3256 | | /// of \a OMPExecutableDirective class and its derivatives and to use the |
3257 | | /// existing infrastructure of clauses with the list of variables. |
3258 | | /// |
3259 | | /// \code |
3260 | | /// #pragma omp flush(a,b) |
3261 | | /// \endcode |
3262 | | /// In this example directive '#pragma omp flush' has implicit clause 'flush' |
3263 | | /// with the variables 'a' and 'b'. |
3264 | | class OMPFlushClause final |
3265 | | : public OMPVarListClause<OMPFlushClause>, |
3266 | | private llvm::TrailingObjects<OMPFlushClause, Expr *> { |
3267 | | friend OMPVarListClause; |
3268 | | friend TrailingObjects; |
3269 | | |
3270 | | /// Build clause with number of variables \a N. |
3271 | | /// |
3272 | | /// \param StartLoc Starting location of the clause. |
3273 | | /// \param LParenLoc Location of '('. |
3274 | | /// \param EndLoc Ending location of the clause. |
3275 | | /// \param N Number of the variables in the clause. |
3276 | | OMPFlushClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
3277 | | SourceLocation EndLoc, unsigned N) |
3278 | | : OMPVarListClause<OMPFlushClause>(OMPC_flush, StartLoc, LParenLoc, |
3279 | 52 | EndLoc, N) {} |
3280 | | |
3281 | | /// Build an empty clause. |
3282 | | /// |
3283 | | /// \param N Number of variables. |
3284 | | explicit OMPFlushClause(unsigned N) |
3285 | | : OMPVarListClause<OMPFlushClause>(OMPC_flush, SourceLocation(), |
3286 | | SourceLocation(), SourceLocation(), |
3287 | 8 | N) {} |
3288 | | |
3289 | | public: |
3290 | | /// Creates clause with a list of variables \a VL. |
3291 | | /// |
3292 | | /// \param C AST context. |
3293 | | /// \param StartLoc Starting location of the clause. |
3294 | | /// \param LParenLoc Location of '('. |
3295 | | /// \param EndLoc Ending location of the clause. |
3296 | | /// \param VL List of references to the variables. |
3297 | | static OMPFlushClause *Create(const ASTContext &C, SourceLocation StartLoc, |
3298 | | SourceLocation LParenLoc, SourceLocation EndLoc, |
3299 | | ArrayRef<Expr *> VL); |
3300 | | |
3301 | | /// Creates an empty clause with \a N variables. |
3302 | | /// |
3303 | | /// \param C AST context. |
3304 | | /// \param N The number of variables. |
3305 | | static OMPFlushClause *CreateEmpty(const ASTContext &C, unsigned N); |
3306 | | |
3307 | 0 | child_range children() { |
3308 | 0 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
3309 | 0 | reinterpret_cast<Stmt **>(varlist_end())); |
3310 | 0 | } |
3311 | | |
3312 | 4 | static bool classof(const OMPClause *T) { |
3313 | 4 | return T->getClauseKind() == OMPC_flush; |
3314 | 4 | } |
3315 | | }; |
3316 | | |
3317 | | /// This represents implicit clause 'depend' for the '#pragma omp task' |
3318 | | /// directive. |
3319 | | /// |
3320 | | /// \code |
3321 | | /// #pragma omp task depend(in:a,b) |
3322 | | /// \endcode |
3323 | | /// In this example directive '#pragma omp task' with clause 'depend' with the |
3324 | | /// variables 'a' and 'b' with dependency 'in'. |
3325 | | class OMPDependClause final |
3326 | | : public OMPVarListClause<OMPDependClause>, |
3327 | | private llvm::TrailingObjects<OMPDependClause, Expr *> { |
3328 | | friend class OMPClauseReader; |
3329 | | friend OMPVarListClause; |
3330 | | friend TrailingObjects; |
3331 | | |
3332 | | /// Dependency type (one of in, out, inout). |
3333 | | OpenMPDependClauseKind DepKind = OMPC_DEPEND_unknown; |
3334 | | |
3335 | | /// Dependency type location. |
3336 | | SourceLocation DepLoc; |
3337 | | |
3338 | | /// Colon location. |
3339 | | SourceLocation ColonLoc; |
3340 | | |
3341 | | /// Number of loops, associated with the depend clause. |
3342 | | unsigned NumLoops = 0; |
3343 | | |
3344 | | /// Build clause with number of variables \a N. |
3345 | | /// |
3346 | | /// \param StartLoc Starting location of the clause. |
3347 | | /// \param LParenLoc Location of '('. |
3348 | | /// \param EndLoc Ending location of the clause. |
3349 | | /// \param N Number of the variables in the clause. |
3350 | | /// \param NumLoops Number of loops that is associated with this depend |
3351 | | /// clause. |
3352 | | OMPDependClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
3353 | | SourceLocation EndLoc, unsigned N, unsigned NumLoops) |
3354 | | : OMPVarListClause<OMPDependClause>(OMPC_depend, StartLoc, LParenLoc, |
3355 | 2.18k | EndLoc, N), NumLoops(NumLoops) {} |
3356 | | |
3357 | | /// Build an empty clause. |
3358 | | /// |
3359 | | /// \param N Number of variables. |
3360 | | /// \param NumLoops Number of loops that is associated with this depend |
3361 | | /// clause. |
3362 | | explicit OMPDependClause(unsigned N, unsigned NumLoops) |
3363 | | : OMPVarListClause<OMPDependClause>(OMPC_depend, SourceLocation(), |
3364 | | SourceLocation(), SourceLocation(), |
3365 | | N), |
3366 | 528 | NumLoops(NumLoops) {} |
3367 | | |
3368 | | /// Set dependency kind. |
3369 | 2.71k | void setDependencyKind(OpenMPDependClauseKind K) { DepKind = K; } |
3370 | | |
3371 | | /// Set dependency kind and its location. |
3372 | 2.71k | void setDependencyLoc(SourceLocation Loc) { DepLoc = Loc; } |
3373 | | |
3374 | | /// Set colon location. |
3375 | 2.71k | void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; } |
3376 | | |
3377 | | public: |
3378 | | /// Creates clause with a list of variables \a VL. |
3379 | | /// |
3380 | | /// \param C AST context. |
3381 | | /// \param StartLoc Starting location of the clause. |
3382 | | /// \param LParenLoc Location of '('. |
3383 | | /// \param EndLoc Ending location of the clause. |
3384 | | /// \param DepKind Dependency type. |
3385 | | /// \param DepLoc Location of the dependency type. |
3386 | | /// \param ColonLoc Colon location. |
3387 | | /// \param VL List of references to the variables. |
3388 | | /// \param NumLoops Number of loops that is associated with this depend |
3389 | | /// clause. |
3390 | | static OMPDependClause *Create(const ASTContext &C, SourceLocation StartLoc, |
3391 | | SourceLocation LParenLoc, |
3392 | | SourceLocation EndLoc, |
3393 | | OpenMPDependClauseKind DepKind, |
3394 | | SourceLocation DepLoc, SourceLocation ColonLoc, |
3395 | | ArrayRef<Expr *> VL, unsigned NumLoops); |
3396 | | |
3397 | | /// Creates an empty clause with \a N variables. |
3398 | | /// |
3399 | | /// \param C AST context. |
3400 | | /// \param N The number of variables. |
3401 | | /// \param NumLoops Number of loops that is associated with this depend |
3402 | | /// clause. |
3403 | | static OMPDependClause *CreateEmpty(const ASTContext &C, unsigned N, |
3404 | | unsigned NumLoops); |
3405 | | |
3406 | | /// Get dependency type. |
3407 | 3.72k | OpenMPDependClauseKind getDependencyKind() const { return DepKind; } |
3408 | | |
3409 | | /// Get dependency type location. |
3410 | 1.26k | SourceLocation getDependencyLoc() const { return DepLoc; } |
3411 | | |
3412 | | /// Get colon location. |
3413 | 872 | SourceLocation getColonLoc() const { return ColonLoc; } |
3414 | | |
3415 | | /// Get number of loops associated with the clause. |
3416 | 2.10k | unsigned getNumLoops() const { return NumLoops; } |
3417 | | |
3418 | | /// Set the loop data for the depend clauses with 'sink|source' kind of |
3419 | | /// dependency. |
3420 | | void setLoopData(unsigned NumLoop, Expr *Cnt); |
3421 | | |
3422 | | /// Get the loop data. |
3423 | | Expr *getLoopData(unsigned NumLoop); |
3424 | | const Expr *getLoopData(unsigned NumLoop) const; |
3425 | | |
3426 | 232 | child_range children() { |
3427 | 232 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
3428 | 232 | reinterpret_cast<Stmt **>(varlist_end())); |
3429 | 232 | } |
3430 | | |
3431 | 8.64k | static bool classof(const OMPClause *T) { |
3432 | 8.64k | return T->getClauseKind() == OMPC_depend; |
3433 | 8.64k | } |
3434 | | }; |
3435 | | |
3436 | | /// This represents 'device' clause in the '#pragma omp ...' |
3437 | | /// directive. |
3438 | | /// |
3439 | | /// \code |
3440 | | /// #pragma omp target device(a) |
3441 | | /// \endcode |
3442 | | /// In this example directive '#pragma omp target' has clause 'device' |
3443 | | /// with single expression 'a'. |
3444 | | class OMPDeviceClause : public OMPClause, public OMPClauseWithPreInit { |
3445 | | friend class OMPClauseReader; |
3446 | | |
3447 | | /// Location of '('. |
3448 | | SourceLocation LParenLoc; |
3449 | | |
3450 | | /// Device number. |
3451 | | Stmt *Device = nullptr; |
3452 | | |
3453 | | /// Set the device number. |
3454 | | /// |
3455 | | /// \param E Device number. |
3456 | 288 | void setDevice(Expr *E) { Device = E; } |
3457 | | |
3458 | | public: |
3459 | | /// Build 'device' clause. |
3460 | | /// |
3461 | | /// \param E Expression associated with this clause. |
3462 | | /// \param CaptureRegion Innermost OpenMP region where expressions in this |
3463 | | /// clause must be captured. |
3464 | | /// \param StartLoc Starting location of the clause. |
3465 | | /// \param LParenLoc Location of '('. |
3466 | | /// \param EndLoc Ending location of the clause. |
3467 | | OMPDeviceClause(Expr *E, Stmt *HelperE, OpenMPDirectiveKind CaptureRegion, |
3468 | | SourceLocation StartLoc, SourceLocation LParenLoc, |
3469 | | SourceLocation EndLoc) |
3470 | | : OMPClause(OMPC_device, StartLoc, EndLoc), OMPClauseWithPreInit(this), |
3471 | 986 | LParenLoc(LParenLoc), Device(E) { |
3472 | 986 | setPreInitStmt(HelperE, CaptureRegion); |
3473 | 986 | } |
3474 | | |
3475 | | /// Build an empty clause. |
3476 | | OMPDeviceClause() |
3477 | | : OMPClause(OMPC_device, SourceLocation(), SourceLocation()), |
3478 | 288 | OMPClauseWithPreInit(this) {} |
3479 | | |
3480 | | /// Sets the location of '('. |
3481 | 288 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
3482 | | |
3483 | | /// Returns the location of '('. |
3484 | 348 | SourceLocation getLParenLoc() const { return LParenLoc; } |
3485 | | |
3486 | | /// Return device number. |
3487 | 380 | Expr *getDevice() { return cast<Expr>(Device); } |
3488 | | |
3489 | | /// Return device number. |
3490 | 792 | Expr *getDevice() const { return cast<Expr>(Device); } |
3491 | | |
3492 | 14 | child_range children() { return child_range(&Device, &Device + 1); } |
3493 | | |
3494 | 6.59k | static bool classof(const OMPClause *T) { |
3495 | 6.59k | return T->getClauseKind() == OMPC_device; |
3496 | 6.59k | } |
3497 | | }; |
3498 | | |
3499 | | /// This represents 'threads' clause in the '#pragma omp ...' directive. |
3500 | | /// |
3501 | | /// \code |
3502 | | /// #pragma omp ordered threads |
3503 | | /// \endcode |
3504 | | /// In this example directive '#pragma omp ordered' has simple 'threads' clause. |
3505 | | class OMPThreadsClause : public OMPClause { |
3506 | | public: |
3507 | | /// Build 'threads' clause. |
3508 | | /// |
3509 | | /// \param StartLoc Starting location of the clause. |
3510 | | /// \param EndLoc Ending location of the clause. |
3511 | | OMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc) |
3512 | 104 | : OMPClause(OMPC_threads, StartLoc, EndLoc) {} |
3513 | | |
3514 | | /// Build an empty clause. |
3515 | | OMPThreadsClause() |
3516 | 8 | : OMPClause(OMPC_threads, SourceLocation(), SourceLocation()) {} |
3517 | | |
3518 | 28 | child_range children() { |
3519 | 28 | return child_range(child_iterator(), child_iterator()); |
3520 | 28 | } |
3521 | | |
3522 | | static bool classof(const OMPClause *T) { |
3523 | | return T->getClauseKind() == OMPC_threads; |
3524 | | } |
3525 | | }; |
3526 | | |
3527 | | /// This represents 'simd' clause in the '#pragma omp ...' directive. |
3528 | | /// |
3529 | | /// \code |
3530 | | /// #pragma omp ordered simd |
3531 | | /// \endcode |
3532 | | /// In this example directive '#pragma omp ordered' has simple 'simd' clause. |
3533 | | class OMPSIMDClause : public OMPClause { |
3534 | | public: |
3535 | | /// Build 'simd' clause. |
3536 | | /// |
3537 | | /// \param StartLoc Starting location of the clause. |
3538 | | /// \param EndLoc Ending location of the clause. |
3539 | | OMPSIMDClause(SourceLocation StartLoc, SourceLocation EndLoc) |
3540 | 74 | : OMPClause(OMPC_simd, StartLoc, EndLoc) {} |
3541 | | |
3542 | | /// Build an empty clause. |
3543 | 16 | OMPSIMDClause() : OMPClause(OMPC_simd, SourceLocation(), SourceLocation()) {} |
3544 | | |
3545 | 38 | child_range children() { |
3546 | 38 | return child_range(child_iterator(), child_iterator()); |
3547 | 38 | } |
3548 | | |
3549 | 8 | static bool classof(const OMPClause *T) { |
3550 | 8 | return T->getClauseKind() == OMPC_simd; |
3551 | 8 | } |
3552 | | }; |
3553 | | |
3554 | | /// Struct that defines common infrastructure to handle mappable |
3555 | | /// expressions used in OpenMP clauses. |
3556 | | class OMPClauseMappableExprCommon { |
3557 | | public: |
3558 | | /// Class that represents a component of a mappable expression. E.g. |
3559 | | /// for an expression S.a, the first component is a declaration reference |
3560 | | /// expression associated with 'S' and the second is a member expression |
3561 | | /// associated with the field declaration 'a'. If the expression is an array |
3562 | | /// subscript it may not have any associated declaration. In that case the |
3563 | | /// associated declaration is set to nullptr. |
3564 | | class MappableComponent { |
3565 | | /// Expression associated with the component. |
3566 | | Expr *AssociatedExpression = nullptr; |
3567 | | |
3568 | | /// Declaration associated with the declaration. If the component does |
3569 | | /// not have a declaration (e.g. array subscripts or section), this is set |
3570 | | /// to nullptr. |
3571 | | ValueDecl *AssociatedDeclaration = nullptr; |
3572 | | |
3573 | | public: |
3574 | | explicit MappableComponent() = default; |
3575 | | explicit MappableComponent(Expr *AssociatedExpression, |
3576 | | ValueDecl *AssociatedDeclaration) |
3577 | | : AssociatedExpression(AssociatedExpression), |
3578 | | AssociatedDeclaration( |
3579 | | AssociatedDeclaration |
3580 | | ? cast<ValueDecl>(AssociatedDeclaration->getCanonicalDecl()) |
3581 | 29.5k | : nullptr) {} |
3582 | | |
3583 | 48.0k | Expr *getAssociatedExpression() const { return AssociatedExpression; } |
3584 | | |
3585 | 80.0k | ValueDecl *getAssociatedDeclaration() const { |
3586 | 80.0k | return AssociatedDeclaration; |
3587 | 80.0k | } |
3588 | | }; |
3589 | | |
3590 | | // List of components of an expression. This first one is the whole |
3591 | | // expression and the last one is the base expression. |
3592 | | using MappableExprComponentList = SmallVector<MappableComponent, 8>; |
3593 | | using MappableExprComponentListRef = ArrayRef<MappableComponent>; |
3594 | | |
3595 | | // List of all component lists associated to the same base declaration. |
3596 | | // E.g. if both 'S.a' and 'S.b' are a mappable expressions, each will have |
3597 | | // their component list but the same base declaration 'S'. |
3598 | | using MappableExprComponentLists = SmallVector<MappableExprComponentList, 8>; |
3599 | | using MappableExprComponentListsRef = ArrayRef<MappableExprComponentList>; |
3600 | | |
3601 | | protected: |
3602 | | // Return the total number of elements in a list of component lists. |
3603 | | static unsigned |
3604 | | getComponentsTotalNumber(MappableExprComponentListsRef ComponentLists); |
3605 | | |
3606 | | // Return the total number of elements in a list of declarations. All |
3607 | | // declarations are expected to be canonical. |
3608 | | static unsigned |
3609 | | getUniqueDeclarationsTotalNumber(ArrayRef<const ValueDecl *> Declarations); |
3610 | | }; |
3611 | | |
3612 | | /// This structure contains all sizes needed for by an |
3613 | | /// OMPMappableExprListClause. |
3614 | | struct OMPMappableExprListSizeTy { |
3615 | | /// Number of expressions listed. |
3616 | | unsigned NumVars; |
3617 | | /// Number of unique base declarations. |
3618 | | unsigned NumUniqueDeclarations; |
3619 | | /// Number of component lists. |
3620 | | unsigned NumComponentLists; |
3621 | | /// Total number of expression components. |
3622 | | unsigned NumComponents; |
3623 | | OMPMappableExprListSizeTy() = default; |
3624 | | OMPMappableExprListSizeTy(unsigned NumVars, unsigned NumUniqueDeclarations, |
3625 | | unsigned NumComponentLists, unsigned NumComponents) |
3626 | | : NumVars(NumVars), NumUniqueDeclarations(NumUniqueDeclarations), |
3627 | | NumComponentLists(NumComponentLists), NumComponents(NumComponents) {} |
3628 | | }; |
3629 | | |
3630 | | /// This represents clauses with a list of expressions that are mappable. |
3631 | | /// Examples of these clauses are 'map' in |
3632 | | /// '#pragma omp target [enter|exit] [data]...' directives, and 'to' and 'from |
3633 | | /// in '#pragma omp target update...' directives. |
3634 | | template <class T> |
3635 | | class OMPMappableExprListClause : public OMPVarListClause<T>, |
3636 | | public OMPClauseMappableExprCommon { |
3637 | | friend class OMPClauseReader; |
3638 | | |
3639 | | /// Number of unique declarations in this clause. |
3640 | | unsigned NumUniqueDeclarations; |
3641 | | |
3642 | | /// Number of component lists in this clause. |
3643 | | unsigned NumComponentLists; |
3644 | | |
3645 | | /// Total number of components in this clause. |
3646 | | unsigned NumComponents; |
3647 | | |
3648 | | /// C++ nested name specifier for the associated user-defined mapper. |
3649 | | NestedNameSpecifierLoc MapperQualifierLoc; |
3650 | | |
3651 | | /// The associated user-defined mapper identifier information. |
3652 | | DeclarationNameInfo MapperIdInfo; |
3653 | | |
3654 | | protected: |
3655 | | /// Build a clause for \a NumUniqueDeclarations declarations, \a |
3656 | | /// NumComponentLists total component lists, and \a NumComponents total |
3657 | | /// components. |
3658 | | /// |
3659 | | /// \param K Kind of the clause. |
3660 | | /// \param Locs Locations needed to build a mappable clause. It includes 1) |
3661 | | /// StartLoc: starting location of the clause (the clause keyword); 2) |
3662 | | /// LParenLoc: location of '('; 3) EndLoc: ending location of the clause. |
3663 | | /// \param Sizes All required sizes to build a mappable clause. It includes 1) |
3664 | | /// NumVars: number of expressions listed in this clause; 2) |
3665 | | /// NumUniqueDeclarations: number of unique base declarations in this clause; |
3666 | | /// 3) NumComponentLists: number of component lists in this clause; and 4) |
3667 | | /// NumComponents: total number of expression components in the clause. |
3668 | | /// \param MapperQualifierLocPtr C++ nested name specifier for the associated |
3669 | | /// user-defined mapper. |
3670 | | /// \param MapperIdInfoPtr The identifier of associated user-defined mapper. |
3671 | | OMPMappableExprListClause( |
3672 | | OpenMPClauseKind K, const OMPVarListLocTy &Locs, |
3673 | | const OMPMappableExprListSizeTy &Sizes, |
3674 | | NestedNameSpecifierLoc *MapperQualifierLocPtr = nullptr, |
3675 | | DeclarationNameInfo *MapperIdInfoPtr = nullptr) |
3676 | | : OMPVarListClause<T>(K, Locs.StartLoc, Locs.LParenLoc, Locs.EndLoc, |
3677 | | Sizes.NumVars), |
3678 | | NumUniqueDeclarations(Sizes.NumUniqueDeclarations), |
3679 | | NumComponentLists(Sizes.NumComponentLists), |
3680 | 21.0k | NumComponents(Sizes.NumComponents) { |
3681 | 21.0k | if (MapperQualifierLocPtr) |
3682 | 15.7k | MapperQualifierLoc = *MapperQualifierLocPtr; |
3683 | 21.0k | if (MapperIdInfoPtr) |
3684 | 15.7k | MapperIdInfo = *MapperIdInfoPtr; |
3685 | 21.0k | } clang::OMPMappableExprListClause<clang::OMPMapClause>::OMPMappableExprListClause(clang::OpenMPClauseKind, clang::OMPVarListLocTy const&, clang::OMPMappableExprListSizeTy const&, clang::NestedNameSpecifierLoc*, clang::DeclarationNameInfo*) Line | Count | Source | 3680 | 16.8k | NumComponents(Sizes.NumComponents) { | 3681 | 16.8k | if (MapperQualifierLocPtr) | 3682 | 14.9k | MapperQualifierLoc = *MapperQualifierLocPtr; | 3683 | 16.8k | if (MapperIdInfoPtr) | 3684 | 14.9k | MapperIdInfo = *MapperIdInfoPtr; | 3685 | 16.8k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::OMPMappableExprListClause(clang::OpenMPClauseKind, clang::OMPVarListLocTy const&, clang::OMPMappableExprListSizeTy const&, clang::NestedNameSpecifierLoc*, clang::DeclarationNameInfo*) Line | Count | Source | 3680 | 818 | NumComponents(Sizes.NumComponents) { | 3681 | 818 | if (MapperQualifierLocPtr) | 3682 | 772 | MapperQualifierLoc = *MapperQualifierLocPtr; | 3683 | 818 | if (MapperIdInfoPtr) | 3684 | 772 | MapperIdInfo = *MapperIdInfoPtr; | 3685 | 818 | } |
clang::OMPMappableExprListClause<clang::OMPFromClause>::OMPMappableExprListClause(clang::OpenMPClauseKind, clang::OMPVarListLocTy const&, clang::OMPMappableExprListSizeTy const&, clang::NestedNameSpecifierLoc*, clang::DeclarationNameInfo*) Line | Count | Source | 3680 | 394 | NumComponents(Sizes.NumComponents) { | 3681 | 394 | if (MapperQualifierLocPtr) | 3682 | 0 | MapperQualifierLoc = *MapperQualifierLocPtr; | 3683 | 394 | if (MapperIdInfoPtr) | 3684 | 0 | MapperIdInfo = *MapperIdInfoPtr; | 3685 | 394 | } |
clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::OMPMappableExprListClause(clang::OpenMPClauseKind, clang::OMPVarListLocTy const&, clang::OMPMappableExprListSizeTy const&, clang::NestedNameSpecifierLoc*, clang::DeclarationNameInfo*) Line | Count | Source | 3680 | 428 | NumComponents(Sizes.NumComponents) { | 3681 | 428 | if (MapperQualifierLocPtr) | 3682 | 0 | MapperQualifierLoc = *MapperQualifierLocPtr; | 3683 | 428 | if (MapperIdInfoPtr) | 3684 | 0 | MapperIdInfo = *MapperIdInfoPtr; | 3685 | 428 | } |
clang::OMPMappableExprListClause<clang::OMPIsDevicePtrClause>::OMPMappableExprListClause(clang::OpenMPClauseKind, clang::OMPVarListLocTy const&, clang::OMPMappableExprListSizeTy const&, clang::NestedNameSpecifierLoc*, clang::DeclarationNameInfo*) Line | Count | Source | 3680 | 2.54k | NumComponents(Sizes.NumComponents) { | 3681 | 2.54k | if (MapperQualifierLocPtr) | 3682 | 0 | MapperQualifierLoc = *MapperQualifierLocPtr; | 3683 | 2.54k | if (MapperIdInfoPtr) | 3684 | 0 | MapperIdInfo = *MapperIdInfoPtr; | 3685 | 2.54k | } |
|
3686 | | |
3687 | | /// Get the unique declarations that are in the trailing objects of the |
3688 | | /// class. |
3689 | 21.0k | MutableArrayRef<ValueDecl *> getUniqueDeclsRef() { |
3690 | 21.0k | return MutableArrayRef<ValueDecl *>( |
3691 | 21.0k | static_cast<T *>(this)->template getTrailingObjects<ValueDecl *>(), |
3692 | 21.0k | NumUniqueDeclarations); |
3693 | 21.0k | } clang::OMPMappableExprListClause<clang::OMPMapClause>::getUniqueDeclsRef() Line | Count | Source | 3689 | 16.8k | MutableArrayRef<ValueDecl *> getUniqueDeclsRef() { | 3690 | 16.8k | return MutableArrayRef<ValueDecl *>( | 3691 | 16.8k | static_cast<T *>(this)->template getTrailingObjects<ValueDecl *>(), | 3692 | 16.8k | NumUniqueDeclarations); | 3693 | 16.8k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::getUniqueDeclsRef() Line | Count | Source | 3689 | 818 | MutableArrayRef<ValueDecl *> getUniqueDeclsRef() { | 3690 | 818 | return MutableArrayRef<ValueDecl *>( | 3691 | 818 | static_cast<T *>(this)->template getTrailingObjects<ValueDecl *>(), | 3692 | 818 | NumUniqueDeclarations); | 3693 | 818 | } |
clang::OMPMappableExprListClause<clang::OMPFromClause>::getUniqueDeclsRef() Line | Count | Source | 3689 | 394 | MutableArrayRef<ValueDecl *> getUniqueDeclsRef() { | 3690 | 394 | return MutableArrayRef<ValueDecl *>( | 3691 | 394 | static_cast<T *>(this)->template getTrailingObjects<ValueDecl *>(), | 3692 | 394 | NumUniqueDeclarations); | 3693 | 394 | } |
clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::getUniqueDeclsRef() Line | Count | Source | 3689 | 428 | MutableArrayRef<ValueDecl *> getUniqueDeclsRef() { | 3690 | 428 | return MutableArrayRef<ValueDecl *>( | 3691 | 428 | static_cast<T *>(this)->template getTrailingObjects<ValueDecl *>(), | 3692 | 428 | NumUniqueDeclarations); | 3693 | 428 | } |
clang::OMPMappableExprListClause<clang::OMPIsDevicePtrClause>::getUniqueDeclsRef() Line | Count | Source | 3689 | 2.54k | MutableArrayRef<ValueDecl *> getUniqueDeclsRef() { | 3690 | 2.54k | return MutableArrayRef<ValueDecl *>( | 3691 | 2.54k | static_cast<T *>(this)->template getTrailingObjects<ValueDecl *>(), | 3692 | 2.54k | NumUniqueDeclarations); | 3693 | 2.54k | } |
|
3694 | | |
3695 | | /// Get the unique declarations that are in the trailing objects of the |
3696 | | /// class. |
3697 | 8.04k | ArrayRef<ValueDecl *> getUniqueDeclsRef() const { |
3698 | 8.04k | return ArrayRef<ValueDecl *>( |
3699 | 8.04k | static_cast<const T *>(this) |
3700 | 8.04k | ->template getTrailingObjects<ValueDecl *>(), |
3701 | 8.04k | NumUniqueDeclarations); |
3702 | 8.04k | } clang::OMPMappableExprListClause<clang::OMPIsDevicePtrClause>::getUniqueDeclsRef() const Line | Count | Source | 3697 | 448 | ArrayRef<ValueDecl *> getUniqueDeclsRef() const { | 3698 | 448 | return ArrayRef<ValueDecl *>( | 3699 | 448 | static_cast<const T *>(this) | 3700 | 448 | ->template getTrailingObjects<ValueDecl *>(), | 3701 | 448 | NumUniqueDeclarations); | 3702 | 448 | } |
clang::OMPMappableExprListClause<clang::OMPMapClause>::getUniqueDeclsRef() const Line | Count | Source | 3697 | 7.32k | ArrayRef<ValueDecl *> getUniqueDeclsRef() const { | 3698 | 7.32k | return ArrayRef<ValueDecl *>( | 3699 | 7.32k | static_cast<const T *>(this) | 3700 | 7.32k | ->template getTrailingObjects<ValueDecl *>(), | 3701 | 7.32k | NumUniqueDeclarations); | 3702 | 7.32k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::getUniqueDeclsRef() const Line | Count | Source | 3697 | 66 | ArrayRef<ValueDecl *> getUniqueDeclsRef() const { | 3698 | 66 | return ArrayRef<ValueDecl *>( | 3699 | 66 | static_cast<const T *>(this) | 3700 | 66 | ->template getTrailingObjects<ValueDecl *>(), | 3701 | 66 | NumUniqueDeclarations); | 3702 | 66 | } |
clang::OMPMappableExprListClause<clang::OMPFromClause>::getUniqueDeclsRef() const Line | Count | Source | 3697 | 58 | ArrayRef<ValueDecl *> getUniqueDeclsRef() const { | 3698 | 58 | return ArrayRef<ValueDecl *>( | 3699 | 58 | static_cast<const T *>(this) | 3700 | 58 | ->template getTrailingObjects<ValueDecl *>(), | 3701 | 58 | NumUniqueDeclarations); | 3702 | 58 | } |
clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::getUniqueDeclsRef() const Line | Count | Source | 3697 | 152 | ArrayRef<ValueDecl *> getUniqueDeclsRef() const { | 3698 | 152 | return ArrayRef<ValueDecl *>( | 3699 | 152 | static_cast<const T *>(this) | 3700 | 152 | ->template getTrailingObjects<ValueDecl *>(), | 3701 | 152 | NumUniqueDeclarations); | 3702 | 152 | } |
|
3703 | | |
3704 | | /// Set the unique declarations that are in the trailing objects of the |
3705 | | /// class. |
3706 | 2.43k | void setUniqueDecls(ArrayRef<ValueDecl *> UDs) { |
3707 | 2.43k | assert(UDs.size() == NumUniqueDeclarations && |
3708 | 2.43k | "Unexpected amount of unique declarations."); |
3709 | 2.43k | std::copy(UDs.begin(), UDs.end(), getUniqueDeclsRef().begin()); |
3710 | 2.43k | } clang::OMPMappableExprListClause<clang::OMPMapClause>::setUniqueDecls(llvm::ArrayRef<clang::ValueDecl*>) Line | Count | Source | 3706 | 1.87k | void setUniqueDecls(ArrayRef<ValueDecl *> UDs) { | 3707 | 1.87k | assert(UDs.size() == NumUniqueDeclarations && | 3708 | 1.87k | "Unexpected amount of unique declarations."); | 3709 | 1.87k | std::copy(UDs.begin(), UDs.end(), getUniqueDeclsRef().begin()); | 3710 | 1.87k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::setUniqueDecls(llvm::ArrayRef<clang::ValueDecl*>) Line | Count | Source | 3706 | 46 | void setUniqueDecls(ArrayRef<ValueDecl *> UDs) { | 3707 | 46 | assert(UDs.size() == NumUniqueDeclarations && | 3708 | 46 | "Unexpected amount of unique declarations."); | 3709 | 46 | std::copy(UDs.begin(), UDs.end(), getUniqueDeclsRef().begin()); | 3710 | 46 | } |
clang::OMPMappableExprListClause<clang::OMPFromClause>::setUniqueDecls(llvm::ArrayRef<clang::ValueDecl*>) Line | Count | Source | 3706 | 32 | void setUniqueDecls(ArrayRef<ValueDecl *> UDs) { | 3707 | 32 | assert(UDs.size() == NumUniqueDeclarations && | 3708 | 32 | "Unexpected amount of unique declarations."); | 3709 | 32 | std::copy(UDs.begin(), UDs.end(), getUniqueDeclsRef().begin()); | 3710 | 32 | } |
clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::setUniqueDecls(llvm::ArrayRef<clang::ValueDecl*>) Line | Count | Source | 3706 | 84 | void setUniqueDecls(ArrayRef<ValueDecl *> UDs) { | 3707 | 84 | assert(UDs.size() == NumUniqueDeclarations && | 3708 | 84 | "Unexpected amount of unique declarations."); | 3709 | 84 | std::copy(UDs.begin(), UDs.end(), getUniqueDeclsRef().begin()); | 3710 | 84 | } |
clang::OMPMappableExprListClause<clang::OMPIsDevicePtrClause>::setUniqueDecls(llvm::ArrayRef<clang::ValueDecl*>) Line | Count | Source | 3706 | 396 | void setUniqueDecls(ArrayRef<ValueDecl *> UDs) { | 3707 | 396 | assert(UDs.size() == NumUniqueDeclarations && | 3708 | 396 | "Unexpected amount of unique declarations."); | 3709 | 396 | std::copy(UDs.begin(), UDs.end(), getUniqueDeclsRef().begin()); | 3710 | 396 | } |
|
3711 | | |
3712 | | /// Get the number of lists per declaration that are in the trailing |
3713 | | /// objects of the class. |
3714 | 21.0k | MutableArrayRef<unsigned> getDeclNumListsRef() { |
3715 | 21.0k | return MutableArrayRef<unsigned>( |
3716 | 21.0k | static_cast<T *>(this)->template getTrailingObjects<unsigned>(), |
3717 | 21.0k | NumUniqueDeclarations); |
3718 | 21.0k | } clang::OMPMappableExprListClause<clang::OMPMapClause>::getDeclNumListsRef() Line | Count | Source | 3714 | 16.8k | MutableArrayRef<unsigned> getDeclNumListsRef() { | 3715 | 16.8k | return MutableArrayRef<unsigned>( | 3716 | 16.8k | static_cast<T *>(this)->template getTrailingObjects<unsigned>(), | 3717 | 16.8k | NumUniqueDeclarations); | 3718 | 16.8k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::getDeclNumListsRef() Line | Count | Source | 3714 | 818 | MutableArrayRef<unsigned> getDeclNumListsRef() { | 3715 | 818 | return MutableArrayRef<unsigned>( | 3716 | 818 | static_cast<T *>(this)->template getTrailingObjects<unsigned>(), | 3717 | 818 | NumUniqueDeclarations); | 3718 | 818 | } |
clang::OMPMappableExprListClause<clang::OMPFromClause>::getDeclNumListsRef() Line | Count | Source | 3714 | 394 | MutableArrayRef<unsigned> getDeclNumListsRef() { | 3715 | 394 | return MutableArrayRef<unsigned>( | 3716 | 394 | static_cast<T *>(this)->template getTrailingObjects<unsigned>(), | 3717 | 394 | NumUniqueDeclarations); | 3718 | 394 | } |
clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::getDeclNumListsRef() Line | Count | Source | 3714 | 428 | MutableArrayRef<unsigned> getDeclNumListsRef() { | 3715 | 428 | return MutableArrayRef<unsigned>( | 3716 | 428 | static_cast<T *>(this)->template getTrailingObjects<unsigned>(), | 3717 | 428 | NumUniqueDeclarations); | 3718 | 428 | } |
clang::OMPMappableExprListClause<clang::OMPIsDevicePtrClause>::getDeclNumListsRef() Line | Count | Source | 3714 | 2.54k | MutableArrayRef<unsigned> getDeclNumListsRef() { | 3715 | 2.54k | return MutableArrayRef<unsigned>( | 3716 | 2.54k | static_cast<T *>(this)->template getTrailingObjects<unsigned>(), | 3717 | 2.54k | NumUniqueDeclarations); | 3718 | 2.54k | } |
|
3719 | | |
3720 | | /// Get the number of lists per declaration that are in the trailing |
3721 | | /// objects of the class. |
3722 | 8.04k | ArrayRef<unsigned> getDeclNumListsRef() const { |
3723 | 8.04k | return ArrayRef<unsigned>( |
3724 | 8.04k | static_cast<const T *>(this)->template getTrailingObjects<unsigned>(), |
3725 | 8.04k | NumUniqueDeclarations); |
3726 | 8.04k | } clang::OMPMappableExprListClause<clang::OMPIsDevicePtrClause>::getDeclNumListsRef() const Line | Count | Source | 3722 | 448 | ArrayRef<unsigned> getDeclNumListsRef() const { | 3723 | 448 | return ArrayRef<unsigned>( | 3724 | 448 | static_cast<const T *>(this)->template getTrailingObjects<unsigned>(), | 3725 | 448 | NumUniqueDeclarations); | 3726 | 448 | } |
clang::OMPMappableExprListClause<clang::OMPMapClause>::getDeclNumListsRef() const Line | Count | Source | 3722 | 7.32k | ArrayRef<unsigned> getDeclNumListsRef() const { | 3723 | 7.32k | return ArrayRef<unsigned>( | 3724 | 7.32k | static_cast<const T *>(this)->template getTrailingObjects<unsigned>(), | 3725 | 7.32k | NumUniqueDeclarations); | 3726 | 7.32k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::getDeclNumListsRef() const Line | Count | Source | 3722 | 66 | ArrayRef<unsigned> getDeclNumListsRef() const { | 3723 | 66 | return ArrayRef<unsigned>( | 3724 | 66 | static_cast<const T *>(this)->template getTrailingObjects<unsigned>(), | 3725 | 66 | NumUniqueDeclarations); | 3726 | 66 | } |
clang::OMPMappableExprListClause<clang::OMPFromClause>::getDeclNumListsRef() const Line | Count | Source | 3722 | 58 | ArrayRef<unsigned> getDeclNumListsRef() const { | 3723 | 58 | return ArrayRef<unsigned>( | 3724 | 58 | static_cast<const T *>(this)->template getTrailingObjects<unsigned>(), | 3725 | 58 | NumUniqueDeclarations); | 3726 | 58 | } |
clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::getDeclNumListsRef() const Line | Count | Source | 3722 | 152 | ArrayRef<unsigned> getDeclNumListsRef() const { | 3723 | 152 | return ArrayRef<unsigned>( | 3724 | 152 | static_cast<const T *>(this)->template getTrailingObjects<unsigned>(), | 3725 | 152 | NumUniqueDeclarations); | 3726 | 152 | } |
|
3727 | | |
3728 | | /// Set the number of lists per declaration that are in the trailing |
3729 | | /// objects of the class. |
3730 | 2.43k | void setDeclNumLists(ArrayRef<unsigned> DNLs) { |
3731 | 2.43k | assert(DNLs.size() == NumUniqueDeclarations && |
3732 | 2.43k | "Unexpected amount of list numbers."); |
3733 | 2.43k | std::copy(DNLs.begin(), DNLs.end(), getDeclNumListsRef().begin()); |
3734 | 2.43k | } clang::OMPMappableExprListClause<clang::OMPMapClause>::setDeclNumLists(llvm::ArrayRef<unsigned int>) Line | Count | Source | 3730 | 1.87k | void setDeclNumLists(ArrayRef<unsigned> DNLs) { | 3731 | 1.87k | assert(DNLs.size() == NumUniqueDeclarations && | 3732 | 1.87k | "Unexpected amount of list numbers."); | 3733 | 1.87k | std::copy(DNLs.begin(), DNLs.end(), getDeclNumListsRef().begin()); | 3734 | 1.87k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::setDeclNumLists(llvm::ArrayRef<unsigned int>) Line | Count | Source | 3730 | 46 | void setDeclNumLists(ArrayRef<unsigned> DNLs) { | 3731 | 46 | assert(DNLs.size() == NumUniqueDeclarations && | 3732 | 46 | "Unexpected amount of list numbers."); | 3733 | 46 | std::copy(DNLs.begin(), DNLs.end(), getDeclNumListsRef().begin()); | 3734 | 46 | } |
clang::OMPMappableExprListClause<clang::OMPFromClause>::setDeclNumLists(llvm::ArrayRef<unsigned int>) Line | Count | Source | 3730 | 32 | void setDeclNumLists(ArrayRef<unsigned> DNLs) { | 3731 | 32 | assert(DNLs.size() == NumUniqueDeclarations && | 3732 | 32 | "Unexpected amount of list numbers."); | 3733 | 32 | std::copy(DNLs.begin(), DNLs.end(), getDeclNumListsRef().begin()); | 3734 | 32 | } |
clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::setDeclNumLists(llvm::ArrayRef<unsigned int>) Line | Count | Source | 3730 | 84 | void setDeclNumLists(ArrayRef<unsigned> DNLs) { | 3731 | 84 | assert(DNLs.size() == NumUniqueDeclarations && | 3732 | 84 | "Unexpected amount of list numbers."); | 3733 | 84 | std::copy(DNLs.begin(), DNLs.end(), getDeclNumListsRef().begin()); | 3734 | 84 | } |
clang::OMPMappableExprListClause<clang::OMPIsDevicePtrClause>::setDeclNumLists(llvm::ArrayRef<unsigned int>) Line | Count | Source | 3730 | 396 | void setDeclNumLists(ArrayRef<unsigned> DNLs) { | 3731 | 396 | assert(DNLs.size() == NumUniqueDeclarations && | 3732 | 396 | "Unexpected amount of list numbers."); | 3733 | 396 | std::copy(DNLs.begin(), DNLs.end(), getDeclNumListsRef().begin()); | 3734 | 396 | } |
|
3735 | | |
3736 | | /// Get the cumulative component lists sizes that are in the trailing |
3737 | | /// objects of the class. They are appended after the number of lists. |
3738 | 21.0k | MutableArrayRef<unsigned> getComponentListSizesRef() { |
3739 | 21.0k | return MutableArrayRef<unsigned>( |
3740 | 21.0k | static_cast<T *>(this)->template getTrailingObjects<unsigned>() + |
3741 | 21.0k | NumUniqueDeclarations, |
3742 | 21.0k | NumComponentLists); |
3743 | 21.0k | } clang::OMPMappableExprListClause<clang::OMPMapClause>::getComponentListSizesRef() Line | Count | Source | 3738 | 16.8k | MutableArrayRef<unsigned> getComponentListSizesRef() { | 3739 | 16.8k | return MutableArrayRef<unsigned>( | 3740 | 16.8k | static_cast<T *>(this)->template getTrailingObjects<unsigned>() + | 3741 | 16.8k | NumUniqueDeclarations, | 3742 | 16.8k | NumComponentLists); | 3743 | 16.8k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::getComponentListSizesRef() Line | Count | Source | 3738 | 818 | MutableArrayRef<unsigned> getComponentListSizesRef() { | 3739 | 818 | return MutableArrayRef<unsigned>( | 3740 | 818 | static_cast<T *>(this)->template getTrailingObjects<unsigned>() + | 3741 | 818 | NumUniqueDeclarations, | 3742 | 818 | NumComponentLists); | 3743 | 818 | } |
clang::OMPMappableExprListClause<clang::OMPFromClause>::getComponentListSizesRef() Line | Count | Source | 3738 | 394 | MutableArrayRef<unsigned> getComponentListSizesRef() { | 3739 | 394 | return MutableArrayRef<unsigned>( | 3740 | 394 | static_cast<T *>(this)->template getTrailingObjects<unsigned>() + | 3741 | 394 | NumUniqueDeclarations, | 3742 | 394 | NumComponentLists); | 3743 | 394 | } |
clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::getComponentListSizesRef() Line | Count | Source | 3738 | 428 | MutableArrayRef<unsigned> getComponentListSizesRef() { | 3739 | 428 | return MutableArrayRef<unsigned>( | 3740 | 428 | static_cast<T *>(this)->template getTrailingObjects<unsigned>() + | 3741 | 428 | NumUniqueDeclarations, | 3742 | 428 | NumComponentLists); | 3743 | 428 | } |
clang::OMPMappableExprListClause<clang::OMPIsDevicePtrClause>::getComponentListSizesRef() Line | Count | Source | 3738 | 2.54k | MutableArrayRef<unsigned> getComponentListSizesRef() { | 3739 | 2.54k | return MutableArrayRef<unsigned>( | 3740 | 2.54k | static_cast<T *>(this)->template getTrailingObjects<unsigned>() + | 3741 | 2.54k | NumUniqueDeclarations, | 3742 | 2.54k | NumComponentLists); | 3743 | 2.54k | } |
|
3744 | | |
3745 | | /// Get the cumulative component lists sizes that are in the trailing |
3746 | | /// objects of the class. They are appended after the number of lists. |
3747 | 8.04k | ArrayRef<unsigned> getComponentListSizesRef() const { |
3748 | 8.04k | return ArrayRef<unsigned>( |
3749 | 8.04k | static_cast<const T *>(this)->template getTrailingObjects<unsigned>() + |
3750 | 8.04k | NumUniqueDeclarations, |
3751 | 8.04k | NumComponentLists); |
3752 | 8.04k | } clang::OMPMappableExprListClause<clang::OMPIsDevicePtrClause>::getComponentListSizesRef() const Line | Count | Source | 3747 | 448 | ArrayRef<unsigned> getComponentListSizesRef() const { | 3748 | 448 | return ArrayRef<unsigned>( | 3749 | 448 | static_cast<const T *>(this)->template getTrailingObjects<unsigned>() + | 3750 | 448 | NumUniqueDeclarations, | 3751 | 448 | NumComponentLists); | 3752 | 448 | } |
clang::OMPMappableExprListClause<clang::OMPMapClause>::getComponentListSizesRef() const Line | Count | Source | 3747 | 7.32k | ArrayRef<unsigned> getComponentListSizesRef() const { | 3748 | 7.32k | return ArrayRef<unsigned>( | 3749 | 7.32k | static_cast<const T *>(this)->template getTrailingObjects<unsigned>() + | 3750 | 7.32k | NumUniqueDeclarations, | 3751 | 7.32k | NumComponentLists); | 3752 | 7.32k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::getComponentListSizesRef() const Line | Count | Source | 3747 | 66 | ArrayRef<unsigned> getComponentListSizesRef() const { | 3748 | 66 | return ArrayRef<unsigned>( | 3749 | 66 | static_cast<const T *>(this)->template getTrailingObjects<unsigned>() + | 3750 | 66 | NumUniqueDeclarations, | 3751 | 66 | NumComponentLists); | 3752 | 66 | } |
clang::OMPMappableExprListClause<clang::OMPFromClause>::getComponentListSizesRef() const Line | Count | Source | 3747 | 58 | ArrayRef<unsigned> getComponentListSizesRef() const { | 3748 | 58 | return ArrayRef<unsigned>( | 3749 | 58 | static_cast<const T *>(this)->template getTrailingObjects<unsigned>() + | 3750 | 58 | NumUniqueDeclarations, | 3751 | 58 | NumComponentLists); | 3752 | 58 | } |
clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::getComponentListSizesRef() const Line | Count | Source | 3747 | 152 | ArrayRef<unsigned> getComponentListSizesRef() const { | 3748 | 152 | return ArrayRef<unsigned>( | 3749 | 152 | static_cast<const T *>(this)->template getTrailingObjects<unsigned>() + | 3750 | 152 | NumUniqueDeclarations, | 3751 | 152 | NumComponentLists); | 3752 | 152 | } |
|
3753 | | |
3754 | | /// Set the cumulative component lists sizes that are in the trailing |
3755 | | /// objects of the class. |
3756 | 2.43k | void setComponentListSizes(ArrayRef<unsigned> CLSs) { |
3757 | 2.43k | assert(CLSs.size() == NumComponentLists && |
3758 | 2.43k | "Unexpected amount of component lists."); |
3759 | 2.43k | std::copy(CLSs.begin(), CLSs.end(), getComponentListSizesRef().begin()); |
3760 | 2.43k | } clang::OMPMappableExprListClause<clang::OMPMapClause>::setComponentListSizes(llvm::ArrayRef<unsigned int>) Line | Count | Source | 3756 | 1.87k | void setComponentListSizes(ArrayRef<unsigned> CLSs) { | 3757 | 1.87k | assert(CLSs.size() == NumComponentLists && | 3758 | 1.87k | "Unexpected amount of component lists."); | 3759 | 1.87k | std::copy(CLSs.begin(), CLSs.end(), getComponentListSizesRef().begin()); | 3760 | 1.87k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::setComponentListSizes(llvm::ArrayRef<unsigned int>) Line | Count | Source | 3756 | 46 | void setComponentListSizes(ArrayRef<unsigned> CLSs) { | 3757 | 46 | assert(CLSs.size() == NumComponentLists && | 3758 | 46 | "Unexpected amount of component lists."); | 3759 | 46 | std::copy(CLSs.begin(), CLSs.end(), getComponentListSizesRef().begin()); | 3760 | 46 | } |
clang::OMPMappableExprListClause<clang::OMPFromClause>::setComponentListSizes(llvm::ArrayRef<unsigned int>) Line | Count | Source | 3756 | 32 | void setComponentListSizes(ArrayRef<unsigned> CLSs) { | 3757 | 32 | assert(CLSs.size() == NumComponentLists && | 3758 | 32 | "Unexpected amount of component lists."); | 3759 | 32 | std::copy(CLSs.begin(), CLSs.end(), getComponentListSizesRef().begin()); | 3760 | 32 | } |
clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::setComponentListSizes(llvm::ArrayRef<unsigned int>) Line | Count | Source | 3756 | 84 | void setComponentListSizes(ArrayRef<unsigned> CLSs) { | 3757 | 84 | assert(CLSs.size() == NumComponentLists && | 3758 | 84 | "Unexpected amount of component lists."); | 3759 | 84 | std::copy(CLSs.begin(), CLSs.end(), getComponentListSizesRef().begin()); | 3760 | 84 | } |
clang::OMPMappableExprListClause<clang::OMPIsDevicePtrClause>::setComponentListSizes(llvm::ArrayRef<unsigned int>) Line | Count | Source | 3756 | 396 | void setComponentListSizes(ArrayRef<unsigned> CLSs) { | 3757 | 396 | assert(CLSs.size() == NumComponentLists && | 3758 | 396 | "Unexpected amount of component lists."); | 3759 | 396 | std::copy(CLSs.begin(), CLSs.end(), getComponentListSizesRef().begin()); | 3760 | 396 | } |
|
3761 | | |
3762 | | /// Get the components that are in the trailing objects of the class. |
3763 | 21.0k | MutableArrayRef<MappableComponent> getComponentsRef() { |
3764 | 21.0k | return MutableArrayRef<MappableComponent>( |
3765 | 21.0k | static_cast<T *>(this) |
3766 | 21.0k | ->template getTrailingObjects<MappableComponent>(), |
3767 | 21.0k | NumComponents); |
3768 | 21.0k | } clang::OMPMappableExprListClause<clang::OMPMapClause>::getComponentsRef() Line | Count | Source | 3763 | 16.8k | MutableArrayRef<MappableComponent> getComponentsRef() { | 3764 | 16.8k | return MutableArrayRef<MappableComponent>( | 3765 | 16.8k | static_cast<T *>(this) | 3766 | 16.8k | ->template getTrailingObjects<MappableComponent>(), | 3767 | 16.8k | NumComponents); | 3768 | 16.8k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::getComponentsRef() Line | Count | Source | 3763 | 818 | MutableArrayRef<MappableComponent> getComponentsRef() { | 3764 | 818 | return MutableArrayRef<MappableComponent>( | 3765 | 818 | static_cast<T *>(this) | 3766 | 818 | ->template getTrailingObjects<MappableComponent>(), | 3767 | 818 | NumComponents); | 3768 | 818 | } |
clang::OMPMappableExprListClause<clang::OMPFromClause>::getComponentsRef() Line | Count | Source | 3763 | 394 | MutableArrayRef<MappableComponent> getComponentsRef() { | 3764 | 394 | return MutableArrayRef<MappableComponent>( | 3765 | 394 | static_cast<T *>(this) | 3766 | 394 | ->template getTrailingObjects<MappableComponent>(), | 3767 | 394 | NumComponents); | 3768 | 394 | } |
clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::getComponentsRef() Line | Count | Source | 3763 | 428 | MutableArrayRef<MappableComponent> getComponentsRef() { | 3764 | 428 | return MutableArrayRef<MappableComponent>( | 3765 | 428 | static_cast<T *>(this) | 3766 | 428 | ->template getTrailingObjects<MappableComponent>(), | 3767 | 428 | NumComponents); | 3768 | 428 | } |
clang::OMPMappableExprListClause<clang::OMPIsDevicePtrClause>::getComponentsRef() Line | Count | Source | 3763 | 2.54k | MutableArrayRef<MappableComponent> getComponentsRef() { | 3764 | 2.54k | return MutableArrayRef<MappableComponent>( | 3765 | 2.54k | static_cast<T *>(this) | 3766 | 2.54k | ->template getTrailingObjects<MappableComponent>(), | 3767 | 2.54k | NumComponents); | 3768 | 2.54k | } |
|
3769 | | |
3770 | | /// Get the components that are in the trailing objects of the class. |
3771 | 19.2k | ArrayRef<MappableComponent> getComponentsRef() const { |
3772 | 19.2k | return ArrayRef<MappableComponent>( |
3773 | 19.2k | static_cast<const T *>(this) |
3774 | 19.2k | ->template getTrailingObjects<MappableComponent>(), |
3775 | 19.2k | NumComponents); |
3776 | 19.2k | } clang::OMPMappableExprListClause<clang::OMPIsDevicePtrClause>::getComponentsRef() const Line | Count | Source | 3771 | 552 | ArrayRef<MappableComponent> getComponentsRef() const { | 3772 | 552 | return ArrayRef<MappableComponent>( | 3773 | 552 | static_cast<const T *>(this) | 3774 | 552 | ->template getTrailingObjects<MappableComponent>(), | 3775 | 552 | NumComponents); | 3776 | 552 | } |
clang::OMPMappableExprListClause<clang::OMPMapClause>::getComponentsRef() const Line | Count | Source | 3771 | 18.2k | ArrayRef<MappableComponent> getComponentsRef() const { | 3772 | 18.2k | return ArrayRef<MappableComponent>( | 3773 | 18.2k | static_cast<const T *>(this) | 3774 | 18.2k | ->template getTrailingObjects<MappableComponent>(), | 3775 | 18.2k | NumComponents); | 3776 | 18.2k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::getComponentsRef() const Line | Count | Source | 3771 | 106 | ArrayRef<MappableComponent> getComponentsRef() const { | 3772 | 106 | return ArrayRef<MappableComponent>( | 3773 | 106 | static_cast<const T *>(this) | 3774 | 106 | ->template getTrailingObjects<MappableComponent>(), | 3775 | 106 | NumComponents); | 3776 | 106 | } |
clang::OMPMappableExprListClause<clang::OMPFromClause>::getComponentsRef() const Line | Count | Source | 3771 | 110 | ArrayRef<MappableComponent> getComponentsRef() const { | 3772 | 110 | return ArrayRef<MappableComponent>( | 3773 | 110 | static_cast<const T *>(this) | 3774 | 110 | ->template getTrailingObjects<MappableComponent>(), | 3775 | 110 | NumComponents); | 3776 | 110 | } |
clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::getComponentsRef() const Line | Count | Source | 3771 | 288 | ArrayRef<MappableComponent> getComponentsRef() const { | 3772 | 288 | return ArrayRef<MappableComponent>( | 3773 | 288 | static_cast<const T *>(this) | 3774 | 288 | ->template getTrailingObjects<MappableComponent>(), | 3775 | 288 | NumComponents); | 3776 | 288 | } |
|
3777 | | |
3778 | | /// Set the components that are in the trailing objects of the class. |
3779 | | /// This requires the list sizes so that it can also fill the original |
3780 | | /// expressions, which are the first component of each list. |
3781 | | void setComponents(ArrayRef<MappableComponent> Components, |
3782 | 2.43k | ArrayRef<unsigned> CLSs) { |
3783 | 2.43k | assert(Components.size() == NumComponents && |
3784 | 2.43k | "Unexpected amount of component lists."); |
3785 | 2.43k | assert(CLSs.size() == NumComponentLists && |
3786 | 2.43k | "Unexpected amount of list sizes."); |
3787 | 2.43k | std::copy(Components.begin(), Components.end(), getComponentsRef().begin()); |
3788 | 2.43k | } clang::OMPMappableExprListClause<clang::OMPMapClause>::setComponents(llvm::ArrayRef<clang::OMPClauseMappableExprCommon::MappableComponent>, llvm::ArrayRef<unsigned int>) Line | Count | Source | 3782 | 1.87k | ArrayRef<unsigned> CLSs) { | 3783 | 1.87k | assert(Components.size() == NumComponents && | 3784 | 1.87k | "Unexpected amount of component lists."); | 3785 | 1.87k | assert(CLSs.size() == NumComponentLists && | 3786 | 1.87k | "Unexpected amount of list sizes."); | 3787 | 1.87k | std::copy(Components.begin(), Components.end(), getComponentsRef().begin()); | 3788 | 1.87k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::setComponents(llvm::ArrayRef<clang::OMPClauseMappableExprCommon::MappableComponent>, llvm::ArrayRef<unsigned int>) Line | Count | Source | 3782 | 46 | ArrayRef<unsigned> CLSs) { | 3783 | 46 | assert(Components.size() == NumComponents && | 3784 | 46 | "Unexpected amount of component lists."); | 3785 | 46 | assert(CLSs.size() == NumComponentLists && | 3786 | 46 | "Unexpected amount of list sizes."); | 3787 | 46 | std::copy(Components.begin(), Components.end(), getComponentsRef().begin()); | 3788 | 46 | } |
clang::OMPMappableExprListClause<clang::OMPFromClause>::setComponents(llvm::ArrayRef<clang::OMPClauseMappableExprCommon::MappableComponent>, llvm::ArrayRef<unsigned int>) Line | Count | Source | 3782 | 32 | ArrayRef<unsigned> CLSs) { | 3783 | 32 | assert(Components.size() == NumComponents && | 3784 | 32 | "Unexpected amount of component lists."); | 3785 | 32 | assert(CLSs.size() == NumComponentLists && | 3786 | 32 | "Unexpected amount of list sizes."); | 3787 | 32 | std::copy(Components.begin(), Components.end(), getComponentsRef().begin()); | 3788 | 32 | } |
clang::OMPMappableExprListClause<clang::OMPUseDevicePtrClause>::setComponents(llvm::ArrayRef<clang::OMPClauseMappableExprCommon::MappableComponent>, llvm::ArrayRef<unsigned int>) Line | Count | Source | 3782 | 84 | ArrayRef<unsigned> CLSs) { | 3783 | 84 | assert(Components.size() == NumComponents && | 3784 | 84 | "Unexpected amount of component lists."); | 3785 | 84 | assert(CLSs.size() == NumComponentLists && | 3786 | 84 | "Unexpected amount of list sizes."); | 3787 | 84 | std::copy(Components.begin(), Components.end(), getComponentsRef().begin()); | 3788 | 84 | } |
clang::OMPMappableExprListClause<clang::OMPIsDevicePtrClause>::setComponents(llvm::ArrayRef<clang::OMPClauseMappableExprCommon::MappableComponent>, llvm::ArrayRef<unsigned int>) Line | Count | Source | 3782 | 396 | ArrayRef<unsigned> CLSs) { | 3783 | 396 | assert(Components.size() == NumComponents && | 3784 | 396 | "Unexpected amount of component lists."); | 3785 | 396 | assert(CLSs.size() == NumComponentLists && | 3786 | 396 | "Unexpected amount of list sizes."); | 3787 | 396 | std::copy(Components.begin(), Components.end(), getComponentsRef().begin()); | 3788 | 396 | } |
|
3789 | | |
3790 | | /// Fill the clause information from the list of declarations and |
3791 | | /// associated component lists. |
3792 | | void setClauseInfo(ArrayRef<ValueDecl *> Declarations, |
3793 | 18.6k | MappableExprComponentListsRef ComponentLists) { |
3794 | 18.6k | // Perform some checks to make sure the data sizes are consistent with the |
3795 | 18.6k | // information available when the clause was created. |
3796 | 18.6k | assert(getUniqueDeclarationsTotalNumber(Declarations) == |
3797 | 18.6k | NumUniqueDeclarations && |
3798 | 18.6k | "Unexpected number of mappable expression info entries!"); |
3799 | 18.6k | assert(getComponentsTotalNumber(ComponentLists) == NumComponents && |
3800 | 18.6k | "Unexpected total number of components!"); |
3801 | 18.6k | assert(Declarations.size() == ComponentLists.size() && |
3802 | 18.6k | "Declaration and component lists size is not consistent!"); |
3803 | 18.6k | assert(Declarations.size() == NumComponentLists && |
3804 | 18.6k | "Unexpected declaration and component lists size!"); |
3805 | 18.6k | |
3806 | 18.6k | // Organize the components by declaration and retrieve the original |
3807 | 18.6k | // expression. Original expressions are always the first component of the |
3808 | 18.6k | // mappable component list. |
3809 | 18.6k | llvm::MapVector<ValueDecl *, SmallVector<MappableExprComponentListRef, 8>> |
3810 | 18.6k | ComponentListMap; |
3811 | 18.6k | { |
3812 | 18.6k | auto CI = ComponentLists.begin(); |
3813 | 38.4k | for (auto DI = Declarations.begin(), DE = Declarations.end(); DI != DE; |
3814 | 19.8k | ++DI, ++CI) { |
3815 | 19.8k | assert(!CI->empty() && "Invalid component list!"); |
3816 | 19.8k | ComponentListMap[*DI].push_back(*CI); |
3817 | 19.8k | } |
3818 | 18.6k | } |
3819 | 18.6k | |
3820 | 18.6k | // Iterators of the target storage. |
3821 | 18.6k | auto UniqueDeclarations = getUniqueDeclsRef(); |
3822 | 18.6k | auto UDI = UniqueDeclarations.begin(); |
3823 | 18.6k | |
3824 | 18.6k | auto DeclNumLists = getDeclNumListsRef(); |
3825 | 18.6k | auto DNLI = DeclNumLists.begin(); |
3826 | 18.6k | |
3827 | 18.6k | auto ComponentListSizes = getComponentListSizesRef(); |
3828 | 18.6k | auto CLSI = ComponentListSizes.begin(); |
3829 | 18.6k | |
3830 | 18.6k | auto Components = getComponentsRef(); |
3831 | 18.6k | auto CI = Components.begin(); |
3832 | 18.6k | |
3833 | 18.6k | // Variable to compute the accumulation of the number of components. |
3834 | 18.6k | unsigned PrevSize = 0u; |
3835 | 18.6k | |
3836 | 18.6k | // Scan all the declarations and associated component lists. |
3837 | 19.7k | for (auto &M : ComponentListMap) { |
3838 | 19.7k | // The declaration. |
3839 | 19.7k | auto *D = M.first; |
3840 | 19.7k | // The component lists. |
3841 | 19.7k | auto CL = M.second; |
3842 | 19.7k | |
3843 | 19.7k | // Initialize the entry. |
3844 | 19.7k | *UDI = D; |
3845 | 19.7k | ++UDI; |
3846 | 19.7k | |
3847 | 19.7k | *DNLI = CL.size(); |
3848 | 19.7k | ++DNLI; |
3849 | 19.7k | |
3850 | 19.7k | // Obtain the cumulative sizes and concatenate all the components in the |
3851 | 19.7k | // reserved storage. |
3852 | 19.8k | for (auto C : CL) { |
3853 | 19.8k | // Accumulate with the previous size. |
3854 | 19.8k | PrevSize += C.size(); |
3855 | 19.8k | |
3856 | 19.8k | // Save the size. |
3857 | 19.8k | *CLSI = PrevSize; |
3858 | 19.8k | ++CLSI; |
3859 | 19.8k | |
3860 | 19.8k | // Append components after the current components iterator. |
3861 | 19.8k | CI = std::copy(C.begin(), C.end(), CI); |
3862 | 19.8k | } |
3863 | 19.7k | } |
3864 | 18.6k | } clang::OMPMappableExprListClause<clang::OMPMapClause>::setClauseInfo(llvm::ArrayRef<clang::ValueDecl*>, llvm::ArrayRef<llvm::SmallVector<clang::OMPClauseMappableExprCommon::MappableComponent, 8u> >) Line | Count | Source | 3793 | 14.9k | MappableExprComponentListsRef ComponentLists) { | 3794 | 14.9k | // Perform some checks to make sure the data sizes are consistent with the | 3795 | 14.9k | // information available when the clause was created. | 3796 | 14.9k | assert(getUniqueDeclarationsTotalNumber(Declarations) == | 3797 | 14.9k | NumUniqueDeclarations && | 3798 | 14.9k | "Unexpected number of mappable expression info entries!"); | 3799 | 14.9k | assert(getComponentsTotalNumber(ComponentLists) == NumComponents && | 3800 | 14.9k | "Unexpected total number of components!"); | 3801 | 14.9k | assert(Declarations.size() == ComponentLists.size() && | 3802 | 14.9k | "Declaration and component lists size is not consistent!"); | 3803 | 14.9k | assert(Declarations.size() == NumComponentLists && | 3804 | 14.9k | "Unexpected declaration and component lists size!"); | 3805 | 14.9k | | 3806 | 14.9k | // Organize the components by declaration and retrieve the original | 3807 | 14.9k | // expression. Original expressions are always the first component of the | 3808 | 14.9k | // mappable component list. | 3809 | 14.9k | llvm::MapVector<ValueDecl *, SmallVector<MappableExprComponentListRef, 8>> | 3810 | 14.9k | ComponentListMap; | 3811 | 14.9k | { | 3812 | 14.9k | auto CI = ComponentLists.begin(); | 3813 | 31.7k | for (auto DI = Declarations.begin(), DE = Declarations.end(); DI != DE; | 3814 | 16.7k | ++DI, ++CI) { | 3815 | 16.7k | assert(!CI->empty() && "Invalid component list!"); | 3816 | 16.7k | ComponentListMap[*DI].push_back(*CI); | 3817 | 16.7k | } | 3818 | 14.9k | } | 3819 | 14.9k | | 3820 | 14.9k | // Iterators of the target storage. | 3821 | 14.9k | auto UniqueDeclarations = getUniqueDeclsRef(); | 3822 | 14.9k | auto UDI = UniqueDeclarations.begin(); | 3823 | 14.9k | | 3824 | 14.9k | auto DeclNumLists = getDeclNumListsRef(); | 3825 | 14.9k | auto DNLI = DeclNumLists.begin(); | 3826 | 14.9k | | 3827 | 14.9k | auto ComponentListSizes = getComponentListSizesRef(); | 3828 | 14.9k | auto CLSI = ComponentListSizes.begin(); | 3829 | 14.9k | | 3830 | 14.9k | auto Components = getComponentsRef(); | 3831 | 14.9k | auto CI = Components.begin(); | 3832 | 14.9k | | 3833 | 14.9k | // Variable to compute the accumulation of the number of components. | 3834 | 14.9k | unsigned PrevSize = 0u; | 3835 | 14.9k | | 3836 | 14.9k | // Scan all the declarations and associated component lists. | 3837 | 16.6k | for (auto &M : ComponentListMap) { | 3838 | 16.6k | // The declaration. | 3839 | 16.6k | auto *D = M.first; | 3840 | 16.6k | // The component lists. | 3841 | 16.6k | auto CL = M.second; | 3842 | 16.6k | | 3843 | 16.6k | // Initialize the entry. | 3844 | 16.6k | *UDI = D; | 3845 | 16.6k | ++UDI; | 3846 | 16.6k | | 3847 | 16.6k | *DNLI = CL.size(); | 3848 | 16.6k | ++DNLI; | 3849 | 16.6k | | 3850 | 16.6k | // Obtain the cumulative sizes and concatenate all the components in the | 3851 | 16.6k | // reserved storage. | 3852 | 16.7k | for (auto C : CL) { | 3853 | 16.7k | // Accumulate with the previous size. | 3854 | 16.7k | PrevSize += C.size(); | 3855 | 16.7k | | 3856 | 16.7k | // Save the size. | 3857 | 16.7k | *CLSI = PrevSize; | 3858 | 16.7k | ++CLSI; | 3859 | 16.7k | | 3860 | 16.7k | // Append components after the current components iterator. | 3861 | 16.7k | CI = std::copy(C.begin(), C.end(), CI); | 3862 | 16.7k | } | 3863 | 16.6k | } | 3864 | 14.9k | } |
clang::OMPMappableExprListClause<clang::OMPToClause>::setClauseInfo(llvm::ArrayRef<clang::ValueDecl*>, llvm::ArrayRef<llvm::SmallVector<clang::OMPClauseMappableExprCommon::MappableComponent, 8u> >) Line | Count | Source | 3793 | 772 | MappableExprComponentListsRef ComponentLists) { | 3794 | 772 | // Perform some checks to make sure the data sizes are consistent with the | 3795 | 772 | // information available when the clause was created. | 3796 | 772 | assert(getUniqueDeclarationsTotalNumber(Declarations) == | 3797 | 772 | NumUniqueDeclarations && | 3798 | 772 | "Unexpected number of mappable expression info entries!"); | 3799 | 772 | assert(getComponentsTotalNumber(ComponentLists) == NumComponents && | 3800 | 772 | "Unexpected total number of components!"); | 3801 | 772 | assert(Declarations.size() == ComponentLists.size() && | 3802 | 772 | "Declaration and component lists size is not consistent!"); | 3803 | 772 | assert(Declarations.size() == NumComponentLists && | 3804 | 772 | "Unexpected declaration and component lists size!"); | 3805 | 772 | | 3806 | 772 | // Organize the components by declaration and retrieve the original | 3807 | 772 | // expression. Original expressions are always the first component of the | 3808 | 772 | // mappable component list. | 3809 | 772 | llvm::MapVector<ValueDecl *, SmallVector<MappableExprComponentListRef, 8>> | 3810 | 772 | ComponentListMap; | 3811 | 772 | { | 3812 | 772 | auto CI = ComponentLists.begin(); | 3813 | 1.46k | |
|