diff --git a/include/llvm/Frontend/OpenMP/OMPConstants.h b/include/llvm/Frontend/OpenMP/OMPConstants.h index d32fa8dc98e..7cda3197473 100644 --- a/include/llvm/Frontend/OpenMP/OMPConstants.h +++ b/include/llvm/Frontend/OpenMP/OMPConstants.h @@ -34,18 +34,11 @@ enum class Directive { #include "llvm/Frontend/OpenMP/OMPKinds.def" }; -/// IDs for all OpenMP clauses. -enum class Clause { -#define OMP_CLAUSE(Enum, ...) Enum, -#include "llvm/Frontend/OpenMP/OMPKinds.def" -}; - /// Make the enum values available in the llvm::omp namespace. This allows us to /// write something like OMPD_parallel if we have a `using namespace omp`. At /// the same time we do not loose the strong type guarantees of the enum class, /// that is we cannot pass an unsigned as Directive without an explicit cast. #define OMP_DIRECTIVE(Enum, ...) constexpr auto Enum = omp::Directive::Enum; -#define OMP_CLAUSE(Enum, ...) constexpr auto Enum = omp::Clause::Enum; #include "llvm/Frontend/OpenMP/OMPKinds.def" /// IDs for all omp runtime library (RTL) functions. @@ -94,12 +87,6 @@ Directive getOpenMPDirectiveKind(StringRef Str); /// Return a textual representation of the directive \p D. StringRef getOpenMPDirectiveName(Directive D); -/// Parse \p Str and return the clause it matches or OMPC_unknown if none. -Clause getOpenMPClauseKind(StringRef Str); - -/// Return a textual representation of the clause \p C. -StringRef getOpenMPClauseName(Clause C); - /// Forward declarations for LLVM-IR types (simple, function and structure) are /// generated below. Their names are defined and used in OpenMP/OMPKinds.def. /// Here we provide the forward declarations, the initializeTypes function will diff --git a/include/llvm/Frontend/OpenMP/OMPKinds.def b/include/llvm/Frontend/OpenMP/OMPKinds.def index 09468358415..c80ecc7cbf7 100644 --- a/include/llvm/Frontend/OpenMP/OMPKinds.def +++ b/include/llvm/Frontend/OpenMP/OMPKinds.def @@ -105,117 +105,6 @@ __OMP_DIRECTIVE(unknown) ///} -/// 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 /// ///{ @@ -343,10 +232,8 @@ __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(__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, ) diff --git a/lib/Frontend/OpenMP/OMPConstants.cpp b/lib/Frontend/OpenMP/OMPConstants.cpp index edd857d7b25..6ee44958d1c 100644 --- a/lib/Frontend/OpenMP/OMPConstants.cpp +++ b/lib/Frontend/OpenMP/OMPConstants.cpp @@ -36,24 +36,6 @@ StringRef llvm::omp::getOpenMPDirectiveName(Directive Kind) { llvm_unreachable("Invalid OpenMP directive kind"); } -Clause llvm::omp::getOpenMPClauseKind(StringRef Str) { - return llvm::StringSwitch(Str) -#define OMP_CLAUSE(Enum, Str, Implicit) \ - .Case(Str, Implicit ? OMPC_unknown : Enum) -#include "llvm/Frontend/OpenMP/OMPKinds.def" - .Default(OMPC_unknown); -} - -StringRef llvm::omp::getOpenMPClauseName(Clause C) { - switch (C) { -#define OMP_CLAUSE(Enum, Str, ...) \ - case Enum: \ - return Str; -#include "llvm/Frontend/OpenMP/OMPKinds.def" - } - llvm_unreachable("Invalid OpenMP clause kind"); -} - /// Declarations for LLVM-IR types (simple, array, function and structure) are /// generated below. Their names are defined and used in OpenMPKinds.def. Here /// we provide the declarations, the initializeTypes function will provide the