1 /* Generate code from machine description to emit insns as rtl.
2 Copyright (C) 1987-2019 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
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
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/>. */
23 #include "coretypes.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. */
37 struct clobber_ent
*insns
;
40 struct clobber_pat
*next
;
44 /* Records one insn that uses the clobber list. */
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
];
58 print_code (RTX_CODE code
)
61 for (p1
= GET_RTX_NAME (code
); *p1
; p1
++)
62 putchar (TOUPPER (*p1
));
66 gen_rtx_scratch (rtx x
, enum rtx_code subroutine_type
)
68 if (subroutine_type
== DEFINE_PEEPHOLE2
)
70 printf ("operand%d", XINT (x
, 0));
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. */
82 gen_exp (rtx x
, enum rtx_code subroutine_type
, char *used
, md_rtx_info
*info
)
104 if (used
[XINT (x
, 0)])
106 printf ("copy_rtx (operand%d)", XINT (x
, 0));
109 used
[XINT (x
, 0)] = 1;
111 printf ("operand%d", XINT (x
, 0));
115 printf ("gen_rtx_fmt_");
116 for (i
= 0; i
< XVECLEN (x
, 1); i
++)
118 printf (" (GET_CODE (operand%d), ", XINT (x
, 0));
119 if (GET_MODE (x
) == VOIDmode
)
120 printf ("GET_MODE (operand%d)", XINT (x
, 0));
122 printf ("%smode", GET_MODE_NAME (GET_MODE (x
)));
123 for (i
= 0; i
< XVECLEN (x
, 1); i
++)
126 gen_exp (XVECEXP (x
, 1, i
), subroutine_type
, used
, info
);
132 printf ("gen_rtx_fmt_");
133 for (i
= 0; i
< XVECLEN (x
, 2); i
++)
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
++)
140 gen_exp (XVECEXP (x
, 2, i
), subroutine_type
, used
, info
);
147 printf ("operand%d", XINT (x
, 0));
151 gen_rtx_scratch (x
, subroutine_type
);
161 printf ("simple_return_rtx");
164 if (REG_P (XEXP (x
, 0)))
166 printf ("gen_hard_reg_clobber (%smode, %i)",
167 GET_MODE_NAME (GET_MODE (XEXP (x
, 0))),
168 REGNO (XEXP (x
, 0)));
173 if (!REG_P (XEXP (x
, 0)))
174 error ("CLOBBER_HIGH argument is not a register expr, at %s:%d",
175 info
->loc
.filename
, info
->loc
.lineno
);
176 printf ("gen_hard_reg_clobber_high (%smode, %i)",
177 GET_MODE_NAME (GET_MODE (XEXP (x
, 0))),
178 REGNO (XEXP (x
, 0)));
187 printf ("const0_rtx");
188 else if (INTVAL (x
) == 1)
189 printf ("const1_rtx");
190 else if (INTVAL (x
) == -1)
191 printf ("constm1_rtx");
192 else if (-MAX_SAVED_CONST_INT
<= INTVAL (x
)
193 && INTVAL (x
) <= MAX_SAVED_CONST_INT
)
194 printf ("const_int_rtx[MAX_SAVED_CONST_INT + (%d)]",
196 else if (INTVAL (x
) == STORE_FLAG_VALUE
)
197 printf ("const_true_rtx");
200 printf ("GEN_INT (");
201 printf (HOST_WIDE_INT_PRINT_DEC_C
, INTVAL (x
));
209 /* These shouldn't be written in MD files. Instead, the appropriate
210 routines in varasm.c should be called. */
220 if (!always_void_p (code
))
222 printf ("%smode", GET_MODE_NAME (GET_MODE (x
)));
226 fmt
= GET_RTX_FORMAT (code
);
227 len
= GET_RTX_LENGTH (code
);
228 for (i
= 0; i
< len
; i
++)
236 gen_exp (XEXP (x
, i
), subroutine_type
, used
, info
);
240 printf ("%u", XINT (x
, i
));
244 printf ("%u", REGNO (x
));
248 /* We don't have a way of parsing polynomial offsets yet,
249 and hopefully never will. */
250 printf ("%d", SUBREG_BYTE (x
).to_constant ());
254 printf ("\"%s\"", XSTR (x
, i
));
260 printf ("gen_rtvec (%d", XVECLEN (x
, i
));
261 for (j
= 0; j
< XVECLEN (x
, i
); j
++)
264 gen_exp (XVECEXP (x
, i
, j
), subroutine_type
, used
, info
);
278 /* Output code to emit the instruction patterns in VEC, with each element
279 becoming a separate instruction. USED is as for gen_exp. */
282 gen_emit_seq (rtvec vec
, char *used
, md_rtx_info
*info
)
284 for (int i
= 0, len
= GET_NUM_ELEM (vec
); i
< len
; ++i
)
286 bool last_p
= (i
== len
- 1);
287 rtx next
= RTVEC_ELT (vec
, i
);
288 if (const char *name
= get_emit_function (next
))
290 printf (" %s (", name
);
291 gen_exp (next
, DEFINE_EXPAND
, used
, info
);
293 if (!last_p
&& needs_barrier_p (next
))
294 printf (" emit_barrier ();");
299 gen_exp (next
, DEFINE_EXPAND
, used
, info
);
300 printf (", %s);\n", last_p
? "false" : "true");
305 /* Emit the given C code to the output file. The code is allowed to
306 fail if CAN_FAIL_P. NAME describes what we're generating,
307 for use in error messages. */
310 emit_c_code (const char *code
, bool can_fail_p
, const char *name
)
313 printf ("#define FAIL return (end_sequence (), _val)\n");
315 printf ("#define FAIL _Pragma (\"GCC error \\\"%s cannot FAIL\\\"\")"
317 printf ("#define DONE return (_val = get_insns (),"
318 "end_sequence (), _val)\n");
320 rtx_reader_ptr
->print_md_ptr_loc (code
);
321 printf ("%s\n", code
);
323 printf ("#undef DONE\n");
324 printf ("#undef FAIL\n");
327 /* Generate the `gen_...' function for a DEFINE_INSN. */
330 gen_insn (md_rtx_info
*info
)
332 struct pattern_stats stats
;
335 /* See if the pattern for this insn ends with a group of CLOBBERs of (hard)
336 registers or MATCH_SCRATCHes. If so, store away the information for
339 rtx insn
= info
->def
;
342 int has_hard_reg
= 0;
344 for (i
= XVECLEN (insn
, 1) - 1; i
> 0; i
--)
346 if (GET_CODE (XVECEXP (insn
, 1, i
)) != CLOBBER
347 && GET_CODE (XVECEXP (insn
, 1, i
)) != CLOBBER_HIGH
)
350 if (REG_P (XEXP (XVECEXP (insn
, 1, i
), 0)))
352 else if (GET_CODE (XEXP (XVECEXP (insn
, 1, i
), 0)) != MATCH_SCRATCH
)
356 if (i
!= XVECLEN (insn
, 1) - 1)
358 struct clobber_pat
*p
;
359 struct clobber_ent
*link
= XNEW (struct clobber_ent
);
362 link
->code_number
= info
->index
;
364 /* See if any previous CLOBBER_LIST entry is the same as this
367 for (p
= clobber_list
; p
; p
= p
->next
)
369 if (p
->first_clobber
!= i
+ 1
370 || XVECLEN (p
->pattern
, 1) != XVECLEN (insn
, 1))
373 for (j
= i
+ 1; j
< XVECLEN (insn
, 1); j
++)
375 rtx old_rtx
= XEXP (XVECEXP (p
->pattern
, 1, j
), 0);
376 rtx new_rtx
= XEXP (XVECEXP (insn
, 1, j
), 0);
378 /* OLD and NEW_INSN are the same if both are to be a SCRATCH
380 or if both are registers of the same mode and number. */
381 if (! (GET_CODE (old_rtx
) == GET_CODE (new_rtx
)
382 && GET_MODE (old_rtx
) == GET_MODE (new_rtx
)
383 && ((GET_CODE (old_rtx
) == MATCH_SCRATCH
384 && GET_CODE (new_rtx
) == MATCH_SCRATCH
)
385 || (REG_P (old_rtx
) && REG_P (new_rtx
)
386 && REGNO (old_rtx
) == REGNO (new_rtx
)))))
390 if (j
== XVECLEN (insn
, 1))
396 p
= XNEW (struct clobber_pat
);
400 p
->first_clobber
= i
+ 1;
401 p
->next
= clobber_list
;
402 p
->has_hard_reg
= has_hard_reg
;
406 link
->next
= p
->insns
;
411 /* Don't mention instructions whose names are the null string
412 or begin with '*'. They are in the machine description just
414 if (XSTR (insn
, 0)[0] == 0 || XSTR (insn
, 0)[0] == '*')
417 printf ("/* %s:%d */\n", info
->loc
.filename
, info
->loc
.lineno
);
419 /* Find out how many operands this function has. */
420 get_pattern_stats (&stats
, XVEC (insn
, 1));
421 if (stats
.max_dup_opno
> stats
.max_opno
)
422 fatal_at (info
->loc
, "match_dup operand number has no match_operand");
424 /* Output the function name and argument declarations. */
425 printf ("rtx\ngen_%s (", XSTR (insn
, 0));
426 if (stats
.num_generator_args
)
427 for (i
= 0; i
< stats
.num_generator_args
; i
++)
429 printf (",\n\trtx operand%d ATTRIBUTE_UNUSED", i
);
431 printf ("rtx operand%d ATTRIBUTE_UNUSED", i
);
437 /* Output code to construct and return the rtl for the instruction body. */
439 rtx pattern
= add_implicit_parallel (XVEC (insn
, 1));
440 /* ??? This is the traditional behavior, but seems suspect. */
441 char *used
= (XVECLEN (insn
, 1) == 1
443 : XCNEWVEC (char, stats
.num_generator_args
));
445 gen_exp (pattern
, DEFINE_INSN
, used
, info
);
450 /* Generate the `gen_...' function for a DEFINE_EXPAND. */
453 gen_expand (md_rtx_info
*info
)
455 struct pattern_stats stats
;
459 rtx expand
= info
->def
;
460 if (strlen (XSTR (expand
, 0)) == 0)
461 fatal_at (info
->loc
, "define_expand lacks a name");
462 if (XVEC (expand
, 1) == 0)
463 fatal_at (info
->loc
, "define_expand for %s lacks a pattern",
466 /* Find out how many operands this function has. */
467 get_pattern_stats (&stats
, XVEC (expand
, 1));
468 if (stats
.min_scratch_opno
!= -1
469 && stats
.min_scratch_opno
<= MAX (stats
.max_opno
, stats
.max_dup_opno
))
470 fatal_at (info
->loc
, "define_expand for %s needs to have match_scratch "
471 "numbers above all other operands", XSTR (expand
, 0));
473 /* Output the function name and argument declarations. */
474 printf ("rtx\ngen_%s (", XSTR (expand
, 0));
475 if (stats
.num_generator_args
)
476 for (i
= 0; i
< stats
.num_generator_args
; i
++)
478 printf (",\n\trtx operand%d", i
);
480 printf ("rtx operand%d", i
);
486 /* If we don't have any C code to write, only one insn is being written,
487 and no MATCH_DUPs are present, we can just return the desired insn
488 like we do for a DEFINE_INSN. This saves memory. */
489 if ((XSTR (expand
, 3) == 0 || *XSTR (expand
, 3) == '\0')
490 && stats
.max_opno
>= stats
.max_dup_opno
491 && XVECLEN (expand
, 1) == 1)
494 gen_exp (XVECEXP (expand
, 1, 0), DEFINE_EXPAND
, NULL
, info
);
499 /* For each operand referred to only with MATCH_DUPs,
500 make a local variable. */
501 for (i
= stats
.num_generator_args
; i
<= stats
.max_dup_opno
; i
++)
502 printf (" rtx operand%d;\n", i
);
503 printf (" rtx_insn *_val = 0;\n");
504 printf (" start_sequence ();\n");
506 /* The fourth operand of DEFINE_EXPAND is some code to be executed
507 before the actual construction.
508 This code expects to refer to `operands'
509 just as the output-code in a DEFINE_INSN does,
510 but here `operands' is an automatic array.
511 So copy the operand values there before executing it. */
512 if (XSTR (expand
, 3) && *XSTR (expand
, 3))
515 if (stats
.num_operand_vars
> 0)
516 printf (" rtx operands[%d];\n", stats
.num_operand_vars
);
518 /* Output code to copy the arguments into `operands'. */
519 for (i
= 0; i
< stats
.num_generator_args
; i
++)
520 printf (" operands[%d] = operand%d;\n", i
, i
);
522 /* Output the special code to be executed before the sequence
525 bool can_fail_p
= true;
526 if (find_optab (&p
, XSTR (expand
, 0)))
528 gcc_assert (p
.op
< NUM_OPTABS
);
529 if (nofail_optabs
[p
.op
])
532 emit_c_code (XSTR (expand
, 3), can_fail_p
, XSTR (expand
, 0));
534 /* Output code to copy the arguments back out of `operands'
535 (unless we aren't going to use them at all). */
536 if (XVEC (expand
, 1) != 0)
538 for (i
= 0; i
<= MAX (stats
.max_opno
, stats
.max_dup_opno
); i
++)
540 printf (" operand%d = operands[%d];\n", i
, i
);
541 printf (" (void) operand%d;\n", i
);
547 used
= XCNEWVEC (char, stats
.num_operand_vars
);
548 gen_emit_seq (XVEC (expand
, 1), used
, info
);
551 /* Call `get_insns' to extract the list of all the
552 insns emitted within this gen_... function. */
554 printf (" _val = get_insns ();\n");
555 printf (" end_sequence ();\n");
556 printf (" return _val;\n}\n\n");
559 /* Like gen_expand, but generates insns resulting from splitting SPLIT. */
562 gen_split (md_rtx_info
*info
)
564 struct pattern_stats stats
;
566 rtx split
= info
->def
;
567 const char *const name
=
568 ((GET_CODE (split
) == DEFINE_PEEPHOLE2
) ? "peephole2" : "split");
572 if (XVEC (split
, 0) == 0)
573 fatal_at (info
->loc
, "%s lacks a pattern",
574 GET_RTX_NAME (GET_CODE (split
)));
575 else if (XVEC (split
, 2) == 0)
576 fatal_at (info
->loc
, "%s lacks a replacement pattern",
577 GET_RTX_NAME (GET_CODE (split
)));
579 /* Find out how many operands this function has. */
581 get_pattern_stats (&stats
, XVEC (split
, 2));
582 unused
= (stats
.num_operand_vars
== 0 ? " ATTRIBUTE_UNUSED" : "");
583 used
= XCNEWVEC (char, stats
.num_operand_vars
);
585 /* Output the prototype, function name and argument declarations. */
586 if (GET_CODE (split
) == DEFINE_PEEPHOLE2
)
588 printf ("extern rtx_insn *gen_%s_%d (rtx_insn *, rtx *);\n",
590 printf ("rtx_insn *\ngen_%s_%d (rtx_insn *curr_insn ATTRIBUTE_UNUSED,"
591 " rtx *operands%s)\n",
592 name
, info
->index
, unused
);
596 printf ("extern rtx_insn *gen_split_%d (rtx_insn *, rtx *);\n",
598 printf ("rtx_insn *\ngen_split_%d "
599 "(rtx_insn *curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n",
600 info
->index
, unused
);
604 /* Declare all local variables. */
605 for (i
= 0; i
< stats
.num_operand_vars
; i
++)
606 printf (" rtx operand%d;\n", i
);
607 printf (" rtx_insn *_val = NULL;\n");
609 if (GET_CODE (split
) == DEFINE_PEEPHOLE2
)
610 output_peephole2_scratches (split
);
612 const char *fn
= info
->loc
.filename
;
613 for (const char *p
= fn
; *p
; p
++)
617 printf (" if (dump_file)\n");
618 printf (" fprintf (dump_file, \"Splitting with gen_%s_%d (%s:%d)\\n\");\n",
619 name
, info
->index
, fn
, info
->loc
.lineno
);
621 printf (" start_sequence ();\n");
623 /* The fourth operand of DEFINE_SPLIT is some code to be executed
624 before the actual construction. */
627 emit_c_code (XSTR (split
, 3), true, name
);
629 /* Output code to copy the arguments back out of `operands' */
630 for (i
= 0; i
< stats
.num_operand_vars
; i
++)
632 printf (" operand%d = operands[%d];\n", i
, i
);
633 printf (" (void) operand%d;\n", i
);
636 gen_emit_seq (XVEC (split
, 2), used
, info
);
638 /* Call `get_insns' to make a list of all the
639 insns emitted within this gen_... function. */
641 printf (" _val = get_insns ();\n");
642 printf (" end_sequence ();\n");
643 printf (" return _val;\n}\n\n");
648 /* Write a function, `add_clobbers', that is given a PARALLEL of sufficient
649 size for the insn and an INSN_CODE, and inserts the required CLOBBERs at
650 the end of the vector. */
653 output_add_clobbers (md_rtx_info
*info
)
655 struct clobber_pat
*clobber
;
656 struct clobber_ent
*ent
;
659 printf ("\n\nvoid\nadd_clobbers (rtx pattern ATTRIBUTE_UNUSED, int insn_code_number)\n");
661 printf (" switch (insn_code_number)\n");
664 for (clobber
= clobber_list
; clobber
; clobber
= clobber
->next
)
666 for (ent
= clobber
->insns
; ent
; ent
= ent
->next
)
667 printf (" case %d:\n", ent
->code_number
);
669 for (i
= clobber
->first_clobber
; i
< XVECLEN (clobber
->pattern
, 1); i
++)
671 printf (" XVECEXP (pattern, 0, %d) = ", i
);
672 gen_exp (XVECEXP (clobber
->pattern
, 1, i
),
673 GET_CODE (clobber
->pattern
), NULL
, info
);
677 printf (" break;\n\n");
680 printf (" default:\n");
681 printf (" gcc_unreachable ();\n");
686 /* Write a function, `added_clobbers_hard_reg_p' that is given an insn_code
687 number that will have clobbers added (as indicated by `recog') and returns
688 1 if those include a clobber of a hard reg or 0 if all of them just clobber
692 output_added_clobbers_hard_reg_p (void)
694 struct clobber_pat
*clobber
;
695 struct clobber_ent
*ent
;
698 printf ("\n\nint\nadded_clobbers_hard_reg_p (int insn_code_number)\n");
700 printf (" switch (insn_code_number)\n");
703 for (clobber_p
= 0; clobber_p
<= 1; clobber_p
++)
706 for (clobber
= clobber_list
; clobber
; clobber
= clobber
->next
)
707 if (clobber
->has_hard_reg
== clobber_p
)
708 for (ent
= clobber
->insns
; ent
; ent
= ent
->next
)
710 printf (" case %d:\n", ent
->code_number
);
715 printf (" return %d;\n\n", clobber_p
);
718 printf (" default:\n");
719 printf (" gcc_unreachable ();\n");
724 /* Generate code to invoke find_free_register () as needed for the
725 scratch registers used by the peephole2 pattern in SPLIT. */
728 output_peephole2_scratches (rtx split
)
734 for (i
= 0; i
< XVECLEN (split
, 0); i
++)
736 rtx elt
= XVECEXP (split
, 0, i
);
737 if (GET_CODE (elt
) == MATCH_SCRATCH
)
739 int last_insn_nr
= insn_nr
;
740 int cur_insn_nr
= insn_nr
;
742 for (j
= i
+ 1; j
< XVECLEN (split
, 0); j
++)
743 if (GET_CODE (XVECEXP (split
, 0, j
)) == MATCH_DUP
)
745 if (XINT (XVECEXP (split
, 0, j
), 0) == XINT (elt
, 0))
746 last_insn_nr
= cur_insn_nr
;
748 else if (GET_CODE (XVECEXP (split
, 0, j
)) != MATCH_SCRATCH
)
753 printf (" HARD_REG_SET _regs_allocated;\n");
754 printf (" CLEAR_HARD_REG_SET (_regs_allocated);\n");
758 printf (" if ((operands[%d] = peep2_find_free_register (%d, %d, \"%s\", %smode, &_regs_allocated)) == NULL_RTX)\n\
761 insn_nr
, last_insn_nr
,
763 GET_MODE_NAME (GET_MODE (elt
)));
766 else if (GET_CODE (elt
) != MATCH_DUP
)
771 /* Print "arg<N>" parameter declarations for each argument N of ONAME. */
774 print_overload_arguments (overloaded_name
*oname
)
776 for (unsigned int i
= 0; i
< oname
->arg_types
.length (); ++i
)
777 printf ("%s%s arg%d", i
== 0 ? "" : ", ", oname
->arg_types
[i
], i
);
780 /* Print code to test whether INSTANCE should be chosen, given that
781 argument N of the overload is available as "arg<N>". */
784 print_overload_test (overloaded_instance
*instance
)
786 for (unsigned int i
= 0; i
< instance
->arg_values
.length (); ++i
)
787 printf ("%sarg%d == %s", i
== 0 ? " if (" : "\n && ",
788 i
, instance
->arg_values
[i
]);
792 /* Emit a maybe_code_for_* function for ONAME. */
795 handle_overloaded_code_for (overloaded_name
*oname
)
797 /* Print the function prototype. */
798 printf ("\ninsn_code\nmaybe_code_for_%s (", oname
->name
);
799 print_overload_arguments (oname
);
802 /* Use a sequence of "if" statements for each instance. */
803 for (overloaded_instance
*instance
= oname
->first_instance
;
804 instance
; instance
= instance
->next
)
806 print_overload_test (instance
);
807 printf (" return CODE_FOR_%s;\n", instance
->name
);
810 /* Return null if no match was found. */
811 printf (" return CODE_FOR_nothing;\n}\n");
814 /* Emit a maybe_gen_* function for ONAME. */
817 handle_overloaded_gen (overloaded_name
*oname
)
819 unsigned HOST_WIDE_INT seen
= 0;
820 /* All patterns must have the same number of operands. */
821 for (overloaded_instance
*instance
= oname
->first_instance
->next
;
822 instance
; instance
= instance
->next
)
825 get_pattern_stats (&stats
, XVEC (instance
->insn
, 1));
826 unsigned HOST_WIDE_INT mask
827 = HOST_WIDE_INT_1U
<< stats
.num_generator_args
;
833 /* Print the function prototype. */
834 printf ("\nrtx\nmaybe_gen_%s (", oname
->name
);
835 print_overload_arguments (oname
);
836 for (int i
= 0; i
< stats
.num_generator_args
; ++i
)
837 printf (", rtx x%d", i
);
840 /* Use maybe_code_for_*, instead of duplicating the selection
842 printf (" insn_code code = maybe_code_for_%s (", oname
->name
);
843 for (unsigned int i
= 0; i
< oname
->arg_types
.length (); ++i
)
844 printf ("%sarg%d", i
== 0 ? "" : ", ", i
);
846 " if (code != CODE_FOR_nothing)\n"
848 " gcc_assert (insn_data[code].n_generator_args == %d);\n"
849 " return GEN_FCN (code) (", stats
.num_generator_args
);
850 for (int i
= 0; i
< stats
.num_generator_args
; ++i
)
851 printf ("%sx%d", i
== 0 ? "" : ", ", i
);
855 " return NULL_RTX;\n"
861 main (int argc
, const char **argv
)
863 progname
= "genemit";
865 if (!init_rtx_reader_args (argc
, argv
))
866 return (FATAL_EXIT_CODE
);
868 #define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
869 nofail_optabs[OPTAB##_optab] = true;
870 #include "internal-fn.def"
872 /* Assign sequential codes to all entries in the machine description
873 in parallel with the tables in insn-output.c. */
875 printf ("/* Generated automatically by the program `genemit'\n\
876 from the machine description file `md'. */\n\n");
878 printf ("#define IN_TARGET_CODE 1\n");
879 printf ("#include \"config.h\"\n");
880 printf ("#include \"system.h\"\n");
881 printf ("#include \"coretypes.h\"\n");
882 printf ("#include \"backend.h\"\n");
883 printf ("#include \"predict.h\"\n");
884 printf ("#include \"tree.h\"\n");
885 printf ("#include \"rtl.h\"\n");
886 printf ("#include \"alias.h\"\n");
887 printf ("#include \"varasm.h\"\n");
888 printf ("#include \"stor-layout.h\"\n");
889 printf ("#include \"calls.h\"\n");
890 printf ("#include \"memmodel.h\"\n");
891 printf ("#include \"tm_p.h\"\n");
892 printf ("#include \"flags.h\"\n");
893 printf ("#include \"insn-config.h\"\n");
894 printf ("#include \"expmed.h\"\n");
895 printf ("#include \"dojump.h\"\n");
896 printf ("#include \"explow.h\"\n");
897 printf ("#include \"emit-rtl.h\"\n");
898 printf ("#include \"stmt.h\"\n");
899 printf ("#include \"expr.h\"\n");
900 printf ("#include \"insn-codes.h\"\n");
901 printf ("#include \"optabs.h\"\n");
902 printf ("#include \"dfp.h\"\n");
903 printf ("#include \"output.h\"\n");
904 printf ("#include \"recog.h\"\n");
905 printf ("#include \"df.h\"\n");
906 printf ("#include \"resource.h\"\n");
907 printf ("#include \"reload.h\"\n");
908 printf ("#include \"diagnostic-core.h\"\n");
909 printf ("#include \"regs.h\"\n");
910 printf ("#include \"tm-constrs.h\"\n");
911 printf ("#include \"ggc.h\"\n");
912 printf ("#include \"target.h\"\n\n");
914 /* Read the machine description. */
917 while (read_md_rtx (&info
))
918 switch (GET_CODE (info
.def
))
925 printf ("/* %s:%d */\n", info
.loc
.filename
, info
.loc
.lineno
);
930 printf ("/* %s:%d */\n", info
.loc
.filename
, info
.loc
.lineno
);
934 case DEFINE_PEEPHOLE2
:
935 printf ("/* %s:%d */\n", info
.loc
.filename
, info
.loc
.lineno
);
943 /* Write out the routines to add CLOBBERs to a pattern and say whether they
944 clobber a hard reg. */
945 output_add_clobbers (&info
);
946 output_added_clobbers_hard_reg_p ();
948 for (overloaded_name
*oname
= rtx_reader_ptr
->get_overloads ();
949 oname
; oname
= oname
->next
)
951 handle_overloaded_code_for (oname
);
952 handle_overloaded_gen (oname
);
956 return (ferror (stdout
) != 0 ? FATAL_EXIT_CODE
: SUCCESS_EXIT_CODE
);