I am trying to write a MachineFunction pass and build it as a loadable module.
I want the pass to run after prolog/epilog emmiter. So far, I have been using
MachineFunctionPass, but by inserting it to lib/Codegen and hacking the
LLVMTargetMachine file, and Pass.h files.
I have created a directory "lib/Transforms/MyPass", and inside I have
the code of the pass (which is just a placeholder for now):
Is it even possible to have a MachineFunctionPass externally, or not?
Probably not. MachineFunctionPasses aren't regular Passes which
opt can meaningfully run, in its current form.
The documentation implies that is should be possible.
In "Writing an LLVM Pass" it does mention MachineFunctionPass, and how it has
the same behaviour as FunctionPass (no adding of blocks or functions, only new
instructions etc). Since this page refers to "writing your own pass", it
could be implied that it is possible.
Anyway, thanks for the response.
The documentation to make MachineFunctionPass is now more explicit about
its special needs.