We define a functional variant of the static single assignment (SSA)
form construction algorithm described by Braun et al.,
which combines simplicity and efficiency. The definition is based on a
general, abstract control flow graph representation using Isabelle locales.
We prove that the algorithm's output is semantically equivalent to the
input according to a small-step semantics, and that it is in minimal SSA
form for the common special case of reducible inputs. We then show the
satisfiability of the locale assumptions by giving instantiations for a
simple While language.
Furthermore, we use a generic instantiation based on typedefs in order
to extract OCaml code and replace the unverified SSA construction
algorithm of the CompCertSSA
project with it.
A more detailed description of the verified SSA construction can be found
in the paper Verified
Construction of Static Single Assignment Form, CC 2016.