<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Dear Mohammad,<br>
      <br>
      Are you trying to get the formal arguments or the actual
      arguments?<br>
      <br>
      If you're trying to get the actual arguments, you can use the
      CallSite class
      (<a class="moz-txt-link-freetext" href="http://llvm.org/doxygen/classllvm_1_1CallSite.html">http://llvm.org/doxygen/classllvm_1_1CallSite.html</a>).  Create a
      local CallSite variable constructed from the Instruction * (in
      this case, a CallInst).  You can then use the getArgument() method
      to get the various operands to the call site.  The CallSite class
      is nice because it abstracts away details of the CallInst and
      InvokeInst instructions.<br>
      <br>
      If you want the formal arguments, you need to find the function
      that the CallInst calls.  You can do that as Manual suggests. 
      However, keep in mind that the CallInst may be an indirect call
      and, therefore, you may not see a Function constant.  In that
      case, you'll need to use a call graph analysis pass (like DSA) to
      determine which set of functions the CallInst can call.<br>
      <br>
      Regards,<br>
      <br>
      John Criswell<br>
      <br>
      <br>
      On 1/12/16 10:43 AM, Mohammad Norouzi via llvm-dev wrote:<br>
    </div>
    <blockquote
cite="mid:CAFVz=BU7_RGja4wx95fXoya=95a_eTsSHK=75inSdqZKTzZuVw@mail.gmail.com"
      type="cite">
      <meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Hi All,<br>
                <br>
              </div>
              I need to get the list of arguments of a function which is
              bitcasted. <br>
              <br>
            </div>
            <div>Here is the C code excerpt:<br>
              <br>
              <div><span>main() <br>
                  {<br>
                   .....<br>
                  <br>
                    /* Get input samples */<br>
                    input_dsp(input, N, 1);<br>
                  <br>
                  .....<br>
                  }</span><br>
              </div>
              <br>
            </div>
            <div>and here is llvm ir for the code section:<br>
              <br>
              <div><span>%call = call i32 (i32*, i32, i32, ...)* bitcast
                  (i32 (...)* @input_dsp to i32 (i32*, i32, i32,
                  ...)*)(i32* getelementptr inbounds ([256 x i32]*
                  @input, i32 0, i32 0), i32 256, i32 1)</span><br>
              </div>
            </div>
            <div><br>
              <br>
            </div>
            When I use the ordinary method for getting arguments,<br>
            <br>
            <div><span>for (Function::ArgumentListType::iterator it =
                f->getArgumentList().begin(); it !=
                f->getArgumentList().end(); it++) {...}<br>
              </span></div>
            <br>
            i get a segmentation fault which i think i valid. But how
            can i get arguments of <i>input_dsp</i> which are <i>input</i>,
            <i>N</i> and <i>1</i> in this case.<br>
            <br>
          </div>
          Best,<br>
        </div>
        Mo<br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a class="moz-txt-link-freetext" href="http://www.cs.rochester.edu/u/criswell">http://www.cs.rochester.edu/u/criswell</a></pre>
  </body>
</html>