Use cpp0 instead of cpp and pick up standard defines.
[suif.git] / src / basesuif / scc / commands.def
blob4a2c5c2b483bda9904d586a0ffc65a5085ba0030
1 /* file "commands.def" */
3 /* Copyright (c) 1994 Stanford University
5 All rights reserved.
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
21 of an enumeration.
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:
46 %i: input file(s)
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
70 line options.
73 PASS( SF2C,
74 ONE_IN_ONE_OUT,
75 s_c,
76 OUTPUT_NOT_SUIF,
77 NULL,
78 "sf2c", "%f -g -w -quiet -lab %p %i -o %o",
79 TRUE,
80 p->flags[0] = new String("");
81 if (automatic_flag)
82 *p->flags[0] += "-a";
83 ; )
85 PASS( CPP,
86 ONE_IN_ONE_OUT,
87 s_i,
88 OUTPUT_NOT_SUIF,
89 NULL,
90 "cpp0", "%f %p %f %i %o",
91 TRUE,
92 p->flags[0] = new String("-D__SCC__");
93 if (pp_deps)
94 *p->flags[0] += " -M";
95 String predefined_path(suif_top);
96 predefined_path += '/';
97 predefined_path += target_machine;
98 predefined_path += "/predefined.txt";
99 *p->flags[0] += " ";
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";
108 } else {
109 *p->flags[1] += " -undef -U__GNUC__ -U__GNUC_MINOR__";
112 PASS( SNOOT,
113 ONE_IN_ONE_OUT,
114 s_snt,
115 OUTPUT_NOT_SUIF,
116 NULL,
117 "snoot", "%f %p %i %o",
118 TRUE,
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"; )
143 PASS( FIXFORTRAN,
144 ONE_IN_ONE_OUT,
145 s_tmp,
146 OUTPUT_NOT_SUIF,
147 NULL,
148 "fixfortran", "%p %i %o",
149 sf2c_flag,
152 PASS( ENTRY_TYPES,
153 ONE_IN_ONE_OUT,
154 s_tmp,
155 OUTPUT_NOT_SUIF,
156 NULL,
157 "entry_types", "%p %i %o",
158 sf2c_flag,
161 PASS( PORKY_PRE_DEFAULTS,
162 ONE_IN_ONE_OUT,
163 s_tmp,
164 OUTPUT_NOT_SUIF,
165 NULL,
166 "porky", "-defaults %p %i %o",
167 TRUE,
170 PASS( PORKY_DEFAULTS,
171 ONE_IN_ONE_OUT,
172 s_tmp,
173 OUTPUT_SUIF,
174 NULL,
175 "porky", "-defaults %p %i %o",
176 TRUE,
179 PASS( PORKY_LINE_FIX,
180 ONE_IN_ONE_OUT,
181 s_spd,
182 OUTPUT_SUIF,
183 NULL,
184 "porky", "-kill-redundant-line-marks %p %i %o",
185 TRUE,
188 PASS( LINKSUIF,
189 MANY_IN_MANY_OUT,
190 s_sln,
191 OUTPUT_SUIF,
192 NULL,
193 "linksuif", "%p %f %a",
194 option_linksuif,
197 PASS( PORKY_UCF_OPT,
198 ONE_IN_ONE_OUT,
199 s_tmp,
200 OUTPUT_SUIF,
201 NULL,
202 "porky", "-ucf-opt %p %i %o",
203 opt_level >= 1,
206 PASS( PORKY_DEAD_CODE1,
207 ONE_IN_ONE_OUT,
208 s_tmp,
209 OUTPUT_SUIF,
210 NULL,
211 "porky", "-dead-code %p %i %o",
212 opt_level >= 1,
215 PASS( STRUCTURE,
216 ONE_IN_ONE_OUT,
217 s_tmp,
218 OUTPUT_SUIF,
219 NULL,
220 "structure", "%p %i %o",
221 opt_level >= 1,
224 PASS( PORKY_FOLD1,
225 ONE_IN_ONE_OUT,
226 s_tmp,
227 OUTPUT_SUIF,
228 NULL,
229 "porky", "-fold %p %i %o",
230 opt_level >= 1,
233 PASS( PORKY_FIND_FORS,
234 ONE_IN_ONE_OUT,
235 s_tmp,
236 OUTPUT_SUIF,
237 NULL,
238 "porky", "-find-fors %p %i %o",
239 opt_level >= 1,
242 PASS( PORKY_CONST_PROP,
243 ONE_IN_ONE_OUT,
244 s_tmp,
245 OUTPUT_SUIF,
246 NULL,
247 "porky", "-const-prop %p %i %o",
248 opt_level >= 1,
251 PASS( PORKY_FOLD2,
252 ONE_IN_ONE_OUT,
253 s_tmp,
254 OUTPUT_SUIF,
255 NULL,
256 "porky", "-fold %p %i %o",
257 opt_level >= 1,
260 PASS( PORKY_COPY_PROP,
261 ONE_IN_ONE_OUT,
262 s_tmp,
263 OUTPUT_SUIF,
264 NULL,
265 "porky", "-copy-prop %p %i %o",
266 opt_level >= 1,
269 PASS( PORKY_DEAD_CODE2,
270 ONE_IN_ONE_OUT,
271 s_tmp,
272 OUTPUT_SUIF,
273 NULL,
274 "porky", "-dead-code %p %i %o",
275 opt_level >= 1,
278 PASS( PORKY_UNUSED1,
279 ONE_IN_ONE_OUT,
280 s_tmp,
281 OUTPUT_SUIF,
282 NULL,
283 "porky", "-unused-syms -unused-types %p %i %o",
284 opt_level >= 1,
287 PASS( PORKY_EMPTY_TABLE1,
288 ONE_IN_ONE_OUT,
289 s_tmp,
290 OUTPUT_SUIF,
291 NULL,
292 "porky", "-no-empty-table %p %i %o",
293 opt_level >= 1,
296 PASS( PORKY_EMPTY_FOR1,
297 ONE_IN_ONE_OUT,
298 s_tmp,
299 OUTPUT_SUIF,
300 NULL,
301 "porky", "-no-empty-fors %p %i %o",
302 opt_level >= 1,
305 PASS( PORKY_CONTROL_SIMP1,
306 ONE_IN_ONE_OUT,
307 s_tmp,
308 OUTPUT_SUIF,
309 NULL,
310 "porky", "-control-simp %p %i %o",
311 opt_level >= 1,
314 PASS( PORKY_FORWARD_PROP1,
315 ONE_IN_ONE_OUT,
316 s_tmp,
317 OUTPUT_SUIF,
318 NULL,
319 "porky", "-forward-prop %p %i %o",
320 opt_level >= 2,
323 PASS( PORKY_FOLD3,
324 ONE_IN_ONE_OUT,
325 s_tmp,
326 OUTPUT_SUIF,
327 NULL,
328 "porky", "-fold %p %i %o",
329 opt_level >= 2,
332 PASS( PORKY_DEAD_CODE3,
333 ONE_IN_ONE_OUT,
334 s_tmp,
335 OUTPUT_SUIF,
336 NULL,
337 "porky", "-dead-code %p %i %o",
338 opt_level >= 2,
341 PASS( PORKY_LOOP_COND,
342 ONE_IN_ONE_OUT,
343 s_tmp,
344 OUTPUT_SUIF,
345 NULL,
346 "porky", "-loop-cond %p %i %o",
347 opt_level >= 3,
350 PASS( PORKY_FORWARD_PROP2,
351 ONE_IN_ONE_OUT,
352 s_tmp,
353 OUTPUT_SUIF,
354 NULL,
355 "porky", "-forward-prop %p %i %o",
356 opt_level >= 3,
359 PASS( PORKY_FOLD4,
360 ONE_IN_ONE_OUT,
361 s_tmp,
362 OUTPUT_SUIF,
363 NULL,
364 "porky", "-fold %p %i %o",
365 opt_level >= 3,
368 PASS( PORKY_DEAD_CODE4,
369 ONE_IN_ONE_OUT,
370 s_tmp,
371 OUTPUT_SUIF,
372 NULL,
373 "porky", "-dead-code %p %i %o",
374 opt_level >= 3,
377 PASS( PORKY_UNUSED2,
378 ONE_IN_ONE_OUT,
379 s_tmp,
380 OUTPUT_SUIF,
381 NULL,
382 "porky", "-unused-syms -unused-types %p %i %o",
383 opt_level >= 2,
386 PASS( PORKY_EMPTY_TABLE2,
387 ONE_IN_ONE_OUT,
388 s_tmp,
389 OUTPUT_SUIF,
390 NULL,
391 "porky", "-no-empty-table %p %i %o",
392 opt_level >= 2,
395 PASS( PORKY_EMPTY_FOR2,
396 ONE_IN_ONE_OUT,
397 s_tmp,
398 OUTPUT_SUIF,
399 NULL,
400 "porky", "-no-empty-fors %p %i %o",
401 opt_level >= 2,
404 PASS( PORKY_CONTROL_SIMP2,
405 ONE_IN_ONE_OUT,
406 s_tmp,
407 OUTPUT_SUIF,
408 NULL,
409 "porky", "-control-simp %p %i %o",
410 opt_level >= 2,
413 PASS( PORKY_LOOP_INVARIANTS1,
414 ONE_IN_ONE_OUT,
415 s_tmp,
416 OUTPUT_SUIF,
417 NULL,
418 "porky", "-loop-invariants %p %i %o",
419 opt_level >= 2,
422 PASS( PORKY_FORWARD_PROP3,
423 ONE_IN_ONE_OUT,
424 s_tmp,
425 OUTPUT_SUIF,
426 NULL,
427 "porky", "-forward-prop %p %i %o",
428 opt_level >= 2,
431 PASS( PORKY_CSE1,
432 ONE_IN_ONE_OUT,
433 s_tmp,
434 OUTPUT_SUIF,
435 NULL,
436 "porky", "-cse %p %i %o",
437 opt_level >= 2,
440 PASS( PORKY_UNUSED,
441 ONE_IN_ONE_OUT,
442 s_tmp,
443 OUTPUT_SUIF,
444 NULL,
445 "porky", "-unused-syms -unused-types %f %p %i %o",
446 TRUE,
449 PASS( S2C,
450 ONE_IN_ONE_OUT,
451 s_out_c,
452 OUTPUT_NOT_SUIF,
453 NULL,
454 "s2c", "-annotes-named history %f %p %i %o",
455 TRUE,
458 PASS( BACKEND_CC,
459 ONE_IN_ONE_OUT,
460 s_o,
461 OUTPUT_NOT_SUIF,
462 alternate_cc ? NULL : ASLD_DIR,
463 "cc", "-c %f %p %i -o %o",
464 TRUE,
465 p->flags[0] = new String("");
466 if (g_flag)
467 *p->flags[0] += "-g";
468 if (no_warn_flag)
469 *p->flags[0] += " -w";
470 if (opt_level > 0) {
471 *p->flags[0] += " -O";
472 *p->flags[0] += opt_level + '0';
475 PASS( LD,
476 MANY_IN_ONE_OUT,
477 s_out,
478 OUTPUT_NOT_SUIF,
479 alternate_cc ? NULL : ASLD_DIR,
480 "ld", "-o %o %f %f %i %p %f -lc %f",
481 TRUE,
482 if (Gnum >= 0) {
483 char buf[20];
484 sprintf(buf, "-G %ld", Gnum);
485 p->flags[0] = new String(buf);
488 p->flags[2] = new String("");
489 if (sf2c_flag) {
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");