One of the goals of my GSoC cmm project is to make cmm roundtripable. That is , be able to serialize/pretty print the cmm data structure ( the one GHC uses for code generation ) into a file and be able to parse/deserialize said file back into a haskell data structure. This is currently not possible because Cmm cant be pretty printed and parsed from textual files. But those two tools use incompatible formats
Initially Csaba Hruska ( my mentor ) and i figured out the least invasive way to accomplish this, would be to rewrite the pretty printer so it produces code compatible with the parser. But we now think this is a bad idea. The parser implements a “high level syntax” which ammount to features not found in the cmm data structure. But even the low level syntax is not an accurate depiction of the AST.
I would like to share some of the documentation i have been writing, so you can see for yourselfs