<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    On 5/8/12 11:40 AM, Richard Osborne wrote:
    <blockquote cite="mid:4FA8EA0B.1000701@xmos.com" type="cite">
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
      On 08/05/12 09:22, Ralf Karrenberg wrote:
      <blockquote cite="mid:c55ba728-8f2d-4938-a248-3d3c3e266927@com"
        type="cite">
        <div class="moz-text-plain" wrap="true" graphical-quote="true"
          style="font-family: -moz-fixed; font-size: 12px;"
          lang="x-unicode">
          <pre wrap="">Hi,

please find attached a patch that adds metadata functionality to BasicBlocks.
It should include all that is required for full support via BitcodeReader/Writer, AsmParser/Writer, etc.

Essentially, the patch mimics behaviour of metadata that is attached to instructions.

The chosen syntax for block metadata is as follows:

entry:
    %property1 !0, %property2 !1
  %x = fadd float %a, %b
  ret float %x

Looking forward to getting feedback on the patch <span class="moz-smiley-s1" title=":)"><span>:)</span></span>.
</pre>
        </div>
      </blockquote>
      Some general comments - why do you need special handling / caching
      of debug loc metadata? Unless the format of debug information is
      changed debug metadata will only be added to instructions and so
      this code is unnecessary. You should add some testcases to cover
      the new functionality and modify the language ref to include a
      description of basic block metadata. Finally the indentation is
      incorrect in a number of places. Please use 2 spaces for
      indentation and avoid tabs.<br>
    </blockquote>
    That's right, LOC metadata is not required - I will remove that.<br>
    Testcases / LangRef / indentation - will do and resubmit.<br>
    <blockquote cite="mid:4FA8EA0B.1000701@xmos.com" type="cite">
      <blockquote cite="mid:c55ba728-8f2d-4938-a248-3d3c3e266927@com"
        type="cite">
        <div class="moz-text-plain" wrap="true" graphical-quote="true"
          style="font-family: -moz-fixed; font-size: 12px;"
          lang="x-unicode">
          <pre wrap="">Cheers,
Ralf</pre>
        </div>
        <div class="moz-text-plain" wrap="true" graphical-quote="true"
          style="font-family: -moz-fixed; font-size: 12px;"
          lang="x-western">
          <pre wrap="">   /// hasAddressTaken - returns true if there are any uses of this basic block
   /// other than direct branches, switches, etc. to it.
-  bool hasAddressTaken() const { return getSubclassDataFromValue() != 0; }
+  bool hasAddressTaken() const {
+    return (getSubclassDataFromValue() & ~HasMetadataBit) != 0;
+  }
</pre>
        </div>
      </blockquote>
      I think this will result in basic block metadata effecting
      optimizations. What would happen if you just ignored metadata
      here?<br>
    </blockquote>
    It will always treat a block that has metadata attached as a block
    whose address has been taken, which results in a crash at a later
    point (don't remember exactly where) because the address was never
    taken.<br>
    <br>
    Thanks,<br>
    Ralf<br>
  </body>
</html>