Search in sources :

Example 1 with LLVM

use of com.oracle.svm.shadowed.org.bytedeco.llvm.global.LLVM 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 2 with LLVM

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

Aggregations

LLVMTypeRef (com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMTypeRef)2 LLVM (com.oracle.svm.shadowed.org.bytedeco.llvm.global.LLVM)2