[OpenACC] declare directive

Jakub Jelinek jakub@redhat.com
Fri Nov 6 19:23:00 GMT 2015


On Fri, Nov 06, 2015 at 08:03:52PM +0100, Jakub Jelinek wrote:
> What exactly do you want to achieve?  Why do you record it
> in gimplify_omp_ctx, but then only look at it in gimplify_body?
> The way you abuse gimplify_omp_ctx for that is just too ugly.
> All the gimplification code expects that when you enter some OpenMP/OpenACC
> construct, you create new context if it needs one, then process the body
> of the construct, then pop it up.  The declare_returns stuff
> violates all of this.  Do you want to enqueue all the statements
> at the end of the body?  Then just stick it into some gimple_seq
> outside of the gimplify_omp_ctx, and process in there.  Or if you
> want to process it when leaving some construct, arrange for that.

If the unmap operation is supposed to sit where the corresponding variable
goes out of scope, supposedly you would need to find out in which bind
(gimplify_ctx (not omp!)) the variable is declared and arrange for the
statement to be added as a cleanup of that region.
If you queue everything to the end of function, I'm afraid with e.g.
void foo (void)
{
  {
    char buf[2048];
    #acc declare whatever(buf)
    // ...
  }
  {
    char buf2[2048];
    #acc declare whatever(buf2)
    // ...
  }
}
both vars will be assigned overlapping ranges and you might run into
trouble trying to map buf2 while buf is still mapped.

	Jakub



More information about the Gcc-patches mailing list