I have been working on an x86 emulator[1] so I have x86 on the mind. As I read the post I was thinking to myself "there's no way you can iterate the instruction stream without a massive amount of effort to parse through all different instruction types"... and then remembered MIPS has constant-sized instructions. So nice!
But also I glanced at some MIPS docs and it seems there there could be additional instructions that modify these registers as outputs, which the code doesn't address. Maybe they just don't occur in practice?
The list of supported instructions was built empirically, by looking at the code that GCC was actually generating for functions' prologues. Luckily there wasn't a lot of variation, but YMMV.
But also I glanced at some MIPS docs and it seems there there could be additional instructions that modify these registers as outputs, which the code doesn't address. Maybe they just don't occur in practice?
[1] https://github.com/evmar/retrowin32