My opt plugin contains multiple passes in it and each pass produces some results and saves them in a global data structure.
$ opt -load myplugin.dylib -pass1 -pass2 -pass3 test.bc
After all passes finish running, I need to flush out the collected results to a disk file. But I don't know when I can do it. Is there a way/callback for my plugin to know when opt is done with it?
Perhaps the last pass could take care of the flushing but my understanding is that it's up to PassManager that decides which pass to run lastly, so I don't think this heck would be a good idea, especially given that I keep adding new passes to my plugin.