Search in sources :

Example 6 with AllocatableValue

use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.

the class AMD64HotSpotLIRGenerator method emitCompress.

@Override
public Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull) {
    LIRKind inputKind = pointer.getValueKind(LIRKind.class);
    LIRKindTool lirKindTool = getLIRKindTool();
    assert inputKind.getPlatformKind() == lirKindTool.getObjectKind().getPlatformKind();
    if (inputKind.isReference(0)) {
        // oop
        Variable result = newVariable(lirKindTool.getNarrowOopKind());
        append(new AMD64Move.CompressPointerOp(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull, getLIRKindTool()));
        return result;
    } else {
        // metaspace pointer
        Variable result = newVariable(lirKindTool.getNarrowPointerKind());
        AllocatableValue base = Value.ILLEGAL;
        OptionValues options = getResult().getLIR().getOptions();
        if (encoding.hasBase() || GeneratePIC.getValue(options)) {
            if (GeneratePIC.getValue(options)) {
                Variable baseAddress = newVariable(lirKindTool.getWordKind());
                AMD64HotSpotMove.BaseMove move = new AMD64HotSpotMove.BaseMove(baseAddress, config);
                append(move);
                base = baseAddress;
            } else {
                base = emitLoadConstant(lirKindTool.getWordKind(), JavaConstant.forLong(encoding.getBase()));
            }
        }
        append(new AMD64Move.CompressPointerOp(result, asAllocatable(pointer), base, encoding, nonNull, getLIRKindTool()));
        return result;
    }
}
Also used : Variable(org.graalvm.compiler.lir.Variable) OptionValues(org.graalvm.compiler.options.OptionValues) LIRKindTool(org.graalvm.compiler.core.common.spi.LIRKindTool) LIRKind(org.graalvm.compiler.core.common.LIRKind) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) AMD64Move(org.graalvm.compiler.lir.amd64.AMD64Move)

Example 7 with AllocatableValue

use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.

the class FarReturnLoweredNode method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    LIRGeneratorTool lirGenTool = gen.getLIRGeneratorTool();
    AllocatableValue resultOperand = lirGenTool.resultOperandFor(result.getStackKind(), LIRKind.fromJavaKind(lirGenTool.target().arch, result.getStackKind()));
    lirGenTool.emitMove(resultOperand, gen.operand(result));
    ((SubstrateLIRGenerator) lirGenTool).emitFarReturn(resultOperand, gen.operand(sp), gen.operand(ip));
}
Also used : SubstrateLIRGenerator(com.oracle.svm.core.graal.code.SubstrateLIRGenerator) LIRGeneratorTool(org.graalvm.compiler.lir.gen.LIRGeneratorTool) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 8 with AllocatableValue

use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.

the class HotSpotZapRegistersPhase method run.

@Override
protected void run(TargetDescription target, LIRGenerationResult lirGenRes, PostAllocationOptimizationContext context) {
    Stub stub = ((HotSpotLIRGenerationResult) lirGenRes).getStub();
    boolean zapRegisters = stub != null && !stub.preservesRegisters();
    boolean zapStack = false;
    for (AllocatableValue arg : lirGenRes.getCallingConvention().getArguments()) {
        if (isStackSlot(arg)) {
            zapStack = true;
            break;
        }
    }
    if (zapRegisters || zapStack) {
        LIR lir = lirGenRes.getLIR();
        processLIR(context.diagnosticLirGenTool, (HotSpotLIRGenerationResult) lirGenRes, lir, zapRegisters, zapStack);
    }
}
Also used : LIR(org.graalvm.compiler.lir.LIR) HotSpotLIRGenerationResult(org.graalvm.compiler.hotspot.HotSpotLIRGenerationResult) Stub(org.graalvm.compiler.hotspot.stubs.Stub) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 9 with AllocatableValue

use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.

the class GetObjectAddressNode method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    AllocatableValue obj = gen.getLIRGeneratorTool().newVariable(LIRKind.unknownReference(gen.getLIRGeneratorTool().target().arch.getWordKind()));
    gen.getLIRGeneratorTool().emitMove(obj, gen.operand(object));
    gen.setResult(this, obj);
}
Also used : AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 10 with AllocatableValue

use of jdk.vm.ci.meta.AllocatableValue in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitShift.

private Variable emitShift(AMD64Shift op, OperandSize size, Value a, Value b) {
    Variable result = getLIRGen().newVariable(LIRKind.combine(a, b).changeType(a.getPlatformKind()));
    AllocatableValue input = getLIRGen().asAllocatable(a);
    if (isJavaConstant(b)) {
        JavaConstant c = asJavaConstant(b);
        if (c.asLong() == 1) {
            getLIRGen().append(new AMD64Unary.MOp(op.m1Op, size, result, input));
        } else {
            /*
                 * c is implicitly masked to 5 or 6 bits by the CPU, so casting it to (int) is
                 * always correct, even without the NumUtil.is32bit() test.
                 */
            getLIRGen().append(new AMD64Binary.ConstOp(op.miOp, size, result, input, (int) c.asLong()));
        }
    } else {
        getLIRGen().emitMove(RCX_I, b);
        getLIRGen().append(new AMD64ShiftOp(op.mcOp, size, result, input, RCX_I));
    }
    return result;
}
Also used : AMD64Unary(org.graalvm.compiler.lir.amd64.AMD64Unary) Variable(org.graalvm.compiler.lir.Variable) AMD64Binary(org.graalvm.compiler.lir.amd64.AMD64Binary) AMD64ShiftOp(org.graalvm.compiler.lir.amd64.AMD64ShiftOp) JavaConstant(jdk.vm.ci.meta.JavaConstant) LIRValueUtil.asJavaConstant(org.graalvm.compiler.lir.LIRValueUtil.asJavaConstant) LIRValueUtil.isJavaConstant(org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Aggregations

AllocatableValue (jdk.vm.ci.meta.AllocatableValue)87 Value (jdk.vm.ci.meta.Value)22 Variable (org.graalvm.compiler.lir.Variable)20 LIRKind (org.graalvm.compiler.core.common.LIRKind)13 LIRInstruction (org.graalvm.compiler.lir.LIRInstruction)11 Indent (org.graalvm.compiler.debug.Indent)10 RegisterValue (jdk.vm.ci.code.RegisterValue)9 ValueUtil.asAllocatableValue (jdk.vm.ci.code.ValueUtil.asAllocatableValue)8 DebugContext (org.graalvm.compiler.debug.DebugContext)8 Register (jdk.vm.ci.code.Register)6 JavaConstant (jdk.vm.ci.meta.JavaConstant)6 AMD64MathIntrinsicUnaryOp (org.graalvm.compiler.lir.amd64.AMD64MathIntrinsicUnaryOp)5 LIRValueUtil.asJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.asJavaConstant)4 LIRValueUtil.isJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant)4 ValueMoveOp (org.graalvm.compiler.lir.StandardOp.ValueMoveOp)4 ArithmeticLIRGenerator (org.graalvm.compiler.lir.gen.ArithmeticLIRGenerator)4 LIRGenerator (org.graalvm.compiler.lir.gen.LIRGenerator)4 SPARCAddressValue (org.graalvm.compiler.lir.sparc.SPARCAddressValue)4 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)3 ValueUtil.isAllocatableValue (jdk.vm.ci.code.ValueUtil.isAllocatableValue)3