Displaying 2 results from an estimated 2 matches for "nativefunc".
Did you mean:
native_funcs
2009 Mar 08
2
[LLVMdev] Creating Pointer Constants
...Constant* constInt = llvm::ConstantInt::get(llvm::Type::Int64Ty,
(int64)thePointer);
llvm::Value* constPtr = llvm::ConstantExpr::getIntToPtr(constInt,
llvm::PointerType::getUnqual(llvm::Type::Int32Ty));
builder.CreateCall(my_function, constPtr);
The resulting IR call looks like this:
call void @nativeFunc(i32* inttoptr (i64 146876396 to i32*))
I'm just wondering if there is a better way to approach this. Casting a
pointer to a signed integer and back to a pointer looks both hack-ish, and
potentially risky (what happens if the address falls in the negative range
of the signed integer?). Unfortun...
2009 Mar 11
0
[LLVMdev] Creating Pointer Constants
...(llvm::Type::Int64Ty,
> (int64)thePointer);
> llvm::Value* constPtr = llvm::ConstantExpr::getIntToPtr(constInt,
> llvm::PointerType::getUnqual(llvm::Type::Int32Ty));
>
> builder.CreateCall(my_function, constPtr);
>
> The resulting IR call looks like this:
>
> call void @nativeFunc(i32* inttoptr (i64 146876396 to i32*))
This is correct.
> I'm just wondering if there is a better way to approach this.
> Casting a
> pointer to a signed integer and back to a pointer looks both hack-
> ish, and
> potentially risky (what happens if the address falls in the n...