package com.oracle.graal.lir.sparc;

import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;

import com.oracle.graal.api.code.CompilationResult.RawData;
import com.oracle.graal.api.meta.*;
import com.oracle.graal.asm.sparc.*;
import com.oracle.graal.lir.asm.*;
import com.oracle.graal.lir.sparc.SPARCMove.LoadAddressOp;

public class SPARCConstDataOp extends SPARCLIRInstruction {

    @Def({REG}) private AllocatableValue dst;
    private byte[] val;

    public SPARCConstDataOp(AllocatableValue dst, byte[] val) {
        this.dst = dst;
        this.val = val;
    }

    @Override
    public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
        RawData data = new RawData(val, 16);
        new LoadAddressOp(dst, (SPARCAddress) crb.recordDataReferenceInCode(data)).emitCode(crb);
    }

}

@@ -96,16 +96,52 @@
 lag.*;%0A%0A
+import com.oracle.graal.api.code.*;%0A
 import c
@@ -261,24 +261,55 @@
 sm.sparc.*;%0A
+import com.oracle.graal.lir.*;%0A
 import com.o
@@ -390,16 +390,118 @@
 ressOp;%0A
+import com.oracle.graal.sparc.*;%0Aimport com.sun.javafx.binding.SelectBinding.*;%0A%0A@Opcode(%22CONST_DATA%22)
 %0Apublic 
@@ -854,139 +854,243 @@
    R
-awData data = new RawData(val, 16);%0A        new LoadAddressOp(dst, (SPARCAddress) crb.recordDataReferenceInCode(data)).emitCode(crb
+egister dstReg = ValueUtil.asLongReg(dst);%0A        long addr = 0; // Will be fixed up by the loader%0A        new SPARCAssembler.Sethi((int) addr, dstReg).emit(masm);%0A        new SPARCAssembler.Add(SPARC.g0, (int) addr, dstReg).emit(masm
 );%0A 

Make proper code for c const strings required for fixup in hotspot