<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">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 class="moz-txt-link-freetext" href="http://llvm.org/doxygen/classllvm_1_1FunctionType.html#ab781285a21baf484d3023a63da798fc7">http://llvm.org/doxygen/classllvm_1_1FunctionType.html#ab781285a21baf484d3023a63da798fc7</a>).<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
On 8/31/14, 4:29 PM, Manish Gupta wrote:<br>
</div>
<blockquote
cite="mid:CAL6s+Wn8PoY4CMgfWiEwRC04hZMczpXMm0qKK9_2-ktCZaR_kw@mail.gmail.com"
type="cite">
<div dir="ltr">Hi All,
<div><br>
</div>
<div>I am using code similar to <a moz-do-not-send="true"
href="https://github.com/liuml07/giri">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 class="" style="white-space:pre"> </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 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>