1 .TH SF2C 1 "April 11 1994" "Stanford University" "SUIF Compiler"
3 sf2c \- first pass of the SUIF Fortran 77 front end
13 program forms the first part of the SUIF Fortran 77 front end. It is
14 typically run automatically by
16 not directly by the user. The output of
20 (the usual C pre-processor, not a part of SUIF)
25 passes, in that order, to complete the SUIF Fortran front end.
29 pass converts Fortran code into a special kind of C code. The C code
30 is legal and has the same semantics as the Fortran program, but it
31 also has special Fortran-specific information encoded in things like
32 assignments to dummy variables. The most important information this
33 encodes is the original array type and bound information, including
36 This special C program is passed through
40 the regular ANSI C front end, to translate it into SUIF code. Then
41 fixfortran extracts the Fortran information that had been encoded in
42 C, restoring array types, call-by-reference and common-block
43 variables, and more, when possible. Note that fixfortran is tightly
44 coupled with sf2c and expects its input to be in exactly the form sf2c
45 put it in. Other Fortran to C converters will not work. It is vital
46 that no changes are made to the C code before
50 or to the SUIF code coming out of snoot before it gets to fixfortran.
51 If any changes are made, fixfortran will become confused and probably
52 die with some error message, but it is possible it will produce
53 incorrect code in that case.
57 pass is based largely on a version of the Bell Labs
59 Fortran-to-C converter. Most of the original
61 options and features are
64 The major changes we've made have been aimed at getting more
65 high-level Fortran information encoded in the C output. There are
66 some strange contortions we put
68 and fixfortran through to preserve this information given the
71 It is strongly recommended that the output of
73 never be used directly; the entire front end of
74 .I sf2c\-cpp\-snoot\-fixfortran\-porky
75 should be treated as a black box. There are a few command line flags
76 to sf2c that might be of general interest, but the internals of the
81 pass takes arguments that end with
85 as Fortran 77 source programs. If no output file is specified (the
87 option), the output (the special C file) is given the same name but
88 put in the current directory with an extension of
90 If no arguments are given, then
92 reads Fortran from standard input and writes the special C file to
95 The resulting C code needs to include the
97 header file, but this is normally taken care of automatically by
99 The code must eventually be linked with the libraries
103 in the case of parallelized code)
106 which are included in the SUIF distribution.
107 This, too, is normally handled automatically when you use scc to link.
108 .SH OPTIONS ADDED FOR SUIF
111 Insert C ``#line'' directives to indicate the line numbers in the
112 original Fortran source. That way the eventual SUIF file's "line"
113 annotations will correctly refer to line numbers in the Fortran
114 source, not an intermediate Fortran file.
118 was not set up to keep careful track of line numbers, so the result is
119 line numbers that are often off by one in some parts of the program.
120 They are close enough to be quite useful, though.
122 Note that this option replaces the
126 The old version of this flag printed the line numbers in comments, not
127 ``#line'' directives.
132 as the output file, instead of trying to figure out an output file
133 based on the input file name.
136 Put each array reference on a separate line. Line breaks are
137 introduced after each array reference if this option is used. Then if
140 option is not used, array refernce instructions can be uniquely
141 identified by their line numbers.
144 Put a semicolon after each label. Why this might be useful is
148 Print version information to stderr and exit immediately. This is
151 flag for most other SUIF passes that is implemented in the main SUIF
155 Do not print verbose commentary while compiling. Without this flag,
157 prints out the names of procedures as they are encountered, among
159 .SH OPTIONS IDENTICAL TO f77 AND f2c
162 Compile code to check that subscripts are within declared array
166 Render INTEGER and LOGICAL as short,
167 INTEGER\(**4 as long int. Assume the default \fIlibF77\fR
168 and \fIlibI77\fR: allow only INTEGER\(**4 (and no LOGICAL)
169 variables in INQUIREs. This flag is incompatible with the
174 The semantics of a DO loop are changed so that their bodies are
175 performed at least once if reached. (Fortran 77 DO loops are not
176 performed at all if the upper limit is smaller than the lower limit.)
179 Honor the case of variables and external names. Fortran keywords must
183 Make the default type of a variable `undefined' rather than using the
184 default Fortran rules.
191 Suppress warning messages. The
193 form supresses all warning messages, the
195 form supresses only Fortran 66 compatibility warnings.
196 .SH OPTIONS RETAINED FROM f2c
199 Use ANSI C constructs. The default is old-style (pre-ANSI) C. SUIF
200 note: this option is irrelevant as far as SUIF is concerned because
201 the old-style C used is a common subset of old C and ANSI C. The
203 pass is fine with or without this option, as it understands the
204 complete ANSI C language.
207 Give local variables automatic (rather than static) storage unless
208 they appear in a DATA, EQUIVALENCE, or SAVE statement. SUIF note: for
209 SUIF it's usually better to use this option because it's easier to
210 analyze automatic variables. But SUIF will still be correct whether
211 or not this flag is set.
214 Insert comments showing the original Fortran source. SUIF note: if
215 this option is used along with the appropriate
219 options, comments can be retained all through the SUIF code in the
220 form of annotations on mark instructions.
223 Declare uninitialized struct created for COMMON to be \f(CWExtern\fR
224 (which \fIsf2c.h\fR \v(CW#define\fRs to be \f(CWextern\fR if it is
225 otherwise undefined).
232 These options are meaningless for SUIF. They cause
234 to emit a separate file for each uninitialized COMMON;
235 e.g. \f(CWCOMMON /ABC/\fR
236 yields \f(CWabc_com.c\fR, which defines \f(CWabc_\fR.
239 then bundle the separate files that would result from
241 into the output file, along with comments giving a
243 script that separates the output file into the files that
248 Complain about f77 extensions.
251 Do something similar to what is done by
253 but assume a modified
257 (compiled with -Df2c_i2), so INTEGER and LOGICAL variables may be
258 assigned in INQUIREs. This is incompatible with the
263 Do not promote REAL functions and operations to DOUBLE PRECISION (as
268 Promote REAL to DOUBLE PRECISION, COMPLEX to DOUBLE COMPLEX.
271 Put temporary files in directory
273 instead of /tmp, the default. Note that the
275 environment variable may also be used to choose the directory to use
276 for temporary files. The
280 environment variable if both are specified.
283 Do not complain when COMMON or EQUIVALENCE forces doubles to be
289 characters/word (default 4) when initializing numeric variables with
293 Do not implicitly recognize DOUBLE COMPLEX.
296 Disable the included statement.
297 .SH OPTIONS THAT ARE UNDOCUMENTED IN f77
299 Disallow all extensions to Fortran 66.
302 Turn on debugging mode. Some effects of debugging mode are that
303 temporary intermediate files are not removed and some verbose
304 information is generated.
307 Undocumented synonym for the
312 Render INTEGER and LOGICAL as `long int'. If this option is used,
313 neither of the options
317 may be used, as they contradict this option.
320 Use `short int' as the type for array subscripts.
323 Set the maximum number of register variables to use. For SUIF we
324 ignore whether the variable was declared ``register'' in C anyway, so
325 this option is meaningless.
338 Set various implementation size limits (internal table sizes). These
339 flags set, respectively, limits on the number of equivalences (default
340 150), external symbols (default 200), statement labels (default 801),
341 nesting of loops or if-then-elses (default 20), and identifier names
345 Use #defines within each procedure to make references to common block
346 variables look to human readers like local variables. For SUIF this
347 is irrelevant since the macros will have been expanded by the C
348 pre-processor before SUIF code is ever produced. SUIF's Fortran mode
349 allows SUIF programs to see common block variables as locals.
352 .BI \-Fr format-string
355 .BI \-Fd format-string
356 Use the specified string to format, respectively, `float' or `double'
357 data written to the output C file. The defaults are "(float)%s" (or
360 flag is used to specify ANSI-C) for `float' and "%.17g" for `double'.
363 This option might mean to #define things in equivalences to look like
364 ordinary local variables to human readers of the C file. If so, it is
365 irrelevant to SUIF since the C pre-processor substitutes for the
366 macros before the code is converted to SUIF.
367 .SH ENVIRONMENT VARIABLES
370 This variable specifies the directory to use for temporary files
371 instead of the default /tmp directory. See also the
386 is based calls itself, "VERSION 14 December 1989 7:55:33". It was
387 adapted for an early version of SUIF by Dror Maydan. Chris Wilson
388 made more modifications to get the information required by the current
391 Parts of this document were taken from the man page distributed with