[llvm-commits] [llvm-gcc-4.2] r45757 - in /llvm-gcc-4.2/trunk/gcc: llvm-types.cpp tree.c tree.h

Dale Johannesen dalej at apple.com
Wed Jan 9 13:03:06 PST 2008


On Jan 9, 2008, at 12:43 PM, Duncan Sands wrote:

> Hi Dale, thanks for fixing this.
>
>> +/// FixBaseClassFields - alter the types referred to by Field  
>> nodes that
>
> Do you really have to modify the fields of the record?  Instead, you  
> could
> have a map in ConvertRECORD (possibly in StructTypeConversionInfo)  
> that gives
> the type to use for each field [currently you use the record as the  
> map, stashing
> the new type there] or just calculate the type in ConvertRECORD and  
> pass the type
> as an extra parameter to all subroutines or somesuch.
>
> Alternatively, couldn't you just convert the original field type to  
> LLVM then drop
> fields off the end of the LLVM type if they go over the DECL_SIZE,  
> or something
> along those lines?

Other implementations may be possible.   This approach (which I agree  
has unaesthetic aspects) makes minimal changes to existing logic; I  
think that's a fairly important virtue.

The idea I liked best was to get the C++ FE to generate the right  
fields in the first place, but couldn't get it to work.

>> +        TREE_INT_CST_LOW(DECL_SIZE(Field)) <
>> +              TREE_INT_CST_LOW(TYPE_SIZE(TREE_TYPE(Field))))
>
> This probably kills Ada (testing now), since the size doesn't have  
> to be
> a constant in general (likewise in RestoreBaseClassFields).

OK, didn't know that.  That's an easy fix.  I figured if I broke Ada  
somebody would tell me :)




More information about the llvm-commits mailing list