[PATCH] Java: expand divide, expand conversions

Andrew Haley aph@pasanda.cygnus.co.uk
Mon Jul 19 11:00:00 GMT 1999


> Date: 1999年7月19日 10:52:17 -0700
> From: Tom Tromey <tromey@cygnus.com>
>> >> It seems like we could potentially optimize the test away in some
> >> situations (that is, if gcc has the necessary machinery for this,
> >> which is something I don't know).
>> Andrew> The call to the divide subroutine isn't generated when
> Andrew> dividing by a constant, so there's no overhead in that case.
>> Cool. I also meant the case where we have "a / b" but can prove that
> b != 0. Can gcc do this?

Yes, I think that if it can prove a region of code is unreaschable the
code will just be deleted. For example, if a division was already in
an `if (i != 0) ...' guarded block, the test could just be removed.
However, what we need is a rule which says: 
 If you can prove that i != 0, generate a `div' insn. Otherwise,
 call a divide subroutine.
It's an interesting idea, but I don't think there's any way to express
it in gcc. I wonder...
Andrew.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /