<div dir="ltr">I understand the specific savings, but do you have a sense of how much this occurs overall for DWARF of some non-trivial program (like the clang binary)?<br><br>I know it's verbose - but it's not especially expensive to maintain the emission of all those bytes (they'd be in a constant array you'd copy into the location expression, I assume - written once) so if there's not much overall size savings and not much parsing savings I'd be inclined to wait until such a thing were standardized rather than introducing an extension.<br><br>That's just my tendency on that - quite possible other folks (CC'd) feel differently.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 4, 2019 at 12:32 AM Chirag Patel <<a href="mailto:Chirag@raincode.com">Chirag@raincode.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-IN">
<div class="gmail-m_7936392033723359218WordSection1">
<p class="MsoNormal"><span>Below is a snippet of the dwarf info that we generate,<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New"">0x00000057: DW_TAG_variable<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_name ("__gbloffset__")<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_type (0x000001e5 "int")<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_external (true)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_decl_file ("…")<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_decl_line (8)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_location (DW_OP_addr 0) // pre linkage<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_linkage_name ("_gblsection__")<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_endianity (DW_END_big)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New"">0x00000170: DW_TAG_variable<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_name ("VAR1")<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_type (0x0000010b "fixed.dec.display.72")<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_decl_file ("…")<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_decl_line (10)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_location (DW_OP_addr 0x0, DW_OP_call4 0x57, DW_OP_deref_size, 4,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New";color:red">DW_OP_dup, DW_OP_constu 0xff, DW_OP_lit0, DW_OP_shl, DW_OP_and, DW_OP_lit24, DW_OP_shl, DW_OP_swap, DW_OP_dup, DW_OP_constu 0xff, DW_OP_lit8, DW_OP_shl, DW_OP_and, DW_OP_lit8,
DW_OP_shl, DW_OP_swap, DW_OP_dup, DW_OP_constu 0xff, DW_OP_lit16, DW_OP_shl, DW_OP_and, DW_OP_lit8, DW_OP_shr, DW_OP_swap, DW_OP_constu 0xff, DW_OP_lit24, DW_OP_shl, DW_OP_and, DW_OP_lit24, DW_OP_shr, DW_OP_swap, DW_OP_or, DW_OP_or, DW_OP_or</span><span style="font-size:12pt;font-family:"Courier New"">,
DW_OP_plus)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Courier New""> DW_AT_linkage_name ("VAR1")</span><span style="font-size:10pt;font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>In above code for location calculation of “VAR1” we change the endianity of “__</span><span style="font-size:12pt;font-family:"Courier New"">gbloffset__</span><span>”
var, it is 32 bit value on 64-bit machine.<u></u><u></u></span></p>
<pre><span style="font-size:12pt;font-family:"Calibri Light",sans-serif">In above case </span><span style="font-size:12pt">DW_OP_byte_swap </span><span style="font-size:12pt;font-family:"Calibri Light",sans-serif">will replace near about 38 operations(for 32 bit value), that’s 38-bytes per usage savings on mem footprint and at runtime as well</span><span style="font-size:12pt">. </span><span style="font-size:12pt;font-family:"Calibri Light",sans-serif">I do not have any profiling data.</span><span style="font-size:12pt"><u></u><u></u></span></pre>
<pre><u></u> <u></u></pre>
<pre><span style="font-size:12pt;font-family:"Calibri Light",sans-serif">The use case for DW_OP_byte_swap is, for typed entry we know the size, for raw data, dwarf operator will consider the generic type and pop the top of the stack, byte swap it and push the data back on the stack.<u></u><u></u></span></pre>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="color:rgb(47,85,151)"><u></u> <u></u></span></b></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">Chirag Patel</span></b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">Software Engineer | Raincode Labs India
<u></u><u></u></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">Tel</span></b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">: (+91) 080 41159811<u></u><u></u></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">Mob</span></b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">: (+91) 9049336744<u></u><u></u></span></p>
<p class="MsoNormal"><u><span lang="EN-US" style="font-size:12pt;color:blue"><a href="http://www.raincodelabs.com/" target="_blank"><span style="color:rgb(5,99,193)">www.raincodelabs.com</span></a><u></u><u></u></span></u></p>
<p class="MsoNormal"><a href="https://in.linkedin.com/in/chirag-patel-" target="_blank"><span style="font-size:10pt;color:rgb(5,99,193);text-decoration:none"><img border="0" width="180" height="60" style="width: 1.875in; height: 0.625in;" id="gmail-m_7936392033723359218Picture_x0020_1" src="cid:16ed118393e4cff311" alt="linkedin-button"></span></a><span style="font-size:10pt;color:rgb(47,85,151)"><u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>>
<br>
<b>Sent:</b> 03 December 2019 21:31<br>
<b>To:</b> Chirag Patel <<a href="mailto:Chirag@raincode.com" target="_blank">Chirag@raincode.com</a>><br>
<b>Cc:</b> Adrian Prantl <<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>>; Paul Robinson <<a href="mailto:paul.robinson@sony.com" target="_blank">paul.robinson@sony.com</a>>; Jonas Devlieghere <<a href="mailto:jdevlieghere@apple.com" target="_blank">jdevlieghere@apple.com</a>>; <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] addition of vendor dwarf operator extension.<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Does this have a significant impact on total DWARF size or performance that you've observed/have data about?<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Dec 3, 2019 at 12:06 AM Chirag Patel <<a href="mailto:Chirag@raincode.com" target="_blank">Chirag@raincode.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal">Hello,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks for prompt reply.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Motivation,<u></u><u></u></p>
<p class="MsoNormal">In case of debugging of bi-endian dwarf and value known at runtime some of the raw values needs to be byte swapped to change the endianity. We have a llvm based compiler which generates
such dwarf, TAG_variable marked as big endian and debugging on little endian host using lldb. The listed operator on dwarf issues does that, one operator instead of list of operators.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Proposal,<u></u><u></u></p>
<p class="MsoNormal">Addition of listed dwarf operator as vender extension in llvm/lldb till it gets released.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Regards, <u></u><u></u></p>
<p class="MsoNormal"><b><span lang="EN-US" style="color:rgb(47,85,151)"> </span></b><u></u><u></u></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">Chirag Patel</span></b><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">Software Engineer | Raincode Labs India
</span><u></u><u></u></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">Tel</span></b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">: (+91) 080 41159811</span><u></u><u></u></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">Mob</span></b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">: (+91) 9049336744</span><u></u><u></u></p>
<p class="MsoNormal"><u><span lang="EN-US" style="font-size:12pt;color:blue"><a href="http://www.raincodelabs.com/" target="_blank"><span style="color:rgb(5,99,193)">www.raincodelabs.com</span></a></span></u><u></u><u></u></p>
<p class="MsoNormal"><a href="https://in.linkedin.com/in/chirag-patel-" target="_blank"><span style="font-size:10pt;color:rgb(5,99,193);text-decoration:none"><img border="0" width="180" height="60" style="width: 1.875in; height: 0.625in;" id="gmail-m_7936392033723359218gmail-m_917325676240102948Picture_x0020_1" src="cid:16ed118393e5b16b22" alt="linkedin-button"></span></a><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>>
<br>
<b>Sent:</b> 02 December 2019 19:51<br>
<b>To:</b> Chirag Patel <<a href="mailto:Chirag@raincode.com" target="_blank">Chirag@raincode.com</a>>; Adrian Prantl <<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>>; Paul Robinson <<a href="mailto:paul.robinson@sony.com" target="_blank">paul.robinson@sony.com</a>>;
Jonas Devlieghere <<a href="mailto:jdevlieghere@apple.com" target="_blank">jdevlieghere@apple.com</a>><br>
<b>Cc:</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] addition of vendor dwarf operator extension.</span><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">There are some vendor extensions already in LLVM/LLDB, though I guess the main question would be: what's the motivation?<u></u><u></u></p>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">On Mon, Dec 2, 2019 at 3:14 AM Chirag Patel via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<div>
<div>
<p class="MsoNormal">Hello all,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">There is one enhancement request open for dwarfv5,
<a href="http://dwarfstd.org/ShowIssue.php?issue=191107.1" target="_blank">http://dwarfstd.org/ShowIssue.php?issue=191107.1</a><u></u><u></u></p>
<p class="MsoNormal">The request is for addition of dwarf expression operator to swap the top of the dwarf stack, the response seems positive but it may take some time till v6.<u></u><u></u></p>
<p class="MsoNormal">I like to add that operator as vendor extension but I am not sure how to go about it for llvm/lldb. Currently I am using it as vendor specific extension on our local fork.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Does adding it as vender specific extension seems like a good idea? If yes please provide me the details about adding specific vendor. <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Regards,<u></u><u></u></p>
<p class="MsoNormal"><b><span lang="EN-US" style="color:rgb(47,85,151)"> </span></b><u></u><u></u></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">Chirag Patel</span></b><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">Software Engineer | Raincode Labs India
</span><u></u><u></u></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">Tel</span></b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">: (+91) 080 41159811</span><u></u><u></u></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">Mob</span></b><span lang="EN-US" style="font-size:12pt;color:rgb(47,85,151)">: (+91) 9049336744</span><u></u><u></u></p>
<p class="MsoNormal"><u><span lang="EN-US" style="font-size:12pt;color:blue"><a href="http://www.raincodelabs.com/" target="_blank"><span style="color:rgb(5,99,193)">www.raincodelabs.com</span></a></span></u><u></u><u></u></p>
<p class="MsoNormal"><a href="https://in.linkedin.com/in/chirag-patel-" target="_blank"><span style="font-size:10pt;color:rgb(5,99,193);text-decoration:none"><img border="0" width="180" height="60" style="width: 1.875in; height: 0.625in;" id="gmail-m_7936392033723359218gmail-m_917325676240102948gmail-m_8019694081635403889Picture_x0020_1" src="cid:16ed118393e692e333" alt="linkedin-button"></span></a><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote></div>