Table of Contents
NAME
scc - SUIF compiler driver program
SYNOPSIS
scc [ options ] files ...
DESCRIPTION
The scc program is the driver for the SUIF ANSI C and FORTRAN 77 compiler. It behaves much like the system's cc compiler. SUIF is a multi-pass compiler. The following chart shows the order in which some of the basic passes are executed and the filename extensions that scc uses for the output of each pass:
- .c
- Fortran-to-C translator
- .i
- C preprocessor
- .snt
- C front end
- .spd
- SUIF cleanup pass
- .spx
- Expander
- .sfo
- Back-end optimizer
- .s
- Code generator (currently only for MIPS systems)
- .o
- Assembler
- (a.out)
- Linker
The extension of each filename argument determines where in the compilation process the compiler will start for that file. For example, files whose names end with .c are assumed to be C source programs, whereas arguments whose names end with .s are assumed to be assembler files. Files with extensions .f and .F are both treated as Fortran files.
OPTIONS
Options with identical meanings to those in cc are -S, -c, -I, -D, -U, -o, -L, -G, -l, -w, -E and -M. The following options are specific to scc:
- -Bdir
- Look for the compiler binaries in directory dir.
- -show
- -v
- -V
- As each pass is executed, print the pass name followed by the command line to execute it.
- -k
- Don't execute the passes. Useful in conjunction with -v to see what passes scc executes with which flags. For example, to see what passes are run with the -O flag, run ``scc -v -k -O foo.c''.
- -T
- Print timing information for each pass as it is executed.
- -g
- Keep symbolic information for debugging. This affects only s2c or other back ends. For s2c, it means putting the original source line numbers in the output C file.
- -s2c Use the SUIF-to-C pass in place of the SUIF back-end.
- This is the default for systems for which there is no SUIF code generator (at present, everything except MIPS).
- -cc compiler
- Use the specified C compiler to generate code after running the SUIF-to-C pass. This option is only meaningful in combination with the -s2c option.
- -f2c
- -sf2c Informs relevant passes that source files came from Fortran. This is the default for filenames with .f or .F extensions.
- -.suffix
- Stop the compilation process after files with the given suffix have been generated (see chart above). For example, the option ``-.sfo'' stops the compilation process after optimization, placing output in files with a suffix ``.sfo''. (The -.s and -.o options are equivalent to -S and -c respectively.)
- -keep
- Save all files generated for each phase, with the appropriate extensions, in the current directory. If this flag is repeated, also save temporary files used within phases when a phase executes more than one pass, as does the optimization phase.
- -O
- Invoke the SUIF optimizer and register allocator. If your program does not speed up by at least 50%, Steve Tjiang will donate a pizza to the charity of his choice. Really.
- -O2
- Invoke the SUIF optimizer. Run an extra pass of code motion.
- -Oivard
Find induction variables and perform other optimizations in the front-end.
- -Oifs
- Moves IFs in and then out again.
- -Oregs
- Do register allocation.
- -tdir
- Use directory dir for temporaries. If no -t option is specified, temporary files are written to the /tmp directory by default. See also the TMPDIR environment variable.
- -reassoc
- Reassociate complex array address calculations such that it is easier to code motion parts out of the inner loop. The default is to do so only when scalar optimization is being performed.
- -noreassoc
- Don't bother to reassociate array address calculations.
- -Target machine
- Override the default target architecture to perform a cross-compilation with target machine. This option only affects passes that are provided with SUIF; correct cross-system use of assemblers, linkers, back-end C compilers, and files include by the C pre-processor is left up to the user. To be safe, this option should only be used when compiling up to the point where the code is converted out of SUIF into assembly or back-end C code. Likewise, system include-file compatability is up to the user, so Fortran should be fine but typical C code won't go through cpp correctly without additional measures because the included system header files will not be those of the target machine.
- -option passname flags
- Call compilation pass passname with the flags options. For example, use ``-option SKWEEL -W'' to have skweel print out statistics. You need to know the name of the pass to use this flag. Some common pass names are: SF2C, CPP, SNOOT, FIXFORTRAN, MGEN, and LD. Phases that might run more than once have more obscure names, since each pass must be uniquely named. If you use the verbose option (-v), you will see the pass name of each pass as it is executed, followed by the command to run that pass. See the table in src/scc/commands.def for a complete list.
- -yes passname
- Force a particular pass to run, overriding other options. For example, ``scc f.c -yes SR'' runs the strength reduction pass, even though -O wasn't specified. The string passname must be a valid pass name; see the -option flag for details about pass names.
- -no passname
- This is the opposite of the -yes flag. It prevents a pass from running, even if specified by other options. For example, ``scc -O f.c -no REG' runs the optimizer but skips the register allocation phase. As with the -yes flag, passname must be a valid pass name; see the -option flag for details about pass names.
- -automatic
- Put Fortran locals on the stack by calling sf2c with the -a flag. This is the default.
- -static
- Keep Fortran locals in memory and initialize them to zero.
- -Nanything
- Any flag beginning with upper case ``N'' is passed through to sf2c unchanged. sf2c uses this to specify implementation limits for its own internal processing. See the sf2c documentation.
- -checkwarn
- This runs checksuif on the output of every pass that produces a SUIF file. The checksuif program is given the -warn flag so it will print a warning about anything illegal that it finds.
- -checkfail
- This is identical to -checkwarn except that it gives the -fail switch to checksuif so it will print an error message and abort the whole compile if it finds a problem.
- -Wall
- This turns on all warnings again, in case they were turned off by -w.
ENVIRONMENT VARIABLES
SUIFHOME
The top directory in the SUIF file hierarchy.
- MACHINE
- The type of machine on which the system is running.
The convention used is <architecture>-<vendor>-<OS>, for example, mips-sgi-irix5, sparc-sun-sunos4, or mips-dec-ultrix.
- SUIFPATH
- List of directories to search for SUIF binaries. The directory names are separated by colons. If this variable is not specified, scc defaults to look in the $SUIFHOME/$MACHINE/bin directory.
- TMPDIR
- Directory where temporary files are stored. The default value is /tmp. This can also be overridden with the -t option.
HISTORY
The scc program was originally written by Michael Wolf, who also developed the basis for the table-driven approach that is currently used by scc. Bob Wilson rewrote most of the original code to make the pass table more flexible and to support interprocedural passes. Since then Chris Wilson has fixed several bugs and made a lot of updates to the options and passes.
Table of Contents