This is an archive of the discontinued LLVM Phabricator instance.

Comprehensive Static Instrumentation (1/2): LLVM pass
Needs ReviewPublic

Authored by tdenniston on Jun 27 2016, 8:02 AM.

Details

Summary

The Comprehensive Static Instrumentation (CSI) framework provides static instrumentation that a compiler inserts into a program-under-test so that dynamic-analysis tools -- memory checkers, race detectors, cache simulators, performance profilers, code-coverage analyzers, etc. -- can observe and investigate runtime behavior. Heretofore, tools based on compiler instrumentation would each separately modify the compiler to insert their own instrumentation. In contrast, CSI inserts a standard collection of instrumentation hooks into the program-under-test. Each CSI-tool is implemented as a library that defines relevant hooks, and the remaining hooks are "nulled'" out and elided during link-time optimization (LTO), resulting in instrumented runtimes on par with custom instrumentation. CSI allows many compiler-based tools to be written as simple libraries without modifying the compiler, greatly lowering the bar for developing dynamic-analysis tools.

This diff encompasses a skeleton compiler pass for CSI. For an extended usage doc, please see the docs/CSI.rst document submitted with the clang diff. We will be submitting further diffs that incrementally add functionality to CSI.

Diff Detail

Repository
rL LLVM

Event Timeline

tdenniston updated this revision to Diff 61964.Jun 27 2016, 8:02 AM
tdenniston retitled this revision from to Comprehensive Static Instrumentation (1/2): LLVM pass.
tdenniston updated this object.
tdenniston set the repository for this revision to rL LLVM.
tdenniston added a project: Restricted Project.
tdenniston added subscribers: llvm-commits, neboat, aizatsky and 3 others.
bruening added inline comments.Jun 30 2016, 10:57 AM
lib/Transforms/Instrumentation/ComprehensiveStaticInstrumentation.cpp
36

I would suggest a FIXME comment to make it clear that this is not finished and is an incremental step.

tdenniston added inline comments.Jun 30 2016, 12:26 PM
lib/Transforms/Instrumentation/ComprehensiveStaticInstrumentation.cpp
36

Will do.

mehdi_amini edited edge metadata.Jul 7 2016, 12:14 PM

Each CSI-tool is implemented as a library that defines relevant hooks, and the remaining hooks are "nulled'" out and elided during link-time optimization (LTO)

The thread on llvm-dev explained why LTO should be orthogonal to the design.