<div dir="ltr"><div>Thank you very much for the information!<br>I will try it out!<br><br></div>Thanasis<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 28, 2014 at 7:59 PM, Amara Emerson <span dir="ltr"><<a href="mailto:amara.emerson@gmail.com" target="_blank">amara.emerson@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Thanasis,<br>
<br>
You should be able to do this easily by writing a FunctionPass (see<br>
<a href="http://llvm.org/docs/WritingAnLLVMPass.html" target="_blank">http://llvm.org/docs/WritingAnLLVMPass.html</a> for more info) and<br>
iterating over the instructions in the function, searching for<br>
CallInst instructions and using getCalledFunction() to check if it's<br>
indirect.<br>
<br>
Amara<br>
<div><div class="h5"><br>
On 28 April 2014 14:10, Petsas Athanasios <<a href="mailto:petsas@ics.forth.gr">petsas@ics.forth.gr</a>> wrote:<br>
> Dear all,<br>
><br>
> I would like to keep track of all the indirect calls that may caused from<br>
> function<br>
> pointers inside a program. I need this in order to be able to construct the<br>
> control<br>
> flow graph of all the indirect calls, that is which function is legal to<br>
> call another<br>
> function.<br>
><br>
> Is there a module that implements this functionality in llvm? If not, is<br>
> there a way to<br>
> do it? Maybe through implementing a pass. I am new to llvm. Could you<br>
> suggest me<br>
> a way to start doing this? Perhaps the llvm intermediate code can help me on<br>
> this.<br>
> Do you know where this code is being produced? or what files or passes do I<br>
> have<br>
> to modify for this?<br>
><br>
> Until now I have used this command to produce and study the llvm bitcode for<br>
> a test<br>
> program:<br>
> clang -S -emit-llvm fpointers.c -c -o fpointers.bc.text<br>
><br>
> Thank you,<br>
><br>
> --<br>
> Thanasis Petsas<br>
> Distributed Computing Systems (DCS)<br>
> Institute of Computer Science (ICS/FORTH)<br>
> Heraklion, Crete<br>
> Greece (GR)<br>
><br>
> <a href="http://www.thanasispetsas.com/" target="_blank">http://www.thanasispetsas.com/</a><br>
><br>
</div></div>> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
</blockquote></div><br><br clear="all"><br>-- <br><font color="#888888"><font face="Helvetica, Verdana, Arial"><span style="font-size:11pt"><font color="#888888"><span>Thanasis</span> <span>Petsas</span><div>
Distributed Computing Systems (<span>DCS</span>)<br>
Institute of Computer Science (ICS/FORTH)<br>
Heraklion, Crete<br>
<span>Greece</span> (GR)<br><br><font color="#888888"><font face="Helvetica, Verdana, Arial"><span style="font-size:11pt"><font color="#888888"><a href="http://www.thanasispetsas.com/" target="_blank">http://www.thanasispetsas.com/</a></font></span></font></font><br>
</div></font></span></font></font>
</div>