This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp] OpenMP IL design notes
Diego Novillo <dnovillo@redhat.com> writes:
> > I personally find it kind of baffling to have the same tree code act
> > differently in GENERIC and GIMPLE, a la SWITCH_EXPR. It seems to add
> > confusion for minimal benefit. If you are suggesting that the single
> > tree code GOMP_PARALLEL have different operands in GENERIC and GIMPLE,
> > can I suggest that you instead use two different tree coes?
> >
> That is a fundamental feature of both GENERIC and GIMPLE. GIMPLE
> is a non-strict subset of GENERIC. Every program in GIMPLE form
> is also in GENERIC form. The reverse, however, is not true.
Well, sure.
But it seems to me that there is a difference. PLUS_EXPR always takes
two operands and adds them together. Given a PLUS_EXPR, you always
where to find the operands, and more or less what they mean. I don't
find that confusing, although I agree that the operands themselves may
be different in GENERIC and GIMPLE.
SWITCH_EXPR is different. Sometimes you use SWITCH_BODY, and
sometimes you use SWITCH_LABELS. How do you know which one to use?
It depends on whether you have GENERIC or GIMPLE.
In particular, this matters for functions like block_may_fallthru,
which are called with both GENERIC and GIMPLE.
> If we did that we would need different codes for every tree code
> (MODIFY_EXPR, PLUS_EXPR, etc). Similarly, we would need
> different codes when we move from High-GIMPLE into Low-GIMPLE.
> I'm not sure that's worth the effort. From the point of view of
> analysis and optimizations the differences between the different
> ILs are mostly in the grammar, not their syntax.
If I understand what you are saying, I am complaining about the
specific cases where the difference is in the syntax. If a tree takes
a different set of operands in GENERIC and GIMPLE, or if the operands
have significantly different meanings, then I think we should use a
different tree code. If the operands are more or less the same, then
I think using the same tree code is fine.
This is obviously all just my opinion, as somebody who came late to
this stuff and is trying to understand it.
Ian