<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 18, 2015 at 2:55 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> On 2015-Feb-18, at 13:48, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
> Hi chandlerc, dexonsmith, grosbach, resistor,<br>
><br>
> Like <a href="http://reviews.llvm.org/D7655" target="_blank">http://reviews.llvm.org/D7655</a>, add bitcode support including backwards<br>
> compatibility, for an explicit type parameter to GEP.<br>
><br>
> At the suggestion of Duncan I tried coalescing the two older bitcodes into a<br>
> single new bitcode, though I did hit a wrinkle: I couldn't figure out how to<br>
> create an explicit abbreviation for a record with a variable number of<br>
> arguments (the indicies to the gep). This means the discriminator between<br>
> inbounds and non-inbounds gep is a full variable-length field I believe? Is my<br>
> understanding correct? Is there a way to create such an abbreviation?<br>
<br>
</span>You can add such an abbreviation by making Array the second last<br>
element, and making the last element the type in the array.<br>
Documented here:<br>
<br>
<a href="http://llvm.org/docs/BitCodeFormat.html#define-abbrev-encoding" target="_blank">http://llvm.org/docs/BitCodeFormat.html#define-abbrev-encoding</a></blockquote><div><br>Ah, thanks - updated the patch to use this. I'm not sure what array type is ideal (since it'll be a combination of types and value references - is there a way to figure out the maximum size I need for those? I know there's the trick for computing the bit size for type references (& use that for the pointee type of the gep) but maybe there's a way to do that for value numbers too, and take the max of the two? Assuming that produces optimal bit encoding (maybe it's better to use a smaller VBR encoding so we only pay extra bits for some of the higher indicies? I've no idea))<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
Examples in-tree: `METADATA_NAME` and `TYPE_CODE_FUNCTION`.<br>
<span class=""><br>
> Should I<br>
> just use two bitcodes as before?<br>
<br>
</span>Regardless of the above, I'm interested in others' opinions on this<br>
(whether two records vs. one record with a discriminator is better).<br>
I've been preferring the single-record approach myself, purely on<br>
the principle that it's easier to upgrade in the future by adding<br>
bits to the discriminator (rather than creating "brand new records").<br></blockquote><div><br>Yeah - certainly open to opinions there.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
><br>
> <a href="http://reviews.llvm.org/D7736" target="_blank">http://reviews.llvm.org/D7736</a><br>
><br>
> Files:<br>
> include/llvm/Bitcode/LLVMBitCodes.h<br>
> include/llvm/IR/Instructions.h<br>
> lib/Bitcode/Reader/BitcodeReader.cpp<br>
> lib/Bitcode/Writer/BitcodeWriter.cpp<br>
> test/Bitcode/function-encoding-rel-operands.ll<br>
> tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp<br>
><br>
> EMAIL PREFERENCES<br>
> <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
</span>> <D7736.20218.patch><br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>