circt
circt copied to clipboard
[FIRRTL] Add hacky FModule printer instrumentation
Inspired by the PR to print IR after specific passes, I thought people might also be interested in this patch I use sometimes for debugging. This adds an experimental pass instrumentation to dump a specific module after each pass runs. It's pretty hacky, but it has saved me a couple times. It uses a regex to match the module name so that it can handle name changes from PrefixModules. It is not multithread safe, so if the regex matches more than 1 module it gets ugly. There is a pretty bad hack to skip OpToOpPassAdaptors. It would be nice if this could be built off the regular IR printing utilities, but I think those will print whatever the pass was running on, e.g. it will dump the entire circuit for CircuitOp passes instead of a specific module. Maybe something is better than nothing? If we want to merge it I can add tests or move the instrumentation to a different file.