<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 2/8/12 12:11 PM, tarun agrawal wrote:
    <blockquote
cite="mid:CAMY5+L79OhwMwGC=Fwdf5Tjjjj7Zn4deh8xY4YdOP1vNsroD4g@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      Just to be clear, I have to add a function name printf in the
      module with no body. And I can call the function. This will
      automatically call the printf function which is defined in the
      library.<br>
    </blockquote>
    <br>
    Yes.  That is correct.<br>
    <br>
    You also need to link in the native code library that defines printf
    after code generation, but since printf is in libc, you are probably
    doing that step already.<br>
    <br>
    -- John T.<br>
    <br>
    <blockquote
cite="mid:CAMY5+L79OhwMwGC=Fwdf5Tjjjj7Zn4deh8xY4YdOP1vNsroD4g@mail.gmail.com"
      type="cite"><br>
      Tarun Agrawal<br>
      <br>
      <div class="gmail_quote">On Wed, Feb 8, 2012 at 11:34 PM, John
        Criswell <span dir="ltr"><<a moz-do-not-send="true"
            href="mailto:criswell@illinois.edu">criswell@illinois.edu</a>></span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div bgcolor="#FFFFFF" text="#000000">
            <div class="im"> On 2/8/12 11:55 AM, tarun agrawal wrote:
              <blockquote type="cite"> 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>
            </div>
            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 type="cite">
              <div class="im"> <br>
                <br>
                <br>
                Thanks and Regards,<br>
                Tarun Agrawal<br>
                <br>
                <fieldset></fieldset>
                <br>
              </div>
              <pre>_______________________________________________
LLVM Developers mailing list
<a moz-do-not-send="true" href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a moz-do-not-send="true" href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a moz-do-not-send="true" 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>
    </blockquote>
    <br>
  </body>
</html>