The translator is used to convert an assembly language file produced
by the VLIW compiler into the assembly language of an existing
architecture, in this case, an RS/6000. Since the VLIW compiler
generates tree-instructions, extra RS/6000 instructions must be added to
simulate the effect of a tree. In essence, a set of RS/6000 branches are
placed before the ALU operations from each segment of a tree. In
addition, the VLIW architecture has more registers than the RS/6000,
necessitating that VLIW registers normally be kept in memory, then
temporarily loaded them into RS/6000 registers to perform specific
ALU operations, with the result stored back to the appropriate VLIW
register in memory. This is most complicated for non-general purpose
registers, such as the Condition Code register which can be addressed as
individual bits, as 4-bit groups, or as a full register. To accomodate
these different modes of access, a great deal of shifting and masking
must be performed.
Statistics are needed to analyze the performance of the VLIW architecture
and compiler. For these purposes, the translator places counting
instructions at each tree path in the corresponding RS/6000 code.
It also writes an annotation file describing each tree-instruction and
tree-path. When a program finishes execution, its counters are flushed
to disk. A postpass routine then combines the information from the
counts file and the annotation file to find (1) the total number of
times each instruction and path was executed, (2) the mean
parallelism achieved, (3) the dynamic distribution of different
opcode frequencies, and (4) other statistics. The postpass routine
is also used to generate profile-directed feedback information for
the VLIW compiler.
A number of other issues must be addressed to make the translator
perform correctly. For example, interfaces to standard shared
libraries such as "malloc", "qsort", and "setjmp" must be correct.
In the case of "qsort," provision must be made for the library to
call a VLIW comparison routine, while "setjmp" must be modified to
handle VLIW registers instead of RS/6000 registers. Some means of
debugging both the compiled program produced by the VLIW compiler
and the correctness of the translator's code is also essential. We
addressed this problem by using dbx macros to define VLIW debug
commands.