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);
}
}
}
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;
}
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;
}
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);
}
}
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;
}
Aggregations