This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gomp] Fix sharing-1.c and sharing-1.C


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]