I'm still working on the next patch, it's going somewhat slowly. I wanted to create a unit test that actually created a union, and in order to do that I had to implement constant unions. And rather than creating a special syntax for constructing a union, I decided that it was simplest to implement the insertvalue instruction for a constant union expression:<div>

<br></div><div>    @foo = constant union { i32, float } insertvalue union { i32, float } undef, i32 4, 0</div><div><br></div><div>What this says is to start with an undef, and then insert the value '4' into the integer field (the zeroth field) of the union.</div>

<div><br></div><div>The reason for doing it this way is that to construct a union, you really need 4 pieces of information: The type of the union, the type and value of the member to be initialized, and the index of which member is being initialized. Originally I thought about having the last be detected automatically by what type of initializer was used:</div>

<div><br></div><div>    @foo = constant union { i32, float } i32 4</div><div><br></div><div>However, from a syntactical standpoint what you get is two types in a row - "union { i32, float }" followed by "i32". That is completely unlike any other IR syntax and doesn't fit well into the parser. Using insertvalue as an initializer has the advantage that it's parameters supply all of information we need. The disadvantage is that you have to type the union type signature twice, but I doubt that will be a major issue since IR isn't meant to be typed by hand anyway.<br>

<div><br><div class="gmail_quote">On Tue, Jan 12, 2010 at 5:01 PM, Talin <span dir="ltr"><<a href="mailto:viridia@gmail.com">viridia@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Here is the LangRef part of the patch.<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Tue, Jan 12, 2010 at 2:11 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>
On Jan 11, 2010, at 4:30 PM, Talin wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm working on a new version of the patch.<br>
<br>
Another thing I wanted to ask about - do you prefer to have one giant patch that has everything, or a series of incremental patches? I can see advantages either way.<br>
</blockquote>
<br></div>
A series of incremental patches is strongly preferred, starting with LangRef.html.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Normally I would want to do this as a series of incremental patches, however this is a rather large project and it may take me quite a while before it's completely done. I don't doubt that I will need some assistance when it comes to the trickier parts (like the optimization aspects you mentioned.) So there's a risk involved in submitting the first one or two patches, because the final patch might not be ready in time for the next release.<br>



<br>
On the other hand, it will be a lot easier for others to assist if we go ahead and submit the initial work.<br>
</blockquote>
<br></div>
No problem, just submit it as you go.  When the langref piece goes in, just say in it that this is an experimental feature in development.  Thanks Talin,<br><font color="#888888">
<br>
-Chris<br>
<br>
</font></blockquote></div><br><br clear="all"><br></div></div>-- <br><font color="#888888">-- Talin<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>-- Talin<br>
</div></div>