disabling arithmetic nodes with memory operands

Christian Wimmer christian.wimmer at oracle.com
Wed May 29 13:30:41 PDT 2013

The AllocatableValue fields of LIR instructions, which reference the 
operands, are annotated with @Def, @Use, or @Temp. As part of the 
annotation, you specify the allowed locations. For example, @Use({REG, 
STACK}) means that the register allocator can use the operand directly 
from a stack slot. If you change it to @Use({REG}), then the register 
allocator emits a load into a register first if the operand was spilled.


On 05/29/2013 01:06 PM, Venkatachalam, Vasanth wrote:
> Hi,
> For an arithmetic test case involving doubles, Graal is generating a node for a double addition where one of the arguments is a stack slot.
> Unlike x86, HSAIL doesn't support passing a stack slot or memory address as one of the arguments to an addition.
> The HSAIL backend I've developed would have to load the value from the stack into a register first and do a register to register addition. Since this hasn't been implemented I get the exception below:
> com.oracle.graal.graph.GraalInternalError: java.lang.ClassCastException: com.oracle.graal.api.code.StackSlot cannot be cast to com.oracle.graal.api.code.RegisterValue
>         at lir instruction: xmm2|d = DADD (x: stack:240|d, ~y: stack:248|d)
>         at com.oracle.graal.lir.LIR.emitOp(LIR.java:172)
>         at com.oracle.graal.lir.LIR.emitBlock(LIR.java:161)
>         at com.oracle.graal.lir.LIR.emitCode(LIR.java:147)
> at com.oracle.graal.lir.hsail.HSAILArithmetic.emit(HSAILArithmetic.java:322)
> at com.oracle.graal.lir.hsail.HSAILArithmetic$Op2Stack.emitCode(HSAILArithmetic.java:75)
>         at com.oracle.graal.lir.hsail.HSAILLIRInstruction.emitCode(HSAILLIRInstruction.java:36)
> Is there a switch that can be used to tell Graal not to generates nodes like the above, since we don't support them yet?
> Vasanth

More information about the graal-dev mailing list