Search in sources :

Example 11 with LLVMTypeRef

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

the class LLVMIRBuilder method buildBinaryNumberOp.

private LLVMValueRef buildBinaryNumberOp(LLVMValueRef a, LLVMValueRef b, BinaryBuilder integerBuilder, BinaryBuilder realBuilder) {
    LLVMTypeRef aType = LLVM.LLVMTypeOf(a);
    LLVMTypeRef bType = LLVM.LLVMTypeOf(b);
    assert compatibleTypes(aType, bType) : dumpValues("invalid binary operation arguments", a, b);
    BinaryBuilder binaryBuilder;
    switch(LLVM.LLVMGetTypeKind(aType)) {
        case LLVM.LLVMIntegerTypeKind:
            binaryBuilder = integerBuilder;
            break;
        case LLVM.LLVMFloatTypeKind:
        case LLVM.LLVMDoubleTypeKind:
            binaryBuilder = realBuilder;
            break;
        default:
            throw shouldNotReachHere(dumpValues("invalid binary operation arguments", a, b));
    }
    return binaryBuilder.build(builder, a, b, DEFAULT_INSTR_NAME);
}
Also used : LLVMTypeRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef)

Example 12 with LLVMTypeRef

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

the class LLVMIRBuilder method buildCompare.

public LLVMValueRef buildCompare(Condition cond, LLVMValueRef a, LLVMValueRef b, boolean unordered) {
    LLVMTypeRef aType = LLVM.LLVMTypeOf(a);
    LLVMTypeRef bType = LLVM.LLVMTypeOf(b);
    assert compatibleTypes(aType, bType) : dumpTypes("comparison", aType, bType);
    switch(LLVM.LLVMGetTypeKind(aType)) {
        case LLVM.LLVMIntegerTypeKind:
        case LLVM.LLVMPointerTypeKind:
            return buildICmp(cond, a, b);
        case LLVM.LLVMFloatTypeKind:
        case LLVM.LLVMDoubleTypeKind:
            return buildFCmp(cond, a, b, unordered);
        default:
            throw shouldNotReachHere(dumpTypes("comparison", aType, bType));
    }
}
Also used : LLVMTypeRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef)

Example 13 with LLVMTypeRef

use of com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef 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)

Example 14 with LLVMTypeRef

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

the class LLVMIRBuilder method buildNeg.

public LLVMValueRef buildNeg(LLVMValueRef a) {
    LLVMTypeRef type = LLVM.LLVMTypeOf(a);
    UnaryBuilder unaryBuilder;
    switch(LLVM.LLVMGetTypeKind(type)) {
        case LLVM.LLVMIntegerTypeKind:
            unaryBuilder = LLVM::LLVMBuildNeg;
            break;
        case LLVM.LLVMFloatTypeKind:
        case LLVM.LLVMDoubleTypeKind:
            unaryBuilder = LLVM::LLVMBuildFNeg;
            break;
        default:
            throw shouldNotReachHere(dumpTypes("invalid negation type", type));
    }
    return unaryBuilder.build(builder, a, DEFAULT_INSTR_NAME);
}
Also used : LLVM(com.oracle.svm.shadowed.org.bytedeco.llvm.global.LLVM) LLVMTypeRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef)

Example 15 with LLVMTypeRef

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

the class LLVMHelperFunctions method buildObjectsCmpxchgFunction.

private LLVMValueRef buildObjectsCmpxchgFunction(boolean compressed, MemoryOrderMode memoryOrder, boolean returnsValue) {
    String funcName = compressed ? returnsValue ? COMPRESSED_OBJECTS_VALUE_CMPXCHG_FUNCTION_NAME : COMPRESSED_OBJECTS_LOGIC_CMPXCHG_FUNCTION_NAME : returnsValue ? OBJECTS_VALUE_CMPXCHG_FUNCTION_NAME : OBJECTS_LOGIC_CMPXCHG_FUNCTION_NAME;
    LLVMTypeRef exchangeType = builder.objectType(compressed);
    LLVMValueRef func = builder.addFunction(funcName, builder.functionType(returnsValue ? exchangeType : builder.booleanType(), builder.pointerType(exchangeType, true, false), exchangeType, exchangeType));
    LLVMIRBuilder.setLinkage(func, LinkageType.LinkOnce);
    builder.setFunctionAttribute(func, Attribute.AlwaysInline);
    builder.setFunctionAttribute(func, Attribute.GCLeafFunction);
    LLVMBasicBlockRef block = builder.appendBasicBlock(func, "main");
    builder.positionAtEnd(block);
    LLVMValueRef addr = LLVMIRBuilder.getParam(func, 0);
    LLVMValueRef expected = LLVMIRBuilder.getParam(func, 1);
    LLVMValueRef newVal = LLVMIRBuilder.getParam(func, 2);
    LLVMValueRef result = builder.buildAtomicCmpXchg(addr, expected, newVal, memoryOrder, returnsValue);
    builder.buildRet(result);
    return func;
}
Also used : LLVMBasicBlockRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMBasicBlockRef) LLVMValueRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMValueRef) LLVMTypeRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef)

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