[LLVMdev] get the "-stats" information from within the application (instead of from command line)

Jingyue Wu jingyue at google.com
Sun May 10 10:21:49 PDT 2015


Hi Zhoulai,

Have you tried `cl::ParseCommandLineOptions` (
http://llvm.org/docs/doxygen/html/CommandLine_8cpp_source.html#l00831)?

You may need to write your own opt.cpp-like tool. There, you run
ParseCommandLineOptions with "-stats" before you run any pass, and access
these stats variables after all passes finish.

We used this approach to pass in certain optimization flags (such as
-disable-machine-sink) without using opt. I hope it works for "-stats" too.

Jingyue

On Sat, May 9, 2015 at 10:16 PM Zhoulai <zell08v at gmail.com> wrote:

> Hi,
>
> I am using “llvm/ADT/Statistic.h" for recording the iteration number of a
> pass. However, instead of printing them with "opt -stat..." command line, I
> need these information from within the application. How can I do this?
>
> For example, if I have:
> *STATISTIC ( HelloCounter, “Counts number of functions greeted” ) *
> in my pass Hello.cpp, how can I retrieve the HelloCouner from other source
> files? Thank you.
>
> Zhoulai
>  _______________________________________________
> 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/20150510/e1a88ba0/attachment.html>


More information about the llvm-dev mailing list