Fixup --enable-target-optspace
[official-gcc.git] / gcc / genemit.c
blobe61d3c09dc45de847e3fbcdb2bf023c1b05f8068
1 /* Generate code from machine description to emit insns as rtl.
2 Copyright (C) 1987, 88, 91, 94, 95, 97, 1998 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, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
22 #include "hconfig.h"
23 #include "system.h"
24 #include "rtl.h"
25 #include "obstack.h"
27 static struct obstack obstack;
28 struct obstack *rtl_obstack = &obstack;
30 #define obstack_chunk_alloc xmalloc
31 #define obstack_chunk_free free
33 char *xmalloc PROTO((unsigned));
34 static void fatal ();
35 void fancy_abort PROTO((void));
37 /* Define this so we can link with print-rtl.o to get debug_rtx function. */
38 char **insn_name_ptr = 0;
40 static int max_opno;
41 static int max_dup_opno;
42 static int register_constraints;
43 static int insn_code_number;
44 static int insn_index_number;
46 /* Data structure for recording the patterns of insns that have CLOBBERs.
47 We use this to output a function that adds these CLOBBERs to a
48 previously-allocated PARALLEL expression. */
50 struct clobber_pat
52 struct clobber_ent *insns;
53 rtx pattern;
54 int first_clobber;
55 struct clobber_pat *next;
56 } *clobber_list;
58 /* Records one insn that uses the clobber list. */
60 struct clobber_ent
62 int code_number; /* Counts only insns. */
63 struct clobber_ent *next;
66 static void max_operand_1 PROTO((rtx));
67 static int max_operand_vec PROTO((rtx, int));
68 static void print_code PROTO((RTX_CODE));
69 static void gen_exp PROTO((rtx));
70 static void gen_insn PROTO((rtx));
71 static void gen_expand PROTO((rtx));
72 static void gen_split PROTO((rtx));
73 static void output_add_clobbers PROTO((void));
74 static void output_init_mov_optab PROTO((void));
77 static void
78 max_operand_1 (x)
79 rtx x;
81 register RTX_CODE code;
82 register int i;
83 register int len;
84 register char *fmt;
86 if (x == 0)
87 return;
89 code = GET_CODE (x);
91 if (code == MATCH_OPERAND && XSTR (x, 2) != 0 && *XSTR (x, 2) != '\0')
92 register_constraints = 1;
93 if (code == MATCH_SCRATCH && XSTR (x, 1) != 0 && *XSTR (x, 1) != '\0')
94 register_constraints = 1;
95 if (code == MATCH_OPERAND || code == MATCH_OPERATOR
96 || code == MATCH_PARALLEL)
97 max_opno = MAX (max_opno, XINT (x, 0));
98 if (code == MATCH_DUP || code == MATCH_OP_DUP || code == MATCH_PAR_DUP)
99 max_dup_opno = MAX (max_dup_opno, XINT (x, 0));
101 fmt = GET_RTX_FORMAT (code);
102 len = GET_RTX_LENGTH (code);
103 for (i = 0; i < len; i++)
105 if (fmt[i] == 'e' || fmt[i] == 'u')
106 max_operand_1 (XEXP (x, i));
107 else if (fmt[i] == 'E')
109 int j;
110 for (j = 0; j < XVECLEN (x, i); j++)
111 max_operand_1 (XVECEXP (x, i, j));
116 static int
117 max_operand_vec (insn, arg)
118 rtx insn;
119 int arg;
121 register int len = XVECLEN (insn, arg);
122 register int i;
124 max_opno = -1;
125 max_dup_opno = -1;
127 for (i = 0; i < len; i++)
128 max_operand_1 (XVECEXP (insn, arg, i));
130 return max_opno + 1;
133 static void
134 print_code (code)
135 RTX_CODE code;
137 register char *p1;
138 for (p1 = GET_RTX_NAME (code); *p1; p1++)
140 if (*p1 >= 'a' && *p1 <= 'z')
141 putchar (*p1 + 'A' - 'a');
142 else
143 putchar (*p1);
147 /* Print a C expression to construct an RTX just like X,
148 substituting any operand references appearing within. */
150 static void
151 gen_exp (x)
152 rtx x;
154 register RTX_CODE code;
155 register int i;
156 register int len;
157 register char *fmt;
159 if (x == 0)
161 printf ("NULL_RTX");
162 return;
165 code = GET_CODE (x);
167 switch (code)
169 case MATCH_OPERAND:
170 case MATCH_DUP:
171 printf ("operand%d", XINT (x, 0));
172 return;
174 case MATCH_OP_DUP:
175 printf ("gen_rtx (GET_CODE (operand%d), ", XINT (x, 0));
176 if (GET_MODE (x) == VOIDmode)
177 printf ("GET_MODE (operand%d)", XINT (x, 0));
178 else
179 printf ("%smode", GET_MODE_NAME (GET_MODE (x)));
180 for (i = 0; i < XVECLEN (x, 1); i++)
182 printf (",\n\t\t");
183 gen_exp (XVECEXP (x, 1, i));
185 printf (")");
186 return;
188 case MATCH_OPERATOR:
189 printf ("gen_rtx (GET_CODE (operand%d)", XINT (x, 0));
190 printf (", %smode", GET_MODE_NAME (GET_MODE (x)));
191 for (i = 0; i < XVECLEN (x, 2); i++)
193 printf (",\n\t\t");
194 gen_exp (XVECEXP (x, 2, i));
196 printf (")");
197 return;
199 case MATCH_PARALLEL:
200 case MATCH_PAR_DUP:
201 printf ("operand%d", XINT (x, 0));
202 return;
204 case MATCH_SCRATCH:
205 printf ("gen_rtx_SCRATCH (%smode)", GET_MODE_NAME (GET_MODE (x)));
206 return;
208 case ADDRESS:
209 fatal ("ADDRESS expression code used in named instruction pattern");
211 case PC:
212 printf ("pc_rtx");
213 return;
215 case CC0:
216 printf ("cc0_rtx");
217 return;
219 case CONST_INT:
220 if (INTVAL (x) == 0)
221 printf ("const0_rtx");
222 else if (INTVAL (x) == 1)
223 printf ("const1_rtx");
224 else if (INTVAL (x) == -1)
225 printf ("constm1_rtx");
226 else if (INTVAL (x) == STORE_FLAG_VALUE)
227 printf ("const_true_rtx");
228 else
230 printf ("GEN_INT (");
231 printf (HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
232 printf (")");
234 return;
236 case CONST_DOUBLE:
237 /* These shouldn't be written in MD files. Instead, the appropriate
238 routines in varasm.c should be called. */
239 abort ();
241 default:
242 break;
245 printf ("gen_rtx_");
246 print_code (code);
247 printf (" (%smode", GET_MODE_NAME (GET_MODE (x)));
249 fmt = GET_RTX_FORMAT (code);
250 len = GET_RTX_LENGTH (code);
251 for (i = 0; i < len; i++)
253 if (fmt[i] == '0')
254 break;
255 printf (",\n\t");
256 if (fmt[i] == 'e' || fmt[i] == 'u')
257 gen_exp (XEXP (x, i));
258 else if (fmt[i] == 'i')
259 printf ("%u", XINT (x, i));
260 else if (fmt[i] == 's')
261 printf ("\"%s\"", XSTR (x, i));
262 else if (fmt[i] == 'E')
264 int j;
265 printf ("gen_rtvec (%d", XVECLEN (x, i));
266 for (j = 0; j < XVECLEN (x, i); j++)
268 printf (",\n\t\t");
269 gen_exp (XVECEXP (x, i, j));
271 printf (")");
273 else
274 abort ();
276 printf (")");
279 /* Generate the `gen_...' function for a DEFINE_INSN. */
281 static void
282 gen_insn (insn)
283 rtx insn;
285 int operands;
286 register int i;
288 /* See if the pattern for this insn ends with a group of CLOBBERs of (hard)
289 registers or MATCH_SCRATCHes. If so, store away the information for
290 later. */
292 if (XVEC (insn, 1))
294 for (i = XVECLEN (insn, 1) - 1; i > 0; i--)
295 if (GET_CODE (XVECEXP (insn, 1, i)) != CLOBBER
296 || (GET_CODE (XEXP (XVECEXP (insn, 1, i), 0)) != REG
297 && GET_CODE (XEXP (XVECEXP (insn, 1, i), 0)) != MATCH_SCRATCH))
298 break;
300 if (i != XVECLEN (insn, 1) - 1)
302 register struct clobber_pat *p;
303 register struct clobber_ent *link
304 = (struct clobber_ent *) xmalloc (sizeof (struct clobber_ent));
305 register int j;
307 link->code_number = insn_code_number;
309 /* See if any previous CLOBBER_LIST entry is the same as this
310 one. */
312 for (p = clobber_list; p; p = p->next)
314 if (p->first_clobber != i + 1
315 || XVECLEN (p->pattern, 1) != XVECLEN (insn, 1))
316 continue;
318 for (j = i + 1; j < XVECLEN (insn, 1); j++)
320 rtx old = XEXP (XVECEXP (p->pattern, 1, j), 0);
321 rtx new = XEXP (XVECEXP (insn, 1, j), 0);
323 /* OLD and NEW are the same if both are to be a SCRATCH
324 of the same mode,
325 or if both are registers of the same mode and number. */
326 if (! (GET_MODE (old) == GET_MODE (new)
327 && ((GET_CODE (old) == MATCH_SCRATCH
328 && GET_CODE (new) == MATCH_SCRATCH)
329 || (GET_CODE (old) == REG && GET_CODE (new) == REG
330 && REGNO (old) == REGNO (new)))))
331 break;
334 if (j == XVECLEN (insn, 1))
335 break;
338 if (p == 0)
340 p = (struct clobber_pat *) xmalloc (sizeof (struct clobber_pat));
342 p->insns = 0;
343 p->pattern = insn;
344 p->first_clobber = i + 1;
345 p->next = clobber_list;
346 clobber_list = p;
349 link->next = p->insns;
350 p->insns = link;
354 /* Don't mention instructions whose names are the null string
355 or begin with '*'. They are in the machine description just
356 to be recognized. */
357 if (XSTR (insn, 0)[0] == 0 || XSTR (insn, 0)[0] == '*')
358 return;
360 /* Find out how many operands this function has,
361 and also whether any of them have register constraints. */
362 register_constraints = 0;
363 operands = max_operand_vec (insn, 1);
364 if (max_dup_opno >= operands)
365 fatal ("match_dup operand number has no match_operand");
367 /* Output the function name and argument declarations. */
368 printf ("rtx\ngen_%s (", XSTR (insn, 0));
369 for (i = 0; i < operands; i++)
370 printf (i ? ", operand%d" : "operand%d", i);
371 printf (")\n");
372 for (i = 0; i < operands; i++)
373 printf (" rtx operand%d;\n", i);
374 printf ("{\n");
376 /* Output code to construct and return the rtl for the instruction body */
378 if (XVECLEN (insn, 1) == 1)
380 printf (" return ");
381 gen_exp (XVECEXP (insn, 1, 0));
382 printf (";\n}\n\n");
384 else
386 printf (" return gen_rtx_PARALLEL (VOIDmode, gen_rtvec (%d", XVECLEN (insn, 1));
387 for (i = 0; i < XVECLEN (insn, 1); i++)
389 printf (",\n\t\t");
390 gen_exp (XVECEXP (insn, 1, i));
392 printf ("));\n}\n\n");
396 /* Generate the `gen_...' function for a DEFINE_EXPAND. */
398 static void
399 gen_expand (expand)
400 rtx expand;
402 int operands;
403 register int i;
405 if (strlen (XSTR (expand, 0)) == 0)
406 fatal ("define_expand lacks a name");
407 if (XVEC (expand, 1) == 0)
408 fatal ("define_expand for %s lacks a pattern", XSTR (expand, 0));
410 /* Find out how many operands this function has,
411 and also whether any of them have register constraints. */
412 register_constraints = 0;
414 operands = max_operand_vec (expand, 1);
416 /* Output the function name and argument declarations. */
417 printf ("rtx\ngen_%s (", XSTR (expand, 0));
418 for (i = 0; i < operands; i++)
419 printf (i ? ", operand%d" : "operand%d", i);
420 printf (")\n");
421 for (i = 0; i < operands; i++)
422 printf (" rtx operand%d;\n", i);
423 printf ("{\n");
425 /* If we don't have any C code to write, only one insn is being written,
426 and no MATCH_DUPs are present, we can just return the desired insn
427 like we do for a DEFINE_INSN. This saves memory. */
428 if ((XSTR (expand, 3) == 0 || *XSTR (expand, 3) == '\0')
429 && operands > max_dup_opno
430 && XVECLEN (expand, 1) == 1)
432 printf (" return ");
433 gen_exp (XVECEXP (expand, 1, 0));
434 printf (";\n}\n\n");
435 return;
438 /* For each operand referred to only with MATCH_DUPs,
439 make a local variable. */
440 for (i = operands; i <= max_dup_opno; i++)
441 printf (" rtx operand%d;\n", i);
442 if (operands > 0 || max_dup_opno >= 0)
443 printf (" rtx operands[%d];\n", MAX (operands, max_dup_opno + 1));
444 printf (" rtx _val = 0;\n");
445 printf (" start_sequence ();\n");
447 /* The fourth operand of DEFINE_EXPAND is some code to be executed
448 before the actual construction.
449 This code expects to refer to `operands'
450 just as the output-code in a DEFINE_INSN does,
451 but here `operands' is an automatic array.
452 So copy the operand values there before executing it. */
453 if (XSTR (expand, 3) && *XSTR (expand, 3))
455 /* Output code to copy the arguments into `operands'. */
456 for (i = 0; i < operands; i++)
457 printf (" operands[%d] = operand%d;\n", i, i);
459 /* Output the special code to be executed before the sequence
460 is generated. */
461 printf ("%s\n", XSTR (expand, 3));
463 /* Output code to copy the arguments back out of `operands'
464 (unless we aren't going to use them at all). */
465 if (XVEC (expand, 1) != 0)
467 for (i = 0; i < operands; i++)
468 printf (" operand%d = operands[%d];\n", i, i);
469 for (; i <= max_dup_opno; i++)
470 printf (" operand%d = operands[%d];\n", i, i);
474 /* Output code to construct the rtl for the instruction bodies.
475 Use emit_insn to add them to the sequence being accumulated.
476 But don't do this if the user's code has set `no_more' nonzero. */
478 for (i = 0; i < XVECLEN (expand, 1); i++)
480 rtx next = XVECEXP (expand, 1, i);
481 if ((GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC)
482 || (GET_CODE (next) == PARALLEL
483 && GET_CODE (XVECEXP (next, 0, 0)) == SET
484 && GET_CODE (SET_DEST (XVECEXP (next, 0, 0))) == PC)
485 || GET_CODE (next) == RETURN)
486 printf (" emit_jump_insn (");
487 else if ((GET_CODE (next) == SET && GET_CODE (SET_SRC (next)) == CALL)
488 || GET_CODE (next) == CALL
489 || (GET_CODE (next) == PARALLEL
490 && GET_CODE (XVECEXP (next, 0, 0)) == SET
491 && GET_CODE (SET_SRC (XVECEXP (next, 0, 0))) == CALL)
492 || (GET_CODE (next) == PARALLEL
493 && GET_CODE (XVECEXP (next, 0, 0)) == CALL))
494 printf (" emit_call_insn (");
495 else if (GET_CODE (next) == CODE_LABEL)
496 printf (" emit_label (");
497 else if (GET_CODE (next) == MATCH_OPERAND
498 || GET_CODE (next) == MATCH_OPERATOR
499 || GET_CODE (next) == MATCH_PARALLEL
500 || GET_CODE (next) == MATCH_OP_DUP
501 || GET_CODE (next) == MATCH_DUP
502 || GET_CODE (next) == PARALLEL)
503 printf (" emit (");
504 else
505 printf (" emit_insn (");
506 gen_exp (next);
507 printf (");\n");
508 if (GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC
509 && GET_CODE (SET_SRC (next)) == LABEL_REF)
510 printf (" emit_barrier ();");
513 /* Call `gen_sequence' to make a SEQUENCE out of all the
514 insns emitted within this gen_... function. */
516 printf (" _val = gen_sequence ();\n");
517 printf (" end_sequence ();\n");
518 printf (" return _val;\n}\n\n");
521 /* Like gen_expand, but generates a SEQUENCE. */
523 static void
524 gen_split (split)
525 rtx split;
527 register int i;
528 int operands;
530 if (XVEC (split, 0) == 0)
531 fatal ("define_split (definition %d) lacks a pattern", insn_index_number);
532 else if (XVEC (split, 2) == 0)
533 fatal ("define_split (definition %d) lacks a replacement pattern",
534 insn_index_number);
536 /* Find out how many operands this function has. */
538 max_operand_vec (split, 2);
539 operands = MAX (max_opno, max_dup_opno) + 1;
541 /* Output the function name and argument declarations. */
542 printf ("rtx\ngen_split_%d (operands)\n rtx *operands;\n",
543 insn_code_number);
544 printf ("{\n");
546 /* Declare all local variables. */
547 for (i = 0; i < operands; i++)
548 printf (" rtx operand%d;\n", i);
549 printf (" rtx _val = 0;\n");
550 printf (" start_sequence ();\n");
552 /* The fourth operand of DEFINE_SPLIT is some code to be executed
553 before the actual construction. */
555 if (XSTR (split, 3))
556 printf ("%s\n", XSTR (split, 3));
558 /* Output code to copy the arguments back out of `operands' */
559 for (i = 0; i < operands; i++)
560 printf (" operand%d = operands[%d];\n", i, i);
562 /* Output code to construct the rtl for the instruction bodies.
563 Use emit_insn to add them to the sequence being accumulated.
564 But don't do this if the user's code has set `no_more' nonzero. */
566 for (i = 0; i < XVECLEN (split, 2); i++)
568 rtx next = XVECEXP (split, 2, i);
569 if ((GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC)
570 || (GET_CODE (next) == PARALLEL
571 && GET_CODE (XVECEXP (next, 0, 0)) == SET
572 && GET_CODE (SET_DEST (XVECEXP (next, 0, 0))) == PC)
573 || GET_CODE (next) == RETURN)
574 printf (" emit_jump_insn (");
575 else if ((GET_CODE (next) == SET && GET_CODE (SET_SRC (next)) == CALL)
576 || GET_CODE (next) == CALL
577 || (GET_CODE (next) == PARALLEL
578 && GET_CODE (XVECEXP (next, 0, 0)) == SET
579 && GET_CODE (SET_SRC (XVECEXP (next, 0, 0))) == CALL)
580 || (GET_CODE (next) == PARALLEL
581 && GET_CODE (XVECEXP (next, 0, 0)) == CALL))
582 printf (" emit_call_insn (");
583 else if (GET_CODE (next) == CODE_LABEL)
584 printf (" emit_label (");
585 else if (GET_CODE (next) == MATCH_OPERAND
586 || GET_CODE (next) == MATCH_OPERATOR
587 || GET_CODE (next) == MATCH_PARALLEL
588 || GET_CODE (next) == MATCH_OP_DUP
589 || GET_CODE (next) == MATCH_DUP
590 || GET_CODE (next) == PARALLEL)
591 printf (" emit (");
592 else
593 printf (" emit_insn (");
594 gen_exp (next);
595 printf (");\n");
596 if (GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC
597 && GET_CODE (SET_SRC (next)) == LABEL_REF)
598 printf (" emit_barrier ();");
601 /* Call `gen_sequence' to make a SEQUENCE out of all the
602 insns emitted within this gen_... function. */
604 printf (" _val = gen_sequence ();\n");
605 printf (" end_sequence ();\n");
606 printf (" return _val;\n}\n\n");
609 /* Write a function, `add_clobbers', that is given a PARALLEL of sufficient
610 size for the insn and an INSN_CODE, and inserts the required CLOBBERs at
611 the end of the vector. */
613 static void
614 output_add_clobbers ()
616 struct clobber_pat *clobber;
617 struct clobber_ent *ent;
618 int i;
620 printf ("\n\nvoid\nadd_clobbers (pattern, insn_code_number)\n");
621 printf (" rtx pattern;\n int insn_code_number;\n");
622 printf ("{\n");
623 printf (" int i;\n\n");
624 printf (" switch (insn_code_number)\n");
625 printf (" {\n");
627 for (clobber = clobber_list; clobber; clobber = clobber->next)
629 for (ent = clobber->insns; ent; ent = ent->next)
630 printf (" case %d:\n", ent->code_number);
632 for (i = clobber->first_clobber; i < XVECLEN (clobber->pattern, 1); i++)
634 printf (" XVECEXP (pattern, 0, %d) = ", i);
635 gen_exp (XVECEXP (clobber->pattern, 1, i));
636 printf (";\n");
639 printf (" break;\n\n");
642 printf (" default:\n");
643 printf (" abort ();\n");
644 printf (" }\n");
645 printf ("}\n");
648 /* Write a function, init_mov_optab, that is called to set up entries
649 in mov_optab for EXTRA_CC_MODES. */
651 static void
652 output_init_mov_optab ()
654 #ifdef EXTRA_CC_NAMES
655 static char *cc_names[] = { EXTRA_CC_NAMES };
656 char *p;
657 size_t i;
659 printf ("\nvoid\ninit_mov_optab ()\n{\n");
661 for (i = 0; i < sizeof cc_names / sizeof cc_names[0]; i++)
663 printf ("#ifdef HAVE_mov");
664 for (p = cc_names[i]; *p; p++)
665 printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p);
666 printf ("\n");
667 printf (" if (HAVE_mov");
668 for (p = cc_names[i]; *p; p++)
669 printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p);
670 printf (")\n");
671 printf (" mov_optab->handlers[(int) %smode].insn_code = CODE_FOR_mov",
672 cc_names[i]);
673 for (p = cc_names[i]; *p; p++)
674 printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p);
675 printf (";\n#endif\n");
678 printf ("}\n");
679 #endif
682 char *
683 xmalloc (size)
684 unsigned size;
686 register char *val = (char *) malloc (size);
688 if (val == 0)
689 fatal ("virtual memory exhausted");
691 return val;
694 char *
695 xrealloc (ptr, size)
696 char *ptr;
697 unsigned size;
699 char *result = (char *) realloc (ptr, size);
700 if (!result)
701 fatal ("virtual memory exhausted");
702 return result;
705 static void
706 fatal (s, a1, a2)
707 char *s;
709 fprintf (stderr, "genemit: ");
710 fprintf (stderr, s, a1, a2);
711 fprintf (stderr, "\n");
712 exit (FATAL_EXIT_CODE);
715 /* More 'friendly' abort that prints the line and file.
716 config.h can #define abort fancy_abort if you like that sort of thing. */
718 void
719 fancy_abort ()
721 fatal ("Internal gcc abort.");
725 main (argc, argv)
726 int argc;
727 char **argv;
729 rtx desc;
730 FILE *infile;
731 register int c;
733 obstack_init (rtl_obstack);
735 if (argc <= 1)
736 fatal ("No input file name.");
738 infile = fopen (argv[1], "r");
739 if (infile == 0)
741 perror (argv[1]);
742 exit (FATAL_EXIT_CODE);
745 init_rtl ();
747 /* Assign sequential codes to all entries in the machine description
748 in parallel with the tables in insn-output.c. */
750 insn_code_number = 0;
751 insn_index_number = 0;
753 printf ("/* Generated automatically by the program `genemit'\n\
754 from the machine description file `md'. */\n\n");
756 printf ("#include \"config.h\"\n");
757 printf ("#include \"system.h\"\n");
758 printf ("#include \"rtl.h\"\n");
759 printf ("#include \"expr.h\"\n");
760 printf ("#include \"real.h\"\n");
761 printf ("#include \"flags.h\"\n");
762 printf ("#include \"output.h\"\n");
763 printf ("#include \"insn-config.h\"\n\n");
764 printf ("#include \"insn-flags.h\"\n\n");
765 printf ("#include \"insn-codes.h\"\n\n");
766 printf ("extern char *insn_operand_constraint[][MAX_RECOG_OPERANDS];\n\n");
767 printf ("extern rtx recog_operand[];\n");
768 printf ("#define operands emit_operand\n\n");
769 printf ("#define FAIL do {end_sequence (); return _val;} while (0)\n");
770 printf ("#define DONE do {_val = gen_sequence (); end_sequence (); return _val;} while (0)\n");
772 /* Read the machine description. */
774 while (1)
776 c = read_skip_spaces (infile);
777 if (c == EOF)
778 break;
779 ungetc (c, infile);
781 desc = read_rtx (infile);
782 if (GET_CODE (desc) == DEFINE_INSN)
784 gen_insn (desc);
785 ++insn_code_number;
787 if (GET_CODE (desc) == DEFINE_EXPAND)
789 gen_expand (desc);
790 ++insn_code_number;
792 if (GET_CODE (desc) == DEFINE_SPLIT)
794 gen_split (desc);
795 ++insn_code_number;
797 if (GET_CODE (desc) == DEFINE_PEEPHOLE)
799 ++insn_code_number;
801 ++insn_index_number;
804 /* Write out the routine to add CLOBBERs to a pattern. */
805 output_add_clobbers ();
807 /* Write the routine to initialize mov_optab for the EXTRA_CC_MODES. */
808 output_init_mov_optab ();
810 fflush (stdout);
811 exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
812 /* NOTREACHED */
813 return 0;