PR lto/69136
[official-gcc.git] / gcc / genemit.c
blob87f530109268f1a7b39f1bb3ead3cf1b2a699ee3
1 /* Generate code from machine description to emit insns as rtl.
2 Copyright (C) 1987-2016 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
21 #include "bconfig.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tm.h"
25 #include "rtl.h"
26 #include "errors.h"
27 #include "read-md.h"
28 #include "gensupport.h"
31 /* Data structure for recording the patterns of insns that have CLOBBERs.
32 We use this to output a function that adds these CLOBBERs to a
33 previously-allocated PARALLEL expression. */
35 struct clobber_pat
37 struct clobber_ent *insns;
38 rtx pattern;
39 int first_clobber;
40 struct clobber_pat *next;
41 int has_hard_reg;
42 } *clobber_list;
44 /* Records one insn that uses the clobber list. */
46 struct clobber_ent
48 int code_number; /* Counts only insns. */
49 struct clobber_ent *next;
52 static void output_peephole2_scratches (rtx);
54 /* True for <X>_optab if that optab isn't allowed to fail. */
55 static bool nofail_optabs[NUM_OPTABS];
57 static void
58 print_code (RTX_CODE code)
60 const char *p1;
61 for (p1 = GET_RTX_NAME (code); *p1; p1++)
62 putchar (TOUPPER (*p1));
65 static void
66 gen_rtx_scratch (rtx x, enum rtx_code subroutine_type)
68 if (subroutine_type == DEFINE_PEEPHOLE2)
70 printf ("operand%d", XINT (x, 0));
72 else
74 printf ("gen_rtx_SCRATCH (%smode)", GET_MODE_NAME (GET_MODE (x)));
78 /* Print a C expression to construct an RTX just like X,
79 substituting any operand references appearing within. */
81 static void
82 gen_exp (rtx x, enum rtx_code subroutine_type, char *used)
84 RTX_CODE code;
85 int i;
86 int len;
87 const char *fmt;
88 const char *sep = "";
90 if (x == 0)
92 printf ("NULL_RTX");
93 return;
96 code = GET_CODE (x);
98 switch (code)
100 case MATCH_OPERAND:
101 case MATCH_DUP:
102 if (used)
104 if (used[XINT (x, 0)])
106 printf ("copy_rtx (operand%d)", XINT (x, 0));
107 return;
109 used[XINT (x, 0)] = 1;
111 printf ("operand%d", XINT (x, 0));
112 return;
114 case MATCH_OP_DUP:
115 printf ("gen_rtx_fmt_");
116 for (i = 0; i < XVECLEN (x, 1); i++)
117 printf ("e");
118 printf (" (GET_CODE (operand%d), ", XINT (x, 0));
119 if (GET_MODE (x) == VOIDmode)
120 printf ("GET_MODE (operand%d)", XINT (x, 0));
121 else
122 printf ("%smode", GET_MODE_NAME (GET_MODE (x)));
123 for (i = 0; i < XVECLEN (x, 1); i++)
125 printf (",\n\t\t");
126 gen_exp (XVECEXP (x, 1, i), subroutine_type, used);
128 printf (")");
129 return;
131 case MATCH_OPERATOR:
132 printf ("gen_rtx_fmt_");
133 for (i = 0; i < XVECLEN (x, 2); i++)
134 printf ("e");
135 printf (" (GET_CODE (operand%d)", XINT (x, 0));
136 printf (", %smode", GET_MODE_NAME (GET_MODE (x)));
137 for (i = 0; i < XVECLEN (x, 2); i++)
139 printf (",\n\t\t");
140 gen_exp (XVECEXP (x, 2, i), subroutine_type, used);
142 printf (")");
143 return;
145 case MATCH_PARALLEL:
146 case MATCH_PAR_DUP:
147 printf ("operand%d", XINT (x, 0));
148 return;
150 case MATCH_SCRATCH:
151 gen_rtx_scratch (x, subroutine_type);
152 return;
154 case PC:
155 printf ("pc_rtx");
156 return;
157 case RETURN:
158 printf ("ret_rtx");
159 return;
160 case SIMPLE_RETURN:
161 printf ("simple_return_rtx");
162 return;
163 case CLOBBER:
164 if (REG_P (XEXP (x, 0)))
166 printf ("gen_hard_reg_clobber (%smode, %i)", GET_MODE_NAME (GET_MODE (XEXP (x, 0))),
167 REGNO (XEXP (x, 0)));
168 return;
170 break;
172 case CC0:
173 printf ("cc0_rtx");
174 return;
176 case CONST_INT:
177 if (INTVAL (x) == 0)
178 printf ("const0_rtx");
179 else if (INTVAL (x) == 1)
180 printf ("const1_rtx");
181 else if (INTVAL (x) == -1)
182 printf ("constm1_rtx");
183 else if (-MAX_SAVED_CONST_INT <= INTVAL (x)
184 && INTVAL (x) <= MAX_SAVED_CONST_INT)
185 printf ("const_int_rtx[MAX_SAVED_CONST_INT + (%d)]",
186 (int) INTVAL (x));
187 else if (INTVAL (x) == STORE_FLAG_VALUE)
188 printf ("const_true_rtx");
189 else
191 printf ("GEN_INT (");
192 printf (HOST_WIDE_INT_PRINT_DEC_C, INTVAL (x));
193 printf (")");
195 return;
197 case CONST_DOUBLE:
198 case CONST_FIXED:
199 case CONST_WIDE_INT:
200 /* These shouldn't be written in MD files. Instead, the appropriate
201 routines in varasm.c should be called. */
202 gcc_unreachable ();
204 default:
205 break;
208 printf ("gen_rtx_");
209 print_code (code);
210 printf (" (");
211 if (!always_void_p (code))
213 printf ("%smode", GET_MODE_NAME (GET_MODE (x)));
214 sep = ",\n\t";
217 fmt = GET_RTX_FORMAT (code);
218 len = GET_RTX_LENGTH (code);
219 for (i = 0; i < len; i++)
221 if (fmt[i] == '0')
222 break;
223 fputs (sep, stdout);
224 switch (fmt[i])
226 case 'e': case 'u':
227 gen_exp (XEXP (x, i), subroutine_type, used);
228 break;
230 case 'i':
231 printf ("%u", XINT (x, i));
232 break;
234 case 'r':
235 printf ("%u", REGNO (x));
236 break;
238 case 's':
239 printf ("\"%s\"", XSTR (x, i));
240 break;
242 case 'E':
244 int j;
245 printf ("gen_rtvec (%d", XVECLEN (x, i));
246 for (j = 0; j < XVECLEN (x, i); j++)
248 printf (",\n\t\t");
249 gen_exp (XVECEXP (x, i, j), subroutine_type, used);
251 printf (")");
252 break;
255 default:
256 gcc_unreachable ();
258 sep = ",\n\t";
260 printf (")");
263 /* Output code to emit the instruction patterns in VEC, with each element
264 becoming a separate instruction. USED is as for gen_exp. */
266 static void
267 gen_emit_seq (rtvec vec, char *used)
269 for (int i = 0, len = GET_NUM_ELEM (vec); i < len; ++i)
271 bool last_p = (i == len - 1);
272 rtx next = RTVEC_ELT (vec, i);
273 if (const char *name = get_emit_function (next))
275 printf (" %s (", name);
276 gen_exp (next, DEFINE_EXPAND, used);
277 printf (");\n");
278 if (!last_p && needs_barrier_p (next))
279 printf (" emit_barrier ();");
281 else
283 printf (" emit (");
284 gen_exp (next, DEFINE_EXPAND, used);
285 printf (", %s);\n", last_p ? "false" : "true");
290 /* Emit the given C code to the output file. The code is allowed to
291 fail if CAN_FAIL_P. NAME describes what we're generating,
292 for use in error messages. */
294 static void
295 emit_c_code (const char *code, bool can_fail_p, const char *name)
297 if (can_fail_p)
298 printf ("#define FAIL return (end_sequence (), _val)\n");
299 else
300 printf ("#define FAIL _Pragma (\"GCC error \\\"%s cannot FAIL\\\"\")"
301 " (void)0\n", name);
302 printf ("#define DONE return (_val = get_insns (),"
303 "end_sequence (), _val)\n");
305 print_md_ptr_loc (code);
306 printf ("%s\n", code);
308 printf ("#undef DONE\n");
309 printf ("#undef FAIL\n");
312 /* Generate the `gen_...' function for a DEFINE_INSN. */
314 static void
315 gen_insn (md_rtx_info *info)
317 struct pattern_stats stats;
318 int i;
320 /* See if the pattern for this insn ends with a group of CLOBBERs of (hard)
321 registers or MATCH_SCRATCHes. If so, store away the information for
322 later. */
324 rtx insn = info->def;
325 if (XVEC (insn, 1))
327 int has_hard_reg = 0;
329 for (i = XVECLEN (insn, 1) - 1; i > 0; i--)
331 if (GET_CODE (XVECEXP (insn, 1, i)) != CLOBBER)
332 break;
334 if (REG_P (XEXP (XVECEXP (insn, 1, i), 0)))
335 has_hard_reg = 1;
336 else if (GET_CODE (XEXP (XVECEXP (insn, 1, i), 0)) != MATCH_SCRATCH)
337 break;
340 if (i != XVECLEN (insn, 1) - 1)
342 struct clobber_pat *p;
343 struct clobber_ent *link = XNEW (struct clobber_ent);
344 int j;
346 link->code_number = info->index;
348 /* See if any previous CLOBBER_LIST entry is the same as this
349 one. */
351 for (p = clobber_list; p; p = p->next)
353 if (p->first_clobber != i + 1
354 || XVECLEN (p->pattern, 1) != XVECLEN (insn, 1))
355 continue;
357 for (j = i + 1; j < XVECLEN (insn, 1); j++)
359 rtx old_rtx = XEXP (XVECEXP (p->pattern, 1, j), 0);
360 rtx new_rtx = XEXP (XVECEXP (insn, 1, j), 0);
362 /* OLD and NEW_INSN are the same if both are to be a SCRATCH
363 of the same mode,
364 or if both are registers of the same mode and number. */
365 if (! (GET_MODE (old_rtx) == GET_MODE (new_rtx)
366 && ((GET_CODE (old_rtx) == MATCH_SCRATCH
367 && GET_CODE (new_rtx) == MATCH_SCRATCH)
368 || (REG_P (old_rtx) && REG_P (new_rtx)
369 && REGNO (old_rtx) == REGNO (new_rtx)))))
370 break;
373 if (j == XVECLEN (insn, 1))
374 break;
377 if (p == 0)
379 p = XNEW (struct clobber_pat);
381 p->insns = 0;
382 p->pattern = insn;
383 p->first_clobber = i + 1;
384 p->next = clobber_list;
385 p->has_hard_reg = has_hard_reg;
386 clobber_list = p;
389 link->next = p->insns;
390 p->insns = link;
394 /* Don't mention instructions whose names are the null string
395 or begin with '*'. They are in the machine description just
396 to be recognized. */
397 if (XSTR (insn, 0)[0] == 0 || XSTR (insn, 0)[0] == '*')
398 return;
400 printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
402 /* Find out how many operands this function has. */
403 get_pattern_stats (&stats, XVEC (insn, 1));
404 if (stats.max_dup_opno > stats.max_opno)
405 fatal_at (info->loc, "match_dup operand number has no match_operand");
407 /* Output the function name and argument declarations. */
408 printf ("rtx\ngen_%s (", XSTR (insn, 0));
409 if (stats.num_generator_args)
410 for (i = 0; i < stats.num_generator_args; i++)
411 if (i)
412 printf (",\n\trtx operand%d ATTRIBUTE_UNUSED", i);
413 else
414 printf ("rtx operand%d ATTRIBUTE_UNUSED", i);
415 else
416 printf ("void");
417 printf (")\n");
418 printf ("{\n");
420 /* Output code to construct and return the rtl for the instruction body. */
422 rtx pattern = add_implicit_parallel (XVEC (insn, 1));
423 /* ??? This is the traditional behavior, but seems suspect. */
424 char *used = (XVECLEN (insn, 1) == 1
425 ? NULL
426 : XCNEWVEC (char, stats.num_generator_args));
427 printf (" return ");
428 gen_exp (pattern, DEFINE_INSN, used);
429 printf (";\n}\n\n");
430 XDELETEVEC (used);
433 /* Generate the `gen_...' function for a DEFINE_EXPAND. */
435 static void
436 gen_expand (md_rtx_info *info)
438 struct pattern_stats stats;
439 int i;
440 char *used;
442 rtx expand = info->def;
443 if (strlen (XSTR (expand, 0)) == 0)
444 fatal_at (info->loc, "define_expand lacks a name");
445 if (XVEC (expand, 1) == 0)
446 fatal_at (info->loc, "define_expand for %s lacks a pattern",
447 XSTR (expand, 0));
449 /* Find out how many operands this function has. */
450 get_pattern_stats (&stats, XVEC (expand, 1));
452 /* Output the function name and argument declarations. */
453 printf ("rtx\ngen_%s (", XSTR (expand, 0));
454 if (stats.num_generator_args)
455 for (i = 0; i < stats.num_generator_args; i++)
456 if (i)
457 printf (",\n\trtx operand%d", i);
458 else
459 printf ("rtx operand%d", i);
460 else
461 printf ("void");
462 printf (")\n");
463 printf ("{\n");
465 /* If we don't have any C code to write, only one insn is being written,
466 and no MATCH_DUPs are present, we can just return the desired insn
467 like we do for a DEFINE_INSN. This saves memory. */
468 if ((XSTR (expand, 3) == 0 || *XSTR (expand, 3) == '\0')
469 && stats.max_opno >= stats.max_dup_opno
470 && XVECLEN (expand, 1) == 1)
472 printf (" return ");
473 gen_exp (XVECEXP (expand, 1, 0), DEFINE_EXPAND, NULL);
474 printf (";\n}\n\n");
475 return;
478 /* For each operand referred to only with MATCH_DUPs,
479 make a local variable. */
480 for (i = stats.num_generator_args; i <= stats.max_dup_opno; i++)
481 printf (" rtx operand%d;\n", i);
482 for (; i <= stats.max_scratch_opno; i++)
483 printf (" rtx operand%d ATTRIBUTE_UNUSED;\n", i);
484 printf (" rtx_insn *_val = 0;\n");
485 printf (" start_sequence ();\n");
487 /* The fourth operand of DEFINE_EXPAND is some code to be executed
488 before the actual construction.
489 This code expects to refer to `operands'
490 just as the output-code in a DEFINE_INSN does,
491 but here `operands' is an automatic array.
492 So copy the operand values there before executing it. */
493 if (XSTR (expand, 3) && *XSTR (expand, 3))
495 printf (" {\n");
496 if (stats.num_operand_vars > 0)
497 printf (" rtx operands[%d];\n", stats.num_operand_vars);
499 /* Output code to copy the arguments into `operands'. */
500 for (i = 0; i < stats.num_generator_args; i++)
501 printf (" operands[%d] = operand%d;\n", i, i);
503 /* Output the special code to be executed before the sequence
504 is generated. */
505 optab_pattern p;
506 bool can_fail_p = true;
507 if (find_optab (&p, XSTR (expand, 0)))
509 gcc_assert (p.op < NUM_OPTABS);
510 if (nofail_optabs[p.op])
511 can_fail_p = false;
513 emit_c_code (XSTR (expand, 3), can_fail_p, XSTR (expand, 0));
515 /* Output code to copy the arguments back out of `operands'
516 (unless we aren't going to use them at all). */
517 if (XVEC (expand, 1) != 0)
519 for (i = 0; i < stats.num_operand_vars; i++)
521 printf (" operand%d = operands[%d];\n", i, i);
522 printf (" (void) operand%d;\n", i);
525 printf (" }\n");
528 used = XCNEWVEC (char, stats.num_operand_vars);
529 gen_emit_seq (XVEC (expand, 1), used);
530 XDELETEVEC (used);
532 /* Call `get_insns' to extract the list of all the
533 insns emitted within this gen_... function. */
535 printf (" _val = get_insns ();\n");
536 printf (" end_sequence ();\n");
537 printf (" return _val;\n}\n\n");
540 /* Like gen_expand, but generates insns resulting from splitting SPLIT. */
542 static void
543 gen_split (md_rtx_info *info)
545 struct pattern_stats stats;
546 int i;
547 rtx split = info->def;
548 const char *const name =
549 ((GET_CODE (split) == DEFINE_PEEPHOLE2) ? "peephole2" : "split");
550 const char *unused;
551 char *used;
553 if (XVEC (split, 0) == 0)
554 fatal_at (info->loc, "%s lacks a pattern",
555 GET_RTX_NAME (GET_CODE (split)));
556 else if (XVEC (split, 2) == 0)
557 fatal_at (info->loc, "%s lacks a replacement pattern",
558 GET_RTX_NAME (GET_CODE (split)));
560 /* Find out how many operands this function has. */
562 get_pattern_stats (&stats, XVEC (split, 2));
563 unused = (stats.num_operand_vars == 0 ? " ATTRIBUTE_UNUSED" : "");
564 used = XCNEWVEC (char, stats.num_operand_vars);
566 /* Output the prototype, function name and argument declarations. */
567 if (GET_CODE (split) == DEFINE_PEEPHOLE2)
569 printf ("extern rtx_insn *gen_%s_%d (rtx_insn *, rtx *);\n",
570 name, info->index);
571 printf ("rtx_insn *\ngen_%s_%d (rtx_insn *curr_insn ATTRIBUTE_UNUSED,"
572 " rtx *operands%s)\n",
573 name, info->index, unused);
575 else
577 printf ("extern rtx_insn *gen_split_%d (rtx_insn *, rtx *);\n",
578 info->index);
579 printf ("rtx_insn *\ngen_split_%d "
580 "(rtx_insn *curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n",
581 info->index, unused);
583 printf ("{\n");
585 /* Declare all local variables. */
586 for (i = 0; i < stats.num_operand_vars; i++)
587 printf (" rtx operand%d;\n", i);
588 printf (" rtx_insn *_val = NULL;\n");
590 if (GET_CODE (split) == DEFINE_PEEPHOLE2)
591 output_peephole2_scratches (split);
593 printf (" if (dump_file)\n");
594 printf (" fprintf (dump_file, \"Splitting with gen_%s_%d\\n\");\n",
595 name, info->index);
597 printf (" start_sequence ();\n");
599 /* The fourth operand of DEFINE_SPLIT is some code to be executed
600 before the actual construction. */
602 if (XSTR (split, 3))
603 emit_c_code (XSTR (split, 3), true, name);
605 /* Output code to copy the arguments back out of `operands' */
606 for (i = 0; i < stats.num_operand_vars; i++)
608 printf (" operand%d = operands[%d];\n", i, i);
609 printf (" (void) operand%d;\n", i);
612 gen_emit_seq (XVEC (split, 2), used);
614 /* Call `get_insns' to make a list of all the
615 insns emitted within this gen_... function. */
617 printf (" _val = get_insns ();\n");
618 printf (" end_sequence ();\n");
619 printf (" return _val;\n}\n\n");
621 free (used);
624 /* Write a function, `add_clobbers', that is given a PARALLEL of sufficient
625 size for the insn and an INSN_CODE, and inserts the required CLOBBERs at
626 the end of the vector. */
628 static void
629 output_add_clobbers (void)
631 struct clobber_pat *clobber;
632 struct clobber_ent *ent;
633 int i;
635 printf ("\n\nvoid\nadd_clobbers (rtx pattern ATTRIBUTE_UNUSED, int insn_code_number)\n");
636 printf ("{\n");
637 printf (" switch (insn_code_number)\n");
638 printf (" {\n");
640 for (clobber = clobber_list; clobber; clobber = clobber->next)
642 for (ent = clobber->insns; ent; ent = ent->next)
643 printf (" case %d:\n", ent->code_number);
645 for (i = clobber->first_clobber; i < XVECLEN (clobber->pattern, 1); i++)
647 printf (" XVECEXP (pattern, 0, %d) = ", i);
648 gen_exp (XVECEXP (clobber->pattern, 1, i),
649 GET_CODE (clobber->pattern), NULL);
650 printf (";\n");
653 printf (" break;\n\n");
656 printf (" default:\n");
657 printf (" gcc_unreachable ();\n");
658 printf (" }\n");
659 printf ("}\n");
662 /* Write a function, `added_clobbers_hard_reg_p' that is given an insn_code
663 number that will have clobbers added (as indicated by `recog') and returns
664 1 if those include a clobber of a hard reg or 0 if all of them just clobber
665 SCRATCH. */
667 static void
668 output_added_clobbers_hard_reg_p (void)
670 struct clobber_pat *clobber;
671 struct clobber_ent *ent;
672 int clobber_p, used;
674 printf ("\n\nint\nadded_clobbers_hard_reg_p (int insn_code_number)\n");
675 printf ("{\n");
676 printf (" switch (insn_code_number)\n");
677 printf (" {\n");
679 for (clobber_p = 0; clobber_p <= 1; clobber_p++)
681 used = 0;
682 for (clobber = clobber_list; clobber; clobber = clobber->next)
683 if (clobber->has_hard_reg == clobber_p)
684 for (ent = clobber->insns; ent; ent = ent->next)
686 printf (" case %d:\n", ent->code_number);
687 used++;
690 if (used)
691 printf (" return %d;\n\n", clobber_p);
694 printf (" default:\n");
695 printf (" gcc_unreachable ();\n");
696 printf (" }\n");
697 printf ("}\n");
700 /* Generate code to invoke find_free_register () as needed for the
701 scratch registers used by the peephole2 pattern in SPLIT. */
703 static void
704 output_peephole2_scratches (rtx split)
706 int i;
707 int insn_nr = 0;
708 bool first = true;
710 for (i = 0; i < XVECLEN (split, 0); i++)
712 rtx elt = XVECEXP (split, 0, i);
713 if (GET_CODE (elt) == MATCH_SCRATCH)
715 int last_insn_nr = insn_nr;
716 int cur_insn_nr = insn_nr;
717 int j;
718 for (j = i + 1; j < XVECLEN (split, 0); j++)
719 if (GET_CODE (XVECEXP (split, 0, j)) == MATCH_DUP)
721 if (XINT (XVECEXP (split, 0, j), 0) == XINT (elt, 0))
722 last_insn_nr = cur_insn_nr;
724 else if (GET_CODE (XVECEXP (split, 0, j)) != MATCH_SCRATCH)
725 cur_insn_nr++;
727 if (first)
729 printf (" HARD_REG_SET _regs_allocated;\n");
730 printf (" CLEAR_HARD_REG_SET (_regs_allocated);\n");
731 first = false;
734 printf (" if ((operands[%d] = peep2_find_free_register (%d, %d, \"%s\", %smode, &_regs_allocated)) == NULL_RTX)\n\
735 return NULL;\n",
736 XINT (elt, 0),
737 insn_nr, last_insn_nr,
738 XSTR (elt, 1),
739 GET_MODE_NAME (GET_MODE (elt)));
742 else if (GET_CODE (elt) != MATCH_DUP)
743 insn_nr++;
748 main (int argc, char **argv)
750 progname = "genemit";
752 if (!init_rtx_reader_args (argc, argv))
753 return (FATAL_EXIT_CODE);
755 #define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
756 nofail_optabs[OPTAB##_optab] = true;
757 #include "internal-fn.def"
759 /* Assign sequential codes to all entries in the machine description
760 in parallel with the tables in insn-output.c. */
762 printf ("/* Generated automatically by the program `genemit'\n\
763 from the machine description file `md'. */\n\n");
765 printf ("#include \"config.h\"\n");
766 printf ("#include \"system.h\"\n");
767 printf ("#include \"coretypes.h\"\n");
768 printf ("#include \"backend.h\"\n");
769 printf ("#include \"predict.h\"\n");
770 printf ("#include \"tree.h\"\n");
771 printf ("#include \"rtl.h\"\n");
772 printf ("#include \"alias.h\"\n");
773 printf ("#include \"varasm.h\"\n");
774 printf ("#include \"stor-layout.h\"\n");
775 printf ("#include \"calls.h\"\n");
776 printf ("#include \"tm_p.h\"\n");
777 printf ("#include \"flags.h\"\n");
778 printf ("#include \"insn-config.h\"\n");
779 printf ("#include \"expmed.h\"\n");
780 printf ("#include \"dojump.h\"\n");
781 printf ("#include \"explow.h\"\n");
782 printf ("#include \"emit-rtl.h\"\n");
783 printf ("#include \"stmt.h\"\n");
784 printf ("#include \"expr.h\"\n");
785 printf ("#include \"insn-codes.h\"\n");
786 printf ("#include \"optabs.h\"\n");
787 printf ("#include \"dfp.h\"\n");
788 printf ("#include \"output.h\"\n");
789 printf ("#include \"recog.h\"\n");
790 printf ("#include \"df.h\"\n");
791 printf ("#include \"resource.h\"\n");
792 printf ("#include \"reload.h\"\n");
793 printf ("#include \"diagnostic-core.h\"\n");
794 printf ("#include \"regs.h\"\n");
795 printf ("#include \"tm-constrs.h\"\n");
796 printf ("#include \"ggc.h\"\n");
797 printf ("#include \"dumpfile.h\"\n");
798 printf ("#include \"target.h\"\n\n");
800 /* Read the machine description. */
802 md_rtx_info info;
803 while (read_md_rtx (&info))
804 switch (GET_CODE (info.def))
806 case DEFINE_INSN:
807 gen_insn (&info);
808 break;
810 case DEFINE_EXPAND:
811 printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
812 gen_expand (&info);
813 break;
815 case DEFINE_SPLIT:
816 printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
817 gen_split (&info);
818 break;
820 case DEFINE_PEEPHOLE2:
821 printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
822 gen_split (&info);
823 break;
825 default:
826 break;
829 /* Write out the routines to add CLOBBERs to a pattern and say whether they
830 clobber a hard reg. */
831 output_add_clobbers ();
832 output_added_clobbers_hard_reg_p ();
834 fflush (stdout);
835 return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);