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:

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


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

From LLVM website, you can refer to

And for outside pass, you can refer to
It’s a great article.
And the author put the source code on Github.

See also from the last Dev Meeting: (slides and video)