annotate gcc/genemit.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Generate code from machine description to emit insns as rtl.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 1987-2020 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #include "bconfig.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 #include "system.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 #include "coretypes.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 #include "tm.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 #include "rtl.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 #include "errors.h"
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
27 #include "read-md.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 #include "gensupport.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 /* Data structure for recording the patterns of insns that have CLOBBERs.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 We use this to output a function that adds these CLOBBERs to a
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 previously-allocated PARALLEL expression. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 struct clobber_pat
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 struct clobber_ent *insns;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 rtx pattern;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 int first_clobber;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 struct clobber_pat *next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 int has_hard_reg;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 } *clobber_list;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 /* Records one insn that uses the clobber list. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 struct clobber_ent
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 int code_number; /* Counts only insns. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 struct clobber_ent *next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 static void output_peephole2_scratches (rtx);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53
111
kono
parents: 67
diff changeset
54 /* True for <X>_optab if that optab isn't allowed to fail. */
kono
parents: 67
diff changeset
55 static bool nofail_optabs[NUM_OPTABS];
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 print_code (RTX_CODE code)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 const char *p1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 for (p1 = GET_RTX_NAME (code); *p1; p1++)
111
kono
parents: 67
diff changeset
62 putchar (TOUPPER (*p1));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 gen_rtx_scratch (rtx x, enum rtx_code subroutine_type)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 if (subroutine_type == DEFINE_PEEPHOLE2)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 printf ("operand%d", XINT (x, 0));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 printf ("gen_rtx_SCRATCH (%smode)", GET_MODE_NAME (GET_MODE (x)));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 /* Print a C expression to construct an RTX just like X,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 substituting any operand references appearing within. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 static void
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
82 gen_exp (rtx x, enum rtx_code subroutine_type, char *used, md_rtx_info *info)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 RTX_CODE code;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 int i;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 int len;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 const char *fmt;
111
kono
parents: 67
diff changeset
88 const char *sep = "";
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 if (x == 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 printf ("NULL_RTX");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 code = GET_CODE (x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 switch (code)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 case MATCH_OPERAND:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 case MATCH_DUP:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 if (used)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 if (used[XINT (x, 0)])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 printf ("copy_rtx (operand%d)", XINT (x, 0));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 used[XINT (x, 0)] = 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 printf ("operand%d", XINT (x, 0));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 case MATCH_OP_DUP:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 printf ("gen_rtx_fmt_");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 for (i = 0; i < XVECLEN (x, 1); i++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 printf ("e");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 printf (" (GET_CODE (operand%d), ", XINT (x, 0));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 if (GET_MODE (x) == VOIDmode)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 printf ("GET_MODE (operand%d)", XINT (x, 0));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 printf ("%smode", GET_MODE_NAME (GET_MODE (x)));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 for (i = 0; i < XVECLEN (x, 1); i++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 printf (",\n\t\t");
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
126 gen_exp (XVECEXP (x, 1, i), subroutine_type, used, info);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 printf (")");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 case MATCH_OPERATOR:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 printf ("gen_rtx_fmt_");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 for (i = 0; i < XVECLEN (x, 2); i++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 printf ("e");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 printf (" (GET_CODE (operand%d)", XINT (x, 0));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 printf (", %smode", GET_MODE_NAME (GET_MODE (x)));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 for (i = 0; i < XVECLEN (x, 2); i++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 printf (",\n\t\t");
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
140 gen_exp (XVECEXP (x, 2, i), subroutine_type, used, info);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 printf (")");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 case MATCH_PARALLEL:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 case MATCH_PAR_DUP:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 printf ("operand%d", XINT (x, 0));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 case MATCH_SCRATCH:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 gen_rtx_scratch (x, subroutine_type);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 case PC:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 printf ("pc_rtx");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 return;
111
kono
parents: 67
diff changeset
157 case RETURN:
kono
parents: 67
diff changeset
158 printf ("ret_rtx");
kono
parents: 67
diff changeset
159 return;
kono
parents: 67
diff changeset
160 case SIMPLE_RETURN:
kono
parents: 67
diff changeset
161 printf ("simple_return_rtx");
kono
parents: 67
diff changeset
162 return;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 case CLOBBER:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 if (REG_P (XEXP (x, 0)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
166 printf ("gen_hard_reg_clobber (%smode, %i)",
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
167 GET_MODE_NAME (GET_MODE (XEXP (x, 0))),
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
168 REGNO (XEXP (x, 0)));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 case CC0:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 printf ("cc0_rtx");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 case CONST_INT:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 if (INTVAL (x) == 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 printf ("const0_rtx");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 else if (INTVAL (x) == 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 printf ("const1_rtx");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 else if (INTVAL (x) == -1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 printf ("constm1_rtx");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 else if (-MAX_SAVED_CONST_INT <= INTVAL (x)
111
kono
parents: 67
diff changeset
184 && INTVAL (x) <= MAX_SAVED_CONST_INT)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 printf ("const_int_rtx[MAX_SAVED_CONST_INT + (%d)]",
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 (int) INTVAL (x));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 else if (INTVAL (x) == STORE_FLAG_VALUE)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 printf ("const_true_rtx");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191 printf ("GEN_INT (");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 printf (HOST_WIDE_INT_PRINT_DEC_C, INTVAL (x));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 printf (")");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 case CONST_DOUBLE:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 case CONST_FIXED:
111
kono
parents: 67
diff changeset
199 case CONST_WIDE_INT:
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 /* These shouldn't be written in MD files. Instead, the appropriate
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 routines in varasm.c should be called. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 gcc_unreachable ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
203
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 default:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 printf ("gen_rtx_");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 print_code (code);
111
kono
parents: 67
diff changeset
210 printf (" (");
kono
parents: 67
diff changeset
211 if (!always_void_p (code))
kono
parents: 67
diff changeset
212 {
kono
parents: 67
diff changeset
213 printf ("%smode", GET_MODE_NAME (GET_MODE (x)));
kono
parents: 67
diff changeset
214 sep = ",\n\t";
kono
parents: 67
diff changeset
215 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
216
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 fmt = GET_RTX_FORMAT (code);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 len = GET_RTX_LENGTH (code);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 for (i = 0; i < len; i++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 if (fmt[i] == '0')
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 break;
111
kono
parents: 67
diff changeset
223 fputs (sep, stdout);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 switch (fmt[i])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
225 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 case 'e': case 'u':
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
227 gen_exp (XEXP (x, i), subroutine_type, used, info);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230 case 'i':
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 printf ("%u", XINT (x, i));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233
111
kono
parents: 67
diff changeset
234 case 'r':
kono
parents: 67
diff changeset
235 printf ("%u", REGNO (x));
kono
parents: 67
diff changeset
236 break;
kono
parents: 67
diff changeset
237
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
238 case 'p':
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
239 /* We don't have a way of parsing polynomial offsets yet,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
240 and hopefully never will. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
241 printf ("%d", SUBREG_BYTE (x).to_constant ());
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
242 break;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
243
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
244 case 's':
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 printf ("\"%s\"", XSTR (x, i));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
247
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 case 'E':
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 int j;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 printf ("gen_rtvec (%d", XVECLEN (x, i));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 for (j = 0; j < XVECLEN (x, i); j++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
254 printf (",\n\t\t");
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
255 gen_exp (XVECEXP (x, i, j), subroutine_type, used, info);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 printf (")");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
258 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
259 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
260
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
261 default:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 gcc_unreachable ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 }
111
kono
parents: 67
diff changeset
264 sep = ",\n\t";
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 printf (")");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
267 }
111
kono
parents: 67
diff changeset
268
kono
parents: 67
diff changeset
269 /* Output code to emit the instruction patterns in VEC, with each element
kono
parents: 67
diff changeset
270 becoming a separate instruction. USED is as for gen_exp. */
kono
parents: 67
diff changeset
271
kono
parents: 67
diff changeset
272 static void
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
273 gen_emit_seq (rtvec vec, char *used, md_rtx_info *info)
111
kono
parents: 67
diff changeset
274 {
kono
parents: 67
diff changeset
275 for (int i = 0, len = GET_NUM_ELEM (vec); i < len; ++i)
kono
parents: 67
diff changeset
276 {
kono
parents: 67
diff changeset
277 bool last_p = (i == len - 1);
kono
parents: 67
diff changeset
278 rtx next = RTVEC_ELT (vec, i);
kono
parents: 67
diff changeset
279 if (const char *name = get_emit_function (next))
kono
parents: 67
diff changeset
280 {
kono
parents: 67
diff changeset
281 printf (" %s (", name);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
282 gen_exp (next, DEFINE_EXPAND, used, info);
111
kono
parents: 67
diff changeset
283 printf (");\n");
kono
parents: 67
diff changeset
284 if (!last_p && needs_barrier_p (next))
kono
parents: 67
diff changeset
285 printf (" emit_barrier ();");
kono
parents: 67
diff changeset
286 }
kono
parents: 67
diff changeset
287 else
kono
parents: 67
diff changeset
288 {
kono
parents: 67
diff changeset
289 printf (" emit (");
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
290 gen_exp (next, DEFINE_EXPAND, used, info);
111
kono
parents: 67
diff changeset
291 printf (", %s);\n", last_p ? "false" : "true");
kono
parents: 67
diff changeset
292 }
kono
parents: 67
diff changeset
293 }
kono
parents: 67
diff changeset
294 }
kono
parents: 67
diff changeset
295
kono
parents: 67
diff changeset
296 /* Emit the given C code to the output file. The code is allowed to
kono
parents: 67
diff changeset
297 fail if CAN_FAIL_P. NAME describes what we're generating,
kono
parents: 67
diff changeset
298 for use in error messages. */
kono
parents: 67
diff changeset
299
kono
parents: 67
diff changeset
300 static void
kono
parents: 67
diff changeset
301 emit_c_code (const char *code, bool can_fail_p, const char *name)
kono
parents: 67
diff changeset
302 {
kono
parents: 67
diff changeset
303 if (can_fail_p)
kono
parents: 67
diff changeset
304 printf ("#define FAIL return (end_sequence (), _val)\n");
kono
parents: 67
diff changeset
305 else
kono
parents: 67
diff changeset
306 printf ("#define FAIL _Pragma (\"GCC error \\\"%s cannot FAIL\\\"\")"
kono
parents: 67
diff changeset
307 " (void)0\n", name);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
308 printf ("#define DONE return (_val = get_insns (), "
111
kono
parents: 67
diff changeset
309 "end_sequence (), _val)\n");
kono
parents: 67
diff changeset
310
kono
parents: 67
diff changeset
311 rtx_reader_ptr->print_md_ptr_loc (code);
kono
parents: 67
diff changeset
312 printf ("%s\n", code);
kono
parents: 67
diff changeset
313
kono
parents: 67
diff changeset
314 printf ("#undef DONE\n");
kono
parents: 67
diff changeset
315 printf ("#undef FAIL\n");
kono
parents: 67
diff changeset
316 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
317
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
318 /* Generate the `gen_...' function for a DEFINE_INSN. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
319
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 static void
111
kono
parents: 67
diff changeset
321 gen_insn (md_rtx_info *info)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
322 {
111
kono
parents: 67
diff changeset
323 struct pattern_stats stats;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
324 int i;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
325
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
326 /* See if the pattern for this insn ends with a group of CLOBBERs of (hard)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
327 registers or MATCH_SCRATCHes. If so, store away the information for
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
328 later. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
329
111
kono
parents: 67
diff changeset
330 rtx insn = info->def;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
331 if (XVEC (insn, 1))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
332 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
333 int has_hard_reg = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
334
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
335 for (i = XVECLEN (insn, 1) - 1; i > 0; i--)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
336 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
337 if (GET_CODE (XVECEXP (insn, 1, i)) != CLOBBER)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
338 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
339
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
340 if (REG_P (XEXP (XVECEXP (insn, 1, i), 0)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
341 has_hard_reg = 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
342 else if (GET_CODE (XEXP (XVECEXP (insn, 1, i), 0)) != MATCH_SCRATCH)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
343 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
344 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
345
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
346 if (i != XVECLEN (insn, 1) - 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
347 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 struct clobber_pat *p;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
349 struct clobber_ent *link = XNEW (struct clobber_ent);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 int j;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
351
111
kono
parents: 67
diff changeset
352 link->code_number = info->index;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
353
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
354 /* See if any previous CLOBBER_LIST entry is the same as this
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
355 one. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
356
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
357 for (p = clobber_list; p; p = p->next)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
358 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
359 if (p->first_clobber != i + 1
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
360 || XVECLEN (p->pattern, 1) != XVECLEN (insn, 1))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
361 continue;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
362
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
363 for (j = i + 1; j < XVECLEN (insn, 1); j++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
364 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
365 rtx old_rtx = XEXP (XVECEXP (p->pattern, 1, j), 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
366 rtx new_rtx = XEXP (XVECEXP (insn, 1, j), 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
367
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
368 /* OLD and NEW_INSN are the same if both are to be a SCRATCH
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
369 of the same mode,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
370 or if both are registers of the same mode and number. */
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
371 if (! (GET_CODE (old_rtx) == GET_CODE (new_rtx)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
372 && GET_MODE (old_rtx) == GET_MODE (new_rtx)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
373 && ((GET_CODE (old_rtx) == MATCH_SCRATCH
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
374 && GET_CODE (new_rtx) == MATCH_SCRATCH)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
375 || (REG_P (old_rtx) && REG_P (new_rtx)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
376 && REGNO (old_rtx) == REGNO (new_rtx)))))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
377 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
378 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
379
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
380 if (j == XVECLEN (insn, 1))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
381 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
382 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
383
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
384 if (p == 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
385 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
386 p = XNEW (struct clobber_pat);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
387
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
388 p->insns = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
389 p->pattern = insn;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
390 p->first_clobber = i + 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
391 p->next = clobber_list;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
392 p->has_hard_reg = has_hard_reg;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
393 clobber_list = p;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
394 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
395
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
396 link->next = p->insns;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
397 p->insns = link;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
399 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
400
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
401 /* Don't mention instructions whose names are the null string
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
402 or begin with '*'. They are in the machine description just
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
403 to be recognized. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
404 if (XSTR (insn, 0)[0] == 0 || XSTR (insn, 0)[0] == '*')
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
406
111
kono
parents: 67
diff changeset
407 printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
408
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
409 /* Find out how many operands this function has. */
111
kono
parents: 67
diff changeset
410 get_pattern_stats (&stats, XVEC (insn, 1));
kono
parents: 67
diff changeset
411 if (stats.max_dup_opno > stats.max_opno)
kono
parents: 67
diff changeset
412 fatal_at (info->loc, "match_dup operand number has no match_operand");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
413
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
414 /* Output the function name and argument declarations. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
415 printf ("rtx\ngen_%s (", XSTR (insn, 0));
111
kono
parents: 67
diff changeset
416 if (stats.num_generator_args)
kono
parents: 67
diff changeset
417 for (i = 0; i < stats.num_generator_args; i++)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
418 if (i)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
419 printf (",\n\trtx operand%d ATTRIBUTE_UNUSED", i);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
420 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
421 printf ("rtx operand%d ATTRIBUTE_UNUSED", i);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
422 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
423 printf ("void");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
424 printf (")\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
425 printf ("{\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
426
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
427 /* Output code to construct and return the rtl for the instruction body. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
428
111
kono
parents: 67
diff changeset
429 rtx pattern = add_implicit_parallel (XVEC (insn, 1));
kono
parents: 67
diff changeset
430 /* ??? This is the traditional behavior, but seems suspect. */
kono
parents: 67
diff changeset
431 char *used = (XVECLEN (insn, 1) == 1
kono
parents: 67
diff changeset
432 ? NULL
kono
parents: 67
diff changeset
433 : XCNEWVEC (char, stats.num_generator_args));
kono
parents: 67
diff changeset
434 printf (" return ");
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
435 gen_exp (pattern, DEFINE_INSN, used, info);
111
kono
parents: 67
diff changeset
436 printf (";\n}\n\n");
kono
parents: 67
diff changeset
437 XDELETEVEC (used);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
438 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
439
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
440 /* Generate the `gen_...' function for a DEFINE_EXPAND. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
441
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
442 static void
111
kono
parents: 67
diff changeset
443 gen_expand (md_rtx_info *info)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
444 {
111
kono
parents: 67
diff changeset
445 struct pattern_stats stats;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
446 int i;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
447 char *used;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
448
111
kono
parents: 67
diff changeset
449 rtx expand = info->def;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
450 if (strlen (XSTR (expand, 0)) == 0)
111
kono
parents: 67
diff changeset
451 fatal_at (info->loc, "define_expand lacks a name");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
452 if (XVEC (expand, 1) == 0)
111
kono
parents: 67
diff changeset
453 fatal_at (info->loc, "define_expand for %s lacks a pattern",
kono
parents: 67
diff changeset
454 XSTR (expand, 0));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
455
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
456 /* Find out how many operands this function has. */
111
kono
parents: 67
diff changeset
457 get_pattern_stats (&stats, XVEC (expand, 1));
kono
parents: 67
diff changeset
458 if (stats.min_scratch_opno != -1
kono
parents: 67
diff changeset
459 && stats.min_scratch_opno <= MAX (stats.max_opno, stats.max_dup_opno))
kono
parents: 67
diff changeset
460 fatal_at (info->loc, "define_expand for %s needs to have match_scratch "
kono
parents: 67
diff changeset
461 "numbers above all other operands", XSTR (expand, 0));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
462
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
463 /* Output the function name and argument declarations. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
464 printf ("rtx\ngen_%s (", XSTR (expand, 0));
111
kono
parents: 67
diff changeset
465 if (stats.num_generator_args)
kono
parents: 67
diff changeset
466 for (i = 0; i < stats.num_generator_args; i++)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
467 if (i)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
468 printf (",\n\trtx operand%d", i);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
469 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
470 printf ("rtx operand%d", i);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
471 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
472 printf ("void");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
473 printf (")\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 printf ("{\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
475
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
476 /* If we don't have any C code to write, only one insn is being written,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
477 and no MATCH_DUPs are present, we can just return the desired insn
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
478 like we do for a DEFINE_INSN. This saves memory. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
479 if ((XSTR (expand, 3) == 0 || *XSTR (expand, 3) == '\0')
111
kono
parents: 67
diff changeset
480 && stats.max_opno >= stats.max_dup_opno
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
481 && XVECLEN (expand, 1) == 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
482 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
483 printf (" return ");
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
484 gen_exp (XVECEXP (expand, 1, 0), DEFINE_EXPAND, NULL, info);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
485 printf (";\n}\n\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
486 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
487 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
488
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
489 /* For each operand referred to only with MATCH_DUPs,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
490 make a local variable. */
111
kono
parents: 67
diff changeset
491 for (i = stats.num_generator_args; i <= stats.max_dup_opno; i++)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
492 printf (" rtx operand%d;\n", i);
111
kono
parents: 67
diff changeset
493 printf (" rtx_insn *_val = 0;\n");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
494 printf (" start_sequence ();\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
495
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
496 /* The fourth operand of DEFINE_EXPAND is some code to be executed
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
497 before the actual construction.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
498 This code expects to refer to `operands'
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
499 just as the output-code in a DEFINE_INSN does,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
500 but here `operands' is an automatic array.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
501 So copy the operand values there before executing it. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
502 if (XSTR (expand, 3) && *XSTR (expand, 3))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
503 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
504 printf (" {\n");
111
kono
parents: 67
diff changeset
505 if (stats.num_operand_vars > 0)
kono
parents: 67
diff changeset
506 printf (" rtx operands[%d];\n", stats.num_operand_vars);
kono
parents: 67
diff changeset
507
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
508 /* Output code to copy the arguments into `operands'. */
111
kono
parents: 67
diff changeset
509 for (i = 0; i < stats.num_generator_args; i++)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
510 printf (" operands[%d] = operand%d;\n", i, i);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
511
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
512 /* Output the special code to be executed before the sequence
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
513 is generated. */
111
kono
parents: 67
diff changeset
514 optab_pattern p;
kono
parents: 67
diff changeset
515 bool can_fail_p = true;
kono
parents: 67
diff changeset
516 if (find_optab (&p, XSTR (expand, 0)))
kono
parents: 67
diff changeset
517 {
kono
parents: 67
diff changeset
518 gcc_assert (p.op < NUM_OPTABS);
kono
parents: 67
diff changeset
519 if (nofail_optabs[p.op])
kono
parents: 67
diff changeset
520 can_fail_p = false;
kono
parents: 67
diff changeset
521 }
kono
parents: 67
diff changeset
522 emit_c_code (XSTR (expand, 3), can_fail_p, XSTR (expand, 0));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
523
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
524 /* Output code to copy the arguments back out of `operands'
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
525 (unless we aren't going to use them at all). */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
526 if (XVEC (expand, 1) != 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
527 {
111
kono
parents: 67
diff changeset
528 for (i = 0; i <= MAX (stats.max_opno, stats.max_dup_opno); i++)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
529 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
530 printf (" operand%d = operands[%d];\n", i, i);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
531 printf (" (void) operand%d;\n", i);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
532 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
533 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
534 printf (" }\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
535 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
536
111
kono
parents: 67
diff changeset
537 used = XCNEWVEC (char, stats.num_operand_vars);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
538 gen_emit_seq (XVEC (expand, 1), used, info);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
539 XDELETEVEC (used);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
540
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
541 /* Call `get_insns' to extract the list of all the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
542 insns emitted within this gen_... function. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
543
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
544 printf (" _val = get_insns ();\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
545 printf (" end_sequence ();\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
546 printf (" return _val;\n}\n\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
547 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
548
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
549 /* Like gen_expand, but generates insns resulting from splitting SPLIT. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
550
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
551 static void
111
kono
parents: 67
diff changeset
552 gen_split (md_rtx_info *info)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
553 {
111
kono
parents: 67
diff changeset
554 struct pattern_stats stats;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
555 int i;
111
kono
parents: 67
diff changeset
556 rtx split = info->def;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
557 const char *const name =
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
558 ((GET_CODE (split) == DEFINE_PEEPHOLE2) ? "peephole2" : "split");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
559 const char *unused;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
560 char *used;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
561
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
562 if (XVEC (split, 0) == 0)
111
kono
parents: 67
diff changeset
563 fatal_at (info->loc, "%s lacks a pattern",
kono
parents: 67
diff changeset
564 GET_RTX_NAME (GET_CODE (split)));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
565 else if (XVEC (split, 2) == 0)
111
kono
parents: 67
diff changeset
566 fatal_at (info->loc, "%s lacks a replacement pattern",
kono
parents: 67
diff changeset
567 GET_RTX_NAME (GET_CODE (split)));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
568
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
569 /* Find out how many operands this function has. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
570
111
kono
parents: 67
diff changeset
571 get_pattern_stats (&stats, XVEC (split, 2));
kono
parents: 67
diff changeset
572 unused = (stats.num_operand_vars == 0 ? " ATTRIBUTE_UNUSED" : "");
kono
parents: 67
diff changeset
573 used = XCNEWVEC (char, stats.num_operand_vars);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
574
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
575 /* Output the prototype, function name and argument declarations. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
576 if (GET_CODE (split) == DEFINE_PEEPHOLE2)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
577 {
111
kono
parents: 67
diff changeset
578 printf ("extern rtx_insn *gen_%s_%d (rtx_insn *, rtx *);\n",
kono
parents: 67
diff changeset
579 name, info->index);
kono
parents: 67
diff changeset
580 printf ("rtx_insn *\ngen_%s_%d (rtx_insn *curr_insn ATTRIBUTE_UNUSED,"
kono
parents: 67
diff changeset
581 " rtx *operands%s)\n",
kono
parents: 67
diff changeset
582 name, info->index, unused);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
583 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
584 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
585 {
111
kono
parents: 67
diff changeset
586 printf ("extern rtx_insn *gen_split_%d (rtx_insn *, rtx *);\n",
kono
parents: 67
diff changeset
587 info->index);
kono
parents: 67
diff changeset
588 printf ("rtx_insn *\ngen_split_%d "
kono
parents: 67
diff changeset
589 "(rtx_insn *curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n",
kono
parents: 67
diff changeset
590 info->index, unused);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
591 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
592 printf ("{\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
593
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
594 /* Declare all local variables. */
111
kono
parents: 67
diff changeset
595 for (i = 0; i < stats.num_operand_vars; i++)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
596 printf (" rtx operand%d;\n", i);
111
kono
parents: 67
diff changeset
597 printf (" rtx_insn *_val = NULL;\n");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
598
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
599 if (GET_CODE (split) == DEFINE_PEEPHOLE2)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
600 output_peephole2_scratches (split);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
601
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
602 const char *fn = info->loc.filename;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
603 for (const char *p = fn; *p; p++)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
604 if (*p == '/')
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
605 fn = p + 1;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
606
111
kono
parents: 67
diff changeset
607 printf (" if (dump_file)\n");
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
608 printf (" fprintf (dump_file, \"Splitting with gen_%s_%d (%s:%d)\\n\");\n",
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
609 name, info->index, fn, info->loc.lineno);
111
kono
parents: 67
diff changeset
610
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
611 printf (" start_sequence ();\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
612
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
613 /* The fourth operand of DEFINE_SPLIT is some code to be executed
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
614 before the actual construction. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
615
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
616 if (XSTR (split, 3))
111
kono
parents: 67
diff changeset
617 emit_c_code (XSTR (split, 3), true, name);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
618
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
619 /* Output code to copy the arguments back out of `operands' */
111
kono
parents: 67
diff changeset
620 for (i = 0; i < stats.num_operand_vars; i++)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
621 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
622 printf (" operand%d = operands[%d];\n", i, i);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
623 printf (" (void) operand%d;\n", i);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
624 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
625
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
626 gen_emit_seq (XVEC (split, 2), used, info);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
627
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
628 /* Call `get_insns' to make a list of all the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
629 insns emitted within this gen_... function. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
630
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
631 printf (" _val = get_insns ();\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
632 printf (" end_sequence ();\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
633 printf (" return _val;\n}\n\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
634
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
635 free (used);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
636 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
637
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
638 /* Write a function, `add_clobbers', that is given a PARALLEL of sufficient
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
639 size for the insn and an INSN_CODE, and inserts the required CLOBBERs at
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
640 the end of the vector. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
641
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
642 static void
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
643 output_add_clobbers (md_rtx_info *info)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
644 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
645 struct clobber_pat *clobber;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
646 struct clobber_ent *ent;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
647 int i;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
648
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
649 printf ("\n\nvoid\nadd_clobbers (rtx pattern ATTRIBUTE_UNUSED, int insn_code_number)\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
650 printf ("{\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
651 printf (" switch (insn_code_number)\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
652 printf (" {\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
653
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
654 for (clobber = clobber_list; clobber; clobber = clobber->next)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
655 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
656 for (ent = clobber->insns; ent; ent = ent->next)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
657 printf (" case %d:\n", ent->code_number);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
658
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
659 for (i = clobber->first_clobber; i < XVECLEN (clobber->pattern, 1); i++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
660 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
661 printf (" XVECEXP (pattern, 0, %d) = ", i);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
662 gen_exp (XVECEXP (clobber->pattern, 1, i),
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
663 GET_CODE (clobber->pattern), NULL, info);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
664 printf (";\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
665 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
666
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
667 printf (" break;\n\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
668 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
669
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
670 printf (" default:\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
671 printf (" gcc_unreachable ();\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
672 printf (" }\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
673 printf ("}\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
674 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
675
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
676 /* Write a function, `added_clobbers_hard_reg_p' that is given an insn_code
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
677 number that will have clobbers added (as indicated by `recog') and returns
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
678 1 if those include a clobber of a hard reg or 0 if all of them just clobber
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
679 SCRATCH. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
680
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
681 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
682 output_added_clobbers_hard_reg_p (void)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
683 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
684 struct clobber_pat *clobber;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
685 struct clobber_ent *ent;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
686 int clobber_p, used;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
687
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
688 printf ("\n\nint\nadded_clobbers_hard_reg_p (int insn_code_number)\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
689 printf ("{\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
690 printf (" switch (insn_code_number)\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
691 printf (" {\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
692
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
693 for (clobber_p = 0; clobber_p <= 1; clobber_p++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
694 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
695 used = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
696 for (clobber = clobber_list; clobber; clobber = clobber->next)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
697 if (clobber->has_hard_reg == clobber_p)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
698 for (ent = clobber->insns; ent; ent = ent->next)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
699 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
700 printf (" case %d:\n", ent->code_number);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
701 used++;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
702 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
703
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
704 if (used)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
705 printf (" return %d;\n\n", clobber_p);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
706 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
707
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
708 printf (" default:\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
709 printf (" gcc_unreachable ();\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
710 printf (" }\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
711 printf ("}\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
712 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
713
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
714 /* Generate code to invoke find_free_register () as needed for the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
715 scratch registers used by the peephole2 pattern in SPLIT. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
716
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
717 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
718 output_peephole2_scratches (rtx split)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
719 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
720 int i;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
721 int insn_nr = 0;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
722 bool first = true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
723
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
724 for (i = 0; i < XVECLEN (split, 0); i++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
725 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
726 rtx elt = XVECEXP (split, 0, i);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
727 if (GET_CODE (elt) == MATCH_SCRATCH)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
728 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
729 int last_insn_nr = insn_nr;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
730 int cur_insn_nr = insn_nr;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
731 int j;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
732 for (j = i + 1; j < XVECLEN (split, 0); j++)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
733 if (GET_CODE (XVECEXP (split, 0, j)) == MATCH_DUP)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
734 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
735 if (XINT (XVECEXP (split, 0, j), 0) == XINT (elt, 0))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
736 last_insn_nr = cur_insn_nr;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
737 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
738 else if (GET_CODE (XVECEXP (split, 0, j)) != MATCH_SCRATCH)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
739 cur_insn_nr++;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
740
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
741 if (first)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
742 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
743 printf (" HARD_REG_SET _regs_allocated;\n");
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
744 printf (" CLEAR_HARD_REG_SET (_regs_allocated);\n");
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
745 first = false;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
746 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
747
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
748 printf (" if ((operands[%d] = peep2_find_free_register (%d, %d, \"%s\", %smode, &_regs_allocated)) == NULL_RTX)\n\
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
749 return NULL;\n",
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
750 XINT (elt, 0),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
751 insn_nr, last_insn_nr,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
752 XSTR (elt, 1),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
753 GET_MODE_NAME (GET_MODE (elt)));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
754
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
755 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
756 else if (GET_CODE (elt) != MATCH_DUP)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
757 insn_nr++;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
758 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
759 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
760
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
761 /* Print "arg<N>" parameter declarations for each argument N of ONAME. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
762
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
763 static void
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
764 print_overload_arguments (overloaded_name *oname)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
765 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
766 for (unsigned int i = 0; i < oname->arg_types.length (); ++i)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
767 printf ("%s%s arg%d", i == 0 ? "" : ", ", oname->arg_types[i], i);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
768 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
769
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
770 /* Print code to test whether INSTANCE should be chosen, given that
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
771 argument N of the overload is available as "arg<N>". */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
772
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
773 static void
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
774 print_overload_test (overloaded_instance *instance)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
775 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
776 for (unsigned int i = 0; i < instance->arg_values.length (); ++i)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
777 printf ("%sarg%d == %s", i == 0 ? " if (" : "\n && ",
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
778 i, instance->arg_values[i]);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
779 printf (")\n");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
780 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
781
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
782 /* Emit a maybe_code_for_* function for ONAME. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
783
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
784 static void
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
785 handle_overloaded_code_for (overloaded_name *oname)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
786 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
787 /* Print the function prototype. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
788 printf ("\ninsn_code\nmaybe_code_for_%s (", oname->name);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
789 print_overload_arguments (oname);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
790 printf (")\n{\n");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
791
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
792 /* Use a sequence of "if" statements for each instance. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
793 for (overloaded_instance *instance = oname->first_instance;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
794 instance; instance = instance->next)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
795 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
796 print_overload_test (instance);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
797 printf (" return CODE_FOR_%s;\n", instance->name);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
798 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
799
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
800 /* Return null if no match was found. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
801 printf (" return CODE_FOR_nothing;\n}\n");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
802 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
803
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
804 /* Emit a maybe_gen_* function for ONAME. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
805
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
806 static void
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
807 handle_overloaded_gen (overloaded_name *oname)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
808 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
809 unsigned HOST_WIDE_INT seen = 0;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
810 /* All patterns must have the same number of operands. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
811 for (overloaded_instance *instance = oname->first_instance->next;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
812 instance; instance = instance->next)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
813 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
814 pattern_stats stats;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
815 get_pattern_stats (&stats, XVEC (instance->insn, 1));
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
816 unsigned HOST_WIDE_INT mask
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
817 = HOST_WIDE_INT_1U << stats.num_generator_args;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
818 if (seen & mask)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
819 continue;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
820
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
821 seen |= mask;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
822
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
823 /* Print the function prototype. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
824 printf ("\nrtx\nmaybe_gen_%s (", oname->name);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
825 print_overload_arguments (oname);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
826 for (int i = 0; i < stats.num_generator_args; ++i)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
827 printf (", rtx x%d", i);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
828 printf (")\n{\n");
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
829
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
830 /* Use maybe_code_for_*, instead of duplicating the selection
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
831 logic here. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
832 printf (" insn_code code = maybe_code_for_%s (", oname->name);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
833 for (unsigned int i = 0; i < oname->arg_types.length (); ++i)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
834 printf ("%sarg%d", i == 0 ? "" : ", ", i);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
835 printf (");\n"
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
836 " if (code != CODE_FOR_nothing)\n"
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
837 " {\n"
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
838 " gcc_assert (insn_data[code].n_generator_args == %d);\n"
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
839 " return GEN_FCN (code) (", stats.num_generator_args);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
840 for (int i = 0; i < stats.num_generator_args; ++i)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
841 printf ("%sx%d", i == 0 ? "" : ", ", i);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
842 printf (");\n"
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
843 " }\n"
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
844 " else\n"
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
845 " return NULL_RTX;\n"
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
846 "}\n");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
847 }
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
848 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
849
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
850 int
111
kono
parents: 67
diff changeset
851 main (int argc, const char **argv)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
852 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
853 progname = "genemit";
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
854
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
855 if (!init_rtx_reader_args (argc, argv))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
856 return (FATAL_EXIT_CODE);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
857
111
kono
parents: 67
diff changeset
858 #define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
kono
parents: 67
diff changeset
859 nofail_optabs[OPTAB##_optab] = true;
kono
parents: 67
diff changeset
860 #include "internal-fn.def"
kono
parents: 67
diff changeset
861
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
862 /* Assign sequential codes to all entries in the machine description
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
863 in parallel with the tables in insn-output.c. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
864
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
865 printf ("/* Generated automatically by the program `genemit'\n\
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
866 from the machine description file `md'. */\n\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
867
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
868 printf ("#define IN_TARGET_CODE 1\n");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
869 printf ("#include \"config.h\"\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
870 printf ("#include \"system.h\"\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
871 printf ("#include \"coretypes.h\"\n");
111
kono
parents: 67
diff changeset
872 printf ("#include \"backend.h\"\n");
kono
parents: 67
diff changeset
873 printf ("#include \"predict.h\"\n");
kono
parents: 67
diff changeset
874 printf ("#include \"tree.h\"\n");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
875 printf ("#include \"rtl.h\"\n");
111
kono
parents: 67
diff changeset
876 printf ("#include \"alias.h\"\n");
kono
parents: 67
diff changeset
877 printf ("#include \"varasm.h\"\n");
kono
parents: 67
diff changeset
878 printf ("#include \"stor-layout.h\"\n");
kono
parents: 67
diff changeset
879 printf ("#include \"calls.h\"\n");
kono
parents: 67
diff changeset
880 printf ("#include \"memmodel.h\"\n");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
881 printf ("#include \"tm_p.h\"\n");
111
kono
parents: 67
diff changeset
882 printf ("#include \"flags.h\"\n");
kono
parents: 67
diff changeset
883 printf ("#include \"insn-config.h\"\n");
kono
parents: 67
diff changeset
884 printf ("#include \"expmed.h\"\n");
kono
parents: 67
diff changeset
885 printf ("#include \"dojump.h\"\n");
kono
parents: 67
diff changeset
886 printf ("#include \"explow.h\"\n");
kono
parents: 67
diff changeset
887 printf ("#include \"emit-rtl.h\"\n");
kono
parents: 67
diff changeset
888 printf ("#include \"stmt.h\"\n");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
889 printf ("#include \"expr.h\"\n");
111
kono
parents: 67
diff changeset
890 printf ("#include \"insn-codes.h\"\n");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
891 printf ("#include \"optabs.h\"\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
892 printf ("#include \"dfp.h\"\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
893 printf ("#include \"output.h\"\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
894 printf ("#include \"recog.h\"\n");
111
kono
parents: 67
diff changeset
895 printf ("#include \"df.h\"\n");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
896 printf ("#include \"resource.h\"\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
897 printf ("#include \"reload.h\"\n");
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
898 printf ("#include \"diagnostic-core.h\"\n");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
899 printf ("#include \"regs.h\"\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
900 printf ("#include \"tm-constrs.h\"\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
901 printf ("#include \"ggc.h\"\n");
111
kono
parents: 67
diff changeset
902 printf ("#include \"target.h\"\n\n");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
903
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
904 /* Read the machine description. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
905
111
kono
parents: 67
diff changeset
906 md_rtx_info info;
kono
parents: 67
diff changeset
907 while (read_md_rtx (&info))
kono
parents: 67
diff changeset
908 switch (GET_CODE (info.def))
kono
parents: 67
diff changeset
909 {
kono
parents: 67
diff changeset
910 case DEFINE_INSN:
kono
parents: 67
diff changeset
911 gen_insn (&info);
kono
parents: 67
diff changeset
912 break;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
913
111
kono
parents: 67
diff changeset
914 case DEFINE_EXPAND:
kono
parents: 67
diff changeset
915 printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
kono
parents: 67
diff changeset
916 gen_expand (&info);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
917 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
918
111
kono
parents: 67
diff changeset
919 case DEFINE_SPLIT:
kono
parents: 67
diff changeset
920 printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
kono
parents: 67
diff changeset
921 gen_split (&info);
kono
parents: 67
diff changeset
922 break;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
923
111
kono
parents: 67
diff changeset
924 case DEFINE_PEEPHOLE2:
kono
parents: 67
diff changeset
925 printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno);
kono
parents: 67
diff changeset
926 gen_split (&info);
kono
parents: 67
diff changeset
927 break;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
928
111
kono
parents: 67
diff changeset
929 default:
kono
parents: 67
diff changeset
930 break;
kono
parents: 67
diff changeset
931 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
932
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
933 /* Write out the routines to add CLOBBERs to a pattern and say whether they
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
934 clobber a hard reg. */
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
935 output_add_clobbers (&info);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
936 output_added_clobbers_hard_reg_p ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
937
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
938 for (overloaded_name *oname = rtx_reader_ptr->get_overloads ();
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
939 oname; oname = oname->next)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
940 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
941 handle_overloaded_code_for (oname);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
942 handle_overloaded_gen (oname);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
943 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
944
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
945 fflush (stdout);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
946 return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
947 }