getting newVariables in HSAILLIRGenerator

Deneau, Tom tom.deneau at
Thu Dec 5 13:38:58 PST 2013

We were playing around with hsail handling for a deoptimization node.
As part of the codegen for the deopt node, we needed a couple of scratch registers so in our LIRGenerator we have

    public void emitDeoptimize(Value actionAndReason, DeoptimizingNode deopting) {
        Variable scratch64 = newVariable(Kind.Object); 
        Variable scratch32 = newVariable(Kind.Int); 
        append(new DeoptimizeOp(actionAndReason, deopting, getMetaAccess(), scratch64, scratch32));

and inside our HSAIL DeooptimizeOp we have

        @Use({REG, CONST}) protected Value actionAndReason;
        protected DeoptimizingNode deopting;
        protected MetaAccessProvider metaAccessProvider;
        @Temp({REG}) private AllocatableValue scratch64;
        @Temp({REG}) private AllocatableValue scratch32;

However, maybe I am doing something wrong with the annotations because it seems that the register allocator will pick registers for scratch64, scratch32 that are really live.  For instance, sometimes the deopt node is jumped to from various locations with different codes as shown below. In this case, the compiler assigned scratch32 to be $s0, but that should be considered in use coming from the @L12 block.

	mov_b32 $s0, -35;	// ClassCastException
	brn @L14;

	// Deoptimization for Variable Reason, scratch64=d0|a, scratch32=s0|i
       ... deoptimize codegen follows

-- Tom

More information about the graal-dev mailing list