use of org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister in project graal by oracle.
the class SPARCMove method const2stack.
public static void const2stack(CompilationResultBuilder crb, SPARCMacroAssembler masm, Value result, Register constantTableBase, SPARCDelayedControlTransfer delaySlotLir, JavaConstant constant) {
if (constant.isDefaultForKind() || constant.isNull()) {
SPARCAddress resultAddress = (SPARCAddress) crb.asAddress(result);
emitStore(g0.asValue(LIRKind.combine(result)), resultAddress, result.getPlatformKind(), delaySlotLir, null, crb, masm);
} else {
try (ScratchRegister sc = masm.getScratchRegister()) {
Value scratchRegisterValue = sc.getRegister().asValue(LIRKind.combine(result));
const2reg(crb, masm, scratchRegisterValue, constantTableBase, constant, SPARCDelayedControlTransfer.DUMMY);
SPARCAddress resultAddress = (SPARCAddress) crb.asAddress(result);
emitStore(scratchRegisterValue, resultAddress, result.getPlatformKind(), delaySlotLir, null, crb, masm);
}
}
}
use of org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister in project graal by oracle.
the class SPARCMove method emitLoad.
public static void emitLoad(CompilationResultBuilder crb, SPARCMacroAssembler masm, SPARCAddress address, Value result, boolean signExtend, PlatformKind kind, SPARCDelayedControlTransfer delayedControlTransfer, LIRFrameState state) {
try (ScratchRegister sc = masm.getScratchRegister()) {
Register scratch = sc.getRegister();
final SPARCAddress addr = generateSimm13OffsetLoad(address, masm, scratch);
final Register dst = asRegister(result);
delayedControlTransfer.emitControlTransfer(crb, masm);
if (state != null) {
crb.recordImplicitException(masm.position(), state);
}
int byteCount = kind.getSizeInBytes();
masm.ld(addr, dst, byteCount, signExtend);
}
}
use of org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister in project graal by oracle.
the class SPARCMove method emitStore.
public static void emitStore(Value input, SPARCAddress address, PlatformKind kind, SPARCDelayedControlTransfer delayedControlTransfer, LIRFrameState state, CompilationResultBuilder crb, SPARCMacroAssembler masm) {
try (ScratchRegister sc = masm.getScratchRegister()) {
Register scratch = sc.getRegister();
SPARCAddress addr = generateSimm13OffsetLoad(address, masm, scratch);
delayedControlTransfer.emitControlTransfer(crb, masm);
if (state != null) {
crb.recordImplicitException(masm.position(), state);
}
int byteCount = kind.getSizeInBytes();
masm.st(asRegister(input), addr, byteCount);
}
}
use of org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister in project graal by oracle.
the class SPARCMove method loadFromConstantTable.
/**
* This method creates a load from the constant section. It automatically respects the different
* patterns used for small constant sections (<8k) and large constant sections (>=8k). The
* generated patterns by this method must be understood by
* CodeInstaller::pd_patch_DataSectionReference (jvmciCodeInstaller_sparc.cpp).
*
* @return the number of bytes loaded from the constant table
*/
public static int loadFromConstantTable(CompilationResultBuilder crb, SPARCMacroAssembler masm, Register constantTableBase, Constant input, Register dest, SPARCDelayedControlTransfer delaySlotInstruction) {
SPARCAddress address;
ScratchRegister scratch = null;
try {
Data data = crb.createDataItem(input);
int size = data.getSize();
if (masm.isImmediateConstantLoad()) {
address = new SPARCAddress(constantTableBase, 0);
// Make delayed only, when using immediate constant load.
delaySlotInstruction.emitControlTransfer(crb, masm);
crb.recordDataReferenceInCode(data, size);
} else {
scratch = masm.getScratchRegister();
Register sr = scratch.getRegister();
crb.recordDataReferenceInCode(data, size);
masm.sethix(0, sr, true);
address = new SPARCAddress(sr, 0);
}
masm.ld(address, dest, size, false);
return size;
} finally {
if (scratch != null) {
scratch.close();
}
}
}
Aggregations