[LLVMdev] running a pass on multiple files

Duncan Sands baldrick at free.fr
Wed Apr 24 05:30:58 PDT 2013


Hi Niko,

> I am new with LLVM and I have written a pass able to analyze the code and see if
> functions in a module are pure.

LLVM already has such a pass (-functionattrs) which marks functions with the
readonly attribute if they are "pure", and with the readnone attribute if they
are "const".

> I managed to run the pass with opt -load on a simple (single file) programIR
> (generated with clang).
> Now I am willing to run it on a structured program (probably on a benchmark
> suite like: http://euler.slu.edu/~fritts/mediabench/
> <http://euler.slu.edu/%7Efritts/mediabench/>) to see how many pure function are
> identified and how many time it takes to perform the analysis (similarly to the
> -time-passes option).
> Do you have any suggestion on how to do it?

I suggest you run LLVM's nightly testsuite (not the regression testsuite that
comes with LLVM, the full testsuite that you have to check out separately).
Running the testsuite compiles everything to bitcode, so once the testsuite is
done you then have a huge pile of bitcode to do statistics on.

Ciao, duncan.



More information about the llvm-dev mailing list