[cfe-dev] "generic" address space

Eli Friedman eli.friedman at gmail.com
Mon Jul 14 22:46:58 PDT 2008

On Mon, Jul 14, 2008 at 10:21 PM, Mon P Wang <wangmp at apple.com> wrote:
> To generate this in Clang, I didn't want to require the user to have
> to specify what specific address spaces a builtin can take, especially
> if the intrinsic is supported on the address space for a particular
> machine.  So, I added the concept to ASQualType the concept of a
> "generic" address space that can be used in the parameter type of a
> function prototype.   This concept is used when we checking to see if
> an argument and a parameter type are compatible.

I don't really like this approach: you're introducing a fake type that
isn't actually usable by user code, which seems messy at best.  I
think it would be better to handle this like __builtin_shufflevector,
where typechecking gets done by a custom validator.

> I'm also going to change clang to generate an error if the compiler
> needs to do an implicit cast between to pointers pointing at different
> address spaces.  Typically, this operation doesn't make sense.  Note
> that users can still do explicit cast between address spaces.

I think that's fine; of course, please submit this patch separately.


More information about the cfe-dev mailing list