[LLVMdev] pass argument to a FunctionPass

John Criswell criswell at uiuc.edu
Fri Apr 23 07:48:38 PDT 2010


khaled hamidouche wrote:
> Hello
> is there any way to pass argument to my own Function pass

Add a command-line option to your pass using the LLVM command-line 
library: http://llvm.org/docs/CommandLine.html.  You can find examples 
in the LLVM source; the inlining optimization pass (in 
lib/Transforms/IPO, I believe) does this.

If you add command-line options using this library, they get registered 
when loaded into opt and bugpoint.

-- John T.
>
> I mean I wrote a Function pass (like Hello) that give me somme 
> analyzes about the code source and I need to pass somme argument to 
> the Pass  like the size of data....
>
> I want some think like this
>
>   opt -load ../../../Debug/lib/LLVMHello.so -hello2 < test.bc > 
> /dev/null   arg1 arg2 ...
>
> So how to get inside the Function pass the arg1 and arg 2 ??
>
>
> Thank you
>
> K.H




More information about the llvm-dev mailing list