Commit 04a830f8 authored by Alexey Bataev's avatar Alexey Bataev
Browse files

[OPENMP50]Support for acquire clause.

Added full support for acquire clause in flush|atomic directives.
parent aa86311e
Loading
Loading
Loading
Loading
+41 −1
Original line number Diff line number Diff line
@@ -1882,7 +1882,7 @@ public:
/// #pragma omp flush acq_rel
/// \endcode
/// In this example directive '#pragma omp flush' has 'acq_rel' clause.
class OMPAcqRelClause : public OMPClause {
class OMPAcqRelClause final : public OMPClause {
public:
  /// Build 'ack_rel' clause.
  ///
@@ -1915,6 +1915,46 @@ public:
  }
};

/// This represents 'acquire' clause in the '#pragma omp atomic|flush'
/// directives.
///
/// \code
/// #pragma omp flush acquire
/// \endcode
/// In this example directive '#pragma omp flush' has 'acquire' clause.
class OMPAcquireClause final : public OMPClause {
public:
  /// Build 'acquire' clause.
  ///
  /// \param StartLoc Starting location of the clause.
  /// \param EndLoc Ending location of the clause.
  OMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc)
      : OMPClause(OMPC_acquire, StartLoc, EndLoc) {}

  /// Build an empty clause.
  OMPAcquireClause()
      : OMPClause(OMPC_acquire, SourceLocation(), SourceLocation()) {}

  child_range children() {
    return child_range(child_iterator(), child_iterator());
  }

  const_child_range children() const {
    return const_child_range(const_child_iterator(), const_child_iterator());
  }

  child_range used_children() {
    return child_range(child_iterator(), child_iterator());
  }
  const_child_range used_children() const {
    return const_child_range(const_child_iterator(), const_child_iterator());
  }

  static bool classof(const OMPClause *T) {
    return T->getClauseKind() == OMPC_acquire;
  }
};

/// This represents clause 'private' in the '#pragma omp ...' directives.
///
/// \code
+5 −0
Original line number Diff line number Diff line
@@ -3126,6 +3126,11 @@ bool RecursiveASTVisitor<Derived>::VisitOMPAcqRelClause(OMPAcqRelClause *) {
  return true;
}

template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPAcquireClause(OMPAcquireClause *) {
  return true;
}

template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPThreadsClause(OMPThreadsClause *) {
  return true;
+3 −3
Original line number Diff line number Diff line
@@ -9695,9 +9695,9 @@ def note_omp_atomic_capture: Note<
  "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
def err_omp_atomic_several_clauses : Error<
  "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause">;
def err_omp_atomic_several_mem_order_clauses : Error<
  "directive '#pragma omp atomic' cannot contain more than one 'seq_cst' or 'acq_rel' clause">;
def note_omp_atomic_previous_clause : Note<
def err_omp_several_mem_order_clauses : Error<
  "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', |}1'acq_rel' or 'acquire' clause">;
def note_omp_previous_mem_order_clause : Note<
  "'%0' clause used here">;
def err_omp_target_contains_not_only_teams : Error<
  "target construct with nested teams region contains statements outside of the teams construct">;
+3 −0
Original line number Diff line number Diff line
@@ -258,6 +258,7 @@ OPENMP_CLAUSE(update, OMPUpdateClause)
OPENMP_CLAUSE(capture, OMPCaptureClause)
OPENMP_CLAUSE(seq_cst, OMPSeqCstClause)
OPENMP_CLAUSE(acq_rel, OMPAcqRelClause)
OPENMP_CLAUSE(acquire, OMPAcquireClause)
OPENMP_CLAUSE(depend, OMPDependClause)
OPENMP_CLAUSE(device, OMPDeviceClause)
OPENMP_CLAUSE(threads, OMPThreadsClause)
@@ -491,6 +492,7 @@ OPENMP_ATOMIC_CLAUSE(update)
OPENMP_ATOMIC_CLAUSE(capture)
OPENMP_ATOMIC_CLAUSE(seq_cst)
OPENMP_ATOMIC_CLAUSE(acq_rel)
OPENMP_ATOMIC_CLAUSE(acquire)

// Clauses allowed for OpenMP directive 'target'.
OPENMP_TARGET_CLAUSE(if)
@@ -1089,6 +1091,7 @@ OPENMP_ORDER_KIND(concurrent)

// Clauses allowed for OpenMP directive 'flush'.
OPENMP_FLUSH_CLAUSE(acq_rel)
OPENMP_FLUSH_CLAUSE(acquire)

#undef OPENMP_FLUSH_CLAUSE
#undef OPENMP_ORDER_KIND
+3 −0
Original line number Diff line number Diff line
@@ -10331,6 +10331,9 @@ public:
  /// Called on well-formed 'acq_rel' clause.
  OMPClause *ActOnOpenMPAcqRelClause(SourceLocation StartLoc,
                                     SourceLocation EndLoc);
  /// Called on well-formed 'acquire' clause.
  OMPClause *ActOnOpenMPAcquireClause(SourceLocation StartLoc,
                                      SourceLocation EndLoc);
  /// Called on well-formed 'threads' clause.
  OMPClause *ActOnOpenMPThreadsClause(SourceLocation StartLoc,
                                      SourceLocation EndLoc);
Loading