[LLVMdev] Suggestion: Support union types in IR

Chris Lattner clattner at apple.com
Sat Jan 3 17:25:05 PST 2009


On Jan 2, 2009, at 2:29 PM, Jon Harrop wrote:
>>> I don't think you would want to build discriminated unions on top of
>>> C-style unions though.
>>
>> Why?
>
> Uniformity when nesting and space efficiency. Users of a language  
> front-end
> will want to nest discriminated unions, e.g. to manipulate trees.

Okay, so you're just talking about boxed vs unboxed discriminated  
unions, or "by ref" vs "by value" discriminated unions.  Clearly the  
LLVM IR support for "c style unions" would only be useful for  
"unboxed" or "byvalue" discriminated unions.  That doesn't mean that  
*your* specific uses would need them.  If you're doing "by-ref" or  
"boxed" unions, then our current support should already be sufficient.

-Chris




More information about the llvm-dev mailing list