@@ -250,6 +250,62 @@ class OMPNumThreadsClause : public OMPClause {
250
250
StmtRange children () { return StmtRange (&NumThreads, &NumThreads + 1 ); }
251
251
};
252
252
253
+ // / \brief This represents 'safelen' clause in the '#pragma omp ...'
254
+ // / directive.
255
+ // /
256
+ // / \code
257
+ // / #pragma omp simd safelen(4)
258
+ // / \endcode
259
+ // / In this example directive '#pragma omp simd' has clause 'safelen'
260
+ // / with single expression '4'.
261
+ // / If the safelen clause is used then no two iterations executed
262
+ // / concurrently with SIMD instructions can have a greater distance
263
+ // / in the logical iteration space than its value. The parameter of
264
+ // / the safelen clause must be a constant positive integer expression.
265
+ // /
266
+ class OMPSafelenClause : public OMPClause {
267
+ friend class OMPClauseReader ;
268
+ // / \brief Location of '('.
269
+ SourceLocation LParenLoc;
270
+ // / \brief Safe iteration space distance.
271
+ Stmt *Safelen;
272
+
273
+ // / \brief Set safelen.
274
+ void setSafelen (Expr *Len) { Safelen = Len; }
275
+
276
+ public:
277
+ // / \brief Build 'safelen' clause.
278
+ // /
279
+ // / \param Len Expression associated with this clause.
280
+ // / \param StartLoc Starting location of the clause.
281
+ // / \param EndLoc Ending location of the clause.
282
+ // /
283
+ OMPSafelenClause (Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc,
284
+ SourceLocation EndLoc)
285
+ : OMPClause(OMPC_safelen, StartLoc, EndLoc), LParenLoc(LParenLoc),
286
+ Safelen (Len) {}
287
+
288
+ // / \brief Build an empty clause.
289
+ // /
290
+ explicit OMPSafelenClause ()
291
+ : OMPClause(OMPC_safelen, SourceLocation(), SourceLocation()),
292
+ LParenLoc(SourceLocation()), Safelen(0 ) {}
293
+
294
+ // / \brief Sets the location of '('.
295
+ void setLParenLoc (SourceLocation Loc) { LParenLoc = Loc; }
296
+ // / \brief Returns the location of '('.
297
+ SourceLocation getLParenLoc () const { return LParenLoc; }
298
+
299
+ // / \brief Return safe iteration space distance.
300
+ Expr *getSafelen () const { return cast_or_null<Expr>(Safelen); }
301
+
302
+ static bool classof (const OMPClause *T) {
303
+ return T->getClauseKind () == OMPC_safelen;
304
+ }
305
+
306
+ StmtRange children () { return StmtRange (&Safelen, &Safelen + 1 ); }
307
+ };
308
+
253
309
// / \brief This represents 'default' clause in the '#pragma omp ...' directive.
254
310
// /
255
311
// / \code
0 commit comments