sachin arora
2014-Sep-17 20:44 UTC
[LLVMdev] Need guidance regarding MachineFunctionPass implementation
Hello all, I need to modify llvm bytecode / native code just before it is emitted i.e. after all the regular operations and optimizations are done. I was told that this can be achieved by implementing a MachineFunctionPass. I searched the internet for some tutorials or some example MachineFunctionPass but found nothing. Kindly point some links, or anything that may help. Thank you. Regards, Sachin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140917/f357d3a4/attachment.html>
David Peixotto
2014-Sep-17 21:21 UTC
[LLVMdev] Need guidance regarding MachineFunctionPass implementation
Hi Sachin, You could check the code in lib/Target/ARM/ARMOptimizeBarriersPass.cpp for an example of a MachineFunctionPass that runs very late. Look in lib/Target/ARM/ARMTargetMachine.cpp to see where it is added to the pass pipeline. -David -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of sachin arora Sent: Wednesday, September 17, 2014 1:45 PM To: llvmdev at cs.uiuc.edu Subject: [LLVMdev] Need guidance regarding MachineFunctionPass implementation Hello all, I need to modify llvm bytecode / native code just before it is emitted i.e. after all the regular operations and optimizations are done. I was told that this can be achieved by implementing a MachineFunctionPass. I searched the internet for some tutorials or some example MachineFunctionPass but found nothing. Kindly point some links, or anything that may help. Thank you. Regards, Sachin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140917/a6c916b4/attachment.html>
John Criswell
2014-Sep-17 23:21 UTC
[LLVMdev] Need guidance regarding MachineFunctionPass implementation
Dear Sachin, You will want to read up on the LLVM Code Generator infrastructure: http://llvm.org/docs/CodeGenerator.html#machine-code-description-classes Also, a MachineFunctionPass is nearly the same as an LLVM FunctionPass except that it operations on MachineFunction objects instead of Function objects. If you read the "Writing an LLVM Pass" document (http://llvm.org/docs/WritingAnLLVMPass.html) and understand how to use MachineInstr's, MachineBasicBlocks, and MachineInstr's, you should be able to figure it out. Finally, take a look at the doxygen documentation anytime you need details on how to use a specific LLVM class, and as David suggested, take a look at existing code. Regards, John Criswell On 9/17/14, 4:44 PM, sachin arora wrote:> Hello all, > > I need to modify llvm bytecode / native code just before it is emitted > i.e. after all the regular operations and optimizations are done. I > was told that this can be achieved by implementing a MachineFunctionPass. > I searched the internet for some tutorials or some example > MachineFunctionPass but found nothing. Kindly point some links, or > anything that may help. Thank you. > > Regards, > Sachin > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140917/0f0ef00f/attachment.html>
sachin arora
2014-Sep-18 16:54 UTC
[LLVMdev] Need guidance regarding MachineFunctionPass implementation
Thank you Mr. John and Mr. David ! Regards, Vipin On Wed, Sep 17, 2014 at 6:21 PM, John Criswell <jtcriswel at gmail.com> wrote:> Dear Sachin, > > You will want to read up on the LLVM Code Generator infrastructure: > http://llvm.org/docs/CodeGenerator.html#machine-code-description-classes > > Also, a MachineFunctionPass is nearly the same as an LLVM FunctionPass > except that it operations on MachineFunction objects instead of Function > objects. If you read the "Writing an LLVM Pass" document ( > http://llvm.org/docs/WritingAnLLVMPass.html) and understand how to use > MachineInstr's, MachineBasicBlocks, and MachineInstr's, you should be able > to figure it out. > > Finally, take a look at the doxygen documentation anytime you need details > on how to use a specific LLVM class, and as David suggested, take a look at > existing code. > > Regards, > > John Criswell > > > > On 9/17/14, 4:44 PM, sachin arora wrote: > > Hello all, > > I need to modify llvm bytecode / native code just before it is emitted > i.e. after all the regular operations and optimizations are done. I was > told that this can be achieved by implementing a MachineFunctionPass. > I searched the internet for some tutorials or some example > MachineFunctionPass but found nothing. Kindly point some links, or anything > that may help. Thank you. > > Regards, > Sachin > > > _______________________________________________ > LLVM Developers mailing listLLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140918/3110ea94/attachment.html>
Maybe Matching Threads
- [LLVMdev] Need guidance regarding MachineFunctionPass
- [LLVMdev] Need guidance regarding MachineFunctionPass
- [LLVMdev] Need guidance regarding MachineFunctionPass
- [LLVMdev] Need guidance regarding MachineFunctionPass
- [LLVMdev] Is it necessary to implement the whole backend in order to add a new "pass" to the backend ?