Adding a function call in my IR code in llvm
问题 Can you give me an example ,how to add a simple call of a function foo(x); on my IR code with my pass in llvm? 回答1: A simple way is to learn is to use ELLCC with Output Options as LLVM C++ API Code . Two key notes: Make sure foo 's definition is available; otherwise you need to define it firstly. Typically you need to get the prototype by using getOrInsertFunction and then use IRBuilder to insert the body for the function. Create the CallInst , an easy way is to use CallInst*IRBuilder: