Implement the new instruction formats.

I also refactored some of the old code in the process, to minimize
duplication, and I also did a minor cleanup of the format spec.

Change-Id: Ib07ea4ade52aa6ec4fa69000798e0cfb8f10c3a9
13 files changed