[LLVMdev] LLVM Tutorials
criswell at illinois.edu
Thu Apr 7 15:03:59 PDT 2011
On 4/7/11 4:56 PM, Nipun Arora wrote:
> Could anyone point me to some simple examples/tutorials for writing
> instrumentation transform passes. Essentially adding instructions to
> basic blocks, such as print statements, load, add, store. I have tried
> going through profiling transforms, and was wondering if there is any
> better documented tutorial etc ?'
Section 5 of the Programmer's Manual may be helpful:
Doxygen is a good reference when you need to look up a class.
Basically, every LLVM instruction and value have their own class:
For an example of an extremely simple instrumentation pass, check out
lib/InsertPoolChecks/LoadStoreChecks.cpp in the SAFECode project
(http://sva.cs.illinois.edu). This code adds a run-time check on every
load and store instruction. It's almost as simple as a transform gets.
-- John T.
More information about the llvm-dev