diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2014-03-21 04:51:18 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-03-21 04:51:18 +0000 |
commit | a465dc43f18a62a73536fb51fbc75172ef4fbbc3 (patch) | |
tree | cc6fbdafde278fa2faa029c9002eb0dad0dece4d /include/clang/AST/OpenMPClause.h | |
parent | d22bb6944761bb0a20d27dc3de24a9f72aea32ac (diff) | |
download | clang-a465dc43f18a62a73536fb51fbc75172ef4fbbc3.tar.gz clang-a465dc43f18a62a73536fb51fbc75172ef4fbbc3.tar.bz2 clang-a465dc43f18a62a73536fb51fbc75172ef4fbbc3.tar.xz |
[OPENMP] parsing of clause 'safelen' (for directive 'omp simd')
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204428 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/OpenMPClause.h')
-rw-r--r-- | include/clang/AST/OpenMPClause.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/include/clang/AST/OpenMPClause.h b/include/clang/AST/OpenMPClause.h index 04ebb6a698..97c4869b98 100644 --- a/include/clang/AST/OpenMPClause.h +++ b/include/clang/AST/OpenMPClause.h @@ -250,6 +250,62 @@ public: StmtRange children() { return StmtRange(&NumThreads, &NumThreads + 1); } }; +/// \brief This represents 'safelen' clause in the '#pragma omp ...' +/// directive. +/// +/// \code +/// #pragma omp simd safelen(4) +/// \endcode +/// In this example directive '#pragma omp simd' has clause 'safelen' +/// with single expression '4'. +/// If the safelen clause is used then no two iterations executed +/// concurrently with SIMD instructions can have a greater distance +/// in the logical iteration space than its value. The parameter of +/// the safelen clause must be a constant positive integer expression. +/// +class OMPSafelenClause : public OMPClause { + friend class OMPClauseReader; + /// \brief Location of '('. + SourceLocation LParenLoc; + /// \brief Safe iteration space distance. + Stmt *Safelen; + + /// \brief Set safelen. + void setSafelen(Expr *Len) { Safelen = Len; } + +public: + /// \brief Build 'safelen' clause. + /// + /// \param Len Expression associated with this clause. + /// \param StartLoc Starting location of the clause. + /// \param EndLoc Ending location of the clause. + /// + OMPSafelenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc, + SourceLocation EndLoc) + : OMPClause(OMPC_safelen, StartLoc, EndLoc), LParenLoc(LParenLoc), + Safelen(Len) {} + + /// \brief Build an empty clause. + /// + explicit OMPSafelenClause() + : OMPClause(OMPC_safelen, SourceLocation(), SourceLocation()), + LParenLoc(SourceLocation()), Safelen(0) {} + + /// \brief Sets the location of '('. + void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } + /// \brief Returns the location of '('. + SourceLocation getLParenLoc() const { return LParenLoc; } + + /// \brief Return safe iteration space distance. + Expr *getSafelen() const { return cast_or_null<Expr>(Safelen); } + + static bool classof(const OMPClause *T) { + return T->getClauseKind() == OMPC_safelen; + } + + StmtRange children() { return StmtRange(&Safelen, &Safelen + 1); } +}; + /// \brief This represents 'default' clause in the '#pragma omp ...' directive. /// /// \code |