On Wed, Jun 03, 2020 at 11:03:50AM +0200, Tobias Burnus wrote:
> @@ -2123,6 +2124,27 @@ c_omp_predetermined_sharing (tree decl)
> return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
> }
>
> +/* OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED unless OpenMP mapping attribute
> + of DECL is predetermined. */
> +
> +enum omp_clause_defaultmap_kind
> +c_omp_predetermined_mapping (tree decl)
> +{
> + /* Predetermine artificial variables holding integral values, those
> + are usually result of gimplify_one_sizepos or SAVE_EXPR
> + gimplification. */
> + if (VAR_P (decl)
> + && DECL_ARTIFICIAL (decl)
> + && INTEGRAL_TYPE_P (TREE_TYPE (decl)))
> + return OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE;
> +
> + if (c_omp_predefined_variable (decl))
> + return OMP_CLAUSE_DEFAULTMAP_TO;
> +
> + return OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED;
> +}
...
> @@ -2321,6 +2322,22 @@ cxx_omp_predetermined_sharing (tree decl)
> return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
> }
>
> +enum omp_clause_defaultmap_kind
> +cxx_omp_predetermined_mapping (tree decl)
> +{
> + /* Predetermine artificial variables holding integral values, those
> + are usually result of gimplify_one_sizepos or SAVE_EXPR
> + gimplification. */
> + if (VAR_P (decl)
> + && DECL_ARTIFICIAL (decl)
> + && INTEGRAL_TYPE_P (TREE_TYPE (decl))
> + && !(DECL_LANG_SPECIFIC (decl)
> + && DECL_OMP_PRIVATIZED_MEMBER (decl)))
> + return OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE;
I'd prefer consistency between C and C++, so I'd add
+ if (c_omp_predefined_variable (decl))
+ return OMP_CLAUSE_DEFAULTMAP_TO;
here too for now (and I'll create a new spec issue for __FUNCTION__ etc.
mapping because the old one happened to be closed without actually solving
what is needed).
> +
> + return OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED;
> +}
Ok with that change. Thanks.
Jakub