<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 4/12/13 4:31 AM, Mingliang LIU
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAGDLzLPp0gncNym_1gO1uJ6ijB-+Q9NmcN8mjfgprOEukfsGBA@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <div dir="ltr">Hi all,
        <div><br>
        </div>
        <div>I need to know the line number range of a function. The
          start of the function line number can be found by the
          definition point, which is stored at the subprogram metadata:
          <span style="background-color:rgb(238,238,238)"><font
              face="courier new, monospace">DISubprogram::getLineNumber().</font></span></div>
        <div><br>
        </div>
        <div style="">However, there is no API (or the metadata in the
          first place) to know the end of the function.</div>
        <div style=""><br>
        </div>
        <div style="">I have to visit all the instructions of the
          function and maintain the <i>max</i> line number of the
          instructions. I use the <span
            style="background-color:rgb(238,238,238)"><font
              face="courier new, monospace">inst_begin(func):
              inst_end(func)</font></span> as the iterator. But I don't
          think it's effective to iterate all the instructions from the
          beginning. It's supposed that we can iterate the instructions
          reversely and the first one who has attached metadata should
          be treated as the end of the function. Unfortunately, there is
          no reverse iterator of a function.</div>
      </div>
    </blockquote>
    <br>
    Keep in mind that some transforms may move instructions, so the last
    instruction in the function with meta-data does not necessarily come
    from the last instruction in the function.<br>
    <br>
    For example, there is a transform that modifies a function so that
    it only has one return instruction.  Which meta-data does the merged
    return instruction get?<br>
    <br>
    I think iterating over all the instructions is more robust.  If you
    need more accuracy than that, it might be a good idea to modify the
    front-end to generate meta-data that marks the line number of the
    end of the function.<br>
    <br>
    -- John T.<br>
    <br>
    <br>
    <blockquote
cite="mid:CAGDLzLPp0gncNym_1gO1uJ6ijB-+Q9NmcN8mjfgprOEukfsGBA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div><br>
        </div>
        <div>Any idea?</div>
        <div><br>
        </div>
        <div>Thank you very much!<br clear="all">
          <div><br>
          </div>
          -- <br>
          <font style="background-color:rgb(255,255,255)"
            color="#666666" face="arial, helvetica, sans-serif">Mingliang
            LIU (刘明亮 in Chinese)<br>
            <br>
            PACMAN Group,  Dept. of Computer Science & Technology<br>
            Tsinghua University, Beijing 100084, China<br>
            Email: <a moz-do-not-send="true"
              href="mailto:liuml07@mails.tsinghua.edu.cn"
              target="_blank">liuml07@mails.tsinghua.edu.cn</a></font>
          <div>
            <font style="background-color:rgb(255,255,255)"
              color="#666666" face="arial, helvetica, sans-serif">Homepage: <a
                moz-do-not-send="true"
                href="http://pacman.cs.tsinghua.edu.cn/%7Eliuml07"
                style="line-height:19px;text-align:center"
                target="_blank">http://pacman.cs.tsinghua.edu.cn/~liuml07/</a></font></div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>