[LLVMdev] Suggestion: Support union types in IR

Talin viridia at gmail.com
Fri May 8 10:07:02 PDT 2009

Nick Lewycky wrote:
> Hi Talin, thanks for looking in to this.
> I think there's already a lot of code that makes the assumption that the 
> different members of a StructType represent distinct storage. Why is it 
> easier to co-opt StructType than to create a new 'UnionType' under 
> CompositeType? What's the tradeoff?
Well, from a pure lines-of-code perspective, the struct and union types 
share about 90% of their implementation, and it seemed wrong to 
duplicate that code. I thought about factoring out a common base class, 
however that seemed more disruptive to the code base than I really 
wanted to deal with.

However, I haven't really looked into the parts of LLVM that actually do 
the analysis. (I'm mostly a front-end guy.) So I don't yet understand 
how much trouble such a change would cause.
> Nick
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list