[LLVMdev] Counting instructions

Chris Lattner sabre at nondot.org
Tue Feb 5 10:08:33 PST 2008


On Tue, 5 Feb 2008, Raul Fernandes Herbster wrote:
> I need to instrument the code in order to generate an event (call a certain
> function) whenever X instructions have been executed. I'm using
> MachineFunctionPass to get machine-dependent representation of each LLVM
> function in the program. However, such pass doesn't allow to modify such
> functions. Is there any other class so I can modify MachineFunctions?

I'm not sure I follow here: you want to insert your instrumentation at the 
machine code level, but you want to change the llvm ir?  Once the 
instruction selection phase converts from llvm ir to machine code, the 
LLVM IR is mostly ignored.  Changing it won't cause a change in the 
generated code.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list