Overriding a pass from backend


I need to replace a certain pass with my own from backend in case the backend is used.

In my particular case the pass I want to replace is register allocation pass. Whatever it is, I want it to be removed and my pass must be run instead. There is a mechanism to register an my pass and a new register allocator, and that solves a half of a problem. Now I want my pass to be Is there any “normal” way to detect if my backend is used and disable all other register allocation classes?

Regards, Dmitry