Search in sources :

Example 16 with LIRKind

use of org.graalvm.compiler.core.common.LIRKind 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 17 with LIRKind

use of org.graalvm.compiler.core.common.LIRKind in project graal by oracle.

the class AMD64AddressNode method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    LIRGeneratorTool tool = gen.getLIRGeneratorTool();
    AllocatableValue baseValue = base == null ? Value.ILLEGAL : tool.asAllocatable(gen.operand(base));
    AllocatableValue indexValue = index == null ? Value.ILLEGAL : tool.asAllocatable(gen.operand(index));
    AllocatableValue baseReference = LIRKind.derivedBaseFromValue(baseValue);
    AllocatableValue indexReference;
    if (index == null) {
        indexReference = null;
    } else if (scale.equals(Scale.Times1)) {
        indexReference = LIRKind.derivedBaseFromValue(indexValue);
    } else {
        if (LIRKind.isValue(indexValue)) {
            indexReference = null;
        } else {
            indexReference = Value.ILLEGAL;
        }
    }
    LIRKind kind = LIRKind.combineDerived(tool.getLIRKind(stamp(NodeView.DEFAULT)), baseReference, indexReference);
    gen.setResult(this, new AMD64AddressValue(kind, baseValue, indexValue, scale, displacement));
}
Also used : AMD64AddressValue(org.graalvm.compiler.lir.amd64.AMD64AddressValue) LIRKind(org.graalvm.compiler.core.common.LIRKind) LIRGeneratorTool(org.graalvm.compiler.lir.gen.LIRGeneratorTool) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 18 with LIRKind

use of org.graalvm.compiler.core.common.LIRKind in project graal by oracle.

the class SubstrateReferenceMapBuilder method addLiveValue.

@Override
public void addLiveValue(Value value) {
    if (ValueUtil.isStackSlot(value)) {
        StackSlot stackSlot = ValueUtil.asStackSlot(value);
        int offset = stackSlot.getOffset(totalFrameSize);
        assert referenceMap.debugMarkStackSlot(offset, stackSlot);
        LIRKind kind = (LIRKind) value.getValueKind();
        if (!kind.isValue()) {
            if (kind.isUnknownReference()) {
                throw JVMCIError.shouldNotReachHere("unknown reference alive across safepoint");
            } else if (kind.isDerivedReference()) {
                throw JVMCIError.shouldNotReachHere("derived references not supported yet on Substrate VM");
            } else {
                int bytes = bytesPerElement(kind);
                int mapSlotSize = SubstrateReferenceMap.getSlotSizeInBytes();
                assert bytes % mapSlotSize == 0;
                assert offset % mapSlotSize == 0;
                for (int i = 0; i < kind.getPlatformKind().getVectorLength(); i++) {
                    if (kind.isReference(i)) {
                        boolean compressed = kind.isCompressedReference(i);
                        referenceMap.markReferenceAtIndex((offset + i * bytes) / mapSlotSize, compressed);
                    }
                }
            }
        }
    } else if (ValueUtil.isRegister(value)) {
        assert referenceMap.debugMarkRegister(ValueUtil.asRegister(value).number, value);
    } else {
        throw VMError.shouldNotReachHere(value.toString());
    }
}
Also used : StackSlot(jdk.vm.ci.code.StackSlot) LIRKind(org.graalvm.compiler.core.common.LIRKind)

Example 19 with LIRKind

use of org.graalvm.compiler.core.common.LIRKind 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)

Example 20 with LIRKind

use of org.graalvm.compiler.core.common.LIRKind in project graal by oracle.

the class NodeLIRBuilder method getExactPhiKind.

protected LIRKind getExactPhiKind(PhiNode phi) {
    LIRKind derivedKind = gen.toRegisterKind(gen.getLIRKind(phi.stamp(NodeView.DEFAULT)));
    /* Collect reference information. */
    for (int i = 0; i < phi.valueCount() && !derivedKind.isUnknownReference(); i++) {
        ValueNode node = phi.valueAt(i);
        Value value = getOperand(node);
        // get ValueKind for input
        final LIRKind valueKind;
        if (value != null) {
            valueKind = value.getValueKind(LIRKind.class);
        } else {
            assert isPhiInputFromBackedge(phi, i) : String.format("Input %s to phi node %s is not yet available although it is not coming from a loop back edge", node, phi);
            LIRKind kind = gen.getLIRKind(node.stamp(NodeView.DEFAULT));
            valueKind = gen.toRegisterKind(kind);
        }
        /* Merge the reference information of the derived kind and the input. */
        derivedKind = LIRKind.mergeReferenceInformation(derivedKind, valueKind);
    }
    return derivedKind;
}
Also used : ValueNode(org.graalvm.compiler.nodes.ValueNode) ComplexMatchValue(org.graalvm.compiler.core.match.ComplexMatchValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) LIRKind(org.graalvm.compiler.core.common.LIRKind)

Aggregations

LIRKind (org.graalvm.compiler.core.common.LIRKind)60 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)20 Variable (org.graalvm.compiler.lir.Variable)19 Value (jdk.vm.ci.meta.Value)15 RegisterValue (jdk.vm.ci.code.RegisterValue)11 TargetDescription (jdk.vm.ci.code.TargetDescription)7 PlatformKind (jdk.vm.ci.meta.PlatformKind)7 LIRGeneratorTool (org.graalvm.compiler.lir.gen.LIRGeneratorTool)7 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)6 JavaConstant (jdk.vm.ci.meta.JavaConstant)4 SPARCKind (jdk.vm.ci.sparc.SPARCKind)4 ComplexMatchValue (org.graalvm.compiler.core.match.ComplexMatchValue)4 AArch64AddressValue (org.graalvm.compiler.lir.aarch64.AArch64AddressValue)4 AMD64AddressValue (org.graalvm.compiler.lir.amd64.AMD64AddressValue)4 ComplexMatchResult (org.graalvm.compiler.core.match.ComplexMatchResult)3 MatchRule (org.graalvm.compiler.core.match.MatchRule)3 ConstantValue (org.graalvm.compiler.lir.ConstantValue)3 AMD64MulDivOp (org.graalvm.compiler.lir.amd64.AMD64MulDivOp)3 SubstrateRegisterConfig (com.oracle.svm.core.graal.meta.SubstrateRegisterConfig)2 Op3s (org.graalvm.compiler.asm.sparc.SPARCAssembler.Op3s)2