use of org.graalvm.compiler.lir.Variable in project graal by oracle.
the class AMD64HotSpotLIRGenerator method emitLoadObjectAddress.
@Override
public Value emitLoadObjectAddress(Constant constant) {
HotSpotObjectConstant objectConstant = (HotSpotObjectConstant) constant;
LIRKind kind = objectConstant.isCompressed() ? getLIRKindTool().getNarrowOopKind() : getLIRKindTool().getObjectKind();
Variable result = newVariable(kind);
append(new AMD64HotSpotLoadAddressOp(result, constant, HotSpotConstantLoadAction.RESOLVE));
return result;
}
use of org.graalvm.compiler.lir.Variable in project graal by oracle.
the class AMD64HotSpotLIRGenerator method emitForeignCall.
@Override
public Variable emitForeignCall(ForeignCallLinkage linkage, LIRFrameState state, Value... args) {
HotSpotForeignCallLinkage hotspotLinkage = (HotSpotForeignCallLinkage) linkage;
boolean destroysRegisters = hotspotLinkage.destroysRegisters();
AMD64SaveRegistersOp save = null;
Stub stub = getStub();
if (destroysRegisters) {
if (stub != null && stub.preservesRegisters()) {
Register[] savedRegisters = getRegisterConfig().getAllocatableRegisters().toArray();
save = emitSaveAllRegisters(savedRegisters, true);
}
}
Variable result;
LIRFrameState debugInfo = null;
if (hotspotLinkage.needsDebugInfo()) {
debugInfo = state;
assert debugInfo != null || stub != null;
}
if (hotspotLinkage.needsJavaFrameAnchor()) {
Register thread = getProviders().getRegisters().getThreadRegister();
append(new AMD64HotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), thread));
result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
append(new AMD64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), config.threadLastJavaPcOffset(), thread));
} else {
result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
}
if (destroysRegisters) {
if (stub != null) {
if (stub.preservesRegisters()) {
HotSpotLIRGenerationResult generationResult = getResult();
LIRFrameState key = currentRuntimeCallInfo;
if (key == null) {
key = LIRFrameState.NO_STATE;
}
assert !generationResult.getCalleeSaveInfo().containsKey(key);
generationResult.getCalleeSaveInfo().put(key, save);
emitRestoreRegisters(save);
}
}
}
return result;
}
use of org.graalvm.compiler.lir.Variable in project graal by oracle.
the class AMD64HotSpotMaths method emitCos.
@Override
public Variable emitCos(LIRGenerator gen, Value input) {
if (GraalArithmeticStubs.getValue(gen.getResult().getLIR().getOptions())) {
return null;
}
Variable result = gen.newVariable(LIRKind.combine(input));
gen.append(new AMD64HotSpotMathIntrinsicOp(COS, result, gen.asAllocatable(input)));
return result;
}
use of org.graalvm.compiler.lir.Variable in project graal by oracle.
the class AMD64HotSpotMaths method emitTan.
@Override
public Variable emitTan(LIRGenerator gen, Value input) {
if (GraalArithmeticStubs.getValue(gen.getResult().getLIR().getOptions())) {
return null;
}
Variable result = gen.newVariable(LIRKind.combine(input));
gen.append(new AMD64HotSpotMathIntrinsicOp(TAN, result, gen.asAllocatable(input)));
return result;
}
use of org.graalvm.compiler.lir.Variable in project graal by oracle.
the class AArch64HotSpotLIRGenerator method emitForeignCall.
@Override
public Variable emitForeignCall(ForeignCallLinkage linkage, LIRFrameState state, Value... args) {
HotSpotForeignCallLinkage hotspotLinkage = (HotSpotForeignCallLinkage) linkage;
Variable result;
LIRFrameState debugInfo = null;
if (hotspotLinkage.needsDebugInfo()) {
debugInfo = state;
assert debugInfo != null || getStub() != null;
}
if (linkage.destroysRegisters() || hotspotLinkage.needsJavaFrameAnchor()) {
HotSpotRegistersProvider registers = getProviders().getRegisters();
Register thread = registers.getThreadRegister();
Variable scratch = newVariable(LIRKind.value(target().arch.getWordKind()));
// We need a label for the return address.
label = new Label();
append(new AArch64HotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), config.threadLastJavaPcOffset(), config.threadLastJavaFpOffset(), thread, scratch, label));
result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
append(new AArch64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), thread));
// Clear it out so it's not being reused later.
label = null;
} else {
result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
}
return result;
}
Aggregations