This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/n] OpenMP 4.0 offloading infrastructure: LTO streaming
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ilya Verbin <iverbin at gmail dot com>
- Cc: Richard Biener <rguenther at suse dot de>, Thomas Schwinge <thomas at codesourcery dot com>, Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org, Kirill Yukhin <kirill dot yukhin at gmail dot com>, Ilya Tocar <tocarip at gmail dot com>, Andrey Turetskiy <andrey dot turetskiy at gmail dot com>, Bernd Schmidt <bernds at codesourcery dot com>
- Date: Wed, 5 Nov 2014 13:50:32 +0100
- Subject: Re: [PATCH 2/n] OpenMP 4.0 offloading infrastructure: LTO streaming
- Authentication-results: sourceware.org; auth=none
- References: <20140929173704 dot GA7526 at msticlxl57 dot ims dot intel dot com> <878ul172w5 dot fsf at schwinge dot name> <20141001161332 dot GB54978 at msticlxl57 dot ims dot intel dot com> <alpine dot LSU dot 2 dot 11 dot 1410151612470 dot 20733 at zhemvz dot fhfr dot qr> <20141020111935 dot GA9362 at msticlxl57 dot ims dot intel dot com> <20141024141601 dot GA62562 at msticlxl57 dot ims dot intel dot com> <20141024142028 dot GD10376 at tucnak dot redhat dot com> <20141028193047 dot GA17865 at msticlxl57 dot ims dot intel dot com> <20141103092447 dot GO5026 at tucnak dot redhat dot com> <20141105124655 dot GA42356 at msticlxl57 dot ims dot intel dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Nov 05, 2014 at 03:46:55PM +0300, Ilya Verbin wrote:
> Maybe also with this change?
>
> diff --git a/gcc/omp-low.c b/gcc/omp-low.c
> index 4e9ed25..beae5b5 100644
> --- a/gcc/omp-low.c
> +++ b/gcc/omp-low.c
> @@ -1653,8 +1653,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
> if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
> && DECL_P (decl)
> && is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx))
> - && lookup_attribute ("omp declare target",
> - DECL_ATTRIBUTES (decl)))
> + && varpool_node::get_create (decl)->offloadable)
> break;
> if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
> && OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER)
> @@ -1794,8 +1793,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
> decl = OMP_CLAUSE_DECL (c);
> if (DECL_P (decl)
> && is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx))
> - && lookup_attribute ("omp declare target",
> - DECL_ATTRIBUTES (decl)))
> + && varpool_node::get_create (decl)->offloadable)
> break;
> if (DECL_P (decl))
> {
That looks reasonable (of course if the other patch is committed).
> --- a/gcc/cgraph.c
> +++ b/gcc/cgraph.c
> @@ -70,6 +70,7 @@ along with GCC; see the file COPYING3. If not see
> #include "tree-dfa.h"
> #include "profile.h"
> #include "params.h"
> +#include "context.h"
>
> /* FIXME: Only for PROP_loops, but cgraph shouldn't have to know about this. */
> #include "tree-pass.h"
> @@ -474,6 +475,14 @@ cgraph_node::create (tree decl)
> gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
>
> node->decl = decl;
> +
> + if (flag_openmp
> + && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
> + {
> + node->offloadable = 1;
> + g->have_offload = true;
> + }
> +
> node->register_symbol ();
LGTM.
Jakub