<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 2/9/12 1:02 PM, tarun agrawal wrote:
    <blockquote
cite="mid:CAMY5+L5yEsowNNR5ifRNYJSADtBV0e2KUGAm8sJNvXVBqMdsoQ@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      Hi,<br>
      <br>
      I have written a simple code to  insert putchar() function into
      IR. <br>
      It compiled well but when  I tried to run the generated .bc file
      with lli, its not showing <br>
      proper output.<br>
      <br>
      Function *putchar_func = cast<Function>(M-><br>
          getOrInsertFunction("putchar",
      IntegerType::getInt32Ty(Context),<br>
                              IntegerType::getInt32Ty(Context), NULL));<br>
      <br>
        Value *One = ConstantInt::get(Type::getInt32Ty(Context), 1);<br>
                                                     <br>
        CallInst *CallFibX1 = CallInst::Create(putchar_func, One,
      "fibx1", BB);<br>
        CallFibX1->setTailCall();<br>
    </blockquote>
    <br>
    I'm assuming the program runs through lli but is not showing any
    output.<br>
    <br>
    I think you're calling putchar() with a value of 1.  That may be an
    unprintable character (like ctrl-a).  Try a value that is an ASCII
    character (I think 'A' is 65, but it's been awhile).<br>
    <br>
    -- John T.<br>
    <br>
    <blockquote
cite="mid:CAMY5+L5yEsowNNR5ifRNYJSADtBV0e2KUGAm8sJNvXVBqMdsoQ@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>