Search in sources :

Example 21 with LLVMTypeRef

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);
}
Also used : LLVMTypeRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef)

Example 22 with LLVMTypeRef

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);
}
Also used : LLVM(com.oracle.svm.shadowed.org.bytedeco.llvm.global.LLVM) LLVMTypeRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef)

Example 23 with LLVMTypeRef

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);
}
Also used : LLVMValueRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef) LLVMTypeRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef)

Example 24 with LLVMTypeRef

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));
}
Also used : LLVMTypeRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef)

Example 25 with LLVMTypeRef

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);
    }
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) DirectCallTargetNode(org.graalvm.compiler.nodes.DirectCallTargetNode) LLVMValueRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef) IndirectCallTargetNode(org.graalvm.compiler.nodes.IndirectCallTargetNode) LLVMTypeRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef) ValueNode(org.graalvm.compiler.nodes.ValueNode) LoweredCallTargetNode(org.graalvm.compiler.nodes.LoweredCallTargetNode) DebugInfo(jdk.vm.ci.code.DebugInfo) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Aggregations

LLVMTypeRef (com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef)25 LLVMValueRef (com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef)15 InlineAssemblyConstraint (com.oracle.svm.core.graal.llvm.util.LLVMIRBuilder.InlineAssemblyConstraint)5 LLVMBasicBlockRef (com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMBasicBlockRef)4 LLVMKind (com.oracle.svm.core.graal.llvm.util.LLVMUtils.LLVMKind)3 LLVMPendingSpecialRegisterRead (com.oracle.svm.core.graal.llvm.util.LLVMUtils.LLVMPendingSpecialRegisterRead)3 LLVMVariable (com.oracle.svm.core.graal.llvm.util.LLVMUtils.LLVMVariable)3 RegisterValue (jdk.vm.ci.code.RegisterValue)3 Value (jdk.vm.ci.meta.Value)3 ValueNode (org.graalvm.compiler.nodes.ValueNode)3 SpecialRegister (com.oracle.svm.core.graal.llvm.LLVMGenerator.SpecialRegister)2 LLVMIRBuilder (com.oracle.svm.core.graal.llvm.util.LLVMIRBuilder)2 LLVMValueWrapper (com.oracle.svm.core.graal.llvm.util.LLVMUtils.LLVMValueWrapper)2 DebugInfo (jdk.vm.ci.code.DebugInfo)2 PlatformKind (jdk.vm.ci.meta.PlatformKind)2 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)2 LIRFrameState (org.graalvm.compiler.lir.LIRFrameState)2 FrameAccess (com.oracle.svm.core.FrameAccess)1 ReservedRegisters (com.oracle.svm.core.ReservedRegisters)1 SubstrateOptions (com.oracle.svm.core.SubstrateOptions)1