[LLVMdev] Pass Question

John Criswell criswell at illinois.edu
Fri Jul 15 14:47:40 PDT 2011


Dear Jian,

Can you be more specific about what you don't understand?  Do you not 
know how to write an LLVM pass that can be loaded into opt, or do you 
not understand the API that an LLVM pass uses to instrument code?

In any event, make sure to read 
http://llvm.org/docs/WritingAnLLVMPass.html.  It describes how to write 
a skeleton LLVM pass.

-- John T.

On 7/15/11 4:42 PM, Jian Cai wrote:
> Hi,
> I am trying to write a pass and add it into the LLVM optimizer so to 
> insert functions for optimization before and after every function call.
> For example, I create a test file test.c. There is  a function f1() 
> just printing out "Print f1", which is called in the main function. 
> That's all the test.c do. Now I want to insert optimazation function 
> opt_begin() before f1() and opt_end() after by adding the command line 
> of my pass in the compilation option of llvm-gcc. Does anyone  have 
> any idea about how to implement this? I would really appreciate if 
> anyone can help me out, since I was stuck by this question for really 
>  a long time.
>
> Jian
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110715/3a4824bc/attachment.html>


More information about the llvm-dev mailing list