[cfe-dev] thoughts about n-bit bytes for clang/llvm

Ray Fix rayfix.ml at gmail.com
Tue Sep 8 14:32:54 PDT 2009

On Sep 4, 2009, at 1:35 PM, me22 wrote:
> 2009/9/4 Ray Fix <rayfix.ml at gmail.com>:
>> On Sep 4, 2009, at 11:19 AM, me22 wrote:
>>> 2009/9/4 Ray Fix <rayfix.ml at gmail.com>:
>>>> Do these changes seem reasonable to pursue?  What other things  
>>>> are broken
>>>> in
>>>> Clang and LLVM by changing the assumption about 8-bit bytes?
>>> Bitter Melon appears to use i8* to implement void*, so you might
>>> consider whether or how that should change.  (It might be handled
>>> better by clang than gcc, though.)
>> Interesting point.  On IRC the other day nlewycky mentioned a type  
>> like i3*
>> would use the architecture's smallest word size so I might be able  
>> to get
>> away with doing very little.  I like the idea of making void*  
>> depend on the
>> architecture, which would be i16* in my case and i8* in all others
>> (currently).  It just seems cleaner.  I guess I need to give a hard  
>> look to
>> TargetData, which someone else on IRC was telling me (his nick is  
>> currently
>> escaping me).
> I'm curious why "void*" doesn't translate to "{}*", myself, as I think
> that fits better.  I suppose you also need to figure out the semantics
> of the align annotations with different byte sizes.

I think the reason might be because internally the SizeOfPointee that  
is getting passed around as 1 in some cases to handle GNU void* and  
function pointer arithmetic extensions.  At least that is what the  
code seems to say.  See ExprConstant.cpp:357.  I am guessing there  
would be lots of breakage if you set SizeOfPointee to, say, 0 here.   
Of course there are others on this list that know much better than  
I.    I will just be happy when I can get void* to point an i16   
(*sigh*  Still working on it.)

Anyway, I'm having fun and learning a little bit each day.


More information about the cfe-dev mailing list