<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 2/8/12 11:55 AM, tarun agrawal wrote:
<blockquote
cite="mid:CAMY5+L6a+LoQyvgYd4_8O937_vTYPrrF3x5u2O3CB4hAoZ5rtg@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
Hi,<br>
<br>
I am trying to insert a instruction for printf or cout. My aim is
to print a integer and a string value using that instruction,
which are already there in the code. <br>
but I am not able to understand how to do it. Any help would be
great help.<br>
</blockquote>
<br>
You want to insert a call instruction that calls the printf
function. You'll need to insert a Function for printf (with no
body) if no printf function exists within the LLVM module you're
transforming.<br>
<br>
So, the code will look something like:<br>
<br>
Function * F = M.getOrInsertFunction ("printf", ...);<br>
CallInst::Create (F, ...);<br>
<br>
Be sure to look at the doxygen docs for exact method names and which
parameters go where; I've skipped over such details above.<br>
<br>
-- John T.<br>
<br>
<blockquote
cite="mid:CAMY5+L6a+LoQyvgYd4_8O937_vTYPrrF3x5u2O3CB4hAoZ5rtg@mail.gmail.com"
type="cite">
<br>
<br>
<br>
Thanks and Regards,<br>
Tarun Agrawal<br>
<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>