This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: OpenACC declare directive updates
- From: Jakub Jelinek <jakub at redhat dot com>
- To: James Norris <jnorris at codesourcery dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 6 Nov 2015 20:31:27 +0100
- Subject: Re: OpenACC declare directive updates
- Authentication-results: sourceware.org; auth=none
- References: <5637692F dot 7050306 at codesourcery dot com> <5639FAC0 dot 2090104 at codesourcery dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Nov 04, 2015 at 06:32:00AM -0600, James Norris wrote:
> +/* Node in the linked list used for storing !$oacc declare constructs. */
> +
> +typedef struct gfc_oacc_declare
> +{
> + struct gfc_oacc_declare *next;
> + bool module_var;
> + gfc_omp_clauses *clauses;
> + gfc_omp_clauses *return_clauses;
> +}
> +gfc_oacc_declare;
> +
> +#define gfc_get_oacc_declare() XCNEW (gfc_oacc_declare)
> +
> +
> /* Node in the linked list used for storing !$omp declare simd constructs. */
>
> typedef struct gfc_omp_declare_simd
> @@ -1644,7 +1668,7 @@ typedef struct gfc_namespace
> struct gfc_data *data, *old_data;
>
> /* !$ACC DECLARE clauses. */
> - gfc_omp_clauses *oacc_declare_clauses;
> + struct gfc_oacc_declare *oacc_declare_clauses;
This should be renamed now that it doesn't hold just clauses,
perhaps just oacc_declare? Also, no need to use struct keyword.
> @@ -2857,6 +2957,42 @@ oacc_compatible_clauses (gfc_omp_clauses *clauses, int list,
> return false;
> }
>
> +/* Check if a variable appears in multiple clauses. */
> +
> +static void
> +resolve_omp_duplicate_list (gfc_omp_namelist *clause_list, bool openacc,
> + int list)
> +{
> + gfc_omp_namelist *n;
> + const char *error_msg = "Symbol %qs present on multiple clauses at %L";
> +
> + /* OpenACC reduction clauses are compatible with everything. We only
> + need to check if a reduction variable is used more than once. */
> + if (openacc && list == OMP_LIST_REDUCTION)
> + {
> + hash_set<gfc_symbol *> reductions;
> +
> + for (n = clause_list; n; n = n->next)
> + {
> + if (reductions.contains (n->sym))
> + gfc_error (error_msg, n->sym->name, &n->expr->where);
> + else
> + reductions.add (n->sym);
> + }
> +
> + return;
> + }
> +
> + /* Ensure that variables are only used in one clause. */
> + for (n = clause_list; n; n = n->next)
> + {
> + if (n->sym->mark)
> + gfc_error (error_msg, n->sym->name, &n->expr->where);
> + else
> + n->sym->mark = 1;
> + }
> +}
You are readding a function that has been rejected, OMP_LIST_REDUCTION
is handled differently now.
Jakub