How to write a simple MachineFunctionPass

Hello everyone,

I have written simple LLVM passes, but I cannot able to write a MachineFunctionPass pass.

I am following the steps form the following link but it is not working:
http://www.gabriel.urdhr.fr/2014/09/26/adding-a-llvm-pass/

Please share the sample MachineFunctionPass code or steps to follow to write MachineFunctionPass.

Thanks,
Bala

First you should learn how to write a pass and then a MachineFunctionPass.

From LLVM website, you can refer to http://llvm.org/docs/WritingAnLLVMPass.html

And for outside pass, you can refer to http://adriansampson.net/blog/llvm.html
It’s a great article.
And the author put the source code on Github.

See also from the last Dev Meeting: http://llvm.org/devmtg/2015-10/#tutorial1 (slides and video)
Github: https://github.com/quarkslab/llvm-dev-meeting-tutorial-2015