Search in sources :

Example 96 with Variable

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

the class SaveCalleeSaveRegisters method run.

@Override
protected void run(TargetDescription target, LIRGenerationResult lirGenRes, PreAllocationOptimizationContext context) {
    RegisterArray calleeSaveRegisters = lirGenRes.getRegisterConfig().getCalleeSaveRegisters();
    if (calleeSaveRegisters == null || calleeSaveRegisters.size() == 0) {
        return;
    }
    LIR lir = lirGenRes.getLIR();
    RegisterMap<Variable> savedRegisters = saveAtEntry(lir, context.lirGen, lirGenRes, calleeSaveRegisters, target.arch);
    for (AbstractBlockBase<?> block : lir.codeEmittingOrder()) {
        if (block == null) {
            continue;
        }
        if (block.getSuccessorCount() == 0) {
            restoreAtExit(lir, context.lirGen.getSpillMoveFactory(), lirGenRes, savedRegisters, block);
        }
    }
}
Also used : Variable(org.graalvm.compiler.lir.Variable) LIR(org.graalvm.compiler.lir.LIR) RegisterArray(jdk.vm.ci.code.RegisterArray)

Example 97 with Variable

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

the class SPARCArithmeticLIRGenerator method emitLoad.

@Override
public Variable emitLoad(LIRKind kind, Value address, LIRFrameState state) {
    SPARCAddressValue loadAddress = getLIRGen().asAddressValue(address);
    Variable result = getLIRGen().newVariable(getLIRGen().toRegisterKind(kind));
    getLIRGen().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 98 with Variable

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

the class SPARCArithmeticLIRGenerator method emitBinary.

private Variable emitBinary(ValueKind<?> resultKind, Opfs opf, Value a, Value b, LIRFrameState state) {
    Variable result = getLIRGen().newVariable(resultKind);
    getLIRGen().append(new SPARCOPFOp(opf, getLIRGen().asAllocatable(a), getLIRGen().asAllocatable(b), result, state));
    return result;
}
Also used : SPARCOPFOp(org.graalvm.compiler.lir.sparc.SPARCOPFOp) Variable(org.graalvm.compiler.lir.Variable)

Example 99 with Variable

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

the class SPARCArithmeticLIRGenerator method emitMul.

@Override
public Variable emitMul(Value a, Value b, boolean setFlags) {
    LIRKind resultKind = LIRKind.combine(a, b);
    PlatformKind aKind = a.getPlatformKind();
    if (isNumericInteger(aKind)) {
        if (setFlags) {
            Variable result = getLIRGen().newVariable(LIRKind.combine(a, b));
            if (aKind == XWORD) {
                getLIRGen().append(new SPARCLMulccOp(result, getLIRGen().load(a), getLIRGen().load(b), getLIRGen()));
            } else if (aKind == WORD) {
                getLIRGen().append(new SPARCIMulccOp(result, getLIRGen().load(a), getLIRGen().load(b)));
            } else {
                throw GraalError.shouldNotReachHere();
            }
            return result;
        } else {
            return emitBinary(resultKind, Op3s.Mulx, a, b);
        }
    } else {
        boolean isDouble = a.getPlatformKind().equals(DOUBLE);
        return emitBinary(resultKind, isDouble ? Fmuld : Fmuls, a, b);
    }
}
Also used : Variable(org.graalvm.compiler.lir.Variable) LIRKind(org.graalvm.compiler.core.common.LIRKind) PlatformKind(jdk.vm.ci.meta.PlatformKind) SPARCIMulccOp(org.graalvm.compiler.lir.sparc.SPARCArithmetic.SPARCIMulccOp) SPARCLMulccOp(org.graalvm.compiler.lir.sparc.SPARCArithmetic.SPARCLMulccOp)

Example 100 with Variable

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

the class SPARCArithmeticLIRGenerator method emitBitCount.

@Override
public Variable emitBitCount(Value operand) {
    Variable result = getLIRGen().newVariable(LIRKind.combine(operand).changeType(SPARCKind.WORD));
    AllocatableValue usedOperand = getLIRGen().asAllocatable(emitZeroExtend(operand));
    getLIRGen().append(new SPARCOP3Op(Op3s.Popc, g0.asValue(), usedOperand, result));
    return result;
}
Also used : Variable(org.graalvm.compiler.lir.Variable) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) SPARCOP3Op(org.graalvm.compiler.lir.sparc.SPARCOP3Op)

Aggregations

Variable (org.graalvm.compiler.lir.Variable)113 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)27 LIRKind (org.graalvm.compiler.core.common.LIRKind)19 RegisterValue (jdk.vm.ci.code.RegisterValue)11 Value (jdk.vm.ci.meta.Value)11 Register (jdk.vm.ci.code.Register)10 AMD64Unary (org.graalvm.compiler.lir.amd64.AMD64Unary)9 AMD64Binary (org.graalvm.compiler.lir.amd64.AMD64Binary)8 SPARCAddressValue (org.graalvm.compiler.lir.sparc.SPARCAddressValue)8 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)7 AMD64AddressValue (org.graalvm.compiler.lir.amd64.AMD64AddressValue)7 SPARCKind (jdk.vm.ci.sparc.SPARCKind)6 ConstantValue (org.graalvm.compiler.lir.ConstantValue)6 JavaConstant (jdk.vm.ci.meta.JavaConstant)5 PlatformKind (jdk.vm.ci.meta.PlatformKind)5 LIRFrameState (org.graalvm.compiler.lir.LIRFrameState)5 LIRValueUtil.asJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.asJavaConstant)5 LIRValueUtil.isJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant)5 AMD64MathIntrinsicUnaryOp (org.graalvm.compiler.lir.amd64.AMD64MathIntrinsicUnaryOp)5 AMD64Move (org.graalvm.compiler.lir.amd64.AMD64Move)5