[llvm-dev] [RFC] Requiring explicit address space arguments for PointerType

Chris Lattner via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 27 18:02:52 PDT 2020


On Jul 27, 2020, at 2:55 AM, Alexander Richardson <Alexander.Richardson at cl.cam.ac.uk> wrote:
> 
> Hi Chris,
> 
> While I'd love to simply remove the "= 0" parameter immediately, there
> are (after my initial patch to remove if from llvm/IR) currently at
> least 275 uses of getPointerTo() and 195 PointerType::getUnqual().
> Unfortunately, it's not always obvious what the right address space
> should be. Should it be a pointer to code/globals/the stack?
> 
> The reason I used the ugly LLVM_DEFAULT_AS_PARAM approach is so that I
> can incrementally remove those uses from certain directories and
> prevent new uses from being added.
> Preventing new uses is extremely important for our downstream fork,
> but not so much for most targets currently in upstream LLVM.

Makes sense.  The macro isn’t really appropriate for upstream, but I can see how it is super useful for your purposes.

> 
> Therefore, I will remove the =0 locally and submit incremental patches
> to remove those uses instead of using the LLVM_DEFAULT_AS_PARAM
> approach.

This is a great approach.

> Hopefully there won't be many new uses of the old APIs being added in
> the meantime.
> Once this is complete I'll add new deprecated overloads that still
> have the =0, to allow gradual migration for downstreams and remove
> them after a few weeks/months/when the next release branch is created.
> Does that sound like a better approach?

Yes, this sounds awesome.  Thank you Alexander!

-Chris


More information about the llvm-dev mailing list