Related articles |
---|
Compiling object code johnl@ima.isc.com (1988-01-20) |
compiling object code hansen@mips.uucp (1988-01-21) |
From: | hansen@mips.uucp (Craig Hansen) |
Date: | Thu, 21 Jan 88 10:58:42 PST |
At MIPS, we've been recompiling object code for several purposes: 1)
emulating a MIPS machine in our initial development environment (a
VAX), 2) generating accurate execution profiles on a MIPS machine, and
3) generating address traces for cache simulation purposes. Credit
really goes to Earl Killian for writing this series of object-code
compilers for MIPS.
#1 (MIPS-on-a-VAX, or "moxie") translates each MIPS instruction into
one or more VAX instructions, generating a new object file, that ran
programs at about one-half the speed of the UNIX BSD 4.3 C compiler
for a VAX. The process was simpler than for most machines because a
MIPS machine has all instructions the same length [most of you have
experienced the garbage a disassembler puts out when it is started in
the middle of an instruction] and has no condition codes to emulate.
We used this to sucessfully bootstrap the compiler system and run most
of the UNIX commands through the compiler before having working
hardware. One complication was that the byte-ordering of a VAX is
little-endian, while out MIPS systems are big-endian; "moxie" would
twiddle the low-order bits of addresss as they were loaded or stored
to handle this, and system calls interfaces had to be coded to reverse
the byte order of operands and results as they passed through.
#2 (MIPS-on-a-MIPS) doesn't need to translate most MIPS instructions,
but inserts code at basic block boundaries to count the number of
executions of each basic block. This is a wonderful feature, because
by post-processing the object code, any compiled object can be
profiled, and there is no need for special profiling libraries. #3
inserts additional code to output an address trace of all instructions
executed and all data loaded and stored through a UNIX pipe. Some
additional code is inserted to move all references to three registers
from the register file into temporary space in memory, so that the
profiling code can use these registers to generate the profiles and/or
the address trace.
[From hansen@mips.uucp (Craig Hansen)]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.