[LLVMdev] whether these transformations are doable and how?
astifter-llvm at gmx.at
Sun Apr 11 21:58:51 PDT 2010
On 04/09/2010 01:29 PM, Ning Wang wrote:
> I'm a newbie to llvm, please first forgive my naive questions. I want to
> instrument llvm code to do some run-time monitoring work. After reading
> some of the llvm documentation, it begins clear to me that I can do the
> instrumentation in a transformation pass. There are several things I
> want to do in the transformation pass, but I'm not sure whether they are
> doable and how to do them even after I read the documentation. I would
> be very appreciate if anyone can answer my questions or give me hints of
> how to do them.
> 1. can I add more global memory objects to a module? any hint how to
> do it? do I need to derive a pass from ModulePass?
There is an instrumentation pass that adds counters to the control flow
graph edges to perform profiling at
lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp. You can have a
look there how its done.
More information about the llvm-dev