[LLVMdev] Instrument examples

zhouxu(NUDT) zhouxuzhu1985 at gmail.com
Thu Nov 3 21:49:23 PDT 2011


>  No idea what exactly you want to achieve, but let me try.
>
>  First, you might need a function doing the instrument. Say,
>
>    void HowManyTimeThisFunctionGetCalled();
>
>  Then you can insert a call to the function above while creating
> a LLVM function [1]. In that way, every time that LLVM function
> get called the function doing the instrument will be called.
>
>  You might need to take a look on ${LLVM_SOURCE}/example/HowToUseJIT
> to get a feel on how to create a LLVM module, function and basic block.
>
> Regards,
> chenwj
>
> [1] http://llvm.org/docs/ProgrammersManual.html#Function
>
>

Yes, instrumenting functions is just one of my purpose. The API document
(though not very detailed) your provide is helpful. However, the problem of
the document is that it is not up-to-date. For example, "Type::Int32Ty" is
not used to acquire an integer type in LLVM2.9. So sometimes it cause
confusion to me.

Thanks.

--
zhouxu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111104/d887711a/attachment.html>


More information about the llvm-dev mailing list