RegisterPass still is the right thing to do (or use registerPostPass if you want to call something - RegisterPass is just a trick to call registerPostPass at initialization, there also is a registerPrePass to get an earlier graph). Note that custom passes are not called during the tracing/scripting phase of the JIT but during the optimization phase in the graph executors.
I once wrote a overview blog post about the runtime phases.