Every time I've tried to write a backend to go from SSA to anything, I hit a wall when I have to go from a graph of basic blocks back to some kind of structured representation, whether it's wasm or Rust or whatever. So I need to learn more about how these transformations are described on a formal level and how to perform them. As it is I just don't know how to collect the information correctly to figure out "this is a loop" vs. "this is a choice" vs. whatever else.
This article is timely: https://medium.com/leaningtech/solving-the-structured-control-flow-problem-once-and-for-all-5123117b1ee2
References from that:
Maybe-useful source: https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-660.pdf
Long, though.
definitely useful source: Simple and Efficient Construction of Static Single Assignment Form. Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau