[LLVMdev] Programmatic compilation of C++ file into bitcode

Trevor Harmon Trevor.W.Harmon at nasa.gov
Thu Feb 25 11:16:29 PST 2010

On Feb 25, 2010, at 1:04 AM, Duncan Sands wrote:

> You can add your static analysis to llvm-gcc as an LLVM pass.
> If you write it as an LLVM pass then you can also use it from
> "opt", which would be convenient.

Thanks, that sounds like a good approach. It appears I can get a  
Module instance simply by inheriting from ModulePass.

There's one problem, however. I will at some point want to integrate  
this analysis tool with other tools. For example, an Eclipse plugin  
might run the analysis tool and then display the analysis results in  
an Eclipse window. I suppose the plugin could execute "opt" as a  
subprocess and then parse the output, but that seems brittle. I'd  
prefer to define an API in my analysis tool that other tools could  
then call. That's why I was trying to build upon projects/sample/*  
instead of lib/Transforms/Hello/*.

Is there perhaps some structured mechanism for retrieving the output  
of an LLVM pass? That is, something better than just parsing the  
output of "opt"...



More information about the llvm-dev mailing list