<div dir="ltr">Thank you very much.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 12, 2013 at 10:26 PM, John Criswell <span dir="ltr"><<a href="mailto:criswell@illinois.edu" target="_blank">criswell@illinois.edu</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><div class="im">
    <div>On 4/12/13 4:31 AM, Mingliang LIU
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <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>However, there is no API (or the metadata in the
          first place) to know the end of the function.</div>
        <div><br>
        </div>
        <div>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></div>
    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 type="cite"><div class="im">
      <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 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 href="mailto:liuml07@mails.tsinghua.edu.cn" target="_blank">liuml07@mails.tsinghua.edu.cn</a></font>
          <div>
            <font style color="#666666" face="arial, helvetica, sans-serif">Homepage: <a 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></fieldset>
      <br>
      </div><pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><font face="arial, helvetica, sans-serif" style="background-color:rgb(255,255,255)" color="#666666">Mingliang LIU (ÁõÃ÷ÁÁ in Chinese)<br><br>PACMAN Group,  Dept. of Computer Science & Technology<br>

Tsinghua University, Beijing 100084, China<br>Email: <a href="mailto:liuml07@mails.tsinghua.edu.cn" target="_blank">liuml07@mails.tsinghua.edu.cn</a></font><div><font face="arial, helvetica, sans-serif" style="background-color:rgb(255,255,255)" color="#666666">Homepage: <a href="http://pacman.cs.tsinghua.edu.cn/~liuml07" style="line-height:19px;text-align:center" target="_blank">http://pacman.cs.tsinghua.edu.cn/~liuml07/</a></font></div>


</div>