Search in sources :

Example 1 with PlatformKind

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)));
}
Also used : HotSpotLIRGenerator(org.graalvm.compiler.hotspot.HotSpotLIRGenerator) Register(jdk.vm.ci.code.Register) PlatformKind(jdk.vm.ci.meta.PlatformKind)

Example 2 with PlatformKind

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;
}
Also used : Variable(org.graalvm.compiler.lir.Variable) PlatformKind(jdk.vm.ci.meta.PlatformKind) LIRKind(org.graalvm.compiler.core.common.LIRKind)

Example 3 with PlatformKind

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);
        }
    }
}
Also used : ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) Register(jdk.vm.ci.code.Register) ValueUtil.isRegister(jdk.vm.ci.code.ValueUtil.isRegister) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) PlatformKind(jdk.vm.ci.meta.PlatformKind) AArch64Address(org.graalvm.compiler.asm.aarch64.AArch64Address)

Example 4 with PlatformKind

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();
    }
}
Also used : Register(jdk.vm.ci.code.Register) ValueUtil.isRegister(jdk.vm.ci.code.ValueUtil.isRegister) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) PlatformKind(jdk.vm.ci.meta.PlatformKind)

Example 5 with PlatformKind

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;
}
Also used : Variable(org.graalvm.compiler.lir.Variable) LIRInstruction(org.graalvm.compiler.lir.LIRInstruction) PlatformKind(jdk.vm.ci.meta.PlatformKind) RegisterValue(jdk.vm.ci.code.RegisterValue) LIRInsertionBuffer(org.graalvm.compiler.lir.LIRInsertionBuffer) Register(jdk.vm.ci.code.Register) RegisterMap(org.graalvm.compiler.lir.util.RegisterMap) LIRKind(org.graalvm.compiler.core.common.LIRKind) StandardOp(org.graalvm.compiler.lir.StandardOp)

Aggregations

PlatformKind (jdk.vm.ci.meta.PlatformKind)20 Register (jdk.vm.ci.code.Register)6 LIRKind (org.graalvm.compiler.core.common.LIRKind)6 RegisterValue (jdk.vm.ci.code.RegisterValue)5 Variable (org.graalvm.compiler.lir.Variable)5 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)4 CallingConvention (jdk.vm.ci.code.CallingConvention)3 TargetDescription (jdk.vm.ci.code.TargetDescription)3 GraalHotSpotVMConfig (org.graalvm.compiler.hotspot.GraalHotSpotVMConfig)3 HotSpotForeignCallLinkageImpl (org.graalvm.compiler.hotspot.HotSpotForeignCallLinkageImpl)3 ValueUtil.asRegister (jdk.vm.ci.code.ValueUtil.asRegister)2 ValueUtil.isRegister (jdk.vm.ci.code.ValueUtil.isRegister)2 JavaConstant (jdk.vm.ci.meta.JavaConstant)2 Value (jdk.vm.ci.meta.Value)2 GraalCompilerTest (org.graalvm.compiler.core.test.GraalCompilerTest)2 NullCheckOp (org.graalvm.compiler.lir.sparc.SPARCMove.NullCheckOp)2 Test (org.junit.Test)2 StackSlot (jdk.vm.ci.code.StackSlot)1 ValueUtil.asAllocatableValue (jdk.vm.ci.code.ValueUtil.asAllocatableValue)1 ValueUtil.isAllocatableValue (jdk.vm.ci.code.ValueUtil.isAllocatableValue)1