The 32V paper, A UNIX™ Operating System for the DEC VAX-11/780 Computer (by Thomas B. London and John F. Reiser) has a few interesting tidbits about
Two features of the VAX-11 architecture — three-address instructions and indexed addressing mode
— were difficult to model within the basic structure of the compiler. The full implementation of three-address instructions proved to be so difficult that it was not really attempted. Instead,
language code improver, tries to merge several instructions into an appropriate three-address instruction.
This suggests that
c2 was somewhat akin to a second (or third, since the C compiler used
c1) pass for the C compiler, albeit assembly language-oriented: it makes up for lacunae in the main C compiler. (Its naming is consistent with this approximation, at least when compared with
as2, the second pass of the assembler.)
The code improver for the assembly language generated by the VAX-11 C compiler is based on a
similar program for the PDP-11. A ’backwards’ register usage pass, performed once and before anything
else, was a major addition. Knowing that no temporary register is live across a backwards jump, the register usage pass introduces three-address instructions wherever possible. It also recognizes situations where
jump on bit (jbc, jbs, jlbc, jlbs,) extract field (extzv, movzbl) and move address (moval, movab, pushal, pushab) instructions can be used. The code for insertion of fancy loop control instructions
sob, aob, acb
was also extended.
This also suggests that
c2 was specifically written to process the code produced by the C compiler.
as doesn’t support any option to invoke
c2 (or any other improver); I imagine the authors wouldn’t have expected hand-written assembly language to need improving after assembly!
f77 replaced the first pass of the C compiler, feeding into
c2 (if the
-O option was provided), so
c2 was used for compiled Fortran code which had been processed by the C compiler’s code generator anyway (see Portability of C Programs and the UNIX System by S. C. Johnson and D. M. Ritchie, published in The Bell System Technical Journal, volume 57, number 6, part 2, July/August 1978).