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.<div>
<br></div><div>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.)<br>
<br><div class="gmail_quote">On Mon, Mar 29, 2010 at 7:15 AM, Tim Northover <span dir="ltr"><<a href="mailto:T.P.Northover@sms.ed.ac.uk">T.P.Northover@sms.ed.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On Mon, Mar 29, 2010 at 01:15:30PM +0100, Renato Golin wrote:<br>
> Hi All,<br>
<div class="im">><br>
> Which implies no one was expecting a UnionType there...<br>
><br>
> Also, if I generate the object code directly, llc fails too...<br>
><br>
> Is there any plan to implement the union type? The work-around is quite ugly...<br>
<br>
</div>Sorry to Renato for getting two copeis of this, I cocked up the reply<br>
first time.<br>
<br>
Anyway, here's a patch for this issue (I'd not tried zero initialiser<br>
during my work). It seems to pass all the same tests as llvm did before,<br>
and give reasonable output.<br>
<br>
Also, does anyone know off the top of their heads what would be needed<br>
to get unions up to scratch? They do seem to be a neat solution and I'd<br>
be sad to see them removed.<br>
<font color="#888888"><br>
Tim.<br>
</font><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>-- Talin<br>
</div>