<div dir="ltr">Thanks! <div><br></div><div>---------</div><div><div>FunctionType *FuncTy = FunctionType::get(VoidType, args, true);</div><div> RecordVarArgs = cast<Function>(M.getOrInsertFunction("recordVarInputValues",</div>

<div>                                                        FuncTy));</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Aug 31, 2014 at 2:09 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 bgcolor="#FFFFFF" text="#000000">
    <div>Dear Manish,<br>
      <br>
      For a varargs function, I think you'll need to use the version of
      Module::getOrInsertFunction() that takes a FunctionType.  That
      FunctionType, in turn, can be created so that is has a vararg type
      (see
<a href="http://llvm.org/doxygen/classllvm_1_1FunctionType.html#ab781285a21baf484d3023a63da798fc7" target="_blank">http://llvm.org/doxygen/classllvm_1_1FunctionType.html#ab781285a21baf484d3023a63da798fc7</a>).<br>
      <br>
      Regards,<br>
      <br>
      John Criswell<div><div class="h5"><br>
      <br>
      On 8/31/14, 4:29 PM, Manish Gupta wrote:<br>
    </div></div></div>
    <blockquote type="cite"><div><div class="h5">
      <div dir="ltr">Hi All,
        <div><br>
        </div>
        <div>I am using code similar to <a href="https://github.com/liuml07/giri" target="_blank">giri instrumentation</a>
          framework to insert my instrumentation code. It works for
          normal functions for example to insert recordInt32 function
          below. </div>
        <div><br>
        </div>
        <div>
          <div>void recordInt32(int32_t val){</div>
          <div><span style="white-space:pre-wrap"> </span>printf("%d,
            ", val);</div>
          <div>}</div>
        </div>
        <div><br>
        </div>
        <div>I can get recodedInt32 function in my Module using
           getOrInsert Function. </div>
        <div><br>
        </div>
        <div>
          <div>Function* RecordInt32 =
            cast<Function>(M.getOrInsertFunction("recordInt32",</div>
          <div>                                              VoidType,</div>
          <div>                                              Int32Type,</div>
          <div>                                              NULL));</div>
        </div>
        <div><br>
        </div>
        <div>and insert at desired instPoint using:</div>
        <div><br>
        </div>
        <div>CallInst::Create(RecordInt32, args, "", instPoint);<br>
        </div>
        <div><br>
        </div>
        <div>What should be the similar instructions for
          recoedVarInsputValues below:</div>
        <div><br>
        </div>
        <div>void recordVarInputValues(int num, ...){ CODE }<br>
        </div>
        <div><br>
        </div>
        <div>I am not able to figure out what will be the argument to
          getOrInsertFunction for "...".</div>
        <div><br>
        </div>
        <div>Thanks!</div>
        <div>Manish</div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></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></div>