1 /* Generate code from machine description to emit insns as rtl.
2 Copyright (C) 1987, 1988, 1991, 1994, 1995, 1997, 1998, 1999, 2000, 2001
3 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
25 #include "coretypes.h"
29 #include "gensupport.h"
33 static int max_dup_opno
;
34 static int max_scratch_opno
;
35 static int register_constraints
;
36 static int insn_code_number
;
37 static int insn_index_number
;
39 /* Data structure for recording the patterns of insns that have CLOBBERs.
40 We use this to output a function that adds these CLOBBERs to a
41 previously-allocated PARALLEL expression. */
45 struct clobber_ent
*insns
;
48 struct clobber_pat
*next
;
52 /* Records one insn that uses the clobber list. */
56 int code_number
; /* Counts only insns. */
57 struct clobber_ent
*next
;
60 static void max_operand_1
PARAMS ((rtx
));
61 static int max_operand_vec
PARAMS ((rtx
, int));
62 static void print_code
PARAMS ((RTX_CODE
));
63 static void gen_exp
PARAMS ((rtx
, enum rtx_code
, char *));
64 static void gen_insn
PARAMS ((rtx
, int));
65 static void gen_expand
PARAMS ((rtx
));
66 static void gen_split
PARAMS ((rtx
));
67 static void output_add_clobbers
PARAMS ((void));
68 static void output_added_clobbers_hard_reg_p
PARAMS ((void));
69 static void gen_rtx_scratch
PARAMS ((rtx
, enum rtx_code
));
70 static void output_peephole2_scratches
PARAMS ((rtx
));
87 if (code
== MATCH_OPERAND
&& XSTR (x
, 2) != 0 && *XSTR (x
, 2) != '\0')
88 register_constraints
= 1;
89 if (code
== MATCH_SCRATCH
&& XSTR (x
, 1) != 0 && *XSTR (x
, 1) != '\0')
90 register_constraints
= 1;
91 if (code
== MATCH_OPERAND
|| code
== MATCH_OPERATOR
92 || code
== MATCH_PARALLEL
)
93 max_opno
= MAX (max_opno
, XINT (x
, 0));
94 if (code
== MATCH_DUP
|| code
== MATCH_OP_DUP
|| code
== MATCH_PAR_DUP
)
95 max_dup_opno
= MAX (max_dup_opno
, XINT (x
, 0));
96 if (code
== MATCH_SCRATCH
)
97 max_scratch_opno
= MAX (max_scratch_opno
, XINT (x
, 0));
99 fmt
= GET_RTX_FORMAT (code
);
100 len
= GET_RTX_LENGTH (code
);
101 for (i
= 0; i
< len
; i
++)
103 if (fmt
[i
] == 'e' || fmt
[i
] == 'u')
104 max_operand_1 (XEXP (x
, i
));
105 else if (fmt
[i
] == 'E')
108 for (j
= 0; j
< XVECLEN (x
, i
); j
++)
109 max_operand_1 (XVECEXP (x
, i
, j
));
115 max_operand_vec (insn
, arg
)
119 int len
= XVECLEN (insn
, arg
);
124 max_scratch_opno
= -1;
126 for (i
= 0; i
< len
; i
++)
127 max_operand_1 (XVECEXP (insn
, arg
, i
));
137 for (p1
= GET_RTX_NAME (code
); *p1
; p1
++)
138 putchar (TOUPPER(*p1
));
142 gen_rtx_scratch (x
, subroutine_type
)
144 enum rtx_code subroutine_type
;
146 if (subroutine_type
== DEFINE_PEEPHOLE2
)
148 printf ("operand%d", XINT (x
, 0));
152 printf ("gen_rtx_SCRATCH (%smode)", GET_MODE_NAME (GET_MODE (x
)));
156 /* Print a C expression to construct an RTX just like X,
157 substituting any operand references appearing within. */
160 gen_exp (x
, subroutine_type
, used
)
162 enum rtx_code subroutine_type
;
184 if (used
[XINT (x
, 0)])
186 printf ("copy_rtx (operand%d)", XINT (x
, 0));
189 used
[XINT (x
, 0)] = 1;
191 printf ("operand%d", XINT (x
, 0));
195 printf ("gen_rtx (GET_CODE (operand%d), ", XINT (x
, 0));
196 if (GET_MODE (x
) == VOIDmode
)
197 printf ("GET_MODE (operand%d)", XINT (x
, 0));
199 printf ("%smode", GET_MODE_NAME (GET_MODE (x
)));
200 for (i
= 0; i
< XVECLEN (x
, 1); i
++)
203 gen_exp (XVECEXP (x
, 1, i
), subroutine_type
, used
);
209 printf ("gen_rtx (GET_CODE (operand%d)", XINT (x
, 0));
210 printf (", %smode", GET_MODE_NAME (GET_MODE (x
)));
211 for (i
= 0; i
< XVECLEN (x
, 2); i
++)
214 gen_exp (XVECEXP (x
, 2, i
), subroutine_type
, used
);
221 printf ("operand%d", XINT (x
, 0));
225 gen_rtx_scratch (x
, subroutine_type
);
229 fatal ("ADDRESS expression code used in named instruction pattern");
241 printf ("const0_rtx");
242 else if (INTVAL (x
) == 1)
243 printf ("const1_rtx");
244 else if (INTVAL (x
) == -1)
245 printf ("constm1_rtx");
246 else if (INTVAL (x
) == STORE_FLAG_VALUE
)
247 printf ("const_true_rtx");
250 printf ("GEN_INT (");
251 printf (HOST_WIDE_INT_PRINT_DEC_C
, INTVAL (x
));
257 /* These shouldn't be written in MD files. Instead, the appropriate
258 routines in varasm.c should be called. */
267 printf (" (%smode", GET_MODE_NAME (GET_MODE (x
)));
269 fmt
= GET_RTX_FORMAT (code
);
270 len
= GET_RTX_LENGTH (code
);
271 for (i
= 0; i
< len
; i
++)
276 if (fmt
[i
] == 'e' || fmt
[i
] == 'u')
277 gen_exp (XEXP (x
, i
), subroutine_type
, used
);
278 else if (fmt
[i
] == 'i')
279 printf ("%u", XINT (x
, i
));
280 else if (fmt
[i
] == 's')
281 printf ("\"%s\"", XSTR (x
, i
));
282 else if (fmt
[i
] == 'E')
285 printf ("gen_rtvec (%d", XVECLEN (x
, i
));
286 for (j
= 0; j
< XVECLEN (x
, i
); j
++)
289 gen_exp (XVECEXP (x
, i
, j
), subroutine_type
, used
);
299 /* Generate the `gen_...' function for a DEFINE_INSN. */
302 gen_insn (insn
, lineno
)
309 /* See if the pattern for this insn ends with a group of CLOBBERs of (hard)
310 registers or MATCH_SCRATCHes. If so, store away the information for
315 int has_hard_reg
= 0;
317 for (i
= XVECLEN (insn
, 1) - 1; i
> 0; i
--)
319 if (GET_CODE (XVECEXP (insn
, 1, i
)) != CLOBBER
)
322 if (GET_CODE (XEXP (XVECEXP (insn
, 1, i
), 0)) == REG
)
324 else if (GET_CODE (XEXP (XVECEXP (insn
, 1, i
), 0)) != MATCH_SCRATCH
)
328 if (i
!= XVECLEN (insn
, 1) - 1)
330 struct clobber_pat
*p
;
331 struct clobber_ent
*link
332 = (struct clobber_ent
*) xmalloc (sizeof (struct clobber_ent
));
335 link
->code_number
= insn_code_number
;
337 /* See if any previous CLOBBER_LIST entry is the same as this
340 for (p
= clobber_list
; p
; p
= p
->next
)
342 if (p
->first_clobber
!= i
+ 1
343 || XVECLEN (p
->pattern
, 1) != XVECLEN (insn
, 1))
346 for (j
= i
+ 1; j
< XVECLEN (insn
, 1); j
++)
348 rtx old
= XEXP (XVECEXP (p
->pattern
, 1, j
), 0);
349 rtx
new = XEXP (XVECEXP (insn
, 1, j
), 0);
351 /* OLD and NEW are the same if both are to be a SCRATCH
353 or if both are registers of the same mode and number. */
354 if (! (GET_MODE (old
) == GET_MODE (new)
355 && ((GET_CODE (old
) == MATCH_SCRATCH
356 && GET_CODE (new) == MATCH_SCRATCH
)
357 || (GET_CODE (old
) == REG
&& GET_CODE (new) == REG
358 && REGNO (old
) == REGNO (new)))))
362 if (j
== XVECLEN (insn
, 1))
368 p
= (struct clobber_pat
*) xmalloc (sizeof (struct clobber_pat
));
372 p
->first_clobber
= i
+ 1;
373 p
->next
= clobber_list
;
374 p
->has_hard_reg
= has_hard_reg
;
378 link
->next
= p
->insns
;
383 /* Don't mention instructions whose names are the null string
384 or begin with '*'. They are in the machine description just
386 if (XSTR (insn
, 0)[0] == 0 || XSTR (insn
, 0)[0] == '*')
389 printf ("/* %s:%d */\n", read_rtx_filename
, lineno
);
391 /* Find out how many operands this function has,
392 and also whether any of them have register constraints. */
393 register_constraints
= 0;
394 operands
= max_operand_vec (insn
, 1);
395 if (max_dup_opno
>= operands
)
396 fatal ("match_dup operand number has no match_operand");
398 /* Output the function name and argument declarations. */
399 printf ("rtx\ngen_%s (", XSTR (insn
, 0));
400 for (i
= 0; i
< operands
; i
++)
402 printf (", operand%d", i
);
404 printf ("operand%d", i
);
406 for (i
= 0; i
< operands
; i
++)
407 printf (" rtx operand%d ATTRIBUTE_UNUSED;\n", i
);
410 /* Output code to construct and return the rtl for the instruction body */
412 if (XVECLEN (insn
, 1) == 1)
415 gen_exp (XVECEXP (insn
, 1, 0), DEFINE_INSN
, NULL
);
420 printf (" return gen_rtx_PARALLEL (VOIDmode, gen_rtvec (%d",
423 for (i
= 0; i
< XVECLEN (insn
, 1); i
++)
426 gen_exp (XVECEXP (insn
, 1, i
), DEFINE_INSN
, NULL
);
428 printf ("));\n}\n\n");
432 /* Generate the `gen_...' function for a DEFINE_EXPAND. */
441 if (strlen (XSTR (expand
, 0)) == 0)
442 fatal ("define_expand lacks a name");
443 if (XVEC (expand
, 1) == 0)
444 fatal ("define_expand for %s lacks a pattern", XSTR (expand
, 0));
446 /* Find out how many operands this function has,
447 and also whether any of them have register constraints. */
448 register_constraints
= 0;
450 operands
= max_operand_vec (expand
, 1);
452 /* Output the function name and argument declarations. */
453 printf ("rtx\ngen_%s (", XSTR (expand
, 0));
454 for (i
= 0; i
< operands
; i
++)
456 printf (", operand%d", i
);
458 printf ("operand%d", i
);
460 for (i
= 0; i
< operands
; i
++)
461 printf (" rtx operand%d;\n", i
);
464 /* If we don't have any C code to write, only one insn is being written,
465 and no MATCH_DUPs are present, we can just return the desired insn
466 like we do for a DEFINE_INSN. This saves memory. */
467 if ((XSTR (expand
, 3) == 0 || *XSTR (expand
, 3) == '\0')
468 && operands
> max_dup_opno
469 && XVECLEN (expand
, 1) == 1)
472 gen_exp (XVECEXP (expand
, 1, 0), DEFINE_EXPAND
, NULL
);
477 /* For each operand referred to only with MATCH_DUPs,
478 make a local variable. */
479 for (i
= operands
; i
<= max_dup_opno
; i
++)
480 printf (" rtx operand%d;\n", i
);
481 for (; i
<= max_scratch_opno
; i
++)
482 printf (" rtx operand%d ATTRIBUTE_UNUSED;\n", i
);
483 printf (" rtx _val = 0;\n");
484 printf (" start_sequence ();\n");
486 /* The fourth operand of DEFINE_EXPAND is some code to be executed
487 before the actual construction.
488 This code expects to refer to `operands'
489 just as the output-code in a DEFINE_INSN does,
490 but here `operands' is an automatic array.
491 So copy the operand values there before executing it. */
492 if (XSTR (expand
, 3) && *XSTR (expand
, 3))
495 if (operands
> 0 || max_dup_opno
>= 0 || max_scratch_opno
>= 0)
496 printf (" rtx operands[%d];\n",
497 MAX (operands
, MAX (max_scratch_opno
, max_dup_opno
) + 1));
498 /* Output code to copy the arguments into `operands'. */
499 for (i
= 0; i
< operands
; i
++)
500 printf (" operands[%d] = operand%d;\n", i
, i
);
502 /* Output the special code to be executed before the sequence
504 printf ("%s\n", XSTR (expand
, 3));
506 /* Output code to copy the arguments back out of `operands'
507 (unless we aren't going to use them at all). */
508 if (XVEC (expand
, 1) != 0)
510 for (i
= 0; i
< operands
; i
++)
511 printf (" operand%d = operands[%d];\n", i
, i
);
512 for (; i
<= max_dup_opno
; i
++)
513 printf (" operand%d = operands[%d];\n", i
, i
);
514 for (; i
<= max_scratch_opno
; i
++)
515 printf (" operand%d = operands[%d];\n", i
, i
);
520 /* Output code to construct the rtl for the instruction bodies.
521 Use emit_insn to add them to the sequence being accumulated.
522 But don't do this if the user's code has set `no_more' nonzero. */
524 for (i
= 0; i
< XVECLEN (expand
, 1); i
++)
526 rtx next
= XVECEXP (expand
, 1, i
);
527 if ((GET_CODE (next
) == SET
&& GET_CODE (SET_DEST (next
)) == PC
)
528 || (GET_CODE (next
) == PARALLEL
529 && ((GET_CODE (XVECEXP (next
, 0, 0)) == SET
530 && GET_CODE (SET_DEST (XVECEXP (next
, 0, 0))) == PC
)
531 || GET_CODE (XVECEXP (next
, 0, 0)) == RETURN
))
532 || GET_CODE (next
) == RETURN
)
533 printf (" emit_jump_insn (");
534 else if ((GET_CODE (next
) == SET
&& GET_CODE (SET_SRC (next
)) == CALL
)
535 || GET_CODE (next
) == CALL
536 || (GET_CODE (next
) == PARALLEL
537 && GET_CODE (XVECEXP (next
, 0, 0)) == SET
538 && GET_CODE (SET_SRC (XVECEXP (next
, 0, 0))) == CALL
)
539 || (GET_CODE (next
) == PARALLEL
540 && GET_CODE (XVECEXP (next
, 0, 0)) == CALL
))
541 printf (" emit_call_insn (");
542 else if (GET_CODE (next
) == CODE_LABEL
)
543 printf (" emit_label (");
544 else if (GET_CODE (next
) == MATCH_OPERAND
545 || GET_CODE (next
) == MATCH_DUP
546 || GET_CODE (next
) == MATCH_OPERATOR
547 || GET_CODE (next
) == MATCH_OP_DUP
548 || GET_CODE (next
) == MATCH_PARALLEL
549 || GET_CODE (next
) == MATCH_PAR_DUP
550 || GET_CODE (next
) == PARALLEL
)
553 printf (" emit_insn (");
554 gen_exp (next
, DEFINE_EXPAND
, NULL
);
556 if (GET_CODE (next
) == SET
&& GET_CODE (SET_DEST (next
)) == PC
557 && GET_CODE (SET_SRC (next
)) == LABEL_REF
)
558 printf (" emit_barrier ();");
561 /* Call `get_insns' to extract the list of all the
562 insns emitted within this gen_... function. */
564 printf (" _val = get_insns ();\n");
565 printf (" end_sequence ();\n");
566 printf (" return _val;\n}\n\n");
569 /* Like gen_expand, but generates insns resulting from splitting SPLIT. */
577 const char *const name
=
578 ((GET_CODE (split
) == DEFINE_PEEPHOLE2
) ? "peephole2" : "split");
582 if (XVEC (split
, 0) == 0)
583 fatal ("define_%s (definition %d) lacks a pattern", name
,
585 else if (XVEC (split
, 2) == 0)
586 fatal ("define_%s (definition %d) lacks a replacement pattern", name
,
589 /* Find out how many operands this function has. */
591 max_operand_vec (split
, 2);
592 operands
= MAX (max_opno
, MAX (max_dup_opno
, max_scratch_opno
)) + 1;
593 unused
= (operands
== 0 ? " ATTRIBUTE_UNUSED" : "");
594 used
= xcalloc (1, operands
);
596 /* Output the prototype, function name and argument declarations. */
597 if (GET_CODE (split
) == DEFINE_PEEPHOLE2
)
599 printf ("extern rtx gen_%s_%d PARAMS ((rtx, rtx *));\n",
600 name
, insn_code_number
);
601 printf ("rtx\ngen_%s_%d (curr_insn, operands)\n",
602 name
, insn_code_number
);
603 printf (" rtx curr_insn ATTRIBUTE_UNUSED;\n");
604 printf (" rtx *operands%s;\n", unused
);
608 printf ("extern rtx gen_split_%d PARAMS ((rtx *));\n", insn_code_number
);
609 printf ("rtx\ngen_%s_%d (operands)\n", name
, insn_code_number
);
610 printf (" rtx *operands%s;\n", unused
);
614 /* Declare all local variables. */
615 for (i
= 0; i
< operands
; i
++)
616 printf (" rtx operand%d;\n", i
);
617 printf (" rtx _val = 0;\n");
619 if (GET_CODE (split
) == DEFINE_PEEPHOLE2
)
620 output_peephole2_scratches (split
);
622 printf (" start_sequence ();\n");
624 /* The fourth operand of DEFINE_SPLIT is some code to be executed
625 before the actual construction. */
628 printf ("%s\n", XSTR (split
, 3));
630 /* Output code to copy the arguments back out of `operands' */
631 for (i
= 0; i
< operands
; i
++)
632 printf (" operand%d = operands[%d];\n", i
, i
);
634 /* Output code to construct the rtl for the instruction bodies.
635 Use emit_insn to add them to the sequence being accumulated.
636 But don't do this if the user's code has set `no_more' nonzero. */
638 for (i
= 0; i
< XVECLEN (split
, 2); i
++)
640 rtx next
= XVECEXP (split
, 2, i
);
641 if ((GET_CODE (next
) == SET
&& GET_CODE (SET_DEST (next
)) == PC
)
642 || (GET_CODE (next
) == PARALLEL
643 && GET_CODE (XVECEXP (next
, 0, 0)) == SET
644 && GET_CODE (SET_DEST (XVECEXP (next
, 0, 0))) == PC
)
645 || GET_CODE (next
) == RETURN
)
646 printf (" emit_jump_insn (");
647 else if ((GET_CODE (next
) == SET
&& GET_CODE (SET_SRC (next
)) == CALL
)
648 || GET_CODE (next
) == CALL
649 || (GET_CODE (next
) == PARALLEL
650 && GET_CODE (XVECEXP (next
, 0, 0)) == SET
651 && GET_CODE (SET_SRC (XVECEXP (next
, 0, 0))) == CALL
)
652 || (GET_CODE (next
) == PARALLEL
653 && GET_CODE (XVECEXP (next
, 0, 0)) == CALL
))
654 printf (" emit_call_insn (");
655 else if (GET_CODE (next
) == CODE_LABEL
)
656 printf (" emit_label (");
657 else if (GET_CODE (next
) == MATCH_OPERAND
658 || GET_CODE (next
) == MATCH_OPERATOR
659 || GET_CODE (next
) == MATCH_PARALLEL
660 || GET_CODE (next
) == MATCH_OP_DUP
661 || GET_CODE (next
) == MATCH_DUP
662 || GET_CODE (next
) == PARALLEL
)
665 printf (" emit_insn (");
666 gen_exp (next
, GET_CODE (split
), used
);
668 if (GET_CODE (next
) == SET
&& GET_CODE (SET_DEST (next
)) == PC
669 && GET_CODE (SET_SRC (next
)) == LABEL_REF
)
670 printf (" emit_barrier ();");
673 /* Call `get_insns' to make a list of all the
674 insns emitted within this gen_... function. */
676 printf (" _val = get_insns ();\n");
677 printf (" end_sequence ();\n");
678 printf (" return _val;\n}\n\n");
683 /* Write a function, `add_clobbers', that is given a PARALLEL of sufficient
684 size for the insn and an INSN_CODE, and inserts the required CLOBBERs at
685 the end of the vector. */
688 output_add_clobbers ()
690 struct clobber_pat
*clobber
;
691 struct clobber_ent
*ent
;
694 printf ("\n\nvoid\nadd_clobbers (pattern, insn_code_number)\n");
695 printf (" rtx pattern ATTRIBUTE_UNUSED;\n int insn_code_number;\n");
697 printf (" switch (insn_code_number)\n");
700 for (clobber
= clobber_list
; clobber
; clobber
= clobber
->next
)
702 for (ent
= clobber
->insns
; ent
; ent
= ent
->next
)
703 printf (" case %d:\n", ent
->code_number
);
705 for (i
= clobber
->first_clobber
; i
< XVECLEN (clobber
->pattern
, 1); i
++)
707 printf (" XVECEXP (pattern, 0, %d) = ", i
);
708 gen_exp (XVECEXP (clobber
->pattern
, 1, i
),
709 GET_CODE (clobber
->pattern
), NULL
);
713 printf (" break;\n\n");
716 printf (" default:\n");
717 printf (" abort ();\n");
722 /* Write a function, `added_clobbers_hard_reg_p' this is given an insn_code
723 number that needs clobbers and returns 1 if they include a clobber of a
724 hard reg and 0 if they just clobber SCRATCH. */
727 output_added_clobbers_hard_reg_p ()
729 struct clobber_pat
*clobber
;
730 struct clobber_ent
*ent
;
733 printf ("\n\nint\nadded_clobbers_hard_reg_p (insn_code_number)\n");
734 printf (" int insn_code_number;\n");
736 printf (" switch (insn_code_number)\n");
739 for (clobber_p
= 0; clobber_p
<= 1; clobber_p
++)
742 for (clobber
= clobber_list
; clobber
; clobber
= clobber
->next
)
743 if (clobber
->has_hard_reg
== clobber_p
)
744 for (ent
= clobber
->insns
; ent
; ent
= ent
->next
)
746 printf (" case %d:\n", ent
->code_number
);
751 printf (" return %d;\n\n", clobber_p
);
754 printf (" default:\n");
755 printf (" abort ();\n");
760 /* Generate code to invoke find_free_register () as needed for the
761 scratch registers used by the peephole2 pattern in SPLIT. */
764 output_peephole2_scratches (split
)
770 printf (" HARD_REG_SET _regs_allocated;\n");
771 printf (" CLEAR_HARD_REG_SET (_regs_allocated);\n");
773 for (i
= 0; i
< XVECLEN (split
, 0); i
++)
775 rtx elt
= XVECEXP (split
, 0, i
);
776 if (GET_CODE (elt
) == MATCH_SCRATCH
)
778 int last_insn_nr
= insn_nr
;
779 int cur_insn_nr
= insn_nr
;
781 for (j
= i
+ 1; j
< XVECLEN (split
, 0); j
++)
782 if (GET_CODE (XVECEXP (split
, 0, j
)) == MATCH_DUP
)
784 if (XINT (XVECEXP (split
, 0, j
), 0) == XINT (elt
, 0))
785 last_insn_nr
= cur_insn_nr
;
787 else if (GET_CODE (XVECEXP (split
, 0, j
)) != MATCH_SCRATCH
)
790 printf (" if ((operands[%d] = peep2_find_free_register (%d, %d, \"%s\", %smode, &_regs_allocated)) == NULL_RTX)\n\
793 insn_nr
, last_insn_nr
,
795 GET_MODE_NAME (GET_MODE (elt
)));
798 else if (GET_CODE (elt
) != MATCH_DUP
)
803 extern int main
PARAMS ((int, char **));
812 progname
= "genemit";
815 fatal ("no input file name");
817 if (init_md_reader_args (argc
, argv
) != SUCCESS_EXIT_CODE
)
818 return (FATAL_EXIT_CODE
);
820 /* Assign sequential codes to all entries in the machine description
821 in parallel with the tables in insn-output.c. */
823 insn_code_number
= 0;
824 insn_index_number
= 0;
826 printf ("/* Generated automatically by the program `genemit'\n\
827 from the machine description file `md'. */\n\n");
829 printf ("#include \"config.h\"\n");
830 printf ("#include \"system.h\"\n");
831 printf ("#include \"coretypes.h\"\n");
832 printf ("#include \"tm.h\"\n");
833 printf ("#include \"rtl.h\"\n");
834 printf ("#include \"tm_p.h\"\n");
835 printf ("#include \"function.h\"\n");
836 printf ("#include \"expr.h\"\n");
837 printf ("#include \"optabs.h\"\n");
838 printf ("#include \"real.h\"\n");
839 printf ("#include \"flags.h\"\n");
840 printf ("#include \"output.h\"\n");
841 printf ("#include \"insn-config.h\"\n");
842 printf ("#include \"hard-reg-set.h\"\n");
843 printf ("#include \"recog.h\"\n");
844 printf ("#include \"resource.h\"\n");
845 printf ("#include \"reload.h\"\n");
846 printf ("#include \"toplev.h\"\n");
847 printf ("#include \"ggc.h\"\n\n");
848 printf ("#define FAIL return (end_sequence (), _val)\n");
849 printf ("#define DONE return (_val = get_insns (), end_sequence (), _val)\n\n");
851 /* Read the machine description. */
857 desc
= read_md_rtx (&line_no
, &insn_code_number
);
861 switch (GET_CODE (desc
))
864 gen_insn (desc
, line_no
);
868 printf ("/* %s:%d */\n", read_rtx_filename
, line_no
);
873 printf ("/* %s:%d */\n", read_rtx_filename
, line_no
);
877 case DEFINE_PEEPHOLE2
:
878 printf ("/* %s:%d */\n", read_rtx_filename
, line_no
);
888 /* Write out the routines to add CLOBBERs to a pattern and say whether they
889 clobber a hard reg. */
890 output_add_clobbers ();
891 output_added_clobbers_hard_reg_p ();
894 return (ferror (stdout
) != 0 ? FATAL_EXIT_CODE
: SUCCESS_EXIT_CODE
);
897 /* Define this so we can link with print-rtl.o to get debug_rtx function. */
900 int code ATTRIBUTE_UNUSED
;