use of com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef in project graal by oracle.
the class LLVMIRBuilder method buildClearCache.
public void buildClearCache(LLVMValueRef start, LLVMValueRef end) {
LLVMTypeRef clearCacheType = functionType(voidType(), rawPointerType(), rawPointerType());
buildIntrinsicCall("llvm.clear_cache", clearCacheType, start, end);
}
use of com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef in project graal by oracle.
the class LLVMIRBuilder method buildIntrinsicOp.
private LLVMValueRef buildIntrinsicOp(String name, LLVMTypeRef retType, LLVMValueRef... args) {
String intrinsicName = "llvm." + name + "." + intrinsicType(retType);
LLVMTypeRef intrinsicType = functionType(retType, Arrays.stream(args).map(LLVM::LLVMTypeOf).toArray(LLVMTypeRef[]::new));
return buildIntrinsicCall(intrinsicName, intrinsicType, args);
}
use of com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef in project graal by oracle.
the class LLVMIRBuilder method buildAtomicRMW.
private LLVMValueRef buildAtomicRMW(int operation, LLVMValueRef address, LLVMValueRef value) {
LLVMTypeRef valueType = LLVM.LLVMTypeOf(value);
LLVMValueRef castedAddress = buildBitcast(address, pointerType(valueType, isObjectType(typeOf(address)), false));
boolean singleThread = !SubstrateOptions.MultiThreaded.getValue();
return LLVM.LLVMBuildAtomicRMW(builder, operation, castedAddress, value, LLVM.LLVMAtomicOrderingMonotonic, singleThread ? TRUE : FALSE);
}
use of com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef in project graal by oracle.
the class LLVMIRBuilder method buildPrefetch.
public void buildPrefetch(LLVMValueRef address) {
LLVMTypeRef prefetchType = functionType(voidType(), LLVM.LLVMTypeOf(address), intType(), intType(), intType());
/* llvm.prefetch(address, WRITE, NO_LOCALITY, DATA) */
buildIntrinsicCall("llvm.prefetch", prefetchType, address, constantInt(1), constantInt(0), constantInt(1));
}
use of com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef in project graal by oracle.
the class NodeLLVMBuilder method emitInvoke.
/* Invoke */
@Override
public void emitInvoke(Invoke i) {
LoweredCallTargetNode callTarget = (LoweredCallTargetNode) i.callTarget();
ResolvedJavaMethod targetMethod = callTarget.targetMethod();
NodeInputList<ValueNode> arguments = callTarget.arguments();
LIRFrameState state = state(i);
state.initDebugInfo(null, false);
DebugInfo debugInfo = state.debugInfo();
LLVMValueRef callee;
boolean isVoid;
LLVMValueRef[] args = getCallArguments(arguments, callTarget.callType());
long patchpointId = LLVMGenerator.nextPatchpointId.getAndIncrement();
if (callTarget instanceof DirectCallTargetNode) {
callee = gen.getFunction(targetMethod);
isVoid = gen.isVoidReturnType(gen.getLLVMFunctionReturnType(targetMethod, false));
gen.getCompilationResult().recordCall(NumUtil.safeToInt(patchpointId), 0, targetMethod, debugInfo, true);
} else if (callTarget instanceof IndirectCallTargetNode) {
LLVMValueRef computedAddress = llvmOperand(((IndirectCallTargetNode) callTarget).computedAddress());
LLVMTypeRef functionType;
if (targetMethod != null) {
functionType = gen.getLLVMFunctionPointerType(targetMethod);
isVoid = gen.isVoidReturnType(gen.getLLVMFunctionReturnType(targetMethod, false));
} else {
LLVMTypeRef returnType = getUnknownCallReturnType(callTarget);
isVoid = gen.isVoidReturnType(returnType);
LLVMTypeRef[] argTypes = getUnknownCallArgumentTypes(callTarget);
assert args.length == argTypes.length;
functionType = builder.functionPointerType(returnType, argTypes);
}
if (LLVMIRBuilder.isObjectType(LLVMIRBuilder.typeOf(computedAddress))) {
callee = builder.buildBitcast(builder.buildAddrSpaceCast(computedAddress, builder.rawPointerType()), functionType);
} else {
callee = builder.buildIntToPtr(computedAddress, functionType);
}
gen.getCompilationResult().recordCall(NumUtil.safeToInt(patchpointId), 0, targetMethod, debugInfo, false);
gen.getDebugInfoPrinter().printIndirectCall(targetMethod, callee);
} else {
throw shouldNotReachHere();
}
LLVMValueRef call = emitCall(i, callTarget, callee, patchpointId, args);
if (!isVoid) {
setResult(i.asNode(), call);
}
}
Aggregations