use of jdk.vm.ci.meta.PlatformKind in project graal by oracle.
the class CurrentJavaThreadNode method generate.
@Override
public void generate(NodeLIRBuilderTool gen) {
Register rawThread = ((HotSpotLIRGenerator) gen.getLIRGeneratorTool()).getProviders().getRegisters().getThreadRegister();
PlatformKind wordKind = gen.getLIRGeneratorTool().target().arch.getWordKind();
gen.setResult(this, rawThread.asValue(LIRKind.value(wordKind)));
}
use of jdk.vm.ci.meta.PlatformKind in project graal by oracle.
the class AArch64ArithmeticLIRGenerator method emitFloatConvert.
@Override
public Value emitFloatConvert(FloatConvert op, Value inputVal) {
PlatformKind resultPlatformKind = getFloatConvertResultKind(op);
LIRKind resultLirKind = LIRKind.combine(inputVal).changeType(resultPlatformKind);
Variable result = getLIRGen().newVariable(resultLirKind);
getLIRGen().append(new AArch64FloatConvertOp(op, result, getLIRGen().asAllocatable(inputVal)));
return result;
}
use of jdk.vm.ci.meta.PlatformKind in project graal by oracle.
the class AArch64Move method emitStackMove.
private static void emitStackMove(CompilationResultBuilder crb, AArch64MacroAssembler masm, AllocatableValue result, Value input) {
try (ScratchRegister r1 = masm.getScratchRegister()) {
try (ScratchRegister r2 = masm.getScratchRegister()) {
Register rscratch1 = r1.getRegister();
Register rscratch2 = r2.getRegister();
// use the slot kind to define the operand size
PlatformKind kind = input.getPlatformKind();
final int size = kind.getSizeInBytes() * Byte.SIZE;
// Always perform stack -> stack copies through integer registers
crb.blockComment("[stack -> stack copy]");
AArch64Address src = loadStackSlotAddress(crb, masm, asStackSlot(input), rscratch2);
masm.ldr(size, rscratch1, src);
AArch64Address dst = loadStackSlotAddress(crb, masm, asStackSlot(result), rscratch2);
masm.str(size, rscratch1, dst);
}
}
}
use of jdk.vm.ci.meta.PlatformKind in project graal by oracle.
the class SPARCBitManipulationOp method emitCode.
@Override
public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
Register dst = asRegister(result, WORD);
if (isRegister(input)) {
Register src = asRegister(input);
switch(opcode) {
case BSF:
PlatformKind tkind = input.getPlatformKind();
if (tkind == WORD) {
masm.sub(src, 1, dst);
masm.andn(dst, src, dst);
masm.srl(dst, g0, dst);
masm.popc(dst, dst);
} else if (tkind == XWORD) {
masm.sub(src, 1, dst);
masm.andn(dst, src, dst);
masm.popc(dst, dst);
} else {
throw GraalError.shouldNotReachHere("missing: " + tkind);
}
break;
case IBSR:
{
PlatformKind ikind = input.getPlatformKind();
assert ikind == WORD;
Register tmp = asRegister(scratch);
assert !tmp.equals(dst);
masm.srl(src, 1, tmp);
masm.srl(src, 0, dst);
masm.or(dst, tmp, dst);
masm.srl(dst, 2, tmp);
masm.or(dst, tmp, dst);
masm.srl(dst, 4, tmp);
masm.or(dst, tmp, dst);
masm.srl(dst, 8, tmp);
masm.or(dst, tmp, dst);
masm.srl(dst, 16, tmp);
masm.or(dst, tmp, dst);
masm.popc(dst, dst);
masm.sub(dst, 1, dst);
break;
}
case LBSR:
{
PlatformKind lkind = input.getPlatformKind();
assert lkind == XWORD;
Register tmp = asRegister(scratch);
assert !tmp.equals(dst);
masm.srlx(src, 1, tmp);
masm.or(src, tmp, dst);
masm.srlx(dst, 2, tmp);
masm.or(dst, tmp, dst);
masm.srlx(dst, 4, tmp);
masm.or(dst, tmp, dst);
masm.srlx(dst, 8, tmp);
masm.or(dst, tmp, dst);
masm.srlx(dst, 16, tmp);
masm.or(dst, tmp, dst);
masm.srlx(dst, 32, tmp);
masm.or(dst, tmp, dst);
masm.popc(dst, dst);
// This is required to fit the given structure.
masm.sub(dst, 1, dst);
break;
}
default:
throw GraalError.shouldNotReachHere();
}
} else {
throw GraalError.shouldNotReachHere();
}
}
use of jdk.vm.ci.meta.PlatformKind in project graal by oracle.
the class SaveCalleeSaveRegisters method saveAtEntry.
private static RegisterMap<Variable> saveAtEntry(LIR lir, LIRGeneratorTool lirGen, LIRGenerationResult lirGenRes, RegisterArray calleeSaveRegisters, Architecture arch) {
AbstractBlockBase<?> startBlock = lir.getControlFlowGraph().getStartBlock();
ArrayList<LIRInstruction> instructions = lir.getLIRforBlock(startBlock);
int insertionIndex = 1;
LIRInsertionBuffer buffer = new LIRInsertionBuffer();
buffer.init(instructions);
StandardOp.LabelOp entry = (StandardOp.LabelOp) instructions.get(insertionIndex - 1);
RegisterValue[] savedRegisterValues = new RegisterValue[calleeSaveRegisters.size()];
int savedRegisterValueIndex = 0;
RegisterMap<Variable> saveMap = new RegisterMap<>(arch);
for (Register register : calleeSaveRegisters) {
PlatformKind registerPlatformKind = arch.getLargestStorableKind(register.getRegisterCategory());
LIRKind lirKind = LIRKind.value(registerPlatformKind);
RegisterValue registerValue = register.asValue(lirKind);
Variable saveVariable = lirGen.newVariable(lirKind);
LIRInstruction save = lirGen.getSpillMoveFactory().createMove(saveVariable, registerValue);
buffer.append(insertionIndex, save);
save.setComment(lirGenRes, "SaveCalleeSavedRegisters: saveAtEntry");
saveMap.put(register, saveVariable);
savedRegisterValues[savedRegisterValueIndex++] = registerValue;
}
entry.addIncomingValues(savedRegisterValues);
buffer.finish();
return saveMap;
}
Aggregations