Registering a MachineFunctionPass from a Clang plugin

Hi,

I am using this code to register a llvm IR pass from a Clang plugin:

void registerPasses(const PassManagerBuilder &PMB, PassManagerBase &PM)
{
PM.add(…);
}

RegisterStandardPasses register_pass(PassManagerBuilder::EP_OptimizerLast, registerPasses);

I would like to do the same for registering a MachineFunctionPass pass. Any idea how to do this?

Perhaps it is also fine to register the machine pass from an IR pass. If so, how?

Regards,
Jan Hoogerbrugge