Description
As discussed in CL 36329, debugging SSA rules can be tedious and time-consuming. CL 36646 adds some rudimentary tools to help. This issue describes a pie-in-the-sky tool. Maybe we'll settle on something in between. :)
ssa.html appropriately treats rule-based passes (opt, dec, lower) as a single phase, but they actually perform a very long series of transformations, and it can be hard to see how the input relates to the output. In a typical rule pass, many many rules get applied, so putting them all side-by-side is not feasible.
But imagine some html dedicated to a single rule-based pass. Two columns, before and after, similar to existing ssa.html columns. A header at the top shows a single rule being applied, and if it does not apply, why it does not apply. Before column shows input to that rule, after shows output. Use arrow keys to step forward/back to watch rules get applied (or not) one at a time.
This would be unusable without a way to filter--there are too many rules to view them all one at a time. Filtering should consist of marking either rules and/or values of interest. Any rule marked as interesting always gets shown, whether it applies or not. Any rule that alters a value of interest gets shown. All other rules get compressed into a single "n rules applied" rule.
So a typical debugging experience might be:
- Mark rules as interesting in the rules file somehow.
- Provide a list of interesting values, from observing previous compilations of the same code. (Where/how? envvar? file? Specifying values of interest dynamically in UI might be too hard, for data volume and sanity reasons.)
- Compile, generating html artifact.
- Poke around at the rules/values you care about.
- Glorious comprehension / profit.