[LLVMdev] Proposal: New IR instruction for casting between address spaces

Chris Lattner clattner at apple.com
Thu Sep 13 16:54:36 PDT 2012


On Sep 13, 2012, at 2:26 PM, "Villmow, Micah" <Micah.Villmow at amd.com> wrote:
>>> The problem with using ptrtoint and inttoptr is that one has to pick
>> an intermediate integer type that is safe to convert to and from.
>> Since the pointer size is target dependent, it seems unnatural to use
>> ptrtoint and inttoptr for that.
>> 
>> If we were to add first class support for this, we'd have to add three
>> new instructions: trunc_ptr, sext_ptr, and zext_ptr, all of which would
>> be used for pointer to pointer conversions.
> [Villmow, Micah] Would we really need to add pointer specific versions for these?

Yes.

> Or could we as an alternative allow sext/zext/trunc to work on pointer types?

No.

-Chris




More information about the llvm-dev mailing list