<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 3, 2017, at 7:08 PM, Peter Collingbourne <<a href="mailto:peter@pcc.me.uk" class="">peter@pcc.me.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi,<div class=""><br class=""></div><div class="">As part of PR27551 I want to add a string table to the bitcode format to allow global value and comdat names to be shared with the proposed symbol table (and, as side effects, allow comdat names to be shared with value names, make bitcode files more compressible and make bitcode easier to parse). The format of the string table would be a top-level block containing a blob containing null-terminated strings [0] similar to the string table format used in most object files. </div></div></div></blockquote><div><br class=""></div><div><br class=""></div><div>I’m in favor of this, but note that currently string can be encoded with less than 8 bits / char in some cases (there might some size increase because of this).</div><div>That said we already paid this with the metadata table in the recent past for example.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">The format of MODULE_CODE_{FUNCTION,GLOBALVAR,ALIAS,IFUNC,COMDAT} records would change so that their first operand would specify their names with a byte offset into the string table. (To allow for backwards compatibility, I would increment the bitcode version.)</div></div></div></blockquote><div><br class=""></div><div>I assume you mean the EPOCH?</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""> Here is what it would look like as bcanalyzer output:</div><div class=""><br class=""></div><div class=""><MODULE_BLOCK></div><div class=""> <VERSION op0=2></div><div class=""> <COMDAT op0=0 ...> ; name = foo</div><div class=""> <FUNCTION op0=0 ...> ; name = foo</div><div class=""> <GLOBALVAR op0=4 ...> ; name = bar</div><div class=""> <ALIAS op0=8 ...> ; name = baz</div><div class=""> ; function bodies, etc.<br class=""></div><div class=""></MODULE_BLOCK></div><div class=""><STRTAB_BLOCK></div><div class=""> <STRTAB_BLOB blob="foo\0bar\0baz\0"></div><div class=""></STRTAB_BLOCK></div></div></div></blockquote><div><br class=""></div><div>Why is the string table after the module instead of before?</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">Each STRTAB_BLOCK would apply to all preceding MODULE_BLOCKs. This means that bitcode files can continue to be concatenated with "llvm-cat -b". (Normally bitcode files would contain a single string table, which in multi-module bitcode files would be shared between modules.)</div><div class=""><br class=""></div><div class="">This *almost* allows us to remove the global (top-level) VST entirely, if not for the function offset in the FNENTRY record. However, this offset is not actually required because we can scan the module's FUNCTION_BLOCK_IDs as we were doing before <a href="http://reviews.llvm.org/D12536" class="">http://reviews.llvm.org/D12536</a> (this may have a performance impact, so I'll measure it first).</div><div class=""><br class=""></div><div class="">Assuming that performance looks good, does this seem reasonable to folks?</div></div></div></blockquote></div><br class=""><div class=""><br class=""></div><div class="">I rather seek to have a symbol table that entirely replace the VST, kee. If there is a perf impact with the FNENTRY offset, why can’t it be replicated in the symbol table?</div><div class=""><br class=""></div><div class="">Thanks for driving this,</div><div class=""><br class=""></div><div class="">— </div><div class="">Mehdi</div><div class=""><br class=""></div></body></html>