[LLVMdev] How to duplicate a CallInst

Rafael Baldiati Parizi parizi.computacao at gmail.com
Fri Jan 6 09:50:05 PST 2012


Hi,
I have the following piece of code:
%34 = fptosi float %33 to i32
%35 = call i32 @function(i32 %34) nounwind

I would like of know how  can I duplicate the statement %35 ? , as follows:
%34 = fptosi float %33 to i32
%35 = call i32 @function(i32 %34) nounwind
*%36 = **call i32 @function(i32 %34) nounwind*
*
*
i.e, two instructions exactly equal.

Using clone, results in badref.
Moreover, how can I get the parameters of function?

This is my experimental code that not is running wich I need:
for (BasicBlock::iterator Is = i->begin(), e = i->end(); Is != e; ++Is){
     if(isa<CallInst>(*Is)){
        CallInst *call = dyn_cast<CallInst>(&*Is);
        Function* ft = call->getCalledFunction();
       *arguments = ????*
       CallInst *call2 = CallInst::Create(ft, *arguments.begin(),
arguments.end()*, "", ++Is);
    }
}


Thanks,
-- 
*Rafael Parizi*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120106/6dc1ea9b/attachment.html>


More information about the llvm-dev mailing list