blob: 09468358415fce8fe1708bae24c4c5bc80c49f63 [file] [log] [blame]
//===--- OMPKinds.def - OpenMP directives, clauses, rt-calls -*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
///
/// This file defines the list of supported OpenMP directives, clauses, runtime
/// calls, and other things that need to be listed in enums.
///
//===----------------------------------------------------------------------===//
/// OpenMP Directives and combined directives
///
///{
#ifndef OMP_DIRECTIVE
#define OMP_DIRECTIVE(Enum, Str)
#endif
#define __OMP_DIRECTIVE_EXT(Name, Str) OMP_DIRECTIVE(OMPD_##Name, Str)
#define __OMP_DIRECTIVE(Name) __OMP_DIRECTIVE_EXT(Name, #Name)
__OMP_DIRECTIVE(threadprivate)
__OMP_DIRECTIVE(parallel)
__OMP_DIRECTIVE(task)
__OMP_DIRECTIVE(simd)
__OMP_DIRECTIVE(for)
__OMP_DIRECTIVE(sections)
__OMP_DIRECTIVE(section)
__OMP_DIRECTIVE(single)
__OMP_DIRECTIVE(master)
__OMP_DIRECTIVE(critical)
__OMP_DIRECTIVE(taskyield)
__OMP_DIRECTIVE(barrier)
__OMP_DIRECTIVE(taskwait)
__OMP_DIRECTIVE(taskgroup)
__OMP_DIRECTIVE(flush)
__OMP_DIRECTIVE(ordered)
__OMP_DIRECTIVE(atomic)
__OMP_DIRECTIVE(target)
__OMP_DIRECTIVE(teams)
__OMP_DIRECTIVE(cancel)
__OMP_DIRECTIVE(requires)
__OMP_DIRECTIVE_EXT(target_data, "target data")
__OMP_DIRECTIVE_EXT(target_enter_data, "target enter data")
__OMP_DIRECTIVE_EXT(target_exit_data, "target exit data")
__OMP_DIRECTIVE_EXT(target_parallel, "target parallel")
__OMP_DIRECTIVE_EXT(target_parallel_for, "target parallel for")
__OMP_DIRECTIVE_EXT(target_update, "target update")
__OMP_DIRECTIVE_EXT(parallel_for, "parallel for")
__OMP_DIRECTIVE_EXT(parallel_for_simd, "parallel for simd")
__OMP_DIRECTIVE_EXT(parallel_master, "parallel master")
__OMP_DIRECTIVE_EXT(parallel_sections, "parallel sections")
__OMP_DIRECTIVE_EXT(for_simd, "for simd")
__OMP_DIRECTIVE_EXT(cancellation_point, "cancellation point")
__OMP_DIRECTIVE_EXT(declare_reduction, "declare reduction")
__OMP_DIRECTIVE_EXT(declare_mapper, "declare mapper")
__OMP_DIRECTIVE_EXT(declare_simd, "declare simd")
__OMP_DIRECTIVE(taskloop)
__OMP_DIRECTIVE_EXT(taskloop_simd, "taskloop simd")
__OMP_DIRECTIVE(distribute)
__OMP_DIRECTIVE_EXT(declare_target, "declare target")
__OMP_DIRECTIVE_EXT(end_declare_target, "end declare target")
__OMP_DIRECTIVE_EXT(distribute_parallel_for, "distribute parallel for")
__OMP_DIRECTIVE_EXT(distribute_parallel_for_simd,
"distribute parallel for simd")
__OMP_DIRECTIVE_EXT(distribute_simd, "distribute simd")
__OMP_DIRECTIVE_EXT(target_parallel_for_simd, "target parallel for simd")
__OMP_DIRECTIVE_EXT(target_simd, "target simd")
__OMP_DIRECTIVE_EXT(teams_distribute, "teams distribute")
__OMP_DIRECTIVE_EXT(teams_distribute_simd, "teams distribute simd")
__OMP_DIRECTIVE_EXT(teams_distribute_parallel_for_simd,
"teams distribute parallel for simd")
__OMP_DIRECTIVE_EXT(teams_distribute_parallel_for,
"teams distribute parallel for")
__OMP_DIRECTIVE_EXT(target_teams, "target teams")
__OMP_DIRECTIVE_EXT(target_teams_distribute, "target teams distribute")
__OMP_DIRECTIVE_EXT(target_teams_distribute_parallel_for,
"target teams distribute parallel for")
__OMP_DIRECTIVE_EXT(target_teams_distribute_parallel_for_simd,
"target teams distribute parallel for simd")
__OMP_DIRECTIVE_EXT(target_teams_distribute_simd,
"target teams distribute simd")
__OMP_DIRECTIVE(allocate)
__OMP_DIRECTIVE_EXT(declare_variant, "declare variant")
__OMP_DIRECTIVE_EXT(master_taskloop, "master taskloop")
__OMP_DIRECTIVE_EXT(parallel_master_taskloop, "parallel master taskloop")
__OMP_DIRECTIVE_EXT(master_taskloop_simd, "master taskloop simd")
__OMP_DIRECTIVE_EXT(parallel_master_taskloop_simd,
"parallel master taskloop simd")
__OMP_DIRECTIVE(depobj)
__OMP_DIRECTIVE(scan)
__OMP_DIRECTIVE_EXT(begin_declare_variant, "begin declare variant")
__OMP_DIRECTIVE_EXT(end_declare_variant, "end declare variant")
// Has to be the last because Clang implicitly expects it to be.
__OMP_DIRECTIVE(unknown)
#undef __OMP_DIRECTIVE_EXT
#undef __OMP_DIRECTIVE
#undef OMP_DIRECTIVE
///}
/// OpenMP Clauses
///
///{
#ifndef OMP_CLAUSE
#define OMP_CLAUSE(Enum, Str, Implicit)
#endif
#ifndef OMP_CLAUSE_CLASS
#define OMP_CLAUSE_CLASS(Enum, Str, Class)
#endif
#ifndef OMP_CLAUSE_NO_CLASS
#define OMP_CLAUSE_NO_CLASS(Enum, Str)
#endif
#define __OMP_CLAUSE(Name, Class) \
OMP_CLAUSE(OMPC_##Name, #Name, /* Implicit */ false) \
OMP_CLAUSE_CLASS(OMPC_##Name, #Name, Class)
#define __OMP_CLAUSE_NO_CLASS(Name) \
OMP_CLAUSE(OMPC_##Name, #Name, /* Implicit */ false) \
OMP_CLAUSE_NO_CLASS(OMPC_##Name, #Name)
#define __OMP_IMPLICIT_CLAUSE_CLASS(Name, Str, Class) \
OMP_CLAUSE(OMPC_##Name, Str, /* Implicit */ true) \
OMP_CLAUSE_CLASS(OMPC_##Name, Str, Class)
#define __OMP_IMPLICIT_CLAUSE_NO_CLASS(Name, Str) \
OMP_CLAUSE(OMPC_##Name, Str, /* Implicit */ true) \
OMP_CLAUSE_NO_CLASS(OMPC_##Name, Str)
__OMP_CLAUSE(allocator, OMPAllocatorClause)
__OMP_CLAUSE(if, OMPIfClause)
__OMP_CLAUSE(final, OMPFinalClause)
__OMP_CLAUSE(num_threads, OMPNumThreadsClause)
__OMP_CLAUSE(safelen, OMPSafelenClause)
__OMP_CLAUSE(simdlen, OMPSimdlenClause)
__OMP_CLAUSE(collapse, OMPCollapseClause)
__OMP_CLAUSE(default, OMPDefaultClause)
__OMP_CLAUSE(private, OMPPrivateClause)
__OMP_CLAUSE(firstprivate, OMPFirstprivateClause)
__OMP_CLAUSE(lastprivate, OMPLastprivateClause)
__OMP_CLAUSE(shared, OMPSharedClause)
__OMP_CLAUSE(reduction, OMPReductionClause)
__OMP_CLAUSE(linear, OMPLinearClause)
__OMP_CLAUSE(aligned, OMPAlignedClause)
__OMP_CLAUSE(copyin, OMPCopyinClause)
__OMP_CLAUSE(copyprivate, OMPCopyprivateClause)
__OMP_CLAUSE(proc_bind, OMPProcBindClause)
__OMP_CLAUSE(schedule, OMPScheduleClause)
__OMP_CLAUSE(ordered, OMPOrderedClause)
__OMP_CLAUSE(nowait, OMPNowaitClause)
__OMP_CLAUSE(untied, OMPUntiedClause)
__OMP_CLAUSE(mergeable, OMPMergeableClause)
__OMP_CLAUSE(read, OMPReadClause)
__OMP_CLAUSE(write, OMPWriteClause)
__OMP_CLAUSE(update, OMPUpdateClause)
__OMP_CLAUSE(capture, OMPCaptureClause)
__OMP_CLAUSE(seq_cst, OMPSeqCstClause)
__OMP_CLAUSE(acq_rel, OMPAcqRelClause)
__OMP_CLAUSE(acquire, OMPAcquireClause)
__OMP_CLAUSE(release, OMPReleaseClause)
__OMP_CLAUSE(relaxed, OMPRelaxedClause)
__OMP_CLAUSE(depend, OMPDependClause)
__OMP_CLAUSE(device, OMPDeviceClause)
__OMP_CLAUSE(threads, OMPThreadsClause)
__OMP_CLAUSE(simd, OMPSIMDClause)
__OMP_CLAUSE(map, OMPMapClause)
__OMP_CLAUSE(num_teams, OMPNumTeamsClause)
__OMP_CLAUSE(thread_limit, OMPThreadLimitClause)
__OMP_CLAUSE(priority, OMPPriorityClause)
__OMP_CLAUSE(grainsize, OMPGrainsizeClause)
__OMP_CLAUSE(nogroup, OMPNogroupClause)
__OMP_CLAUSE(num_tasks, OMPNumTasksClause)
__OMP_CLAUSE(hint, OMPHintClause)
__OMP_CLAUSE(dist_schedule, OMPDistScheduleClause)
__OMP_CLAUSE(defaultmap, OMPDefaultmapClause)
__OMP_CLAUSE(to, OMPToClause)
__OMP_CLAUSE(from, OMPFromClause)
__OMP_CLAUSE(use_device_ptr, OMPUseDevicePtrClause)
__OMP_CLAUSE(is_device_ptr, OMPIsDevicePtrClause)
__OMP_CLAUSE(task_reduction, OMPTaskReductionClause)
__OMP_CLAUSE(in_reduction, OMPInReductionClause)
__OMP_CLAUSE(unified_address, OMPUnifiedAddressClause)
__OMP_CLAUSE(unified_shared_memory, OMPUnifiedSharedMemoryClause)
__OMP_CLAUSE(reverse_offload, OMPReverseOffloadClause)
__OMP_CLAUSE(dynamic_allocators, OMPDynamicAllocatorsClause)
__OMP_CLAUSE(atomic_default_mem_order, OMPAtomicDefaultMemOrderClause)
__OMP_CLAUSE(allocate, OMPAllocateClause)
__OMP_CLAUSE(nontemporal, OMPNontemporalClause)
__OMP_CLAUSE(order, OMPOrderClause)
__OMP_CLAUSE(destroy, OMPDestroyClause)
__OMP_CLAUSE(detach, OMPDetachClause)
__OMP_CLAUSE(inclusive, OMPInclusiveClause)
__OMP_CLAUSE(exclusive, OMPExclusiveClause)
__OMP_CLAUSE_NO_CLASS(uniform)
__OMP_CLAUSE_NO_CLASS(device_type)
__OMP_CLAUSE_NO_CLASS(match)
__OMP_IMPLICIT_CLAUSE_CLASS(depobj, "depobj", OMPDepobjClause)
__OMP_IMPLICIT_CLAUSE_CLASS(flush, "flush", OMPFlushClause)
__OMP_IMPLICIT_CLAUSE_NO_CLASS(threadprivate, "threadprivate or thread local")
__OMP_IMPLICIT_CLAUSE_NO_CLASS(unknown, "unknown")
#undef __OMP_IMPLICIT_CLAUSE_NO_CLASS
#undef __OMP_IMPLICIT_CLAUSE_CLASS
#undef __OMP_CLAUSE
#undef OMP_CLAUSE_NO_CLASS
#undef OMP_CLAUSE_CLASS
#undef OMP_CLAUSE
///}
/// Types used in runtime structs or runtime functions
///
///{
#ifndef OMP_TYPE
#define OMP_TYPE(VarName, InitValue)
#endif
#define __OMP_TYPE(VarName) OMP_TYPE(VarName, Type::get##VarName##Ty(Ctx))
__OMP_TYPE(Void)
__OMP_TYPE(Int8)
__OMP_TYPE(Int32)
__OMP_TYPE(Int8Ptr)
__OMP_TYPE(Int32Ptr)
#undef __OMP_TYPE
#undef OMP_TYPE
///}
/// array types
///
///{
#ifndef OMP_ARRAY_TYPE
#define OMP_ARRAY_TYPE(VarName, ElemTy, ArraySize)
#endif
#define __OMP_ARRAY_TYPE(VarName, ElemTy, ArraySize) \
OMP_ARRAY_TYPE(VarName, ElemTy, ArraySize)
__OMP_ARRAY_TYPE(KmpCriticalName, Int32, 8)
#undef __OMP_ARRAY_TYPE
#undef OMP_ARRAY_TYPE
///}
/// Struct and function types
///
///{
#ifndef OMP_STRUCT_TYPE
#define OMP_STRUCT_TYPE(VarName, StructName, ...)
#endif
#define __OMP_STRUCT_TYPE(VarName, Name, ...) \
OMP_STRUCT_TYPE(VarName, "struct." #Name, __VA_ARGS__)
__OMP_STRUCT_TYPE(Ident, ident_t, Int32, Int32, Int32, Int32, Int8Ptr)
#undef __OMP_STRUCT_TYPE
#undef OMP_STRUCT_TYPE
#ifndef OMP_FUNCTION_TYPE
#define OMP_FUNCTION_TYPE(VarName, IsVarArg, ReturnType, ...)
#endif
#define __OMP_FUNCTION_TYPE(VarName, IsVarArg, ReturnType, ...) \
OMP_FUNCTION_TYPE(VarName, IsVarArg, ReturnType, __VA_ARGS__)
__OMP_FUNCTION_TYPE(ParallelTask, true, Void, Int32Ptr, Int32Ptr)
#undef __OMP_FUNCTION_TYPE
#undef OMP_FUNCTION_TYPE
///}
/// Runtime library function (and their attributes)
///
///{
#ifndef OMP_RTL
#define OMP_RTL(Enum, Str, IsVarArg, ReturnType, ...)
#endif
#define __OMP_RTL(Name, IsVarArg, ReturnType, ...) \
OMP_RTL(OMPRTL_##Name, #Name, IsVarArg, ReturnType, __VA_ARGS__)
__OMP_RTL(__kmpc_barrier, false, Void, IdentPtr, Int32)
__OMP_RTL(__kmpc_cancel, false, Int32, IdentPtr, Int32, Int32)
__OMP_RTL(__kmpc_cancel_barrier, false, Int32, IdentPtr, Int32)
__OMP_RTL(__kmpc_flush, false, Void, IdentPtr)
__OMP_RTL(__kmpc_global_thread_num, false, Int32, IdentPtr)
__OMP_RTL(__kmpc_fork_call, true, Void, IdentPtr, Int32, ParallelTaskPtr)
__OMP_RTL(__kmpc_omp_taskwait, false, Int32, IdentPtr, Int32)
__OMP_RTL(__kmpc_omp_taskyield, false, Int32, IdentPtr, Int32, Int32)
__OMP_RTL(__kmpc_push_num_threads, false, Void, IdentPtr, Int32,
/* Int */ Int32)
__OMP_RTL(__kmpc_push_proc_bind, false, Void, IdentPtr, Int32, /* Int */ Int32)
__OMP_RTL(__kmpc_serialized_parallel, false, Void, IdentPtr, Int32)
__OMP_RTL(__kmpc_end_serialized_parallel, false, Void, IdentPtr, Int32)
__OMP_RTL(omp_get_thread_num, false, Int32, )
__OMP_RTL(omp_get_num_threads, false, Int32, )
__OMP_RTL(omp_get_max_threads, false, Int32, )
__OMP_RTL(omp_in_parallel, false, Int32, )
__OMP_RTL(omp_get_dynamic, false, Int32, )
__OMP_RTL(omp_get_cancellation, false, Int32, )
__OMP_RTL(omp_get_nested, false, Int32, )
__OMP_RTL(omp_get_schedule, false, Void, Int32Ptr, Int32Ptr)
__OMP_RTL(omp_get_thread_limit, false, Int32, )
__OMP_RTL(omp_get_supported_active_levels, false, Int32, )
__OMP_RTL(omp_get_max_active_levels, false, Int32, )
__OMP_RTL(omp_get_level, false, Int32, )
__OMP_RTL(omp_get_ancestor_thread_num, false, Int32, Int32)
__OMP_RTL(omp_get_team_size, false, Int32, Int32)
__OMP_RTL(omp_get_active_level, false, Int32, )
__OMP_RTL(omp_in_final, false, Int32, )
__OMP_RTL(omp_get_proc_bind, false, Int32, )
__OMP_RTL(omp_get_num_places, false, Int32, )
__OMP_RTL(omp_get_num_procs, false, Int32, )
__OMP_RTL(omp_get_place_proc_ids, false, Void, Int32, Int32Ptr)
__OMP_RTL(omp_get_place_num, false, Int32, )
__OMP_RTL(omp_get_partition_num_places, false, Int32, )
__OMP_RTL(omp_get_partition_place_nums, false, Void, Int32Ptr)
__OMP_RTL(omp_set_num_threads, false, Void, Int32)
__OMP_RTL(omp_set_dynamic, false, Void, Int32)
__OMP_RTL(omp_set_nested, false, Void, Int32)
__OMP_RTL(omp_set_schedule, false, Void, Int32, Int32)
__OMP_RTL(omp_set_max_active_levels, false, Void, Int32)
__OMP_RTL(__kmpc_master, false, Int32, IdentPtr, Int32)
__OMP_RTL(__kmpc_end_master, false, Void, IdentPtr, Int32)
__OMP_RTL(__kmpc_critical, false, Void, IdentPtr, Int32, KmpCriticalNamePtrTy)
__OMP_RTL(__kmpc_critical_with_hint, false, Void, IdentPtr, Int32,
KmpCriticalNamePtrTy, Int32)
__OMP_RTL(__kmpc_end_critical, false, Void, IdentPtr, Int32,
KmpCriticalNamePtrTy)
__OMP_RTL(__last, false, Void, )
#undef __OMP_RTL
#undef OMP_RTL
#define EnumAttr(Kind) Attribute::get(Ctx, Attribute::AttrKind::Kind)
#define AttributeSet(...) \
AttributeSet::get(Ctx, ArrayRef<Attribute>({__VA_ARGS__}))
#ifndef OMP_ATTRS_SET
#define OMP_ATTRS_SET(VarName, AttrSet)
#endif
#define __OMP_ATTRS_SET(VarName, AttrSet) OMP_ATTRS_SET(VarName, AttrSet)
__OMP_ATTRS_SET(GetterAttrs,
OptimisticAttributes
? AttributeSet(EnumAttr(NoUnwind), EnumAttr(ReadOnly),
EnumAttr(NoSync), EnumAttr(NoFree), EnumAttr(InaccessibleMemOnly))
: AttributeSet(EnumAttr(NoUnwind)))
__OMP_ATTRS_SET(GetterArgWriteAttrs,
OptimisticAttributes
? AttributeSet(EnumAttr(NoUnwind), EnumAttr(NoSync),
EnumAttr(NoFree), EnumAttr(InaccessibleMemOrArgMemOnly))
: AttributeSet(EnumAttr(NoUnwind)))
__OMP_ATTRS_SET(SetterAttrs,
OptimisticAttributes
? AttributeSet(EnumAttr(NoUnwind), EnumAttr(WriteOnly),
EnumAttr(NoSync), EnumAttr(NoFree), EnumAttr(InaccessibleMemOnly))
: AttributeSet(EnumAttr(NoUnwind)))
#undef __OMP_ATTRS_SET
#undef OMP_ATTRS_SET
#ifndef OMP_RTL_ATTRS
#define OMP_RTL_ATTRS(Enum, FnAttrSet, RetAttrSet, ArgAttrSets)
#endif
#define __OMP_RTL_ATTRS(Name, FnAttrSet, RetAttrSet, ArgAttrSets) \
OMP_RTL_ATTRS(OMPRTL_##Name, FnAttrSet, RetAttrSet, ArgAttrSets)
__OMP_RTL_ATTRS(__kmpc_barrier,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_cancel,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_cancel_barrier,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_flush,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_global_thread_num, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_fork_call, AttributeSet(EnumAttr(NoUnwind)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_omp_taskwait,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_omp_taskyield,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_push_num_threads,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_push_proc_bind,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_serialized_parallel,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_end_serialized_parallel,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_thread_num, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_num_threads, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_max_threads, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_in_parallel, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_dynamic, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_cancellation, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_nested, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_schedule, GetterArgWriteAttrs, AttributeSet(),
ArrayRef<AttributeSet>(
{AttributeSet(EnumAttr(NoCapture), EnumAttr(WriteOnly)),
AttributeSet(EnumAttr(NoCapture), EnumAttr(WriteOnly))}))
__OMP_RTL_ATTRS(omp_get_thread_limit, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_supported_active_levels, GetterAttrs, AttributeSet(),
{})
__OMP_RTL_ATTRS(omp_get_max_active_levels, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_level, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_ancestor_thread_num, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_team_size, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_active_level, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_in_final, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_proc_bind, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_num_places, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_num_procs, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_place_proc_ids, GetterArgWriteAttrs, AttributeSet(),
ArrayRef<AttributeSet>({AttributeSet(),
AttributeSet(EnumAttr(NoCapture),
EnumAttr(WriteOnly))}))
__OMP_RTL_ATTRS(omp_get_place_num, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_partition_num_places, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_get_partition_place_nums, GetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_set_num_threads, SetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_set_dynamic, SetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_set_nested, SetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_set_schedule, SetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(omp_set_max_active_levels, SetterAttrs, AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_master,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_end_master,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_critical,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_critical_with_hint,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
__OMP_RTL_ATTRS(__kmpc_end_critical,
AttributeSet(EnumAttr(InaccessibleMemOrArgMemOnly)),
AttributeSet(), {})
#undef __OMP_RTL_ATTRS
#undef OMP_RTL_ATTRS
#undef AttributeSet
#undef EnumAttr
///}
/// KMP ident_t bit flags
///
/// In accordance with the values in `openmp/runtime/src/kmp.h`.
///
///{
#ifndef OMP_IDENT_FLAG
#define OMP_IDENT_FLAG(Enum, Str, Value)
#endif
#define __OMP_IDENT_FLAG(Name, Value) \
OMP_IDENT_FLAG(OMP_IDENT_FLAG_##Name, #Name, Value)
__OMP_IDENT_FLAG(KMPC, 0x02)
__OMP_IDENT_FLAG(BARRIER_EXPL, 0x20)
__OMP_IDENT_FLAG(BARRIER_IMPL, 0x0040)
__OMP_IDENT_FLAG(BARRIER_IMPL_MASK, 0x01C0)
__OMP_IDENT_FLAG(BARRIER_IMPL_FOR, 0x0040)
__OMP_IDENT_FLAG(BARRIER_IMPL_SECTIONS, 0x00C0)
__OMP_IDENT_FLAG(BARRIER_IMPL_SINGLE, 0x0140)
__OMP_IDENT_FLAG(BARRIER_IMPL_WORKSHARE, 0x01C0)
#undef __OMP_IDENT_FLAG
#undef OMP_IDENT_FLAG
///}
/// KMP cancel kind
///
///{
#ifndef OMP_CANCEL_KIND
#define OMP_CANCEL_KIND(Enum, Str, DirectiveEnum, Value)
#endif
#define __OMP_CANCEL_KIND(Name, Value) \
OMP_CANCEL_KIND(OMP_CANCEL_KIND_##Name, #Name, OMPD_##Name, Value)
__OMP_CANCEL_KIND(parallel, 1)
__OMP_CANCEL_KIND(for, 2)
__OMP_CANCEL_KIND(sections, 3)
__OMP_CANCEL_KIND(taskgroup, 4)
#undef __OMP_CANCEL_KIND
#undef OMP_CANCEL_KIND
///}
/// Default kinds
///
///{
#ifndef OMP_DEFAULT_KIND
#define OMP_DEFAULT_KIND(Enum, Str)
#endif
#define __OMP_DEFAULT_KIND(Name) OMP_DEFAULT_KIND(OMP_DEFAULT_##Name, #Name)
__OMP_DEFAULT_KIND(none)
__OMP_DEFAULT_KIND(shared)
__OMP_DEFAULT_KIND(unknown)
#undef __OMP_DEFAULT_KIND
#undef OMP_DEFAULT_KIND
///}
/// Proc bind kinds
///
///{
#ifndef OMP_PROC_BIND_KIND
#define OMP_PROC_BIND_KIND(Enum, Str, Value)
#endif
#define __OMP_PROC_BIND_KIND(Name, Value) \
OMP_PROC_BIND_KIND(OMP_PROC_BIND_##Name, #Name, Value)
__OMP_PROC_BIND_KIND(master, 2)
__OMP_PROC_BIND_KIND(close, 3)
__OMP_PROC_BIND_KIND(spread, 4)
__OMP_PROC_BIND_KIND(default, 6)
__OMP_PROC_BIND_KIND(unknown, 7)
#undef __OMP_PROC_BIND_KIND
#undef OMP_PROC_BIND_KIND
///}
/// OpenMP context related definitions:
/// - trait set selector
/// - trait selector
/// - trait property
///
///{
#ifndef OMP_TRAIT_SET
#define OMP_TRAIT_SET(Enum, Str)
#endif
#ifndef OMP_TRAIT_SELECTOR
#define OMP_TRAIT_SELECTOR(Enum, TraitSetEnum, Str, RequiresProperty)
#endif
#ifndef OMP_TRAIT_PROPERTY
#define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str)
#endif
#ifndef OMP_LAST_TRAIT_PROPERTY
#define OMP_LAST_TRAIT_PROPERTY(Enum)
#endif
#define __OMP_TRAIT_SET(Name) OMP_TRAIT_SET(Name, #Name)
#define __OMP_TRAIT_SELECTOR(TraitSet, Name, RequiresProperty) \
OMP_TRAIT_SELECTOR(TraitSet##_##Name, TraitSet, #Name, RequiresProperty)
#define __OMP_TRAIT_SELECTOR_AND_PROPERTY(TraitSet, Name) \
OMP_TRAIT_SELECTOR(TraitSet##_##Name, TraitSet, #Name, false) \
OMP_TRAIT_PROPERTY(TraitSet##_##Name##_##Name, TraitSet, TraitSet##_##Name, \
#Name)
#define __OMP_TRAIT_PROPERTY(TraitSet, TraitSelector, Name) \
OMP_TRAIT_PROPERTY(TraitSet##_##TraitSelector##_##Name, TraitSet, \
TraitSet##_##TraitSelector, #Name)
// "invalid" must go first.
OMP_TRAIT_SET(invalid, "invalid")
OMP_TRAIT_SELECTOR(invalid, invalid, "invalid", false)
OMP_TRAIT_PROPERTY(invalid, invalid, invalid, "invalid")
__OMP_TRAIT_SET(construct)
__OMP_TRAIT_SELECTOR_AND_PROPERTY(construct, target)
__OMP_TRAIT_SELECTOR_AND_PROPERTY(construct, teams)
__OMP_TRAIT_SELECTOR_AND_PROPERTY(construct, parallel)
__OMP_TRAIT_SELECTOR_AND_PROPERTY(construct, for)
__OMP_TRAIT_SELECTOR_AND_PROPERTY(construct, simd)
__OMP_TRAIT_SET(device)
__OMP_TRAIT_SELECTOR(device, kind, true)
__OMP_TRAIT_PROPERTY(device, kind, host)
__OMP_TRAIT_PROPERTY(device, kind, nohost)
__OMP_TRAIT_PROPERTY(device, kind, cpu)
__OMP_TRAIT_PROPERTY(device, kind, gpu)
__OMP_TRAIT_PROPERTY(device, kind, fpga)
__OMP_TRAIT_PROPERTY(device, kind, any)
__OMP_TRAIT_SELECTOR(device, isa, true)
// TODO: What do we want for ISA?
__OMP_TRAIT_SELECTOR(device, arch, true)
__OMP_TRAIT_PROPERTY(device, arch, arm)
__OMP_TRAIT_PROPERTY(device, arch, armeb)
__OMP_TRAIT_PROPERTY(device, arch, aarch64)
__OMP_TRAIT_PROPERTY(device, arch, aarch64_be)
__OMP_TRAIT_PROPERTY(device, arch, aarch64_32)
__OMP_TRAIT_PROPERTY(device, arch, ppc)
__OMP_TRAIT_PROPERTY(device, arch, ppc64)
__OMP_TRAIT_PROPERTY(device, arch, ppc64le)
__OMP_TRAIT_PROPERTY(device, arch, x86)
__OMP_TRAIT_PROPERTY(device, arch, x86_64)
__OMP_TRAIT_PROPERTY(device, arch, amdgcn)
__OMP_TRAIT_PROPERTY(device, arch, nvptx)
__OMP_TRAIT_PROPERTY(device, arch, nvptx64)
__OMP_TRAIT_SET(implementation)
__OMP_TRAIT_SELECTOR(implementation, vendor, true)
__OMP_TRAIT_PROPERTY(implementation, vendor, amd)
__OMP_TRAIT_PROPERTY(implementation, vendor, arm)
__OMP_TRAIT_PROPERTY(implementation, vendor, bsc)
__OMP_TRAIT_PROPERTY(implementation, vendor, cray)
__OMP_TRAIT_PROPERTY(implementation, vendor, fujitsu)
__OMP_TRAIT_PROPERTY(implementation, vendor, gnu)
__OMP_TRAIT_PROPERTY(implementation, vendor, ibm)
__OMP_TRAIT_PROPERTY(implementation, vendor, intel)
__OMP_TRAIT_PROPERTY(implementation, vendor, llvm)
__OMP_TRAIT_PROPERTY(implementation, vendor, pgi)
__OMP_TRAIT_PROPERTY(implementation, vendor, ti)
__OMP_TRAIT_PROPERTY(implementation, vendor, unknown)
__OMP_TRAIT_SELECTOR(implementation, extension, true)
__OMP_TRAIT_SET(user)
__OMP_TRAIT_SELECTOR(user, condition, true)
__OMP_TRAIT_PROPERTY(user, condition, true)
__OMP_TRAIT_PROPERTY(user, condition, false)
__OMP_TRAIT_PROPERTY(user, condition, unknown)
#undef OMP_TRAIT_SET
#undef __OMP_TRAIT_SET
///}
/// Traits for the requires directive
///
/// These will (potentially) become trait selectors for the OpenMP context if
/// the OMP_REQUIRES_TRAIT macro is not defined.
///
///{
#ifdef OMP_REQUIRES_TRAIT
#define __OMP_REQUIRES_TRAIT(Name) \
OMP_REQUIRES_TRAIT(OMP_REQUIRES_TRAIT_##Name, #Name)
#else
#define __OMP_REQUIRES_TRAIT(Name) \
__OMP_TRAIT_SELECTOR_AND_PROPERTY(implementation, Name)
#endif
__OMP_REQUIRES_TRAIT(unified_address)
__OMP_REQUIRES_TRAIT(unified_shared_memory)
__OMP_REQUIRES_TRAIT(reverse_offload)
__OMP_REQUIRES_TRAIT(dynamic_allocators)
__OMP_REQUIRES_TRAIT(atomic_default_mem_order)
OMP_LAST_TRAIT_PROPERTY(
implementation_atomic_default_mem_order_atomic_default_mem_order)
#undef __OMP_TRAIT_SELECTOR_AND_PROPERTY
#undef OMP_TRAIT_SELECTOR
#undef __OMP_TRAIT_SELECTOR
#undef OMP_TRAIT_PROPERTY
#undef OMP_LAST_TRAIT_PROPERTY
#undef __OMP_TRAIT_PROPERTY
#undef __OMP_REQUIRES_TRAIT
#undef OMP_REQUIRES_TRAIT
///}