[LLVMdev] inefficiencies in ConstantUniqueMap ?

Jay Foad jay.foad at gmail.com
Thu Jun 30 08:56:04 PDT 2011


>>> [...] why not to a struct without a name?
>>
>> This would imply that you were starting with a struct with no name and
>> no fields, which is not something you can create in C:
>>
>> struct; // this isn't a C type!
>
> I see structs with fields but without names come flying out of gcc for C++
> code
> all the time.

That's fine; in C this is like the type of s in:

struct { int i, j; } s;

But in this case, you know what the fields are straight away; you
don't need to create a tag-less field-less struct and then add the
fields *later*.

To put it another way, when a C struct is first declared, it has
either a name (tag) or a list of fields or both, but not neither!

> The name-noname distinction still seems artificial to me.  I assume it is
> being
> driven by efficiency considerations: i.e. not allowing named types to be
> refined
> simplifies LLVM's internals considerably.

I see your point. Maybe Chris's implementation *does* allow you to
refine unnamed types. I hadn't really considered it before.

Jay.




More information about the llvm-dev mailing list