Dear All,
I've developed a patch for mainline LLVM that integrates parts of the SAFECode memory safety compiler (http://sva.cs.illinois.edu) into LLVM. The patch includes transforms that add run-time safety checks to loads and stores and GetElementPtr instructions, a run-time library that implements the checks, a transform that enhances the run-time checks with source file debugging information (essentially making the compiler a valgrind-like tool), and one of the simpler but more critical run-time check optimization passes.
Working under the assumption that people are interested in memory safety transforms being in LLVM, we'd like to integrate this code into LLVM and would like to know if someone is willing to review the patch and provide feedback. I have commit access already, so I can commit the code myself provided that it passes review.
The patch is available as a tar archive at http://llvm.cs.uiuc.edu/~criswell/sc.tar.gz and can be extracted into the top-level LLVM source tree (*). I have also created two new test Makefiles for the test-suite that run the transforms on programs in the LLVM test suite; those can be found (as a regular patch to test-suite) at http://llvm.cs.uiuc.edu/~criswell/patch.
BTW, there are more optimizations and other code from SAFECode that we'd like to integrate (including some memory safety check optimizations, the simple static array bounds checking passes, and the control-flow integrity pass), but I wanted to start with a small initial patch and work from there.
-- John T.
(*) I apologize for not creating a normal "diff" patch; I used svn copy to preserve the revision history when moving files from the SAFECode source tree to my LLVM working directory; a side effect of this is that the result of "svn diff" merely shows what changed relative to the original source files in the SAFECode source tree and not the differences relative to the LLVM source tree.