Help to write LLVM MachineFunctionPass

Dear All,

I am writing the MachineFunctionPass passes in LLVM. I am following the steps from following link but not able to proceced further. The steps are not clears since it does mention in which folder we need to store the file and how to compile.

http://web.archive.org/web/20140725235132/http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-January/037496.html

http://www.gabriel.urdhr.fr/2014/09/26/adding-a-llvm-pass/

http://adriansampson.net/blog/llvm.html

It would be great if some one share sample code of codegen pass(MachineFunctionPass) and steps need to be followed to write LLVM MachineFunctionPass pass, which I wanted run after global register allocation pass.

Thanks,
Bala

It may be easiest to copy an existing MachineFunctionPass, chaning file and class names as appropriate.