<div dir="ltr"><div>Did you see anywhere in the docs that needed updating?</div><div><br></div><div>Regarding patch 0005, thankfully those were benign since they just had leading 0's. Can you doublecheck the diagnostic quality? We need to give a clear indication that what is wrong so that users don't get left scratching their heads.</div>
<div><br></div><div><br></div><div><div>+  /// resolveListElementReference - This method is used to implement</div><div>+  /// VarListElementInit::resolveReferences.  If the list element is resolvable</div><div>+  /// now, we return the resolved value, otherwise we return null.</div>
<div>+  Init *resolveListElementReference(Record &R, const RecordVal *RV,</div><div>+                                    unsigned Elt) const override {</div><div>+    llvm_unreachable("Illegal element reference off bits<n>");</div>
<div>+  }</div></div><div><br></div><div>This saddens me... all this TableGen code really needs to be refactored...</div><div>There may be a simple refactor for this resolveListElementReference situation that does not require plunging into the murky depths of the resolution machinery.</div>
<div><br></div><div><br></div><div>-- Sean Silva</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 31, 2014 at 2:48 PM, Pete Cooper <span dir="ltr"><<a href="mailto:peter_cooper@apple.com" target="_blank">peter_cooper@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 style="word-wrap:break-word">Hi all<div><br></div><div>Moving this from LLVMDev (<a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-July/075223.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-July/075223.html</a>) now that i have patches i’d welcome reviews of.  The following is the initial summary from that email thread.</div>
<div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>"Currently tablegen parses binary literals such as 0b011 and immediately turns them in to integers internally.  Due to this, 0b011 is a 2-bit value because tablegen will happily drop leading zeroes on integers.</div>
<div><br></div><div>I propose that we change this, and store binary literals with a size.  I think this is much more natural, as when the user writes a value with 3 bits, I think they expect to get a value with 3 bits, and not a 2-bit value which is silently truncated and later silently zero extended.</div>
<div><br></div><div>Given this, I would then like to extend bits initializers to accept these new sized binary literals.  For example, I would like to be able to write</div><div><br></div><div>bits<2> opc;</div><div>
bits<8> x = { opc, 0b1100, rd{1}, rs{0} }</div><div><br></div><div>This would let us write some encodings much more concisely, instead of having to put each initializer on its own line.”</div></blockquote><div><br></div>
<div>For those interested in the low level details, i’ve changed binary literals such as 0b011 from creating an integer ‘3’, to creating a BitsInit ‘{ 0, 1, 1}’.  As Sean suggested, this was better than introducing yet another type just for binary literals.</div>
<div><br></div><div>As part of this, BitsInit values now had to be able to be typed.  This is because we had uses of binary literals which expected to be typed (for example list<bits<2>> [0b00, 0b01]).  I’ve moved BitsInit from being a subclass of Init to a subclass of TypedInit to allow this.</div>
<div><br></div><div>Note that patches 2 and 3 really need to be committed together.  I can squash them before commit, but just wanted to present the changes independently.</div><div><br></div><div>Patch 5 can also be committed without any of the others, but just shows that this did actually catch some useful cases where we mismatched sizes of binary expressions.</div>
<div><br></div><div>Thanks,</div><div>Pete</div><div><br></div><div></div></div><br><div style="word-wrap:break-word"><div></div></div>
<br><div style="word-wrap:break-word"><div></div></div>
<br><div style="word-wrap:break-word"><div></div></div>
<br><div style="word-wrap:break-word"><div></div></div>
<br><div style="word-wrap:break-word"><div></div></div>
<br></blockquote></div><br></div>