Shirish Seetharam (sseethar)
2006-Oct-10 20:36 UTC
[LLVMdev] Questions regarding using LLVM for static code analysis
Hi, I am looking into the possibility of using the the LLVM infrastructure for static code analysis. Specifically I am trying to understand the object mod/ref relationships between modules (which are a set of C/C++ files). I plan to generate the .o and .bc files (using CC=llvm-gcc) and then run "opt" on the .bc file to display the information. One of the things I noticed was that some of the optimizer phases had already transformed the code, so the dependency had moved to another function. I wanted to know if there is a simple way to disable all the optimizing transformations ? I am also interested in knowing how scalable this approach (generating the .o and the .bc and then using opt) is going to be ? The source I am looking is fairly large (several million lines of code). Thanks, Shirish -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20061010/e948f4c8/attachment.html>
Chris Lattner
2006-Oct-10 22:11 UTC
[LLVMdev] Questions regarding using LLVM for static code analysis
On Tue, 10 Oct 2006, Shirish Seetharam (sseethar) wrote:> I am looking into the possibility of using the the LLVM > infrastructure for static code analysis. Specifically I am trying to > understand the object mod/ref relationships between modules (which are a > set of C/C++ files). I plan to generate the .o and .bc files (using > CC=llvm-gcc) and then run "opt" on the .bc file to display the > information. One of the things I noticed was that some of the optimizer > phases had already transformed the code, so the dependency had moved took> another function. I wanted to know if there is a simple way to disable > all the optimizing transformations ? I am also interested in knowing > how scalable this approach (generating the .o and the .bc and then using > opt) is going to be ? The source I am looking is fairly large (several > million lines of code).If you're using llvm-gcc4, passing -O0 should be sufficient. If you're using llvm-gcc3, please see: http://llvm.org/docs/FAQ.html#cfe -Chris -- http://nondot.org/sabre/ http://llvm.org/