(gen_insn): Ignore insns whose names begin with '*'.
[official-gcc.git] / gcc / genemit.c
blob3c38d539ea70854f82e4c3a4c9564956e7d81e07
1 /* Generate code from machine description to emit insns as rtl.
2 Copyright (C) 1987, 1988, 1991, 1994, 1995 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21 #include <stdio.h>
22 #include "hconfig.h"
23 #include "rtl.h"
24 #include "obstack.h"
26 static struct obstack obstack;
27 struct obstack *rtl_obstack = &obstack;
29 #define obstack_chunk_alloc xmalloc
30 #define obstack_chunk_free free
32 extern void free ();
33 extern rtx read_rtx ();
35 char *xmalloc ();
36 static void fatal ();
37 void fancy_abort ();
39 static int max_opno;
40 static int max_dup_opno;
41 static int register_constraints;
42 static int insn_code_number;
43 static int insn_index_number;
45 /* Data structure for recording the patterns of insns that have CLOBBERs.
46 We use this to output a function that adds these CLOBBERs to a
47 previously-allocated PARALLEL expression. */
49 struct clobber_pat
51 struct clobber_ent *insns;
52 rtx pattern;
53 int first_clobber;
54 struct clobber_pat *next;
55 } *clobber_list;
57 /* Records one insn that uses the clobber list. */
59 struct clobber_ent
61 int code_number; /* Counts only insns. */
62 struct clobber_ent *next;
65 static void
66 max_operand_1 (x)
67 rtx x;
69 register RTX_CODE code;
70 register int i;
71 register int len;
72 register char *fmt;
74 if (x == 0)
75 return;
77 code = GET_CODE (x);
79 if (code == MATCH_OPERAND && XSTR (x, 2) != 0 && *XSTR (x, 2) != '\0')
80 register_constraints = 1;
81 if (code == MATCH_SCRATCH && XSTR (x, 1) != 0 && *XSTR (x, 1) != '\0')
82 register_constraints = 1;
83 if (code == MATCH_OPERAND || code == MATCH_OPERATOR
84 || code == MATCH_PARALLEL)
85 max_opno = MAX (max_opno, XINT (x, 0));
86 if (code == MATCH_DUP || code == MATCH_OP_DUP || code == MATCH_PAR_DUP)
87 max_dup_opno = MAX (max_dup_opno, XINT (x, 0));
89 fmt = GET_RTX_FORMAT (code);
90 len = GET_RTX_LENGTH (code);
91 for (i = 0; i < len; i++)
93 if (fmt[i] == 'e' || fmt[i] == 'u')
94 max_operand_1 (XEXP (x, i));
95 else if (fmt[i] == 'E')
97 int j;
98 for (j = 0; j < XVECLEN (x, i); j++)
99 max_operand_1 (XVECEXP (x, i, j));
104 static int
105 max_operand_vec (insn, arg)
106 rtx insn;
107 int arg;
109 register int len = XVECLEN (insn, arg);
110 register int i;
112 max_opno = -1;
113 max_dup_opno = -1;
115 for (i = 0; i < len; i++)
116 max_operand_1 (XVECEXP (insn, arg, i));
118 return max_opno + 1;
121 static void
122 print_code (code)
123 RTX_CODE code;
125 register char *p1;
126 for (p1 = GET_RTX_NAME (code); *p1; p1++)
128 if (*p1 >= 'a' && *p1 <= 'z')
129 putchar (*p1 + 'A' - 'a');
130 else
131 putchar (*p1);
135 /* Print a C expression to construct an RTX just like X,
136 substituting any operand references appearing within. */
138 static void
139 gen_exp (x)
140 rtx x;
142 register RTX_CODE code;
143 register int i;
144 register int len;
145 register char *fmt;
147 if (x == 0)
149 printf ("NULL_RTX");
150 return;
153 code = GET_CODE (x);
155 switch (code)
157 case MATCH_OPERAND:
158 case MATCH_DUP:
159 printf ("operand%d", XINT (x, 0));
160 return;
162 case MATCH_OP_DUP:
163 printf ("gen_rtx (GET_CODE (operand%d), GET_MODE (operand%d)",
164 XINT (x, 0), XINT (x, 0));
165 for (i = 0; i < XVECLEN (x, 1); i++)
167 printf (",\n\t\t");
168 gen_exp (XVECEXP (x, 1, i));
170 printf (")");
171 return;
173 case MATCH_OPERATOR:
174 printf ("gen_rtx (GET_CODE (operand%d)", XINT (x, 0));
175 printf (", %smode", GET_MODE_NAME (GET_MODE (x)));
176 for (i = 0; i < XVECLEN (x, 2); i++)
178 printf (",\n\t\t");
179 gen_exp (XVECEXP (x, 2, i));
181 printf (")");
182 return;
184 case MATCH_PARALLEL:
185 case MATCH_PAR_DUP:
186 printf ("operand%d", XINT (x, 0));
187 return;
189 case MATCH_SCRATCH:
190 printf ("gen_rtx (SCRATCH, %smode, 0)", GET_MODE_NAME (GET_MODE (x)));
191 return;
193 case ADDRESS:
194 fatal ("ADDRESS expression code used in named instruction pattern");
196 case PC:
197 printf ("pc_rtx");
198 return;
200 case CC0:
201 printf ("cc0_rtx");
202 return;
204 case CONST_INT:
205 if (INTVAL (x) == 0)
206 printf ("const0_rtx");
207 else if (INTVAL (x) == 1)
208 printf ("const1_rtx");
209 else if (INTVAL (x) == -1)
210 printf ("constm1_rtx");
211 else if (INTVAL (x) == STORE_FLAG_VALUE)
212 printf ("const_true_rtx");
213 else
214 printf (
215 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
216 "GEN_INT (%d)",
217 #else
218 "GEN_INT (%ld)",
219 #endif
220 INTVAL (x));
221 return;
223 case CONST_DOUBLE:
224 /* These shouldn't be written in MD files. Instead, the appropriate
225 routines in varasm.c should be called. */
226 abort ();
229 printf ("gen_rtx (");
230 print_code (code);
231 printf (", %smode", GET_MODE_NAME (GET_MODE (x)));
233 fmt = GET_RTX_FORMAT (code);
234 len = GET_RTX_LENGTH (code);
235 for (i = 0; i < len; i++)
237 if (fmt[i] == '0')
238 break;
239 printf (",\n\t");
240 if (fmt[i] == 'e' || fmt[i] == 'u')
241 gen_exp (XEXP (x, i));
242 else if (fmt[i] == 'i')
243 printf ("%u", XINT (x, i));
244 else if (fmt[i] == 's')
245 printf ("\"%s\"", XSTR (x, i));
246 else if (fmt[i] == 'E')
248 int j;
249 printf ("gen_rtvec (%d", XVECLEN (x, i));
250 for (j = 0; j < XVECLEN (x, i); j++)
252 printf (",\n\t\t");
253 gen_exp (XVECEXP (x, i, j));
255 printf (")");
257 else
258 abort ();
260 printf (")");
263 /* Generate the `gen_...' function for a DEFINE_INSN. */
265 static void
266 gen_insn (insn)
267 rtx insn;
269 int operands;
270 register int i;
272 /* See if the pattern for this insn ends with a group of CLOBBERs of (hard)
273 registers or MATCH_SCRATCHes. If so, store away the information for
274 later. */
276 if (XVEC (insn, 1))
278 for (i = XVECLEN (insn, 1) - 1; i > 0; i--)
279 if (GET_CODE (XVECEXP (insn, 1, i)) != CLOBBER
280 || (GET_CODE (XEXP (XVECEXP (insn, 1, i), 0)) != REG
281 && GET_CODE (XEXP (XVECEXP (insn, 1, i), 0)) != MATCH_SCRATCH))
282 break;
284 if (i != XVECLEN (insn, 1) - 1)
286 register struct clobber_pat *p;
287 register struct clobber_ent *link
288 = (struct clobber_ent *) xmalloc (sizeof (struct clobber_ent));
289 register int j;
291 link->code_number = insn_code_number;
293 /* See if any previous CLOBBER_LIST entry is the same as this
294 one. */
296 for (p = clobber_list; p; p = p->next)
298 if (p->first_clobber != i + 1
299 || XVECLEN (p->pattern, 1) != XVECLEN (insn, 1))
300 continue;
302 for (j = i + 1; j < XVECLEN (insn, 1); j++)
304 rtx old = XEXP (XVECEXP (p->pattern, 1, j), 0);
305 rtx new = XEXP (XVECEXP (insn, 1, j), 0);
307 /* OLD and NEW are the same if both are to be a SCRATCH
308 of the same mode,
309 or if both are registers of the same mode and number. */
310 if (! (GET_MODE (old) == GET_MODE (new)
311 && ((GET_CODE (old) == MATCH_SCRATCH
312 && GET_CODE (new) == MATCH_SCRATCH)
313 || (GET_CODE (old) == REG && GET_CODE (new) == REG
314 && REGNO (old) == REGNO (new)))))
315 break;
318 if (j == XVECLEN (insn, 1))
319 break;
322 if (p == 0)
324 p = (struct clobber_pat *) xmalloc (sizeof (struct clobber_pat));
326 p->insns = 0;
327 p->pattern = insn;
328 p->first_clobber = i + 1;
329 p->next = clobber_list;
330 clobber_list = p;
333 link->next = p->insns;
334 p->insns = link;
338 /* Don't mention instructions whose names are the null string
339 or begin with '*'. They are in the machine description just
340 to be recognized. */
341 if (XSTR (insn, 0)[0] == 0 || XSTR (insn, 0)[0] == '*')
342 return;
344 /* Find out how many operands this function has,
345 and also whether any of them have register constraints. */
346 register_constraints = 0;
347 operands = max_operand_vec (insn, 1);
348 if (max_dup_opno >= operands)
349 fatal ("match_dup operand number has no match_operand");
351 /* Output the function name and argument declarations. */
352 printf ("rtx\ngen_%s (", XSTR (insn, 0));
353 for (i = 0; i < operands; i++)
354 printf (i ? ", operand%d" : "operand%d", i);
355 printf (")\n");
356 for (i = 0; i < operands; i++)
357 printf (" rtx operand%d;\n", i);
358 printf ("{\n");
360 /* Output code to construct and return the rtl for the instruction body */
362 if (XVECLEN (insn, 1) == 1)
364 printf (" return ");
365 gen_exp (XVECEXP (insn, 1, 0));
366 printf (";\n}\n\n");
368 else
370 printf (" return gen_rtx (PARALLEL, VOIDmode, gen_rtvec (%d", XVECLEN (insn, 1));
371 for (i = 0; i < XVECLEN (insn, 1); i++)
373 printf (",\n\t\t");
374 gen_exp (XVECEXP (insn, 1, i));
376 printf ("));\n}\n\n");
380 /* Generate the `gen_...' function for a DEFINE_EXPAND. */
382 static void
383 gen_expand (expand)
384 rtx expand;
386 int operands;
387 register int i;
389 if (strlen (XSTR (expand, 0)) == 0)
390 fatal ("define_expand lacks a name");
391 if (XVEC (expand, 1) == 0)
392 fatal ("define_expand for %s lacks a pattern", XSTR (expand, 0));
394 /* Find out how many operands this function has,
395 and also whether any of them have register constraints. */
396 register_constraints = 0;
398 operands = max_operand_vec (expand, 1);
400 /* Output the function name and argument declarations. */
401 printf ("rtx\ngen_%s (", XSTR (expand, 0));
402 for (i = 0; i < operands; i++)
403 printf (i ? ", operand%d" : "operand%d", i);
404 printf (")\n");
405 for (i = 0; i < operands; i++)
406 printf (" rtx operand%d;\n", i);
407 printf ("{\n");
409 /* If we don't have any C code to write, only one insn is being written,
410 and no MATCH_DUPs are present, we can just return the desired insn
411 like we do for a DEFINE_INSN. This saves memory. */
412 if ((XSTR (expand, 3) == 0 || *XSTR (expand, 3) == '\0')
413 && operands > max_dup_opno
414 && XVECLEN (expand, 1) == 1)
416 printf (" return ");
417 gen_exp (XVECEXP (expand, 1, 0));
418 printf (";\n}\n\n");
419 return;
422 /* For each operand referred to only with MATCH_DUPs,
423 make a local variable. */
424 for (i = operands; i <= max_dup_opno; i++)
425 printf (" rtx operand%d;\n", i);
426 if (operands > 0 || max_dup_opno >= 0)
427 printf (" rtx operands[%d];\n", MAX (operands, max_dup_opno + 1));
428 printf (" rtx _val = 0;\n");
429 printf (" start_sequence ();\n");
431 /* The fourth operand of DEFINE_EXPAND is some code to be executed
432 before the actual construction.
433 This code expects to refer to `operands'
434 just as the output-code in a DEFINE_INSN does,
435 but here `operands' is an automatic array.
436 So copy the operand values there before executing it. */
437 if (XSTR (expand, 3) && *XSTR (expand, 3))
439 /* Output code to copy the arguments into `operands'. */
440 for (i = 0; i < operands; i++)
441 printf (" operands[%d] = operand%d;\n", i, i);
443 /* Output the special code to be executed before the sequence
444 is generated. */
445 printf ("%s\n", XSTR (expand, 3));
447 /* Output code to copy the arguments back out of `operands'
448 (unless we aren't going to use them at all). */
449 if (XVEC (expand, 1) != 0)
451 for (i = 0; i < operands; i++)
452 printf (" operand%d = operands[%d];\n", i, i);
453 for (; i <= max_dup_opno; i++)
454 printf (" operand%d = operands[%d];\n", i, i);
458 /* Output code to construct the rtl for the instruction bodies.
459 Use emit_insn to add them to the sequence being accumulated.
460 But don't do this if the user's code has set `no_more' nonzero. */
462 for (i = 0; i < XVECLEN (expand, 1); i++)
464 rtx next = XVECEXP (expand, 1, i);
465 if ((GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC)
466 || (GET_CODE (next) == PARALLEL
467 && GET_CODE (XVECEXP (next, 0, 0)) == SET
468 && GET_CODE (SET_DEST (XVECEXP (next, 0, 0))) == PC)
469 || GET_CODE (next) == RETURN)
470 printf (" emit_jump_insn (");
471 else if ((GET_CODE (next) == SET && GET_CODE (SET_SRC (next)) == CALL)
472 || GET_CODE (next) == CALL
473 || (GET_CODE (next) == PARALLEL
474 && GET_CODE (XVECEXP (next, 0, 0)) == SET
475 && GET_CODE (SET_SRC (XVECEXP (next, 0, 0))) == CALL)
476 || (GET_CODE (next) == PARALLEL
477 && GET_CODE (XVECEXP (next, 0, 0)) == CALL))
478 printf (" emit_call_insn (");
479 else if (GET_CODE (next) == CODE_LABEL)
480 printf (" emit_label (");
481 else if (GET_CODE (next) == MATCH_OPERAND
482 || GET_CODE (next) == MATCH_OPERATOR
483 || GET_CODE (next) == MATCH_PARALLEL
484 || GET_CODE (next) == MATCH_OP_DUP
485 || GET_CODE (next) == MATCH_DUP
486 || GET_CODE (next) == PARALLEL)
487 printf (" emit (");
488 else
489 printf (" emit_insn (");
490 gen_exp (next);
491 printf (");\n");
492 if (GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC
493 && GET_CODE (SET_SRC (next)) == LABEL_REF)
494 printf (" emit_barrier ();");
497 /* Call `gen_sequence' to make a SEQUENCE out of all the
498 insns emitted within this gen_... function. */
500 printf (" _done:\n");
501 printf (" _val = gen_sequence ();\n");
502 printf (" _fail:\n");
503 printf (" end_sequence ();\n");
504 printf (" return _val;\n}\n\n");
507 /* Like gen_expand, but generates a SEQUENCE. */
508 static void
509 gen_split (split)
510 rtx split;
512 register int i;
513 int operands;
515 if (XVEC (split, 0) == 0)
516 fatal ("define_split (definition %d) lacks a pattern", insn_index_number);
517 else if (XVEC (split, 2) == 0)
518 fatal ("define_split (definition %d) lacks a replacement pattern",
519 insn_index_number);
521 /* Find out how many operands this function has. */
523 max_operand_vec (split, 2);
524 operands = MAX (max_opno, max_dup_opno) + 1;
526 /* Output the function name and argument declarations. */
527 printf ("rtx\ngen_split_%d (operands)\n rtx *operands;\n",
528 insn_code_number);
529 printf ("{\n");
531 /* Declare all local variables. */
532 for (i = 0; i < operands; i++)
533 printf (" rtx operand%d;\n", i);
534 printf (" rtx _val = 0;\n");
535 printf (" start_sequence ();\n");
537 /* The fourth operand of DEFINE_SPLIT is some code to be executed
538 before the actual construction. */
540 if (XSTR (split, 3))
541 printf ("%s\n", XSTR (split, 3));
543 /* Output code to copy the arguments back out of `operands' */
544 for (i = 0; i < operands; i++)
545 printf (" operand%d = operands[%d];\n", i, i);
547 /* Output code to construct the rtl for the instruction bodies.
548 Use emit_insn to add them to the sequence being accumulated.
549 But don't do this if the user's code has set `no_more' nonzero. */
551 for (i = 0; i < XVECLEN (split, 2); i++)
553 rtx next = XVECEXP (split, 2, i);
554 if ((GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC)
555 || (GET_CODE (next) == PARALLEL
556 && GET_CODE (XVECEXP (next, 0, 0)) == SET
557 && GET_CODE (SET_DEST (XVECEXP (next, 0, 0))) == PC)
558 || GET_CODE (next) == RETURN)
559 printf (" emit_jump_insn (");
560 else if ((GET_CODE (next) == SET && GET_CODE (SET_SRC (next)) == CALL)
561 || GET_CODE (next) == CALL
562 || (GET_CODE (next) == PARALLEL
563 && GET_CODE (XVECEXP (next, 0, 0)) == SET
564 && GET_CODE (SET_SRC (XVECEXP (next, 0, 0))) == CALL)
565 || (GET_CODE (next) == PARALLEL
566 && GET_CODE (XVECEXP (next, 0, 0)) == CALL))
567 printf (" emit_call_insn (");
568 else if (GET_CODE (next) == CODE_LABEL)
569 printf (" emit_label (");
570 else if (GET_CODE (next) == MATCH_OPERAND
571 || GET_CODE (next) == MATCH_OPERATOR
572 || GET_CODE (next) == MATCH_PARALLEL
573 || GET_CODE (next) == MATCH_OP_DUP
574 || GET_CODE (next) == MATCH_DUP
575 || GET_CODE (next) == PARALLEL)
576 printf (" emit (");
577 else
578 printf (" emit_insn (");
579 gen_exp (next);
580 printf (");\n");
581 if (GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC
582 && GET_CODE (SET_SRC (next)) == LABEL_REF)
583 printf (" emit_barrier ();");
586 /* Call `gen_sequence' to make a SEQUENCE out of all the
587 insns emitted within this gen_... function. */
589 printf (" _done:\n");
590 printf (" _val = gen_sequence ();\n");
591 printf (" _fail:\n");
592 printf (" end_sequence ();\n");
593 printf (" return _val;\n}\n\n");
596 /* Write a function, `add_clobbers', that is given a PARALLEL of sufficient
597 size for the insn and an INSN_CODE, and inserts the required CLOBBERs at
598 the end of the vector. */
600 static void
601 output_add_clobbers ()
603 struct clobber_pat *clobber;
604 struct clobber_ent *ent;
605 int i;
607 printf ("\n\nvoid\nadd_clobbers (pattern, insn_code_number)\n");
608 printf (" rtx pattern;\n int insn_code_number;\n");
609 printf ("{\n");
610 printf (" int i;\n\n");
611 printf (" switch (insn_code_number)\n");
612 printf (" {\n");
614 for (clobber = clobber_list; clobber; clobber = clobber->next)
616 for (ent = clobber->insns; ent; ent = ent->next)
617 printf (" case %d:\n", ent->code_number);
619 for (i = clobber->first_clobber; i < XVECLEN (clobber->pattern, 1); i++)
621 printf (" XVECEXP (pattern, 0, %d) = ", i);
622 gen_exp (XVECEXP (clobber->pattern, 1, i));
623 printf (";\n");
626 printf (" break;\n\n");
629 printf (" default:\n");
630 printf (" abort ();\n");
631 printf (" }\n");
632 printf ("}\n");
635 /* Write a function, init_mov_optab, that is called to set up entries
636 in mov_optab for EXTRA_CC_MODES. */
638 static void
639 output_init_mov_optab ()
641 #ifdef EXTRA_CC_NAMES
642 static char *cc_names[] = { EXTRA_CC_NAMES };
643 char *p;
644 int i;
646 printf ("\nvoid\ninit_mov_optab ()\n{\n");
648 for (i = 0; i < sizeof cc_names / sizeof cc_names[0]; i++)
650 printf ("#ifdef HAVE_mov");
651 for (p = cc_names[i]; *p; p++)
652 printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p);
653 printf ("\n");
654 printf (" if (HAVE_mov");
655 for (p = cc_names[i]; *p; p++)
656 printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p);
657 printf (")\n");
658 printf (" mov_optab->handlers[(int) %smode].insn_code = CODE_FOR_mov",
659 cc_names[i]);
660 for (p = cc_names[i]; *p; p++)
661 printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p);
662 printf (";\n#endif\n");
665 printf ("}\n");
666 #endif
669 char *
670 xmalloc (size)
671 unsigned size;
673 register char *val = (char *) malloc (size);
675 if (val == 0)
676 fatal ("virtual memory exhausted");
678 return val;
681 char *
682 xrealloc (ptr, size)
683 char *ptr;
684 unsigned size;
686 char *result = (char *) realloc (ptr, size);
687 if (!result)
688 fatal ("virtual memory exhausted");
689 return result;
692 static void
693 fatal (s, a1, a2)
694 char *s;
696 fprintf (stderr, "genemit: ");
697 fprintf (stderr, s, a1, a2);
698 fprintf (stderr, "\n");
699 exit (FATAL_EXIT_CODE);
702 /* More 'friendly' abort that prints the line and file.
703 config.h can #define abort fancy_abort if you like that sort of thing. */
705 void
706 fancy_abort ()
708 fatal ("Internal gcc abort.");
712 main (argc, argv)
713 int argc;
714 char **argv;
716 rtx desc;
717 FILE *infile;
718 register int c;
720 obstack_init (rtl_obstack);
722 if (argc <= 1)
723 fatal ("No input file name.");
725 infile = fopen (argv[1], "r");
726 if (infile == 0)
728 perror (argv[1]);
729 exit (FATAL_EXIT_CODE);
732 init_rtl ();
734 /* Assign sequential codes to all entries in the machine description
735 in parallel with the tables in insn-output.c. */
737 insn_code_number = 0;
738 insn_index_number = 0;
740 printf ("/* Generated automatically by the program `genemit'\n\
741 from the machine description file `md'. */\n\n");
743 printf ("#include \"config.h\"\n");
744 printf ("#include \"rtl.h\"\n");
745 printf ("#include \"expr.h\"\n");
746 printf ("#include \"real.h\"\n");
747 printf ("#include \"output.h\"\n");
748 printf ("#include \"insn-config.h\"\n\n");
749 printf ("#include \"insn-flags.h\"\n\n");
750 printf ("#include \"insn-codes.h\"\n\n");
751 printf ("extern char *insn_operand_constraint[][MAX_RECOG_OPERANDS];\n\n");
752 printf ("extern rtx recog_operand[];\n");
753 printf ("#define operands emit_operand\n\n");
754 printf ("#define FAIL goto _fail\n\n");
755 printf ("#define DONE goto _done\n\n");
757 /* Read the machine description. */
759 while (1)
761 c = read_skip_spaces (infile);
762 if (c == EOF)
763 break;
764 ungetc (c, infile);
766 desc = read_rtx (infile);
767 if (GET_CODE (desc) == DEFINE_INSN)
769 gen_insn (desc);
770 ++insn_code_number;
772 if (GET_CODE (desc) == DEFINE_EXPAND)
774 gen_expand (desc);
775 ++insn_code_number;
777 if (GET_CODE (desc) == DEFINE_SPLIT)
779 gen_split (desc);
780 ++insn_code_number;
782 if (GET_CODE (desc) == DEFINE_PEEPHOLE)
784 ++insn_code_number;
786 ++insn_index_number;
789 /* Write out the routine to add CLOBBERs to a pattern. */
790 output_add_clobbers ();
792 /* Write the routine to initialize mov_optab for the EXTRA_CC_MODES. */
793 output_init_mov_optab ();
795 fflush (stdout);
796 exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
797 /* NOTREACHED */
798 return 0;