freenode/#sicl - IRC Chatlog
Search
16:14:52
beach
If you think it will be informative, then I think you just have to linearize the HIR code in some systematic manner.
16:15:20
jcowan
Primarily, I'd say, because diff is not hierarchical: it thinks in terms of non-semantic units called "lines".
16:15:31
drmeister
Rather, what would be a better way to see the differences between two HIR graphs?
16:17:44
beach
drmeister: Here is what I think. I think it is trivial to write a HIR-to-text module, so rather than guessing whether diff would be useful on such a thing, it is probably easier just to try it out.
16:18:56
jcowan
For example, when running regressions on my HTML->XML converter, I had it generate a format called PYX (also known as "nsgmls output format") which represents each open-tag, attribute-value pair, text content, close tag, etc. as a separate line so that ordinary diff will work on it.
16:19:27
jcowan
S-expressions could be linearized (in the literal sense of "converted to a sequence of lines") in a similar way.
16:21:12
jcowan
It may be that HIR objects are simple enough, apart from their references to other HIR objects, that they can be (in this sense) linearized by a special-purpose routine, I don't know.
16:21:39
drmeister
If we assign basic-block labels based on the depth from the first instruction then the insertion of a branch will completely change all of the labels.
16:24:57
beach
You want the arc that jumps back to the beginning to be represented as a jump from a position further down the page to further up the page.
16:27:24
beach
Otherwise, if you have cycles in the graph, it can be quite arbitrary which arcs go forward and which ones go backward.
16:28:10
beach
In Common Lisp, most graphs will have "natural loops", so you can compute such a natural ordering.
16:46:22
beach
You could use the "longest path" algorithm that I use in the HIR visualizer. That one is pretty good about getting a consistent layout.