Hi, 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? Thanks in advance, Raul. -- Raul Fernandes Herbster Embedded and Pervasive Computing Laboratory - embedded.ufcg.edu.br Electrical Engineering and Informatics Center - CEEI Federal University of Campina Grande - UFCG - www.ufcg.edu.br Caixa Postal 10105 58109-970 Campina Grande - PB - Brasil -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080205/5d8c705b/attachment.html>
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/
I'm not quite sure Chris. But I think Raul only wanna to execute some specific instruction about every X instructions. He probably don't need to modify the instruction generated, but only to count the number of machine instructions and execute something after. Am I right Raul? I believe he is trying to do that at the JIT level. These where my two bits.... :) In time, I don't know the answer for his question. cheers kyller On 2/5/08, Chris Lattner <sabre at nondot.org> wrote:> 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/ > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- |_|0|_| |_|_|0| |0|0|0|