<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Introduce new MDString/MDNode hybrid to reduce heap size of debug & profile metadata"
   href="http://llvm.org/bugs/show_bug.cgi?id=17892">17892</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Introduce new MDString/MDNode hybrid to reduce heap size of debug & profile metadata
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>1.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Core LLVM classes
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>clattner@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is related to PR17891, but independent and separable.  One nice thing
about our current debug information encoding in MDNodes is that each MDNode
starts with a dwarf tag+version number, encoded into an integer at the start of
the field (it would be even nicer if the asmwriter printed the value in hex,
but, anyway).  If we take PR17891 to its logical conclusion, we lose the
uniformity that the current encoding provides as we get a sprawl of ad-hoc
encoding approaches.

We could solve this by allowing MDString to optionally have children nodes (the
same way MDNode does today).  This would lead to an LLVM IR syntax something
along the lines of:

// This exists today, and the asmwriter would generally continue to print
operand-less MDStrings inline instead of numbering them.
!0 = metadata !"foo"

// This would be the new syntax (this is one of many possible syntaxes):
!1 = metadata !"bar"(metadata !42, i32* null)

If we did this, then we could get the consistency advantages of the current
metadata encoding, with the density advantages sketched out in PR17891.  The
general form of a debug info node would become a string that starts with the DW
tag, a version, and any string fields encoded as strings.  If there are any
nodes that want sharing, they would be encoded as operands.  To give one
concrete example, instead of this for a field:

; [ DW_TAG_member ] [y] [line 3, size 32, align 32, offset 32] [from int]
!14 = metadata !{i32 786445, metadata !1, metadata !10, metadata !"y", i32 3,
i64 32, i64 32, i64 32, i32 0, metadata !13}

We could use:

; [ DW_TAG_member ] [y] [line 3, size 32, align 32, offset 32] [from int]
!14 = metadata !"v12,14,y,3,0,32,32,32"(metadata !1, metadata !13)

This would keep readability and would be a *huge* reduction of heap size for
debug info.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>