Re: [GSoC / Question] TREEDEF vs built-in

Martin Jambor <[email protected]>
Newsgroups gmane.comp.gcc.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.