1 /* file
"commands.def" */
3 /* Copyright (c
) 1994 Stanford University
7 This software is provided under the terms described in
8 the
"suif_copyright.h" include file.
*/
10 #include
<suif_copyright.h
>
12 /* This file contains the descriptions of all of the compiler passes.
13 The fields for each pass are extracted in various ways by redefining
14 the PASS macro and then including this file. The passes must be listed
15 in ascending order of output suffix
, with the exception of passes that
16 produce an s_tmp suffix. The s_tmp passes may appear anywhere except in
17 between passes with the same output suffix. The fields for each pass are
:
19 TAG
-- a unique name for the pass which must not conflict with
20 any variables in the scc code
, since it is used as a member
23 COUNTS
-- whether this pass works on input files one at a time
24 (ONE_IN_ONE_OUT
), all at once to produce one output file
25 (MANY_IN_ONE_OUT
), or all at once to produce an output file
26 for every input
file (MANY_IN_MANY_OUT
).
28 SFX
-- output
suffix (see comment above about pass ordering
).
30 OUTFORM
-- the format of the output file or files of this
31 pass
, either
OUTPUT_SUIF (meaning new SUIF only
) or
32 OUTPUT_NOT_SUIF. Scc needs to know if the file is a
33 SUIF file or not if it is to do checking on SUIF files
34 (the ``
-checkwarn
'' or ``
-checkfail
'' options
).
36 DIR
-- directory containing the binary for the pass. This field
37 contains an expression that is evaluated after reading the
38 command line flags. If it is set to NULL
, the default
39 SUIF path will be used.
41 NAME
-- the name of the executable file
43 FMT
-- the command format string. This field describes the command
-
44 line arguments used to execute command. There are four types
45 of fields within this format string
:
47 %o
: output
file (optional
)
48 %a
: alternate input and output
files (as opposed
49 to
%i
%o
, which would give first all the input
50 then all the output files
)
51 %p
: pass
options (specified on the scc command line
)
52 %f
: flag (up to MAX_FLAGS of these are allowed
)
53 If the output file field is not present
, it is assumed that
54 the output file name is the same as the input file with the
55 suffix set to the output suffix for the pass.
57 EXEC
-- execution predicate. This field is a boolean expression
58 that is evaluated after reading the command line flags.
59 The pass will be executed if it evaluates to
TRUE.
61 FLAGS
-- code to set the pass flags. Each entry in the pass table
62 contains an
array (flags
) of MAX_FLAGS pointers to String
63 objects. The Nth array element replaces the Nth
%f field
64 in the command format string. Initially
, all of the flags
65 are set to NULL
, but the code in this field can be used to
66 set them to arbitrary Strings. The pass table entry can
67 be accessed through the
"p" variable
; thus
, flag
0 can be
68 set with
"p->flags[0] = new String". The code is put into
69 a function that is evaluated after reading the command
78 "sf2c", "%f -g -w -quiet -lab %p %i -o %o",
80 p
->flags
[0] = new
String("");
90 "cpp0", "%f %p %f %i %o",
92 p
->flags
[0] = new
String("-D__SCC__");
94 *p
->flags
[0] += " -M";
95 String
predefined_path(suif_top
);
96 predefined_path
+= '/';
97 predefined_path
+= target_machine
;
98 predefined_path
+= "/predefined.txt";
100 string_from_file(predefined_path.
string(), p
->flags
[0]);
101 if (strcmp(target_machine
, "sparc-sun-sunos4") == 0) {
102 *p
->flags
[0] += " -D__BUILTIN_VA_ARG_INCR";
104 p
->flags
[1] = new
String(" -I");
105 *p
->flags
[1] += suif_include
;
106 if (strstr(target_machine
, "linux") == 0) {
107 *p
->flags
[1] += " -nostdinc -I/usr/include";
109 *p
->flags
[1] += " -undef -U__GNUC__ -U__GNUC_MINOR__";
117 "snoot", "%f %p %i %o",
119 p
->flags
[0] = new
String("");
120 /* If the machine needs built
-in identifiers
, the target name
121 * must be passed explicitly to snoot
, but it cannot be passed
122 * explicitly in general
, since in general snoot will not
123 * recognize the target name. So here we hard
-code the
124 * targets for which snoot has hard
-coded (in config.h
) lists
125 * of built
-in identifiers.
*/
126 if ((strcmp(target_machine
, scc_machine
) != 0) ||
127 (strcmp(target_machine
, "mips-sgi-irix5") == 0) ||
128 (strcmp(target_machine
, "mips-sgi-irix5.3") == 0) ||
129 (strcmp(target_machine
, "mips-sgi-irix6.2") == 0) ||
130 (strcmp(target_machine
, "mips-sgi-irix6.4") == 0) ||
131 (strcmp(target_machine
, "sparc-sun-sunos4") == 0) ||
132 (strcmp(target_machine
, "sparc-sun-solaris2.3") == 0) ||
133 (strcmp(target_machine
, "i386-sun-solaris2.4") == 0) ||
134 (strcmp(target_machine
, "alpha-dec-osf") == 0) ||
135 (strcmp(target_machine
, "alpha-dec-osf3.2") == 0) ||
136 (strcmp(target_machine
, "mips-dec-ultrix") == 0) ||
137 (strcmp(target_machine
, "i386-unknown-bsdos") == 0)) {
138 *p
->flags
[0] += "-T";
139 *p
->flags
[0] += target_machine
;
141 if (no_warn_flag
) *p
->flags
[0] += " -w"; )
148 "fixfortran", "%p %i %o",
157 "entry_types", "%p %i %o",
161 PASS( PORKY_PRE_DEFAULTS
,
166 "porky", "-defaults %p %i %o",
170 PASS( PORKY_DEFAULTS
,
175 "porky", "-defaults %p %i %o",
179 PASS( PORKY_LINE_FIX
,
184 "porky", "-kill-redundant-line-marks %p %i %o",
193 "linksuif", "%p %f %a",
202 "porky", "-ucf-opt %p %i %o",
206 PASS( PORKY_DEAD_CODE1
,
211 "porky", "-dead-code %p %i %o",
220 "structure", "%p %i %o",
229 "porky", "-fold %p %i %o",
233 PASS( PORKY_FIND_FORS
,
238 "porky", "-find-fors %p %i %o",
242 PASS( PORKY_CONST_PROP
,
247 "porky", "-const-prop %p %i %o",
256 "porky", "-fold %p %i %o",
260 PASS( PORKY_COPY_PROP
,
265 "porky", "-copy-prop %p %i %o",
269 PASS( PORKY_DEAD_CODE2
,
274 "porky", "-dead-code %p %i %o",
283 "porky", "-unused-syms -unused-types %p %i %o",
287 PASS( PORKY_EMPTY_TABLE1
,
292 "porky", "-no-empty-table %p %i %o",
296 PASS( PORKY_EMPTY_FOR1
,
301 "porky", "-no-empty-fors %p %i %o",
305 PASS( PORKY_CONTROL_SIMP1
,
310 "porky", "-control-simp %p %i %o",
314 PASS( PORKY_FORWARD_PROP1
,
319 "porky", "-forward-prop %p %i %o",
328 "porky", "-fold %p %i %o",
332 PASS( PORKY_DEAD_CODE3
,
337 "porky", "-dead-code %p %i %o",
341 PASS( PORKY_LOOP_COND
,
346 "porky", "-loop-cond %p %i %o",
350 PASS( PORKY_FORWARD_PROP2
,
355 "porky", "-forward-prop %p %i %o",
364 "porky", "-fold %p %i %o",
368 PASS( PORKY_DEAD_CODE4
,
373 "porky", "-dead-code %p %i %o",
382 "porky", "-unused-syms -unused-types %p %i %o",
386 PASS( PORKY_EMPTY_TABLE2
,
391 "porky", "-no-empty-table %p %i %o",
395 PASS( PORKY_EMPTY_FOR2
,
400 "porky", "-no-empty-fors %p %i %o",
404 PASS( PORKY_CONTROL_SIMP2
,
409 "porky", "-control-simp %p %i %o",
413 PASS( PORKY_LOOP_INVARIANTS1
,
418 "porky", "-loop-invariants %p %i %o",
422 PASS( PORKY_FORWARD_PROP3
,
427 "porky", "-forward-prop %p %i %o",
436 "porky", "-cse %p %i %o",
445 "porky", "-unused-syms -unused-types %f %p %i %o",
454 "s2c", "-annotes-named history %f %p %i %o",
462 alternate_cc ? NULL
: ASLD_DIR
,
463 "cc", "-c %f %p %i -o %o",
465 p
->flags
[0] = new
String("");
467 *p
->flags
[0] += "-g";
469 *p
->flags
[0] += " -w";
471 *p
->flags
[0] += " -O";
472 *p
->flags
[0] += opt_level
+ '0';
479 alternate_cc ? NULL
: ASLD_DIR
,
480 "ld", "-o %o %f %f %i %p %f -lc %f",
484 sprintf(buf
, "-G %ld", Gnum
);
485 p
->flags
[0] = new
String(buf
);
488 p
->flags
[2] = new
String("");
490 *p
->flags
[2] += "-L";
491 *p
->flags
[2] += suif_lib
;
493 *p
->flags
[2] += " -lF77 -lI77 -lfortrun";
494 *p
->flags
[2] += " -lm";
497 if (strcmp(target_machine
, "mips-sgi-irix5") == 0) {
498 p
->flags
[3] = new
String("/usr/lib/crtn.o");