[llvm-dev] Setters for `addrspace`?
Manuel Jacob via llvm-dev
llvm-dev at lists.llvm.org
Sun Oct 15 09:30:42 PDT 2017
Hi Siddharth,
The addrspace is a property of pointer types, not of instructions. But
types are immutable. And if I'm not mistaken you can't change the
target type of a CastInst. To set the addrspace of the target type of a
CastInst, you have to create a new pointer type with the desired
addrspace and create a new CastInst with this type as the target type.
You may want to `replaceUsesOfWith` the old with the new instruction and
/ or delete the old instruction as well.
-Manuel
On 2017-10-14 00:54, (IIIT) Siddharth Bhat via llvm-dev wrote:
> Hello all,
>
> I've found the need to fixup address spaces in some code I'm writing.
> I'm
> puzzled by the fact that there are no setters for `addrspace`: For
> example,
> in GetElementPtrInst's API, or in `CastInst` and its subclasses.
>
> I believe there is some rationale for this I'm missing. Could someone
> please fill me in?
>
> Cheers,
> ~Siddharth.
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
More information about the llvm-dev
mailing list