This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp] Fix sharing-1.c and sharing-1.C
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 18 Oct 2005 12:36:56 -0400
- Subject: Re: [gomp] Fix sharing-1.c and sharing-1.C
- References: <20051018161618.GF16034@devserv.devel.redhat.com>
On Tuesday 18 October 2005 12:16, Jakub Jelinek wrote:
> * langhooks.h (struct lang_hooks_for_decls): Add
> omp_predetermined_sharing hook.
> * langhooks.c (lhd_omp_predetermined_sharing): New function.
> * langhooks-def.h (lhd_omp_predetermined_sharing): New prototype.
> (LANG_HOOKS_OMP_PREDETERMINED_SHARING): Define.
> (LANG_HOOKS_DECLS): Add LANG_HOOKS_OMP_PREDETERMINED_SHARING.
> * gimplify.c (omp_notice_variable): Only return immediately
> if a global var is DECL_THREAD_LOCAL_P. Use
> omp_predetermined_sharing langhook.
> (gimplify_reconstruct_omp_clauses_1): Do not add global vars
> into OMP_CLAUSE_SHARED clause.
> * c-common.h (c_omp_predetermined_sharing): New prototype.
> * c-objc-common.h (LANG_HOOKS_OMP_PREDETERMINED_SHARING): Redefine.
> * c-omp.c (c_omp_predetermined_sharing): New function.
> cp/
> * semantics.c (cxx_omp_predetermined_sharing): New function.
> * cp-tree.h (cxx_omp_predetermined_sharing): New prototype.
> * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_SHARING): Redefine.
>
Ah, you beat me to it. This also fixes parts of appendix-a/a.24.1.c.
However, you are adding TREE_READONLY to the shared clauses. This causes
us to emit save/restore code. That's not right. My approach was to just
ignore TREE_READONLY variables, no mark them shared. They are going to be
const-propagated anyway, so adding them to the clauses is useless.
We either should introduce OMP_CLAUSE_DEFAULT_FIRSTPRIVATE or have
omp-low.c emit TREE_READONLY locals with their DECL_INITIALs. The latter
is probably easier.
The rest of the patch looks OK.