[GSoC / Question] TREEDEF vs built-in
Martin Jambor
mjambor@suse.cz
Mon Jun 1 13:06:42 GMT 2026
Hi,
On Thu, May 28 2026, Sebastian Galindo via Gcc wrote:
> Hi,
>
> I'm implementing some OpenACC directives but since I'm a new contributor
> with a very simple but conceptual question that I prefer asking in the
> mailing list rather than believing some unclear explanation from AI.
>
> I know that some directives (Talking about OpenMP / OpenACC)
> imply futher optimizations or variables treatment and that case
> is defined as a tree node (TREEDEF). In the other side, built-in
> is required when it's a runtime call that can be resolved in the
> front-end (?).
Did you mean to write "that CANNOT be resolved by a front-end?" (Or any
stage of compilation, for that matter?).
The thing is, especially in the OpenMP/OpenACC context, the same stuff
can be represented by both. For example there is an OMP_PARALLEL tree
code that is generated by the front-ends to represent OpenMP parallel
construct which then however gets lowered/expanded to a call to
builtin_GOMP_parallel which stays until the end of the compilation and
the call is emitted to the assembly (and is implemented in the run-time
library libgomp).
So, if you eventually need a call to libgomp, you will need to use a
(call to) a builtin function. However, how you convey other information
from the front-ends to lowering/expansion and beyond is upon you, I guess.
> I'm not sure about that and I would appreciate some examples. Not
> necessarily in the case of OpenACC / OpenMP, but some useful examples to
> judge if some statement requires built-in or define a tree node for that
> (if requires special treatment).
See above. Compile a simple OpenMP/OpenACC example with -fdump-tree-all
and see how things change throughout the GCC pass pipeline.
Hope this helps,
Martin
More information about the Gcc
mailing list