How to define a pass requiring a register allocation pass?

How to define a MachineFunctionPass requireing one of the register
allocation passes being executed first?

Should there be a PassInfo for register allocation in Pass.h?

Pass.h:

namespace llvm {
  extern const PassInfo *PHIEliminationID;
  extern const PassInfo *TwoAddressInstructionPassID;
  extern const PassInfo *RegisterAllocationPassID; // <--
add this one?

There are four register allocation passes in CodeGen, but I don't know
which one will be used unitl run-time (the register allocator is
chosen by a command line argument).

you don't really know. The way to control this is the order in which passes are added to the pass manager by your target's addPassesToEmitFile method. Just make sure that the pass that must run after register allocation is only added there.

-Chris