Administrative Normal Form is an intermediate representation of code, suitable for use by compilers, that is logically equivalent to Single Static Assignment but has some advantages. For example, checking whether a program is a valid SSA form is an existential question about the set of possible paths through a graph. However, checking whether a program is a valid ANF expression is just a question of local syntax.
It is quite easy to generate ANF from strictly functional code, but I'm interested in producing it from imperative code that contains variable updates, loops, etc.
There are straightforward algorithms for converting SSA to ANF. However, generating SSA in the first place becomes nontrivial if you want to do it quickly. It seems intuitive that if what you want to end up with is the more straightforward, more transparent format, it should be more efficient to generate it directly rather than going via the more opaque form.
Is there a published algorithm for generating ANF directly from imperative code?