First round of compilation stage refactoring.

This separates the backend-independent stages from the backend-specific
stages. The methods that relate to a backend's stages move into the
Backend class.

A new :from(...) parameter to .compile enables various places that did
their own stage visiting, because they had a non-source start point, to
just use .compile instead, which is a pleasant cleanup.

Additionally, stage names are now properly validated.