Use snippets in LIRGenerator
Roland Schatz
roland.schatz at oracle.com
Wed Mar 26 14:23:57 UTC 2014
Hi Daniel,
You shouldn't create new control flow in the LIR. A better way to do
this in the high level graph, then you can still profit from subsequent
optimizations on the control flow.
We have a similar use case already in the AMD64 backend: The AMD64
floating point convert semantics differs from the Java semantics. What
we do there is, we replace the FloatConvertNode with an
AMD64FloatConvertNode + some other code from a snippet that fixes up the
difference. Then the AMD64FloatConvertNode can be lowered directly to a
LIR instruction that results in a single assembler instruction.
You can look at AMD64HotSpotLoweringProvider and AMD64ConvertSnippets
for how this is done.
-Roland
On 03/26/2014 12:58 PM, D.Sturm wrote:
> Hi,
> Division under aarch64 does not generate an implicit exception in case of
> division by 0, therefore I have to generate code along the lines of:
>
> if (divisor == 0) throw new ArithmethicException("Division by 0");
> result = dividend / divisor;
>
> for emitDiv, etc. Now I could implement that all as low-level code in the
> LIR, but on the other hand we already know how to create new objects and
> throw exceptions, so I was wondering if there's a way to use Snippets to
> avoid doing this manually?
>
> -- Daniel
More information about the graal-dev
mailing list