[LLVMdev] Union types
viridia at gmail.com
Wed Apr 7 14:05:45 PDT 2010
Last time I looked at the union stuff, I was trying to decide how to
implement TargetData.cpp for unions, and whether or not to copy the way
structs handled memory layout. Currently structs have an auxilliary data
structure (StructLayout) that is used to cache the overall size of the
struct and the offset of each member. In the case of unions, it doesn't need
the offsets, since they are always zero, but it does need to calculate the
overall size (with alignment considerations). The alternative is to simply
recalculate the union size each time it is needed -- it does seem like a lot
of extra complexity to have a whole cache just for the size.
At the moment, my LLVM-related project is on hiatus - After two years of
working on it I decided to take a few months off to recharge my creative
batteries before tackling the next phase (which is garbage collection - I
did make pretty good progress generating the tables for direct probing of
stack roots, without needing shadow-stack.)
On Mon, Mar 29, 2010 at 7:15 AM, Tim Northover
<T.P.Northover at sms.ed.ac.uk>wrote:
> On Mon, Mar 29, 2010 at 01:15:30PM +0100, Renato Golin wrote:
> > Hi All,
> > Which implies no one was expecting a UnionType there...
> > Also, if I generate the object code directly, llc fails too...
> > Is there any plan to implement the union type? The work-around is quite
> Sorry to Renato for getting two copeis of this, I cocked up the reply
> first time.
> Anyway, here's a patch for this issue (I'd not tried zero initialiser
> during my work). It seems to pass all the same tests as llvm did before,
> and give reasonable output.
> Also, does anyone know off the top of their heads what would be needed
> to get unions up to scratch? They do seem to be a neat solution and I'd
> be sad to see them removed.
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev