[LLVMdev] Creating Pointer Constants
John McCall
rjmccall at apple.com
Wed Mar 11 11:04:07 PDT 2009
On Mar 11, 2009, at 6:03 AM, Gordon Henriksen wrote:
>> 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?).
If you're worried about sign extension, you could always case through
uintptr_t instead of int64. The LLVM target data holds the equivalent
LLVM type; if you're writing a JIT, you can do jitEngine-
>getTargetData()->getIntPtrType().
John.
More information about the llvm-dev
mailing list