Search in sources :

Example 16 with LLVMValueRef

use of com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef in project graal by oracle.

the class NodeLLVMBuilder method visitLoopEnd.

@Override
public void visitLoopEnd(LoopEndNode i) {
    LLVMBasicBlockRef[] basicBlocks = new LLVMBasicBlockRef[] { gen.getBlockEnd((Block) gen.getCurrentBlock()) };
    assert gen.getCurrentBlock().getSuccessorCount() == 1;
    for (SpecialRegister reg : SpecialRegister.registers()) {
        Block successor = ((Block) gen.getCurrentBlock()).getFirstSuccessor();
        LLVMValueRef phi = gen.getInitialSpecialRegisterValue(reg, successor);
        assert LLVM.LLVMGetInstructionOpcode(phi) == LLVM.LLVMPHI;
        builder.addIncoming(phi, new LLVMValueRef[] { gen.getSpecialRegisterValue(reg) }, basicBlocks);
    }
    for (ValuePhiNode phiNode : i.merge().valuePhis()) {
        LLVMValueRef phi = backwardsPhi.get(phiNode);
        LLVMValueRef value = llvmOperand(phiNode.valueAt(i));
        LLVMValueRef[] values = new LLVMValueRef[] { value };
        builder.addIncoming(phi, values, basicBlocks);
    }
}
Also used : LLVMBasicBlockRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMBasicBlockRef) ValuePhiNode(org.graalvm.compiler.nodes.ValuePhiNode) Block(org.graalvm.compiler.nodes.cfg.Block) LLVMValueRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef) SpecialRegister(com.oracle.svm.core.graal.llvm.LLVMGenerator.SpecialRegister)

Example 17 with LLVMValueRef

use of com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef in project graal by oracle.

the class NodeLLVMBuilder method emitCallInstruction.

private LLVMValueRef emitCallInstruction(Invoke invoke, boolean nativeABI, LLVMValueRef callee, long patchpointId, LLVMValueRef... args) {
    LLVMValueRef call;
    if (invoke instanceof InvokeWithExceptionNode) {
        InvokeWithExceptionNode invokeWithExceptionNode = (InvokeWithExceptionNode) invoke;
        LLVMBasicBlockRef successor = gen.getBlock(invokeWithExceptionNode.next());
        LLVMBasicBlockRef handler = gen.getBlock(invokeWithExceptionNode.exceptionEdge());
        call = gen.buildStatepointInvoke(callee, nativeABI, successor, handler, patchpointId, args);
    } else {
        call = gen.buildStatepointCall(callee, nativeABI, patchpointId, args);
    }
    return call;
}
Also used : LLVMBasicBlockRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMBasicBlockRef) InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) LLVMValueRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef)

Example 18 with LLVMValueRef

use of com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef in project graal by oracle.

the class LLVMIRBuilder method buildLoad.

public LLVMValueRef buildLoad(LLVMValueRef address, LLVMTypeRef type) {
    LLVMTypeRef addressType = LLVM.LLVMTypeOf(address);
    if (isObjectType(type) && !isObjectType(addressType)) {
        boolean compressed = isCompressedPointerType(type);
        return buildCall(helpers.getLoadObjectFromUntrackedPointerFunction(compressed), address);
    }
    LLVMValueRef castedAddress = buildBitcast(address, pointerType(type, isObjectType(addressType), false));
    return buildLoad(castedAddress);
}
Also used : LLVMValueRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef) LLVMTypeRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef)

Example 19 with LLVMValueRef

use of com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef in project graal by oracle.

the class LLVMIRBuilder method getExternalSymbol.

public LLVMValueRef getExternalSymbol(String name) {
    LLVMValueRef val = getGlobal(name);
    if (val == null) {
        val = LLVM.LLVMAddGlobalInAddressSpace(module, rawPointerType(), name, UNTRACKED_POINTER_ADDRESS_SPACE);
        setLinkage(val, LinkageType.External);
    }
    return val;
}
Also used : LLVMValueRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef)

Example 20 with LLVMValueRef

use of com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef in project graal by oracle.

the class LLVMIRBuilder method buildStackmap.

public void buildStackmap(LLVMValueRef patchpointId, LLVMValueRef... liveValues) {
    LLVMTypeRef stackmapType = functionType(voidType(), true, longType(), intType());
    LLVMValueRef[] allArgs = new LLVMValueRef[2 + liveValues.length];
    allArgs[0] = patchpointId;
    allArgs[1] = constantInt(0);
    System.arraycopy(liveValues, 0, allArgs, 2, liveValues.length);
    buildIntrinsicCall("llvm.experimental.stackmap", stackmapType, allArgs);
}
Also used : LLVMValueRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef) LLVMTypeRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef)

Aggregations

LLVMValueRef (com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef)51 LLVMBasicBlockRef (com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMBasicBlockRef)17 LLVMTypeRef (com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef)14 LLVMVariable (com.oracle.svm.core.graal.llvm.util.LLVMUtils.LLVMVariable)9 InlineAssemblyConstraint (com.oracle.svm.core.graal.llvm.util.LLVMIRBuilder.InlineAssemblyConstraint)7 Safepoint (com.oracle.svm.core.thread.Safepoint)4 SpecialRegister (com.oracle.svm.core.graal.llvm.LLVMGenerator.SpecialRegister)3 SubstrateCallingConventionType (com.oracle.svm.core.graal.code.SubstrateCallingConventionType)2 LLVMKind (com.oracle.svm.core.graal.llvm.util.LLVMUtils.LLVMKind)2 LLVMPendingSpecialRegisterRead (com.oracle.svm.core.graal.llvm.util.LLVMUtils.LLVMPendingSpecialRegisterRead)2 SafepointCheckNode (com.oracle.svm.core.nodes.SafepointCheckNode)2 DebugInfo (jdk.vm.ci.code.DebugInfo)2 RegisterValue (jdk.vm.ci.code.RegisterValue)2 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)2 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)2 Value (jdk.vm.ci.meta.Value)2 DirectCallTargetNode (org.graalvm.compiler.nodes.DirectCallTargetNode)2 IndirectCallTargetNode (org.graalvm.compiler.nodes.IndirectCallTargetNode)2 InvokeWithExceptionNode (org.graalvm.compiler.nodes.InvokeWithExceptionNode)2 LogicConstantNode (org.graalvm.compiler.nodes.LogicConstantNode)2