[LLVMdev] Difficulty inserting putchar in IR

tarun agrawal tarun at cse.iitb.ac.in
Thu Feb 9 11:02:46 PST 2012


Hi,

I have written a simple code to  insert putchar() function into IR.
It compiled well but when  I tried to run the generated .bc file with lli,
its not showing
proper output.

Function *putchar_func = cast<Function>(M->
    getOrInsertFunction("putchar", IntegerType::getInt32Ty(Context),
                        IntegerType::getInt32Ty(Context), NULL));

  Value *One = ConstantInt::get(Type::getInt32Ty(Context), 1);

  CallInst *CallFibX1 = CallInst::Create(putchar_func, One, "fibx1", BB);
  CallFibX1->setTailCall();



Thanks and Regards,
Tarun Agrawal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120210/9bcd728b/attachment.html>


More information about the llvm-dev mailing list