Man page for mgen.1
Table of Contents

NAME

mgen - MIPS code generator

SYNOPSIS

mgen [ options ] infile ...
mgen -ddebug

DESCRIPTION

The mgen program is a code generator from old-SUIF to MIPS assembly. The input files must have already been processed by mexp. There can be multiple input files. You cannot specify the names of the output files. Instead, the suffix of each input file is replaced by .s to determine the name of the corresponding output file. Each input file must have a suffix, but it doesn't matter what it is.

There are three passes in the code generator. The first pass:

does major translation of SUIF instructions into MIPS assembly
;

gathers information on all types of registers
;

gathers information on the size of the stack frame, etc.
;

and performs some peephole optimizations (e.g. replaces "ldc
" instructions with immediate operands and generates pc-relative branches).

The second pass:

determines stack home and/or register home of every pseudo regis
ter;

spills node registers to memory if there are not enough temporar
y registers;

expands ao_cg_*rec pseudo operations
;

performs other minor translations, not done in the first pass
;

expands built-in functions
;

and performs some peephole optimizations
.

The third pass:

determines the true size of the stack frame
;

finishes creation of the header
;

expands ao_cg_restore ops with the trailer instructions
;

completes machine register allocation by allocating temporar
y

registers to the node registers;

and performs the final peephole optimizations
.

OPTIONS

-ddebug
Describe the actions of each debug level.

-debugN
Set the debug level to N, where N is between 0 and 9, inclusive. The default debug level is 0.

-infTRs
Generate MIPS assembly with infinite temporary registers.

-infSRs
Generate MIPS assembly with infinite saved registers.

-zeroSRs
Assume that all pseudo registers live on the stack.

-oput X
If X is "binary", the output is to a binary file instead of an ASCII file. This is used when the output file is passed to an instruction scheduler.

-pass1
Stop translation after the first pass.

-pass2
Stop translation after the second pass.

RESTRICTIONS

The input files must be processed by mexp before running mgen. Moreover, mgen cannot handle "mod" instructions; they must have already been expanded. The counts for the various shift instructions cannot be negative. The target addresses for "btrue" and "bfalse" instructions must be in node registers.

AUTHOR

Mike Smith

SEE ALSO

mexp(1)


Table of Contents