2 ms·
That one is pretty easy to implement. The Cooper & Torczon book describes the algorithm well and has worked examples. https://shop.elsevier.com/books/engineerin
by rayiner 2y ago
That one is pretty easy to implement. The Cooper & Torczon book describes the algorithm well and has worked examples. https://shop.elsevier.com/books/engineering-a-compiler/cooper/978-0-12-815412-0 https://shop.elsevier.com/books/engineering-a-compiler/coope...
Note also if you’re dealing with weird control flow you might get oddities in translating out of SSA form: https://www.tjhsst.edu/~rlatimer/papers/sreedharTranslatingOutOfStaticSingleAssignmentForm.pdf https://www.tjhsst.edu/~rlatimer/papers/sreedharTranslatingO.... Sreedhar’s algorithm for translating out of SSA form is relatively easy to implement.
This is probably useless to you unless you know Common Lisp, but I put together a couple of toy implementations of these algorithms years ago to help myself learn them. There’s a couple of nits the papers gloss over that are noted in comments. You’ll need to compute liveness and dominance frontiers. Examples for those are in the project too. https://github.com/rayiner/portfolio/blob/master/ssa_analysis/ssa-conversion.lisp https://github.com/rayiner/portfolio/blob/master/ssa_analysi...
https://github.com/rayiner/portfolio/blob/master/ssa_analysis/ssa-elimination.lisp https://github.com/rayiner/portfolio/blob/master/ssa_analysi...