Search in sources :

Example 1 with SPARCAddressValue

use of org.graalvm.compiler.lir.sparc.SPARCAddressValue in project graal by oracle.

the class SPARCHotSpotLIRGenerator method emitPrefetchAllocate.

@Override
public void emitPrefetchAllocate(Value address) {
    SPARCAddressValue addr = asAddressValue(address);
    append(new SPARCPrefetchOp(addr, SPARCAssembler.Fcn.SeveralWritesAndPossiblyReads));
}
Also used : SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) SPARCPrefetchOp(org.graalvm.compiler.lir.sparc.SPARCPrefetchOp)

Example 2 with SPARCAddressValue

use of org.graalvm.compiler.lir.sparc.SPARCAddressValue in project graal by oracle.

the class SPARCArithmeticLIRGenerator method emitStore.

@Override
public void emitStore(ValueKind<?> kind, Value address, Value inputVal, LIRFrameState state) {
    SPARCAddressValue storeAddress = getLIRGen().asAddressValue(address);
    if (isJavaConstant(inputVal)) {
        JavaConstant c = asJavaConstant(inputVal);
        if (c.isDefaultForKind()) {
            getLIRGen().append(new StoreConstantOp(kind.getPlatformKind(), storeAddress, c, state));
            return;
        }
    }
    Variable input = getLIRGen().load(inputVal);
    getLIRGen().append(new StoreOp(kind.getPlatformKind(), storeAddress, input, state));
}
Also used : Variable(org.graalvm.compiler.lir.Variable) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) JavaConstant(jdk.vm.ci.meta.JavaConstant) LIRValueUtil.asJavaConstant(org.graalvm.compiler.lir.LIRValueUtil.asJavaConstant) LIRValueUtil.isJavaConstant(org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant) StoreOp(org.graalvm.compiler.lir.sparc.SPARCMove.StoreOp) StoreConstantOp(org.graalvm.compiler.lir.sparc.SPARCMove.StoreConstantOp)

Example 3 with SPARCAddressValue

use of org.graalvm.compiler.lir.sparc.SPARCAddressValue in project graal by oracle.

the class SPARCLIRGenerator method emitZeroExtendLoad.

public Value emitZeroExtendLoad(LIRKind kind, LIRKind resultKind, Value address, LIRFrameState state) {
    SPARCAddressValue loadAddress = asAddressValue(address);
    Variable result = newVariable(resultKind);
    append(new LoadOp(kind.getPlatformKind(), result, loadAddress, state));
    return result;
}
Also used : Variable(org.graalvm.compiler.lir.Variable) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) LoadOp(org.graalvm.compiler.lir.sparc.SPARCMove.LoadOp)

Example 4 with SPARCAddressValue

use of org.graalvm.compiler.lir.sparc.SPARCAddressValue in project graal by oracle.

the class SPARCMoveFactory method createMove.

@Override
public LIRInstruction createMove(AllocatableValue dst, Value src) {
    boolean srcIsSlot = isStackSlotValue(src);
    boolean dstIsSlot = isStackSlotValue(dst);
    if (isConstantValue(src)) {
        return createLoad(dst, asConstant(src));
    } else if (src instanceof SPARCAddressValue) {
        return new LoadAddressOp(dst, (SPARCAddressValue) src);
    } else {
        assert src instanceof AllocatableValue;
        if (srcIsSlot && dstIsSlot) {
            throw GraalError.shouldNotReachHere(src.getClass() + " " + dst.getClass());
        } else {
            return new Move(dst, (AllocatableValue) src);
        }
    }
}
Also used : Move(org.graalvm.compiler.lir.sparc.SPARCMove.Move) SPARCMove(org.graalvm.compiler.lir.sparc.SPARCMove) LoadAddressOp(org.graalvm.compiler.lir.sparc.SPARCMove.LoadAddressOp) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 5 with SPARCAddressValue

use of org.graalvm.compiler.lir.sparc.SPARCAddressValue in project graal by oracle.

the class SPARCNodeMatchRules method ifCompareLogicCas.

@MatchRule("(If (ObjectEquals=compare value LogicCompareAndSwap=cas))")
@MatchRule("(If (PointerEquals=compare value LogicCompareAndSwap=cas))")
@MatchRule("(If (FloatEquals=compare value LogicCompareAndSwap=cas))")
@MatchRule("(If (IntegerEquals=compare value LogicCompareAndSwap=cas))")
public ComplexMatchResult ifCompareLogicCas(IfNode root, CompareNode compare, ValueNode value, LogicCompareAndSwapNode cas) {
    JavaConstant constant = value.asJavaConstant();
    assert compare.condition() == CanonicalCondition.EQ;
    if (constant != null && cas.usages().count() == 1) {
        long constantValue = constant.asLong();
        boolean successIsTrue;
        if (constantValue == 0) {
            successIsTrue = false;
        } else if (constantValue == 1) {
            successIsTrue = true;
        } else {
            return null;
        }
        return builder -> {
            LIRKind kind = getLirKind(cas);
            LabelRef trueLabel = getLIRBlock(root.trueSuccessor());
            LabelRef falseLabel = getLIRBlock(root.falseSuccessor());
            double trueLabelProbability = root.probability(root.trueSuccessor());
            Value expectedValue = operand(cas.getExpectedValue());
            Value newValue = operand(cas.getNewValue());
            SPARCAddressValue address = (SPARCAddressValue) operand(cas.getAddress());
            Condition condition = successIsTrue ? Condition.EQ : Condition.NE;
            Value result = getLIRGeneratorTool().emitValueCompareAndSwap(address, expectedValue, newValue);
            getLIRGeneratorTool().emitCompareBranch(kind.getPlatformKind(), result, expectedValue, condition, false, trueLabel, falseLabel, trueLabelProbability);
            return null;
        };
    }
    return null;
}
Also used : CompareNode(org.graalvm.compiler.nodes.calc.CompareNode) LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) XWORD(jdk.vm.ci.sparc.SPARCKind.XWORD) LabelRef(org.graalvm.compiler.lir.LabelRef) SPARCKind(jdk.vm.ci.sparc.SPARCKind) WORD(jdk.vm.ci.sparc.SPARCKind.WORD) SignExtendNode(org.graalvm.compiler.nodes.calc.SignExtendNode) ZeroExtendNode(org.graalvm.compiler.nodes.calc.ZeroExtendNode) Condition(org.graalvm.compiler.core.common.calc.Condition) HWORD(jdk.vm.ci.sparc.SPARCKind.HWORD) IfNode(org.graalvm.compiler.nodes.IfNode) LIRKind(org.graalvm.compiler.core.common.LIRKind) LIRLowerableAccess(org.graalvm.compiler.nodes.memory.LIRLowerableAccess) BYTE(jdk.vm.ci.sparc.SPARCKind.BYTE) DeoptimizingNode(org.graalvm.compiler.nodes.DeoptimizingNode) CanonicalCondition(org.graalvm.compiler.core.common.calc.CanonicalCondition) JavaConstant(jdk.vm.ci.meta.JavaConstant) ValueNode(org.graalvm.compiler.nodes.ValueNode) Value(jdk.vm.ci.meta.Value) ComplexMatchResult(org.graalvm.compiler.core.match.ComplexMatchResult) Access(org.graalvm.compiler.nodes.memory.Access) NodeMatchRules(org.graalvm.compiler.core.gen.NodeMatchRules) GraalError(org.graalvm.compiler.debug.GraalError) LIRGeneratorTool(org.graalvm.compiler.lir.gen.LIRGeneratorTool) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) MatchRule(org.graalvm.compiler.core.match.MatchRule) LogicCompareAndSwapNode(org.graalvm.compiler.nodes.java.LogicCompareAndSwapNode) Condition(org.graalvm.compiler.core.common.calc.Condition) CanonicalCondition(org.graalvm.compiler.core.common.calc.CanonicalCondition) Value(jdk.vm.ci.meta.Value) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) JavaConstant(jdk.vm.ci.meta.JavaConstant) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) LIRKind(org.graalvm.compiler.core.common.LIRKind) LabelRef(org.graalvm.compiler.lir.LabelRef) MatchRule(org.graalvm.compiler.core.match.MatchRule)

Aggregations

SPARCAddressValue (org.graalvm.compiler.lir.sparc.SPARCAddressValue)8 Variable (org.graalvm.compiler.lir.Variable)4 LoadOp (org.graalvm.compiler.lir.sparc.SPARCMove.LoadOp)3 JavaConstant (jdk.vm.ci.meta.JavaConstant)2 LIRKind (org.graalvm.compiler.core.common.LIRKind)2 StoreOp (org.graalvm.compiler.lir.sparc.SPARCMove.StoreOp)2 RegisterValue (jdk.vm.ci.code.RegisterValue)1 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)1 Value (jdk.vm.ci.meta.Value)1 SPARCKind (jdk.vm.ci.sparc.SPARCKind)1 BYTE (jdk.vm.ci.sparc.SPARCKind.BYTE)1 HWORD (jdk.vm.ci.sparc.SPARCKind.HWORD)1 WORD (jdk.vm.ci.sparc.SPARCKind.WORD)1 XWORD (jdk.vm.ci.sparc.SPARCKind.XWORD)1 CanonicalCondition (org.graalvm.compiler.core.common.calc.CanonicalCondition)1 Condition (org.graalvm.compiler.core.common.calc.Condition)1 NodeMatchRules (org.graalvm.compiler.core.gen.NodeMatchRules)1 ComplexMatchResult (org.graalvm.compiler.core.match.ComplexMatchResult)1 MatchRule (org.graalvm.compiler.core.match.MatchRule)1 GraalError (org.graalvm.compiler.debug.GraalError)1