[LLVMdev] LLVM IR Type System Rewrite

Chris Lattner clattner at apple.com
Mon Feb 28 13:01:30 PST 2011


On Feb 27, 2011, at 12:59 PM, Jin Gu Kang wrote:

>> Given this, the rules above would be that "only non-anonymous structs can have
>> cycles" for example.  Arrays, pointers and other non-namable types can be
>> considered to be anonymous as well.
>> 
>> When printing out .ll files, anonymous structs (which cannot have cycles) are
>> just printed inline, as in "{i32, i32}*".  Named structs are printed as their
>> name ("%foo*"), and unnamed structs are printed with a number ("%42*").  This is
>> nice and compatible with existing .ll files.
> 
> When initializer type of Global Variable with StructType is different from type of
> Global Variable, current front-end makes an temporary StructType for initializer
> as unnamed struct ("%42"). In this case, Is temporary StructType for initializer
> Unnamed sturct (named structs with no names)?
> 
> And will be key(StructValType) of StructTypes(map) the number of elements and
> isPacked in current IR plus a name? 
> (if so, isPacked is likely to be redundant in some types.)

isPacked is still needed because it affects layout of the struct.  Having a name (or not) doesn't impact layout.  I don't know exactly what policy the frontend will use, but it would make sense for it to be an anonymous struct type.

-Chris



More information about the llvm-dev mailing list