diff --git a/include/llvm/Frontend/OpenMP/OMPConstants.h b/include/llvm/Frontend/OpenMP/OMPConstants.h index f612fb3cd94..3ad13ddc513 100644 --- a/include/llvm/Frontend/OpenMP/OMPConstants.h +++ b/include/llvm/Frontend/OpenMP/OMPConstants.h @@ -41,12 +41,12 @@ enum class InternalControlVar { #include "llvm/Frontend/OpenMP/OMPKinds.def" enum class ICVInitValue { -#define ICV_DATA_ENV(Enum, Name, EnvVar, Init) Init, +#define ICV_INIT_VALUE(Enum, Name) Enum, #include "llvm/Frontend/OpenMP/OMPKinds.def" }; -#define ICV_DATA_ENV(Enum, Name, EnvVar, Init) \ - constexpr auto Init = omp::ICVInitValue::Init; +#define ICV_INIT_VALUE(Enum, Name) \ + constexpr auto Enum = omp::ICVInitValue::Enum; #include "llvm/Frontend/OpenMP/OMPKinds.def" /// IDs for all omp runtime library (RTL) functions. diff --git a/include/llvm/Frontend/OpenMP/OMPKinds.def b/include/llvm/Frontend/OpenMP/OMPKinds.def index f74f036c311..e93f836ea3f 100644 --- a/include/llvm/Frontend/OpenMP/OMPKinds.def +++ b/include/llvm/Frontend/OpenMP/OMPKinds.def @@ -230,6 +230,20 @@ __OMP_FUNCTION_TYPE(TaskRoutineEntry, false, Int32, Int32, /// ///{ +#ifndef ICV_INIT_VALUE +#define ICV_INIT_VALUE(Enum, Name) +#endif + +#define __ICV_INIT_VALUE(Name) ICV_INIT_VALUE(ICV_##Name, #Name) + +__ICV_INIT_VALUE(ZERO) +__ICV_INIT_VALUE(FALSE) +__ICV_INIT_VALUE(IMPLEMENTATION_DEFINED) +__ICV_INIT_VALUE(LAST) + +#undef __ICV_INIT_VALUE +#undef ICV_INIT_VALUE + #ifndef ICV_DATA_ENV #define ICV_DATA_ENV(Enum, Name, EnvVarName, Init) #endif @@ -240,6 +254,7 @@ __OMP_FUNCTION_TYPE(TaskRoutineEntry, false, Int32, Int32, __ICV_DATA_ENV(nthreads, OMP_NUM_THREADS, ICV_IMPLEMENTATION_DEFINED) __ICV_DATA_ENV(active_levels, NONE, ICV_ZERO) __ICV_DATA_ENV(cancel, OMP_CANCELLATION, ICV_FALSE) +__ICV_DATA_ENV(proc_bind, OMP_PROC_BIND, ICV_IMPLEMENTATION_DEFINED) __ICV_DATA_ENV(__last, last, ICV_LAST) #undef __ICV_DATA_ENV @@ -265,6 +280,7 @@ __ICV_RT_SET(nthreads, omp_set_num_threads) __ICV_RT_GET(nthreads, omp_get_max_threads) __ICV_RT_GET(active_levels, omp_get_active_level) __ICV_RT_GET(cancel, omp_get_cancellation) +__ICV_RT_GET(proc_bind, omp_get_proc_bind) #undef __ICV_RT_GET #undef ICV_RT_GET diff --git a/lib/Transforms/IPO/OpenMPOpt.cpp b/lib/Transforms/IPO/OpenMPOpt.cpp index 66928ebe8c9..d372f108e3d 100644 --- a/lib/Transforms/IPO/OpenMPOpt.cpp +++ b/lib/Transforms/IPO/OpenMPOpt.cpp @@ -518,7 +518,8 @@ struct OpenMPOpt { /// Print initial ICV values for testing. /// FIXME: This should be done from the Attributor once it is added. void printICVs() const { - InternalControlVar ICVs[] = {ICV_nthreads, ICV_active_levels, ICV_cancel}; + InternalControlVar ICVs[] = {ICV_nthreads, ICV_active_levels, ICV_cancel, + ICV_proc_bind}; for (Function *F : OMPInfoCache.ModuleSlice) { for (auto ICV : ICVs) {