Solved by tom in post #4 
              
              
                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 …