[llvm-commits] Patch to update LLVM/Tools with getPointerTo getting multiple address space support

Villmow, Micah Micah.Villmow at amd.com
Thu Oct 25 08:01:28 PDT 2012



> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-
> bounces at cs.uiuc.edu] On Behalf Of Duncan Sands
> Sent: Thursday, October 25, 2012 7:50 AM
> To: llvm-commits at cs.uiuc.edu
> Subject: Re: [llvm-commits] Patch to update LLVM/Tools with getPointerTo
> getting multiple address space support
> 
> Hi Micah,
> 
> >> On Wed, Oct 24, 2012 at 2:43 PM, Villmow, Micah
> >> <Micah.Villmow at amd.com>
> >> wrote:
> >>> Here is a cleaned up version of the patch.
> >>
> >> +  /// getPointerTo - Return a pointer of the current type.
> >> +  PointerType *getPointerTo();
> >>
> >> I don't see why you're keeping this API around.
> > [Villmow, Micah] This is a new API that is used quite often to get a
> pointer to a type based on the type.
> > For example there is I32PtrTy->getPointerTo()->getPointerTo(). Without
> > this API, I would have to write,
> > I32PtrTy->getPointerTo(I32PtrTy)->getPointerTo()->(I32PtrTy). The
> > I32PtrTy->other two API's are only used if you want
> > to change the address space of the pointer and not use what is already
> there.
> 
> the problem is that thanks to this method you can accidentally forget
> the address space very easily.  If instead you eliminate the method and
> always require an address space then at least people will be forced to
> think about what the address space should be.  I'm also not convinced by
> your example, since you can always write I32PtrTy->getPointerTo(0)-
> >getPointerTo(0).
[Villmow, Micah] Ok, this will make some of the code more verbose, but I can remove it.
> 
> Ciao, Duncan.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits






More information about the llvm-commits mailing list