Search in sources :

Example 51 with LIRKind

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

the class SPARCImmediateAddressNode method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    SPARCLIRGenerator tool = (SPARCLIRGenerator) gen.getLIRGeneratorTool();
    AllocatableValue baseValue = tool.asAllocatable(gen.operand(base));
    LIRKind kind = tool.getLIRKind(stamp(NodeView.DEFAULT));
    AllocatableValue baseReference = LIRKind.derivedBaseFromValue(baseValue);
    if (baseReference != null) {
        kind = kind.makeDerivedReference(baseReference);
    }
    gen.setResult(this, new SPARCImmediateAddressValue(kind, baseValue, displacement));
}
Also used : SPARCImmediateAddressValue(org.graalvm.compiler.lir.sparc.SPARCImmediateAddressValue) LIRKind(org.graalvm.compiler.core.common.LIRKind) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 52 with LIRKind

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

the class SPARCIndexedAddressNode method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    SPARCLIRGenerator tool = (SPARCLIRGenerator) gen.getLIRGeneratorTool();
    AllocatableValue baseValue = tool.asAllocatable(gen.operand(base));
    AllocatableValue indexValue = tool.asAllocatable(gen.operand(index));
    AllocatableValue baseReference = LIRKind.derivedBaseFromValue(baseValue);
    AllocatableValue indexReference = LIRKind.derivedBaseFromValue(indexValue);
    LIRKind kind = LIRKind.combineDerived(tool.getLIRKind(stamp(NodeView.DEFAULT)), baseReference, indexReference);
    gen.setResult(this, new SPARCIndexedAddressValue(kind, baseValue, indexValue));
}
Also used : SPARCIndexedAddressValue(org.graalvm.compiler.lir.sparc.SPARCIndexedAddressValue) LIRKind(org.graalvm.compiler.core.common.LIRKind) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 53 with LIRKind

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

the class JVMCIInfopointErrorTest method testInvalidShortOop.

@Test(expected = Error.class)
public void testInvalidShortOop() {
    test((tool, state, safepoint) -> {
        PlatformKind kind = tool.target().arch.getPlatformKind(JavaKind.Short);
        LIRKind lirKind = LIRKind.reference(kind);
        Variable var = tool.newVariable(lirKind);
        tool.append(new ValueDef(var));
        safepoint.accept(state);
        tool.append(new ValueUse(var));
    });
}
Also used : Variable(org.graalvm.compiler.lir.Variable) PlatformKind(jdk.vm.ci.meta.PlatformKind) LIRKind(org.graalvm.compiler.core.common.LIRKind) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest) Test(org.junit.Test)

Example 54 with LIRKind

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

the class HotSpotReferenceMapBuilder method finish.

@Override
public ReferenceMap finish(LIRFrameState state) {
    Location[] objects;
    Location[] derivedBase;
    int[] sizeInBytes;
    if (objectCount == 0) {
        objects = NO_LOCATIONS;
        derivedBase = NO_LOCATIONS;
        sizeInBytes = NO_SIZES;
    } else {
        objects = new Location[objectCount];
        derivedBase = new Location[objectCount];
        sizeInBytes = new int[objectCount];
    }
    int idx = 0;
    for (Value obj : objectValues) {
        LIRKind kind = (LIRKind) obj.getValueKind();
        int bytes = bytesPerElement(kind);
        if (kind.isUnknownReference()) {
            throw GraalError.shouldNotReachHere(String.format("unknown reference alive across safepoint: %s", obj));
        } else {
            Location base = null;
            if (kind.isDerivedReference()) {
                Variable baseVariable = (Variable) kind.getDerivedReferenceBase();
                Value baseValue = state.getLiveBasePointers().get(baseVariable.index);
                assert baseValue.getPlatformKind().getVectorLength() == 1 && ((LIRKind) baseValue.getValueKind()).isReference(0) && !((LIRKind) baseValue.getValueKind()).isDerivedReference();
                base = toLocation(baseValue, 0);
            }
            for (int i = 0; i < kind.getPlatformKind().getVectorLength(); i++) {
                if (kind.isReference(i)) {
                    assert kind.isCompressedReference(i) ? (bytes < uncompressedReferenceSize) : (bytes == uncompressedReferenceSize);
                    objects[idx] = toLocation(obj, i * bytes);
                    derivedBase[idx] = base;
                    sizeInBytes[idx] = bytes;
                    idx++;
                }
            }
        }
    }
    return new HotSpotReferenceMap(objects, derivedBase, sizeInBytes, maxRegisterSize);
}
Also used : Variable(org.graalvm.compiler.lir.Variable) Value(jdk.vm.ci.meta.Value) LIRKind(org.graalvm.compiler.core.common.LIRKind) HotSpotReferenceMap(jdk.vm.ci.hotspot.HotSpotReferenceMap) Location(jdk.vm.ci.code.Location)

Example 55 with LIRKind

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

the class FloatingReadNode method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    LIRKind readKind = gen.getLIRGeneratorTool().getLIRKind(stamp(NodeView.DEFAULT));
    gen.setResult(this, gen.getLIRGeneratorTool().getArithmetic().emitLoad(readKind, gen.operand(address), null));
}
Also used : 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