forked from OSchip/llvm-project
Add support for 'atomic_default_mem_order' clause on 'requires' directive. Also renamed test files relating to 'requires'. Differntial review: https://reviews.llvm.org/D53513
llvm-svn: 345967
This commit is contained in:
parent
5595b1ea28
commit
7a2a27c4a4
|
@ -859,6 +859,85 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// This represents 'atomic_default_mem_order' clause in the '#pragma omp
|
||||||
|
/// requires' directive.
|
||||||
|
///
|
||||||
|
/// \code
|
||||||
|
/// #pragma omp requires atomic_default_mem_order(seq_cst)
|
||||||
|
/// \endcode
|
||||||
|
/// In this example directive '#pragma omp requires' has simple
|
||||||
|
/// atomic_default_mem_order' clause with kind 'seq_cst'.
|
||||||
|
class OMPAtomicDefaultMemOrderClause final : public OMPClause {
|
||||||
|
friend class OMPClauseReader;
|
||||||
|
|
||||||
|
/// Location of '('
|
||||||
|
SourceLocation LParenLoc;
|
||||||
|
|
||||||
|
/// A kind of the 'atomic_default_mem_order' clause.
|
||||||
|
OpenMPAtomicDefaultMemOrderClauseKind Kind =
|
||||||
|
OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown;
|
||||||
|
|
||||||
|
/// Start location of the kind in source code.
|
||||||
|
SourceLocation KindKwLoc;
|
||||||
|
|
||||||
|
/// Set kind of the clause.
|
||||||
|
///
|
||||||
|
/// \param K Kind of clause.
|
||||||
|
void setAtomicDefaultMemOrderKind(OpenMPAtomicDefaultMemOrderClauseKind K) {
|
||||||
|
Kind = K;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set clause kind location.
|
||||||
|
///
|
||||||
|
/// \param KLoc Kind location.
|
||||||
|
void setAtomicDefaultMemOrderKindKwLoc(SourceLocation KLoc) {
|
||||||
|
KindKwLoc = KLoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// Build 'atomic_default_mem_order' clause with argument \a A ('seq_cst',
|
||||||
|
/// 'acq_rel' or 'relaxed').
|
||||||
|
///
|
||||||
|
/// \param A Argument of the clause ('seq_cst', 'acq_rel' or 'relaxed').
|
||||||
|
/// \param ALoc Starting location of the argument.
|
||||||
|
/// \param StartLoc Starting location of the clause.
|
||||||
|
/// \param LParenLoc Location of '('.
|
||||||
|
/// \param EndLoc Ending location of the clause.
|
||||||
|
OMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind A,
|
||||||
|
SourceLocation ALoc, SourceLocation StartLoc,
|
||||||
|
SourceLocation LParenLoc,
|
||||||
|
SourceLocation EndLoc)
|
||||||
|
: OMPClause(OMPC_atomic_default_mem_order, StartLoc, EndLoc),
|
||||||
|
LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
|
||||||
|
|
||||||
|
/// Build an empty clause.
|
||||||
|
OMPAtomicDefaultMemOrderClause()
|
||||||
|
: OMPClause(OMPC_atomic_default_mem_order, SourceLocation(),
|
||||||
|
SourceLocation()) {}
|
||||||
|
|
||||||
|
/// Sets the location of '('.
|
||||||
|
void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
|
||||||
|
|
||||||
|
/// Returns the locaiton of '('.
|
||||||
|
SourceLocation getLParenLoc() const { return LParenLoc; }
|
||||||
|
|
||||||
|
/// Returns kind of the clause.
|
||||||
|
OpenMPAtomicDefaultMemOrderClauseKind getAtomicDefaultMemOrderKind() const {
|
||||||
|
return Kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns location of clause kind.
|
||||||
|
SourceLocation getAtomicDefaultMemOrderKindKwLoc() const { return KindKwLoc; }
|
||||||
|
|
||||||
|
child_range children() {
|
||||||
|
return child_range(child_iterator(), child_iterator());
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool classof(const OMPClause *T) {
|
||||||
|
return T->getClauseKind() == OMPC_atomic_default_mem_order;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/// This represents 'schedule' clause in the '#pragma omp ...' directive.
|
/// This represents 'schedule' clause in the '#pragma omp ...' directive.
|
||||||
///
|
///
|
||||||
/// \code
|
/// \code
|
||||||
|
|
|
@ -2887,6 +2887,12 @@ bool RecursiveASTVisitor<Derived>::VisitOMPDynamicAllocatorsClause(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Derived>
|
||||||
|
bool RecursiveASTVisitor<Derived>::VisitOMPAtomicDefaultMemOrderClause(
|
||||||
|
OMPAtomicDefaultMemOrderClause *) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Derived>
|
template <typename Derived>
|
||||||
bool
|
bool
|
||||||
RecursiveASTVisitor<Derived>::VisitOMPScheduleClause(OMPScheduleClause *C) {
|
RecursiveASTVisitor<Derived>::VisitOMPScheduleClause(OMPScheduleClause *C) {
|
||||||
|
|
|
@ -126,6 +126,9 @@
|
||||||
#ifndef OPENMP_DEFAULTMAP_KIND
|
#ifndef OPENMP_DEFAULTMAP_KIND
|
||||||
#define OPENMP_DEFAULTMAP_KIND(Name)
|
#define OPENMP_DEFAULTMAP_KIND(Name)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND
|
||||||
|
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)
|
||||||
|
#endif
|
||||||
#ifndef OPENMP_DEFAULTMAP_MODIFIER
|
#ifndef OPENMP_DEFAULTMAP_MODIFIER
|
||||||
#define OPENMP_DEFAULTMAP_MODIFIER(Name)
|
#define OPENMP_DEFAULTMAP_MODIFIER(Name)
|
||||||
#endif
|
#endif
|
||||||
|
@ -283,6 +286,7 @@ OPENMP_CLAUSE(unified_address, OMPUnifiedAddressClause)
|
||||||
OPENMP_CLAUSE(unified_shared_memory, OMPUnifiedSharedMemoryClause)
|
OPENMP_CLAUSE(unified_shared_memory, OMPUnifiedSharedMemoryClause)
|
||||||
OPENMP_CLAUSE(reverse_offload, OMPReverseOffloadClause)
|
OPENMP_CLAUSE(reverse_offload, OMPReverseOffloadClause)
|
||||||
OPENMP_CLAUSE(dynamic_allocators, OMPDynamicAllocatorsClause)
|
OPENMP_CLAUSE(dynamic_allocators, OMPDynamicAllocatorsClause)
|
||||||
|
OPENMP_CLAUSE(atomic_default_mem_order, OMPAtomicDefaultMemOrderClause)
|
||||||
|
|
||||||
// Clauses allowed for OpenMP directive 'parallel'.
|
// Clauses allowed for OpenMP directive 'parallel'.
|
||||||
OPENMP_PARALLEL_CLAUSE(if)
|
OPENMP_PARALLEL_CLAUSE(if)
|
||||||
|
@ -469,6 +473,12 @@ OPENMP_REQUIRES_CLAUSE(unified_address)
|
||||||
OPENMP_REQUIRES_CLAUSE(unified_shared_memory)
|
OPENMP_REQUIRES_CLAUSE(unified_shared_memory)
|
||||||
OPENMP_REQUIRES_CLAUSE(reverse_offload)
|
OPENMP_REQUIRES_CLAUSE(reverse_offload)
|
||||||
OPENMP_REQUIRES_CLAUSE(dynamic_allocators)
|
OPENMP_REQUIRES_CLAUSE(dynamic_allocators)
|
||||||
|
OPENMP_REQUIRES_CLAUSE(atomic_default_mem_order)
|
||||||
|
|
||||||
|
// Modifiers for 'atomic_default_mem_order' clause.
|
||||||
|
OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(seq_cst)
|
||||||
|
OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(acq_rel)
|
||||||
|
OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(relaxed)
|
||||||
|
|
||||||
// Clauses allowed for OpenMP directive 'target data'.
|
// Clauses allowed for OpenMP directive 'target data'.
|
||||||
OPENMP_TARGET_DATA_CLAUSE(if)
|
OPENMP_TARGET_DATA_CLAUSE(if)
|
||||||
|
@ -898,6 +908,7 @@ OPENMP_TASKGROUP_CLAUSE(task_reduction)
|
||||||
#undef OPENMP_ATOMIC_CLAUSE
|
#undef OPENMP_ATOMIC_CLAUSE
|
||||||
#undef OPENMP_TARGET_CLAUSE
|
#undef OPENMP_TARGET_CLAUSE
|
||||||
#undef OPENMP_REQUIRES_CLAUSE
|
#undef OPENMP_REQUIRES_CLAUSE
|
||||||
|
#undef OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND
|
||||||
#undef OPENMP_TARGET_DATA_CLAUSE
|
#undef OPENMP_TARGET_DATA_CLAUSE
|
||||||
#undef OPENMP_TARGET_ENTER_DATA_CLAUSE
|
#undef OPENMP_TARGET_ENTER_DATA_CLAUSE
|
||||||
#undef OPENMP_TARGET_EXIT_DATA_CLAUSE
|
#undef OPENMP_TARGET_EXIT_DATA_CLAUSE
|
||||||
|
|
|
@ -120,6 +120,14 @@ enum OpenMPDefaultmapClauseModifier {
|
||||||
OMPC_DEFAULTMAP_MODIFIER_last
|
OMPC_DEFAULTMAP_MODIFIER_last
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// OpenMP attributes for 'atomic_default_mem_order' clause.
|
||||||
|
enum OpenMPAtomicDefaultMemOrderClauseKind {
|
||||||
|
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
|
||||||
|
OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name,
|
||||||
|
#include "clang/Basic/OpenMPKinds.def"
|
||||||
|
OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown
|
||||||
|
};
|
||||||
|
|
||||||
/// Scheduling data for loop-based OpenMP directives.
|
/// Scheduling data for loop-based OpenMP directives.
|
||||||
struct OpenMPScheduleTy final {
|
struct OpenMPScheduleTy final {
|
||||||
OpenMPScheduleClauseKind Schedule = OMPC_SCHEDULE_unknown;
|
OpenMPScheduleClauseKind Schedule = OMPC_SCHEDULE_unknown;
|
||||||
|
|
|
@ -9209,6 +9209,11 @@ public:
|
||||||
OMPClause *ActOnOpenMPDynamicAllocatorsClause(SourceLocation StartLoc,
|
OMPClause *ActOnOpenMPDynamicAllocatorsClause(SourceLocation StartLoc,
|
||||||
SourceLocation EndLoc);
|
SourceLocation EndLoc);
|
||||||
|
|
||||||
|
/// Called on well-formed 'atomic_default_mem_order' clause.
|
||||||
|
OMPClause *ActOnOpenMPAtomicDefaultMemOrderClause(
|
||||||
|
OpenMPAtomicDefaultMemOrderClauseKind Kind, SourceLocation KindLoc,
|
||||||
|
SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
|
||||||
|
|
||||||
OMPClause *ActOnOpenMPVarListClause(
|
OMPClause *ActOnOpenMPVarListClause(
|
||||||
OpenMPClauseKind Kind, ArrayRef<Expr *> Vars, Expr *TailExpr,
|
OpenMPClauseKind Kind, ArrayRef<Expr *> Vars, Expr *TailExpr,
|
||||||
SourceLocation StartLoc, SourceLocation LParenLoc,
|
SourceLocation StartLoc, SourceLocation LParenLoc,
|
||||||
|
|
|
@ -1549,11 +1549,9 @@ void DeclPrinter::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) {
|
||||||
void DeclPrinter::VisitOMPRequiresDecl(OMPRequiresDecl *D) {
|
void DeclPrinter::VisitOMPRequiresDecl(OMPRequiresDecl *D) {
|
||||||
Out << "#pragma omp requires ";
|
Out << "#pragma omp requires ";
|
||||||
if (!D->clauselist_empty()) {
|
if (!D->clauselist_empty()) {
|
||||||
for (auto I = D->clauselist_begin(), E = D->clauselist_end(); I != E; ++I) {
|
OMPClausePrinter Printer(Out, Policy);
|
||||||
if (I != D->clauselist_begin())
|
for (auto I = D->clauselist_begin(), E = D->clauselist_end(); I != E; ++I)
|
||||||
Out << ',';
|
Printer.Visit(*I);
|
||||||
Out << getOpenMPClauseName((*I)->getClauseKind());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,7 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
|
||||||
case OMPC_unified_shared_memory:
|
case OMPC_unified_shared_memory:
|
||||||
case OMPC_reverse_offload:
|
case OMPC_reverse_offload:
|
||||||
case OMPC_dynamic_allocators:
|
case OMPC_dynamic_allocators:
|
||||||
|
case OMPC_atomic_default_mem_order:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,6 +185,7 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C)
|
||||||
case OMPC_unified_shared_memory:
|
case OMPC_unified_shared_memory:
|
||||||
case OMPC_reverse_offload:
|
case OMPC_reverse_offload:
|
||||||
case OMPC_dynamic_allocators:
|
case OMPC_dynamic_allocators:
|
||||||
|
case OMPC_atomic_default_mem_order:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1123,6 +1125,14 @@ void OMPClausePrinter::VisitOMPDynamicAllocatorsClause(
|
||||||
OS << "dynamic_allocators";
|
OS << "dynamic_allocators";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OMPClausePrinter::VisitOMPAtomicDefaultMemOrderClause(
|
||||||
|
OMPAtomicDefaultMemOrderClause *Node) {
|
||||||
|
OS << "atomic_default_mem_order("
|
||||||
|
<< getOpenMPSimpleClauseTypeName(OMPC_atomic_default_mem_order,
|
||||||
|
Node->getAtomicDefaultMemOrderKind())
|
||||||
|
<< ")";
|
||||||
|
}
|
||||||
|
|
||||||
void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) {
|
void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) {
|
||||||
OS << "schedule(";
|
OS << "schedule(";
|
||||||
if (Node->getFirstScheduleModifier() != OMPC_SCHEDULE_MODIFIER_unknown) {
|
if (Node->getFirstScheduleModifier() != OMPC_SCHEDULE_MODIFIER_unknown) {
|
||||||
|
|
|
@ -479,6 +479,9 @@ void OMPClauseProfiler::VisitOMPReverseOffloadClause(
|
||||||
void OMPClauseProfiler::VisitOMPDynamicAllocatorsClause(
|
void OMPClauseProfiler::VisitOMPDynamicAllocatorsClause(
|
||||||
const OMPDynamicAllocatorsClause *C) {}
|
const OMPDynamicAllocatorsClause *C) {}
|
||||||
|
|
||||||
|
void OMPClauseProfiler::VisitOMPAtomicDefaultMemOrderClause(
|
||||||
|
const OMPAtomicDefaultMemOrderClause *C) {}
|
||||||
|
|
||||||
void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) {
|
void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) {
|
||||||
VistOMPClauseWithPreInit(C);
|
VistOMPClauseWithPreInit(C);
|
||||||
if (auto *S = C->getChunkSize())
|
if (auto *S = C->getChunkSize())
|
||||||
|
|
|
@ -125,6 +125,12 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
|
||||||
.Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
|
.Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
|
||||||
#include "clang/Basic/OpenMPKinds.def"
|
#include "clang/Basic/OpenMPKinds.def"
|
||||||
.Default(OMPC_DEFAULTMAP_unknown);
|
.Default(OMPC_DEFAULTMAP_unknown);
|
||||||
|
case OMPC_atomic_default_mem_order:
|
||||||
|
return llvm::StringSwitch<OpenMPAtomicDefaultMemOrderClauseKind>(Str)
|
||||||
|
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
|
||||||
|
.Case(#Name, OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name)
|
||||||
|
#include "clang/Basic/OpenMPKinds.def"
|
||||||
|
.Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown);
|
||||||
case OMPC_unknown:
|
case OMPC_unknown:
|
||||||
case OMPC_threadprivate:
|
case OMPC_threadprivate:
|
||||||
case OMPC_if:
|
case OMPC_if:
|
||||||
|
@ -270,6 +276,16 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
|
||||||
#include "clang/Basic/OpenMPKinds.def"
|
#include "clang/Basic/OpenMPKinds.def"
|
||||||
}
|
}
|
||||||
llvm_unreachable("Invalid OpenMP 'schedule' clause type");
|
llvm_unreachable("Invalid OpenMP 'schedule' clause type");
|
||||||
|
case OMPC_atomic_default_mem_order:
|
||||||
|
switch (Type) {
|
||||||
|
case OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown:
|
||||||
|
return "unknown";
|
||||||
|
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name) \
|
||||||
|
case OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name: \
|
||||||
|
return #Name;
|
||||||
|
#include "clang/Basic/OpenMPKinds.def"
|
||||||
|
}
|
||||||
|
llvm_unreachable("Invalid OpenMP 'atomic_default_mem_order' clause type");
|
||||||
case OMPC_unknown:
|
case OMPC_unknown:
|
||||||
case OMPC_threadprivate:
|
case OMPC_threadprivate:
|
||||||
case OMPC_if:
|
case OMPC_if:
|
||||||
|
|
|
@ -3970,6 +3970,7 @@ static void emitOMPAtomicExpr(CodeGenFunction &CGF, OpenMPClauseKind Kind,
|
||||||
case OMPC_unified_shared_memory:
|
case OMPC_unified_shared_memory:
|
||||||
case OMPC_reverse_offload:
|
case OMPC_reverse_offload:
|
||||||
case OMPC_dynamic_allocators:
|
case OMPC_dynamic_allocators:
|
||||||
|
case OMPC_atomic_default_mem_order:
|
||||||
llvm_unreachable("Clause is not allowed in 'omp atomic'.");
|
llvm_unreachable("Clause is not allowed in 'omp atomic'.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1337,11 +1337,15 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
|
||||||
break;
|
break;
|
||||||
case OMPC_default:
|
case OMPC_default:
|
||||||
case OMPC_proc_bind:
|
case OMPC_proc_bind:
|
||||||
|
case OMPC_atomic_default_mem_order:
|
||||||
// OpenMP [2.14.3.1, Restrictions]
|
// OpenMP [2.14.3.1, Restrictions]
|
||||||
// Only a single default clause may be specified on a parallel, task or
|
// Only a single default clause may be specified on a parallel, task or
|
||||||
// teams directive.
|
// teams directive.
|
||||||
// OpenMP [2.5, parallel Construct, Restrictions]
|
// OpenMP [2.5, parallel Construct, Restrictions]
|
||||||
// At most one proc_bind clause can appear on the directive.
|
// At most one proc_bind clause can appear on the directive.
|
||||||
|
// OpenMP [5.0, Requires directive, Restrictions]
|
||||||
|
// At most one atomic_default_mem_order clause can appear
|
||||||
|
// on the directive
|
||||||
if (!FirstClause) {
|
if (!FirstClause) {
|
||||||
Diag(Tok, diag::err_omp_more_one_clause)
|
Diag(Tok, diag::err_omp_more_one_clause)
|
||||||
<< getOpenMPDirectiveName(DKind) << getOpenMPClauseName(CKind) << 0;
|
<< getOpenMPDirectiveName(DKind) << getOpenMPClauseName(CKind) << 0;
|
||||||
|
|
|
@ -8175,6 +8175,7 @@ OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr,
|
||||||
case OMPC_unified_shared_memory:
|
case OMPC_unified_shared_memory:
|
||||||
case OMPC_reverse_offload:
|
case OMPC_reverse_offload:
|
||||||
case OMPC_dynamic_allocators:
|
case OMPC_dynamic_allocators:
|
||||||
|
case OMPC_atomic_default_mem_order:
|
||||||
llvm_unreachable("Clause is not allowed.");
|
llvm_unreachable("Clause is not allowed.");
|
||||||
}
|
}
|
||||||
return Res;
|
return Res;
|
||||||
|
@ -8700,6 +8701,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
|
||||||
case OMPC_unified_shared_memory:
|
case OMPC_unified_shared_memory:
|
||||||
case OMPC_reverse_offload:
|
case OMPC_reverse_offload:
|
||||||
case OMPC_dynamic_allocators:
|
case OMPC_dynamic_allocators:
|
||||||
|
case OMPC_atomic_default_mem_order:
|
||||||
llvm_unreachable("Unexpected OpenMP clause.");
|
llvm_unreachable("Unexpected OpenMP clause.");
|
||||||
}
|
}
|
||||||
return CaptureRegion;
|
return CaptureRegion;
|
||||||
|
@ -8968,6 +8970,11 @@ OMPClause *Sema::ActOnOpenMPSimpleClause(
|
||||||
static_cast<OpenMPProcBindClauseKind>(Argument), ArgumentLoc, StartLoc,
|
static_cast<OpenMPProcBindClauseKind>(Argument), ArgumentLoc, StartLoc,
|
||||||
LParenLoc, EndLoc);
|
LParenLoc, EndLoc);
|
||||||
break;
|
break;
|
||||||
|
case OMPC_atomic_default_mem_order:
|
||||||
|
Res = ActOnOpenMPAtomicDefaultMemOrderClause(
|
||||||
|
static_cast<OpenMPAtomicDefaultMemOrderClauseKind>(Argument),
|
||||||
|
ArgumentLoc, StartLoc, LParenLoc, EndLoc);
|
||||||
|
break;
|
||||||
case OMPC_if:
|
case OMPC_if:
|
||||||
case OMPC_final:
|
case OMPC_final:
|
||||||
case OMPC_num_threads:
|
case OMPC_num_threads:
|
||||||
|
@ -9093,6 +9100,21 @@ OMPClause *Sema::ActOnOpenMPProcBindClause(OpenMPProcBindClauseKind Kind,
|
||||||
OMPProcBindClause(Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
|
OMPProcBindClause(Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OMPClause *Sema::ActOnOpenMPAtomicDefaultMemOrderClause(
|
||||||
|
OpenMPAtomicDefaultMemOrderClauseKind Kind, SourceLocation KindKwLoc,
|
||||||
|
SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) {
|
||||||
|
if (Kind == OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown) {
|
||||||
|
Diag(KindKwLoc, diag::err_omp_unexpected_clause_value)
|
||||||
|
<< getListOfPossibleValues(
|
||||||
|
OMPC_atomic_default_mem_order, /*First=*/0,
|
||||||
|
/*Last=*/OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown)
|
||||||
|
<< getOpenMPClauseName(OMPC_atomic_default_mem_order);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return new (Context) OMPAtomicDefaultMemOrderClause(Kind, KindKwLoc, StartLoc,
|
||||||
|
LParenLoc, EndLoc);
|
||||||
|
}
|
||||||
|
|
||||||
OMPClause *Sema::ActOnOpenMPSingleExprWithArgClause(
|
OMPClause *Sema::ActOnOpenMPSingleExprWithArgClause(
|
||||||
OpenMPClauseKind Kind, ArrayRef<unsigned> Argument, Expr *Expr,
|
OpenMPClauseKind Kind, ArrayRef<unsigned> Argument, Expr *Expr,
|
||||||
SourceLocation StartLoc, SourceLocation LParenLoc,
|
SourceLocation StartLoc, SourceLocation LParenLoc,
|
||||||
|
@ -9181,6 +9203,7 @@ OMPClause *Sema::ActOnOpenMPSingleExprWithArgClause(
|
||||||
case OMPC_unified_shared_memory:
|
case OMPC_unified_shared_memory:
|
||||||
case OMPC_reverse_offload:
|
case OMPC_reverse_offload:
|
||||||
case OMPC_dynamic_allocators:
|
case OMPC_dynamic_allocators:
|
||||||
|
case OMPC_atomic_default_mem_order:
|
||||||
llvm_unreachable("Clause is not allowed.");
|
llvm_unreachable("Clause is not allowed.");
|
||||||
}
|
}
|
||||||
return Res;
|
return Res;
|
||||||
|
@ -9387,6 +9410,7 @@ OMPClause *Sema::ActOnOpenMPClause(OpenMPClauseKind Kind,
|
||||||
case OMPC_from:
|
case OMPC_from:
|
||||||
case OMPC_use_device_ptr:
|
case OMPC_use_device_ptr:
|
||||||
case OMPC_is_device_ptr:
|
case OMPC_is_device_ptr:
|
||||||
|
case OMPC_atomic_default_mem_order:
|
||||||
llvm_unreachable("Clause is not allowed.");
|
llvm_unreachable("Clause is not allowed.");
|
||||||
}
|
}
|
||||||
return Res;
|
return Res;
|
||||||
|
@ -9579,6 +9603,7 @@ OMPClause *Sema::ActOnOpenMPVarListClause(
|
||||||
case OMPC_unified_shared_memory:
|
case OMPC_unified_shared_memory:
|
||||||
case OMPC_reverse_offload:
|
case OMPC_reverse_offload:
|
||||||
case OMPC_dynamic_allocators:
|
case OMPC_dynamic_allocators:
|
||||||
|
case OMPC_atomic_default_mem_order:
|
||||||
llvm_unreachable("Clause is not allowed.");
|
llvm_unreachable("Clause is not allowed.");
|
||||||
}
|
}
|
||||||
return Res;
|
return Res;
|
||||||
|
|
|
@ -8456,6 +8456,13 @@ OMPClause *TreeTransform<Derived>::TransformOMPDynamicAllocatorsClause(
|
||||||
"dynamic_allocators clause cannot appear in dependent context");
|
"dynamic_allocators clause cannot appear in dependent context");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Derived>
|
||||||
|
OMPClause *TreeTransform<Derived>::TransformOMPAtomicDefaultMemOrderClause(
|
||||||
|
OMPAtomicDefaultMemOrderClause *C) {
|
||||||
|
llvm_unreachable(
|
||||||
|
"atomic_default_mem_order clause cannot appear in dependent context");
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Derived>
|
template <typename Derived>
|
||||||
OMPClause *
|
OMPClause *
|
||||||
TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *C) {
|
TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *C) {
|
||||||
|
|
|
@ -11732,7 +11732,10 @@ OMPClause *OMPClauseReader::readClause() {
|
||||||
case OMPC_dynamic_allocators:
|
case OMPC_dynamic_allocators:
|
||||||
C = new (Context) OMPDynamicAllocatorsClause();
|
C = new (Context) OMPDynamicAllocatorsClause();
|
||||||
break;
|
break;
|
||||||
case OMPC_private:
|
case OMPC_atomic_default_mem_order:
|
||||||
|
C = new (Context) OMPAtomicDefaultMemOrderClause();
|
||||||
|
break;
|
||||||
|
case OMPC_private:
|
||||||
C = OMPPrivateClause::CreateEmpty(Context, Record.readInt());
|
C = OMPPrivateClause::CreateEmpty(Context, Record.readInt());
|
||||||
break;
|
break;
|
||||||
case OMPC_firstprivate:
|
case OMPC_firstprivate:
|
||||||
|
@ -11971,6 +11974,14 @@ void
|
||||||
OMPClauseReader::VisitOMPDynamicAllocatorsClause(OMPDynamicAllocatorsClause *) {
|
OMPClauseReader::VisitOMPDynamicAllocatorsClause(OMPDynamicAllocatorsClause *) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OMPClauseReader::VisitOMPAtomicDefaultMemOrderClause(
|
||||||
|
OMPAtomicDefaultMemOrderClause *C) {
|
||||||
|
C->setAtomicDefaultMemOrderKind(
|
||||||
|
static_cast<OpenMPAtomicDefaultMemOrderClauseKind>(Record.readInt()));
|
||||||
|
C->setLParenLoc(Record.readSourceLocation());
|
||||||
|
C->setAtomicDefaultMemOrderKindKwLoc(Record.readSourceLocation());
|
||||||
|
}
|
||||||
|
|
||||||
void OMPClauseReader::VisitOMPPrivateClause(OMPPrivateClause *C) {
|
void OMPClauseReader::VisitOMPPrivateClause(OMPPrivateClause *C) {
|
||||||
C->setLParenLoc(Record.readSourceLocation());
|
C->setLParenLoc(Record.readSourceLocation());
|
||||||
unsigned NumVars = C->varlist_size();
|
unsigned NumVars = C->varlist_size();
|
||||||
|
|
|
@ -6944,3 +6944,10 @@ void OMPClauseWriter::VisitOMPReverseOffloadClause(OMPReverseOffloadClause *) {}
|
||||||
void
|
void
|
||||||
OMPClauseWriter::VisitOMPDynamicAllocatorsClause(OMPDynamicAllocatorsClause *) {
|
OMPClauseWriter::VisitOMPDynamicAllocatorsClause(OMPDynamicAllocatorsClause *) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OMPClauseWriter::VisitOMPAtomicDefaultMemOrderClause(
|
||||||
|
OMPAtomicDefaultMemOrderClause *C) {
|
||||||
|
Record.push_back(C->getAtomicDefaultMemOrderKind());
|
||||||
|
Record.AddSourceLocation(C->getLParenLoc());
|
||||||
|
Record.AddSourceLocation(C->getAtomicDefaultMemOrderKindKwLoc());
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
|
||||||
|
// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
|
||||||
|
// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
||||||
|
|
||||||
|
// RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
|
||||||
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
|
||||||
|
// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
||||||
|
// expected-no-diagnostics
|
||||||
|
|
||||||
|
#ifndef HEADER
|
||||||
|
#define HEADER
|
||||||
|
|
||||||
|
#pragma omp requires atomic_default_mem_order(acq_rel)
|
||||||
|
// CHECK:#pragma omp requires atomic_default_mem_order(acq_rel)
|
||||||
|
|
||||||
|
#endif
|
|
@ -22,4 +22,7 @@
|
||||||
#pragma omp requires dynamic_allocators
|
#pragma omp requires dynamic_allocators
|
||||||
// CHECK:#pragma omp requires dynamic_allocators
|
// CHECK:#pragma omp requires dynamic_allocators
|
||||||
|
|
||||||
|
#pragma omp requires atomic_default_mem_order(seq_cst)
|
||||||
|
// CHECK:#pragma omp requires atomic_default_mem_order(seq_cst)
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -18,6 +18,23 @@
|
||||||
|
|
||||||
#pragma omp requires dynamic_allocators, dynamic_allocators // expected-error {{Only one dynamic_allocators clause can appear on a requires directive in a single translation unit}} expected-error {{directive '#pragma omp requires' cannot contain more than one 'dynamic_allocators' clause}}
|
#pragma omp requires dynamic_allocators, dynamic_allocators // expected-error {{Only one dynamic_allocators clause can appear on a requires directive in a single translation unit}} expected-error {{directive '#pragma omp requires' cannot contain more than one 'dynamic_allocators' clause}}
|
||||||
|
|
||||||
|
#pragma omp requires atomic_default_mem_order(seq_cst) // expected-note {{atomic_default_mem_order clause previously used here}} expected-note {{atomic_default_mem_order clause previously used here}} expected-note {{atomic_default_mem_order clause previously used here}} expected-note {{atomic_default_mem_order clause previously used here}} expected-note {{atomic_default_mem_order clause previously used here}}
|
||||||
|
|
||||||
|
#pragma omp requires atomic_default_mem_order(acq_rel) // expected-error {{Only one atomic_default_mem_order clause can appear on a requires directive in a single translation unit}}
|
||||||
|
|
||||||
|
#pragma omp requires atomic_default_mem_order(relaxed) // expected-error {{Only one atomic_default_mem_order clause can appear on a requires directive in a single translation unit}}
|
||||||
|
|
||||||
|
#pragma omp requires atomic_default_mem_order // expected-error {{expected '(' after 'atomic_default_mem_order'}} expected-error {{expected at least one clause on '#pragma omp requires' directive}}
|
||||||
|
|
||||||
|
#pragma omp requires atomic_default_mem_order( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'seq_cst', 'acq_rel' or 'relaxed' in OpenMP clause 'atomic_default_mem_order'}} expected-error {{expected at least one clause on '#pragma omp requires' directive}}
|
||||||
|
|
||||||
|
#pragma omp requires atomic_default_mem_order(seq_cst // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{Only one atomic_default_mem_order clause can appear on a requires directive in a single translation unit}}
|
||||||
|
|
||||||
|
#pragma omp requires atomic_default_mem_order(invalid_modifier) // expected-error {{expected 'seq_cst', 'acq_rel' or 'relaxed' in OpenMP clause 'atomic_default_mem_order'}} expected-error {{expected at least one clause on '#pragma omp requires' directive}}
|
||||||
|
|
||||||
|
#pragma omp requires atomic_default_mem_order(shared) // expected-error {{expected 'seq_cst', 'acq_rel' or 'relaxed' in OpenMP clause 'atomic_default_mem_order'}} expected-error {{expected at least one clause on '#pragma omp requires' directive}}
|
||||||
|
|
||||||
|
#pragma omp requires atomic_default_mem_order(acq_rel), atomic_default_mem_order(relaxed) // expected-error {{directive '#pragma omp requires' cannot contain more than one 'atomic_default_mem_order' claus}} expected-error {{Only one atomic_default_mem_order clause can appear on a requires directive in a single translation unit}}
|
||||||
|
|
||||||
#pragma omp requires // expected-error {{expected at least one clause on '#pragma omp requires' directive}}
|
#pragma omp requires // expected-error {{expected at least one clause on '#pragma omp requires' directive}}
|
||||||
|
|
||||||
|
@ -29,7 +46,7 @@
|
||||||
|
|
||||||
#pragma omp requires invalid_clause unified_address // expected-warning {{extra tokens at the end of '#pragma omp requires' are ignored}} expected-error {{expected at least one clause on '#pragma omp requires' directive}}
|
#pragma omp requires invalid_clause unified_address // expected-warning {{extra tokens at the end of '#pragma omp requires' are ignored}} expected-error {{expected at least one clause on '#pragma omp requires' directive}}
|
||||||
|
|
||||||
#pragma omp requires unified_shared_memory, unified_address, reverse_offload, dynamic_allocators // expected-error {{Only one unified_shared_memory clause can appear on a requires directive in a single translation unit}} expected-error{{Only one unified_address clause can appear on a requires directive in a single translation unit}} expected-error{{Only one reverse_offload clause can appear on a requires directive in a single translation unit}} expected-error{{Only one dynamic_allocators clause can appear on a requires directive in a single translation unit}}
|
#pragma omp requires unified_shared_memory, unified_address, reverse_offload, dynamic_allocators, atomic_default_mem_order(seq_cst) // expected-error {{Only one unified_shared_memory clause can appear on a requires directive in a single translation unit}} expected-error{{Only one unified_address clause can appear on a requires directive in a single translation unit}} expected-error{{Only one reverse_offload clause can appear on a requires directive in a single translation unit}} expected-error{{Only one dynamic_allocators clause can appear on a requires directive in a single translation unit}} expected-error {{Only one atomic_default_mem_order clause can appear on a requires directive in a single translation unit}}
|
||||||
|
|
||||||
namespace A {
|
namespace A {
|
||||||
#pragma omp requires unified_address // expected-error {{Only one unified_address clause can appear on a requires directive in a single translation unit}}
|
#pragma omp requires unified_address // expected-error {{Only one unified_address clause can appear on a requires directive in a single translation unit}}
|
|
@ -0,0 +1,16 @@
|
||||||
|
// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
|
||||||
|
// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
|
||||||
|
// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
||||||
|
|
||||||
|
// RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
|
||||||
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
|
||||||
|
// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
||||||
|
// expected-no-diagnostics
|
||||||
|
|
||||||
|
#ifndef HEADER
|
||||||
|
#define HEADER
|
||||||
|
|
||||||
|
#pragma omp requires atomic_default_mem_order(relaxed)
|
||||||
|
// CHECK:#pragma omp requires atomic_default_mem_order(relaxed)
|
||||||
|
|
||||||
|
#endif
|
|
@ -2219,6 +2219,9 @@ void OMPClauseEnqueue::VisitOMPReverseOffloadClause(
|
||||||
void OMPClauseEnqueue::VisitOMPDynamicAllocatorsClause(
|
void OMPClauseEnqueue::VisitOMPDynamicAllocatorsClause(
|
||||||
const OMPDynamicAllocatorsClause *) {}
|
const OMPDynamicAllocatorsClause *) {}
|
||||||
|
|
||||||
|
void OMPClauseEnqueue::VisitOMPAtomicDefaultMemOrderClause(
|
||||||
|
const OMPAtomicDefaultMemOrderClause *) {}
|
||||||
|
|
||||||
void OMPClauseEnqueue::VisitOMPDeviceClause(const OMPDeviceClause *C) {
|
void OMPClauseEnqueue::VisitOMPDeviceClause(const OMPDeviceClause *C) {
|
||||||
Visitor->AddStmt(C->getDevice());
|
Visitor->AddStmt(C->getDevice());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue