This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: SIMPLE: A language-independent tree IR
On Wed, 02 Jan 2002, Tom Tromey wrote:
> In Java a `break' in an inner loop can break out of an outer loop (if
> the user uses the `break <label'> form). In this case the break must
> also deal with enclosing `try-finally' constructs properly. I don't
> know whether capturing this information is important at this level, or
> if you'd rather we just model this with goto or whatever. (I don't
> know what we do right now.) The same holds for `continue'.
>
Initially, I would just follow what the current tree->RTL
expander does. Emitting SIMPLE trees instead of RTL, of course.
I won't know for sure until I have sat down and looked at it,
though.
> I looked through the BNF you provided but I didn't see how `goto' or
> `?:' expressions are handled. I also didn't see how exceptions are
> handled.
>
Conditional ?: expressions are expanded to the equivalent
if-then-else tree. GOTOs are a special case. One of their goals
is to remove all GOTOs from the code. I don't think this is
crucial in the short term, so I will just keep the GOTOs.
> If we do tree lowering like this before doing any tree-based
> optimizations, then that will make optimizing Java bytecode generation
> much harder (to the point where it is unlikely that it will be done).
> This probably isn't a great loss.
>
Ah, but for Java bytecodes we can use JIMPLE. It's essentially
the same IR as SIMPLE, specifically targeted at bytecode
optimizations: http://www.sable.mcgill.ca/soot/
However, I don't plan on eliminating the optimizations we do on
language-dependent trees. This lowering would be done after the
ld-trees have been optimized (e.g. inlining)
Diego.