[cfe-dev] AST Representation of Conversions

Cédric Venet cedric.venet at laposte.net
Wed Jul 29 00:45:06 PDT 2009


>> CodeGen needs to distinguish:
>> - a raw bitcast (reinterpret_cast of pointers and pointer/integer  
>> pairs,
>> reinterpret_cast of lvalues to references)
>> - a floating point truncation (double -> float)
>> - a floating point extension (float -> double)
>> - an integer truncation (int -> short)
>> - an integer extension (short -> int)
>> - a static hierarchy cast without virtual bases (add an offset to the
>> pointer)
>> - a static hierarchy cast with virtual bases (fetch the pointer to the
>> virtual base, and then add an offset)
>> - a dynamic hierarchy cast (emit calls to support library)
>> - a user-defined conversion via constructor (call that constructor)
>> - a user-defined conversion via conversion operator (call that  
>> operator)
>> - a static hierarchy cast of a member object pointer (adjust the value
>> of that pointer)
>> - a static hierarchy cast of a member function pointer (I have no idea
>> how that works)
>> - function and array decay
>> - GCC aggregate casts in various forms
>> - vector and extvector casts
>> - Objective-C casts
>> I think that's everything. In short, CodeGen also cares about pretty
>> much everything.
>>     
>
> Quite an exhaustive list! I can't think of any you missed, except  
> perhaps "no-op" conversions that merely adjust types (e.g., by adding  
> qualifiers) and require no code generation.
>   

I don't see where floating point to integer conversion and integer to 
floating-point fit.




More information about the cfe-dev mailing list