[cfe-dev] Fwd: "generic" address space

Mon P Wang wangmp at apple.com
Tue Jul 15 08:50:19 PDT 2008


Hi,

I took a look at what __buildin_shufflevector does.  In that case, it  
enforces more rules than the type system allow after checking the  
call.  In that vein, what I could do instead of using this weird type  
is in ActOnCallExpr,when checking the arguments of an intrinsic call,  
instead of calling
    CheckSingleAssignmentConstraints
I could call my own version, e.g., CheckBuiltinAssignmentConstraints  
that will allow mismatches between address spaces to go through.  How  
does that sound?

   -- Mon Ping



>> From: Mon P Wang <wangmp at apple.com>
>> Date: July 14, 2008 11:22:42 PM PDT
>> To: Eli Friedman <eli.friedman at gmail.com>
>> Subject: Re: [cfe-dev] "generic" address space
>>
>> Hi Eli,
>>
>> On Jul 14, 2008, at 10:46 PM, Eli Friedman wrote:
>>
>>> 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.
>>
>> What you suggest sounds like a reasonable alternative.  I'll take a  
>> look into doing it this way for any built-in of this flavor.
>>
>>
>>>> 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.
>>
>> Sure no problem.
>>
>>
>> Thanks,
>>  -- Mon Ping
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080715/9d806929/attachment.html>


More information about the cfe-dev mailing list