[LLVMdev] Union type, is it really used or necessary?

Chris Lattner clattner at apple.com
Tue Sep 7 16:34:10 PDT 2010


On Sep 7, 2010, at 4:31 PM, Erik de Castro Lopo wrote:
> Chris Lattner wrote:
>>> a) What is required for them to be accepted back in?
>> 
>> It needs to work.  When reverted, it was broken in almost all cases.
> 
> 'It needs work' and 'it was broken' doesn't really give me an
> idea of what specifically is required.

There were numerous problems, basically any time someone tried to use it, it broke.  I don't think codegen supported it at all for example.

> Specifically, what I am interested in is using unions within
> packed structs to force alignment. Using unions like this was
> the easiest and most reliable way of forcing specific alignment.
> It made it really easy to calculate offsets in high level code
> allowing me to completely ignore whether I was generating code
> for 32 or 64 bits.

Lots of people agree it would be a useful feature, we are lacking a useful implementation :-)

> 
>>> b) What are the chances of getting them in the 2.8 release?
>> 
>> Zero.
> 
> So a feature, of which a subset was actually working (I know
> this because I am using unions successfully in the compiler
> I'm working on) in the 2.7 release and was documented on the
> web site
> 
>    http://llvm.org/releases/2.7/docs/LangRef.html#t_union
> 
> just gets yanked?

The 2.7 release notes: 
http://llvm.org/releases/2.7/docs/ReleaseNotes.html

contained:

"LLVM 2.7 has pre-alpha support for unions in LLVM IR. Unfortunately, this support is not really usable in 2.7, so if you're interested in pushing it forward, please help contribute to LLVM mainline."

Several other features that were in 2.7, but unmaintained, also got removed.


2.8 has already branched for its release, so it is too late for new features.  Bill's email made this very clear.

-Chris



More information about the llvm-dev mailing list