[LLVMdev] Suggestion: Support union types in IR

Jon Harrop jon at ffconsultancy.com
Sun Jan 4 05:07:57 PST 2009


On Sunday 04 January 2009 01:25:05 Chris Lattner wrote:
> 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.

Yes. I expect relatively few people would need C-style unions.

> If you're doing "by-ref" or "boxed" unions, then our current support should
> already be sufficient. 

Yes, LLVM's existing support is fine.

Incidentally, is there any way for LLVM users to vote on a "wish list" in such 
a way that developers can see which features are most sought after?

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e



More information about the llvm-dev mailing list