<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"> <br>Hi all,<br>I want to run a function pass on a certain .bc file. In the process, the pass will insert a check function into the .bc file.<br><br>I know the .bc file is regarded as a module in LLVM. So, there are two basic steps needed to be done,<br>1, Use the "getOrInsertFunction"API to add a declaration of the extern "check function".<br>2, Use the "insertBefore"API to insert the CallInst into the right position.<br><br>My problem is about the step 1. How can I get the handle of the .bc file (Probably is a Module*)? so I can <br>declare the extern function like<br>// insert the " i32 @fib(i32 )" to the module M<br>Function *FibF =<br>    cast<Function>(M->getOrInsertFunction("fib", Type::getInt32Ty(Context),<br>                                          Type::getInt32Ty(Context),<br>                                          (Type *)0));<br>How can I get the "M" of the .bc file??????<br><br>Any help~<br>  <br><div>--<br><div>
<div>
<div><font color="#c0c0c0" size="2">
<div><font color="#c0c0c0"><font size="3">  <span style="COLOR: #000000">          ×£ºÃ£¡</span></font></font></div><span style="COLOR: #000000">
<div> </div>
<div><font size="3">  Õç¿­</font></div>
<div>
<div><font color="#c0c0c0"><font size="3">------------------------------------------------------------------------------------------------------</font></font></div></div>
<div><font color="#c0c0c0"><font size="3">2012-04-10</font></font></div></span></font></div>
<div><font color="#c0c0c0"><font size="3">------------------------------------------------------------------------------------------------------</font></font></div>
<div><font color="#c0c0c0"><font size="3">Name: Õç¿­(ZhenKai)<br>Homepage:http://www.renren.com/262729393</font></font></div>
<div><font color="#c0c0c0"><font size="3">Email: </font><a href="mailto:zhenkaixd@126.com" target="_blank" _listener="1901"><font color="#0066cc" size="3">zhenkaixd@126.com</font></a><font size="3"> or <a href="mailto:846227103@qq.com">846227103@qq.com</a></font></font></div>
<div><font color="#c0c0c0" size="3">TEL: 15810729006(Beijing)<br>Address: Room I-406, Central Building, Tsinghua University, Beijing, China. 100084.</font></div></div></div></div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>