Reusing OpenMP front end infrastructure for OpenACC -- how?

Thomas Schwinge
Thu Sep 5 14:51:00 GMT 2013


Implementing OpenACC support in GCC's frontends, there are things that I
trivially have to reimplement, that are already present for OpenMP.  For
example, the infrastructure for parsing clauses (as attached to OpenACC
and OpenMP directives), and their representation in the GCC internal data
structures.  Given the syntactical similarity of OpenACC and OpenMP, this
infrastructure is similar, too, if not even identical.  Thus, my inner
engineer tells me we ought to share this infrastructure instead of having
a copy of it only different for s%omp%oacc.

For a specific example, I'd like to reuse everything known by omp_clause*
and similar, and extend it with the things OpenACC does
additionally/differently (adding safe-guards, if not already present, to
the OpenMP code so that no clauses specific to OpenACC end up there).

Is this generally an accepted approach?  If yes, should I rename omp* to,
say, oacc_omp* (putting the OpenACC tag first for the simple reason that
it sorts first alphabetically), or can we think of a better tag than
oacc_omp, or should I leave the names as omp* and add comments that these
things are used for OpenACC, too?

Creating a (class) hierarchy of clauses that are valid for both OpenACC
and OpenMP, and then specific ones for only OpenACC or OpenMP, seems
overkill to me; I'd rather have the OpenACC/OpenMP passes that are
handling the shared set of clauses error out if they meet one they aren't
supposed to handle.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <>

More information about the Gcc mailing list