Re: [PATCH 2/5, OpenACC] Support Fortran optional arguments in the firstprivate clause

2019-10-07 Thread Kwok Cheung Yeung
On 07/10/2019 10:25 am, Thomas Schwinge wrote: Hi Kwok, Tobias! On 2019-07-29T21:55:52+0100, Kwok Cheung Yeung wrote: > if (omp_is_reference (new_var) > && TREE_CODE (TREE_TYPE (new_var)) != POINTER_TYPE) As is, this code in lower_omp_target will always rejec

Re: [PATCH 2/5, OpenACC] Support Fortran optional arguments in the firstprivate clause

2019-10-07 Thread Thomas Schwinge
Hi Kwok, Tobias! On 2019-07-29T21:55:52+0100, Kwok Cheung Yeung wrote: > >if (omp_is_reference (new_var) > >&& TREE_CODE (TREE_TYPE (new_var)) != POINTER_TYPE) > > As is, this code in lower_omp_target will always reject optional arguments, > so > it must be changed

Re: [PATCH 2/5, OpenACC] Support Fortran optional arguments in the firstprivate clause

2019-07-31 Thread Jakub Jelinek
On Mon, Jul 29, 2019 at 09:55:52PM +0100, Kwok Cheung Yeung wrote: > +/* True if OpenMP should treat this DECL as an optional argument. */ > + > +bool > +gfc_omp_is_optional_argument (const_tree decl) > +{ > + return DECL_LANG_SPECIFIC (decl) > + && GFC_DECL_OPTIONAL_ARGUMENT (decl); I thin

Re: [PATCH 2/5, OpenACC] Support Fortran optional arguments in the firstprivate clause

2019-07-29 Thread Kwok Cheung Yeung
On 12/07/2019 12:41 pm, Jakub Jelinek wrote: +/* Return true if DECL is a Fortran optional argument. */ + +bool +omp_is_optional_argument (tree decl) +{ + /* A passed-by-reference Fortran optional argument is similar to + a normal argument, but since it can be null the type is a + POINT

Re: [PATCH 2/5, OpenACC] Support Fortran optional arguments in the firstprivate clause

2019-07-18 Thread Kwok Cheung Yeung
On 18/07/2019 10:28 am, Tobias Burnus wrote: Hi all, I played around and came up with another second way one gets a single "*" without 'optional'. I haven't checked whether which of those match the proposed omp_is_optional_argument's +&& DECL_BY_REFERENCE (decl) +&& TREE_CODE

Re: [PATCH 2/5, OpenACC] Support Fortran optional arguments in the firstprivate clause

2019-07-18 Thread Tobias Burnus
Hi all, I played around and came up with another second way one gets a single "*" without 'optional'. I haven't checked whether which of those match the proposed omp_is_optional_argument's +&& DECL_BY_REFERENCE (decl) +&& TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE; nor whether

Re: [PATCH 2/5, OpenACC] Support Fortran optional arguments in the firstprivate clause

2019-07-17 Thread Tobias Burnus
Am 17.07.19 um 19:53 schrieb Kwok Cheung Yeung: > On 12/07/2019 12:41 pm, Jakub Jelinek wrote: >> This should be done through a langhook. >> Are really all PARM_DECLs wtih DECL_BY_REFERENCE and pointer type >> optional >> arguments?  I mean, POINTER_TYPE is used for a lot of cases. > > Hmmm... I th

Re: [PATCH 2/5, OpenACC] Support Fortran optional arguments in the firstprivate clause

2019-07-17 Thread Kwok Cheung Yeung
On 12/07/2019 12:41 pm, Jakub Jelinek wrote: This should be done through a langhook. Are really all PARM_DECLs wtih DECL_BY_REFERENCE and pointer type optional arguments? I mean, POINTER_TYPE is used for a lot of cases. Hmmm... I thought it was the case that if you pass an argument in by refer

Re: [PATCH 2/5, OpenACC] Support Fortran optional arguments in the firstprivate clause

2019-07-12 Thread Jakub Jelinek
On Fri, Jul 12, 2019 at 12:36:13PM +0100, Kwok Cheung Yeung wrote: > --- a/gcc/omp-general.c > +++ b/gcc/omp-general.c > @@ -48,6 +48,20 @@ omp_find_clause (tree clauses, enum omp_clause_code kind) >return NULL_TREE; > } > > +/* Return true if DECL is a Fortran optional argument. */ > + > +b

[PATCH 2/5, OpenACC] Support Fortran optional arguments in the firstprivate clause

2019-07-12 Thread Kwok Cheung Yeung
Reference types used by Fortran often need to be treated specially in the OACC lowering to deal with the referenced object as well as the reference itself. However, as optional arguments can be null, they are pointer types rather than reference types, so the code to detect these situations need