annotate gcc/lra-coalesce.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Coalesce spilled pseudos.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 Copyright (C) 2010-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3 Contributed by Vladimir Makarov <vmakarov@redhat.com>.
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 This file is part of GCC.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
8 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
9 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
10 version.
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
15 for more details.
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
18 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 /* This file contains a pass making some simple RTL code
kono
parents:
diff changeset
23 transformations by coalescing pseudos to remove some move insns.
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 Spilling pseudos in LRA can create memory-memory moves. We should
kono
parents:
diff changeset
26 remove potential memory-memory moves before the next constraint
kono
parents:
diff changeset
27 pass because the constraint pass will generate additional insns for
kono
parents:
diff changeset
28 such moves and all these insns will be hard to remove afterwards.
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 Here we coalesce only spilled pseudos. Coalescing non-spilled
kono
parents:
diff changeset
31 pseudos (with different hard regs) might result in spilling
kono
parents:
diff changeset
32 additional pseudos because of possible conflicts with other
kono
parents:
diff changeset
33 non-spilled pseudos and, as a consequence, in more constraint
kono
parents:
diff changeset
34 passes and even LRA infinite cycling. Trivial the same hard
kono
parents:
diff changeset
35 register moves will be removed by subsequent compiler passes.
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 We don't coalesce special reload pseudos. It complicates LRA code
kono
parents:
diff changeset
38 a lot without visible generated code improvement.
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 The pseudo live-ranges are used to find conflicting pseudos during
kono
parents:
diff changeset
41 coalescing.
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 Most frequently executed moves is tried to be coalesced first. */
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 #include "config.h"
kono
parents:
diff changeset
46 #include "system.h"
kono
parents:
diff changeset
47 #include "coretypes.h"
kono
parents:
diff changeset
48 #include "backend.h"
kono
parents:
diff changeset
49 #include "rtl.h"
kono
parents:
diff changeset
50 #include "predict.h"
kono
parents:
diff changeset
51 #include "df.h"
kono
parents:
diff changeset
52 #include "insn-config.h"
kono
parents:
diff changeset
53 #include "regs.h"
kono
parents:
diff changeset
54 #include "memmodel.h"
kono
parents:
diff changeset
55 #include "ira.h"
kono
parents:
diff changeset
56 #include "recog.h"
kono
parents:
diff changeset
57 #include "lra-int.h"
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 /* Arrays whose elements represent the first and the next pseudo
kono
parents:
diff changeset
60 (regno) in the coalesced pseudos group to which given pseudo (its
kono
parents:
diff changeset
61 regno is the index) belongs. The next of the last pseudo in the
kono
parents:
diff changeset
62 group refers to the first pseudo in the group, in other words the
kono
parents:
diff changeset
63 group is represented by a cyclic list. */
kono
parents:
diff changeset
64 static int *first_coalesced_pseudo, *next_coalesced_pseudo;
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 /* The function is used to sort moves according to their execution
kono
parents:
diff changeset
67 frequencies. */
kono
parents:
diff changeset
68 static int
kono
parents:
diff changeset
69 move_freq_compare_func (const void *v1p, const void *v2p)
kono
parents:
diff changeset
70 {
kono
parents:
diff changeset
71 rtx_insn *mv1 = *(rtx_insn * const *) v1p;
kono
parents:
diff changeset
72 rtx_insn *mv2 = *(rtx_insn * const *) v2p;
kono
parents:
diff changeset
73 int pri1, pri2;
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 pri1 = REG_FREQ_FROM_BB (BLOCK_FOR_INSN (mv1));
kono
parents:
diff changeset
76 pri2 = REG_FREQ_FROM_BB (BLOCK_FOR_INSN (mv2));
kono
parents:
diff changeset
77 if (pri2 - pri1)
kono
parents:
diff changeset
78 return pri2 - pri1;
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 /* If frequencies are equal, sort by moves, so that the results of
kono
parents:
diff changeset
81 qsort leave nothing to chance. */
kono
parents:
diff changeset
82 return (int) INSN_UID (mv1) - (int) INSN_UID (mv2);
kono
parents:
diff changeset
83 }
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 /* Pseudos which go away after coalescing. */
kono
parents:
diff changeset
86 static bitmap_head coalesced_pseudos_bitmap;
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 /* Merge two sets of coalesced pseudos given correspondingly by
kono
parents:
diff changeset
89 pseudos REGNO1 and REGNO2 (more accurately merging REGNO2 group
kono
parents:
diff changeset
90 into REGNO1 group). Set up COALESCED_PSEUDOS_BITMAP. */
kono
parents:
diff changeset
91 static void
kono
parents:
diff changeset
92 merge_pseudos (int regno1, int regno2)
kono
parents:
diff changeset
93 {
kono
parents:
diff changeset
94 int regno, first, first2, last, next;
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 first = first_coalesced_pseudo[regno1];
kono
parents:
diff changeset
97 if ((first2 = first_coalesced_pseudo[regno2]) == first)
kono
parents:
diff changeset
98 return;
kono
parents:
diff changeset
99 for (last = regno2, regno = next_coalesced_pseudo[regno2];;
kono
parents:
diff changeset
100 regno = next_coalesced_pseudo[regno])
kono
parents:
diff changeset
101 {
kono
parents:
diff changeset
102 first_coalesced_pseudo[regno] = first;
kono
parents:
diff changeset
103 bitmap_set_bit (&coalesced_pseudos_bitmap, regno);
kono
parents:
diff changeset
104 if (regno == regno2)
kono
parents:
diff changeset
105 break;
kono
parents:
diff changeset
106 last = regno;
kono
parents:
diff changeset
107 }
kono
parents:
diff changeset
108 next = next_coalesced_pseudo[first];
kono
parents:
diff changeset
109 next_coalesced_pseudo[first] = regno2;
kono
parents:
diff changeset
110 next_coalesced_pseudo[last] = next;
kono
parents:
diff changeset
111 lra_reg_info[first].live_ranges
kono
parents:
diff changeset
112 = (lra_merge_live_ranges
kono
parents:
diff changeset
113 (lra_reg_info[first].live_ranges,
kono
parents:
diff changeset
114 lra_copy_live_range_list (lra_reg_info[first2].live_ranges)));
kono
parents:
diff changeset
115 if (partial_subreg_p (lra_reg_info[first].biggest_mode,
kono
parents:
diff changeset
116 lra_reg_info[first2].biggest_mode))
kono
parents:
diff changeset
117 lra_reg_info[first].biggest_mode = lra_reg_info[first2].biggest_mode;
kono
parents:
diff changeset
118 }
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 /* Change pseudos in *LOC on their coalescing group
kono
parents:
diff changeset
121 representatives. */
kono
parents:
diff changeset
122 static bool
kono
parents:
diff changeset
123 substitute (rtx *loc)
kono
parents:
diff changeset
124 {
kono
parents:
diff changeset
125 int i, regno;
kono
parents:
diff changeset
126 const char *fmt;
kono
parents:
diff changeset
127 enum rtx_code code;
kono
parents:
diff changeset
128 bool res;
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130 if (*loc == NULL_RTX)
kono
parents:
diff changeset
131 return false;
kono
parents:
diff changeset
132 code = GET_CODE (*loc);
kono
parents:
diff changeset
133 if (code == REG)
kono
parents:
diff changeset
134 {
kono
parents:
diff changeset
135 regno = REGNO (*loc);
kono
parents:
diff changeset
136 if (regno < FIRST_PSEUDO_REGISTER
kono
parents:
diff changeset
137 || first_coalesced_pseudo[regno] == regno)
kono
parents:
diff changeset
138 return false;
kono
parents:
diff changeset
139 *loc = regno_reg_rtx[first_coalesced_pseudo[regno]];
kono
parents:
diff changeset
140 return true;
kono
parents:
diff changeset
141 }
kono
parents:
diff changeset
142
kono
parents:
diff changeset
143 res = false;
kono
parents:
diff changeset
144 fmt = GET_RTX_FORMAT (code);
kono
parents:
diff changeset
145 for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
kono
parents:
diff changeset
146 {
kono
parents:
diff changeset
147 if (fmt[i] == 'e')
kono
parents:
diff changeset
148 {
kono
parents:
diff changeset
149 if (substitute (&XEXP (*loc, i)))
kono
parents:
diff changeset
150 res = true;
kono
parents:
diff changeset
151 }
kono
parents:
diff changeset
152 else if (fmt[i] == 'E')
kono
parents:
diff changeset
153 {
kono
parents:
diff changeset
154 int j;
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 for (j = XVECLEN (*loc, i) - 1; j >= 0; j--)
kono
parents:
diff changeset
157 if (substitute (&XVECEXP (*loc, i, j)))
kono
parents:
diff changeset
158 res = true;
kono
parents:
diff changeset
159 }
kono
parents:
diff changeset
160 }
kono
parents:
diff changeset
161 return res;
kono
parents:
diff changeset
162 }
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 /* Specialize "substitute" for use on an insn. This can't change
kono
parents:
diff changeset
165 the insn ptr, just the contents of the insn. */
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 static bool
kono
parents:
diff changeset
168 substitute_within_insn (rtx_insn *insn)
kono
parents:
diff changeset
169 {
kono
parents:
diff changeset
170 rtx loc = insn;
kono
parents:
diff changeset
171 return substitute (&loc);
kono
parents:
diff changeset
172 }
kono
parents:
diff changeset
173
kono
parents:
diff changeset
174 /* The current iteration (1, 2, ...) of the coalescing pass. */
kono
parents:
diff changeset
175 int lra_coalesce_iter;
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 /* Return true if the move involving REGNO1 and REGNO2 is a potential
kono
parents:
diff changeset
178 memory-memory move. */
kono
parents:
diff changeset
179 static bool
kono
parents:
diff changeset
180 mem_move_p (int regno1, int regno2)
kono
parents:
diff changeset
181 {
kono
parents:
diff changeset
182 return reg_renumber[regno1] < 0 && reg_renumber[regno2] < 0;
kono
parents:
diff changeset
183 }
kono
parents:
diff changeset
184
kono
parents:
diff changeset
185 /* Pseudos used instead of the coalesced pseudos. */
kono
parents:
diff changeset
186 static bitmap_head used_pseudos_bitmap;
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 /* Set up USED_PSEUDOS_BITMAP, and update LR_BITMAP (a BB live info
kono
parents:
diff changeset
189 bitmap). */
kono
parents:
diff changeset
190 static void
kono
parents:
diff changeset
191 update_live_info (bitmap lr_bitmap)
kono
parents:
diff changeset
192 {
kono
parents:
diff changeset
193 unsigned int j;
kono
parents:
diff changeset
194 bitmap_iterator bi;
kono
parents:
diff changeset
195
kono
parents:
diff changeset
196 bitmap_clear (&used_pseudos_bitmap);
kono
parents:
diff changeset
197 EXECUTE_IF_AND_IN_BITMAP (&coalesced_pseudos_bitmap, lr_bitmap,
kono
parents:
diff changeset
198 FIRST_PSEUDO_REGISTER, j, bi)
kono
parents:
diff changeset
199 bitmap_set_bit (&used_pseudos_bitmap, first_coalesced_pseudo[j]);
kono
parents:
diff changeset
200 if (! bitmap_empty_p (&used_pseudos_bitmap))
kono
parents:
diff changeset
201 {
kono
parents:
diff changeset
202 bitmap_and_compl_into (lr_bitmap, &coalesced_pseudos_bitmap);
kono
parents:
diff changeset
203 bitmap_ior_into (lr_bitmap, &used_pseudos_bitmap);
kono
parents:
diff changeset
204 }
kono
parents:
diff changeset
205 }
kono
parents:
diff changeset
206
kono
parents:
diff changeset
207 /* Return true if pseudo REGNO can be potentially coalesced. */
kono
parents:
diff changeset
208 static bool
kono
parents:
diff changeset
209 coalescable_pseudo_p (int regno)
kono
parents:
diff changeset
210 {
kono
parents:
diff changeset
211 lra_assert (regno >= FIRST_PSEUDO_REGISTER);
kono
parents:
diff changeset
212 return (/* We don't want to coalesce regnos with equivalences, at
kono
parents:
diff changeset
213 least without updating this info. */
kono
parents:
diff changeset
214 ira_reg_equiv[regno].constant == NULL_RTX
kono
parents:
diff changeset
215 && ira_reg_equiv[regno].memory == NULL_RTX
kono
parents:
diff changeset
216 && ira_reg_equiv[regno].invariant == NULL_RTX);
kono
parents:
diff changeset
217 }
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 /* The major function for aggressive pseudo coalescing of moves only
kono
parents:
diff changeset
220 if the both pseudos were spilled and not special reload pseudos. */
kono
parents:
diff changeset
221 bool
kono
parents:
diff changeset
222 lra_coalesce (void)
kono
parents:
diff changeset
223 {
kono
parents:
diff changeset
224 basic_block bb;
kono
parents:
diff changeset
225 rtx_insn *mv, *insn, *next, **sorted_moves;
kono
parents:
diff changeset
226 rtx set;
kono
parents:
diff changeset
227 int i, mv_num, sregno, dregno;
kono
parents:
diff changeset
228 int coalesced_moves;
kono
parents:
diff changeset
229 int max_regno = max_reg_num ();
kono
parents:
diff changeset
230 bitmap_head involved_insns_bitmap;
kono
parents:
diff changeset
231
kono
parents:
diff changeset
232 timevar_push (TV_LRA_COALESCE);
kono
parents:
diff changeset
233
kono
parents:
diff changeset
234 if (lra_dump_file != NULL)
kono
parents:
diff changeset
235 fprintf (lra_dump_file,
kono
parents:
diff changeset
236 "\n********** Pseudos coalescing #%d: **********\n\n",
kono
parents:
diff changeset
237 ++lra_coalesce_iter);
kono
parents:
diff changeset
238 first_coalesced_pseudo = XNEWVEC (int, max_regno);
kono
parents:
diff changeset
239 next_coalesced_pseudo = XNEWVEC (int, max_regno);
kono
parents:
diff changeset
240 for (i = 0; i < max_regno; i++)
kono
parents:
diff changeset
241 first_coalesced_pseudo[i] = next_coalesced_pseudo[i] = i;
kono
parents:
diff changeset
242 sorted_moves = XNEWVEC (rtx_insn *, get_max_uid ());
kono
parents:
diff changeset
243 mv_num = 0;
kono
parents:
diff changeset
244 /* Collect moves. */
kono
parents:
diff changeset
245 coalesced_moves = 0;
kono
parents:
diff changeset
246 FOR_EACH_BB_FN (bb, cfun)
kono
parents:
diff changeset
247 {
kono
parents:
diff changeset
248 FOR_BB_INSNS_SAFE (bb, insn, next)
kono
parents:
diff changeset
249 if (INSN_P (insn)
kono
parents:
diff changeset
250 && (set = single_set (insn)) != NULL_RTX
kono
parents:
diff changeset
251 && REG_P (SET_DEST (set)) && REG_P (SET_SRC (set))
kono
parents:
diff changeset
252 && (sregno = REGNO (SET_SRC (set))) >= FIRST_PSEUDO_REGISTER
kono
parents:
diff changeset
253 && (dregno = REGNO (SET_DEST (set))) >= FIRST_PSEUDO_REGISTER
kono
parents:
diff changeset
254 && mem_move_p (sregno, dregno)
kono
parents:
diff changeset
255 && coalescable_pseudo_p (sregno) && coalescable_pseudo_p (dregno)
kono
parents:
diff changeset
256 && ! side_effects_p (set)
kono
parents:
diff changeset
257 && !(lra_intersected_live_ranges_p
kono
parents:
diff changeset
258 (lra_reg_info[sregno].live_ranges,
kono
parents:
diff changeset
259 lra_reg_info[dregno].live_ranges)))
kono
parents:
diff changeset
260 sorted_moves[mv_num++] = insn;
kono
parents:
diff changeset
261 }
kono
parents:
diff changeset
262 qsort (sorted_moves, mv_num, sizeof (rtx), move_freq_compare_func);
kono
parents:
diff changeset
263 /* Coalesced copies, most frequently executed first. */
kono
parents:
diff changeset
264 bitmap_initialize (&coalesced_pseudos_bitmap, &reg_obstack);
kono
parents:
diff changeset
265 bitmap_initialize (&involved_insns_bitmap, &reg_obstack);
kono
parents:
diff changeset
266 for (i = 0; i < mv_num; i++)
kono
parents:
diff changeset
267 {
kono
parents:
diff changeset
268 mv = sorted_moves[i];
kono
parents:
diff changeset
269 set = single_set (mv);
kono
parents:
diff changeset
270 lra_assert (set != NULL && REG_P (SET_SRC (set))
kono
parents:
diff changeset
271 && REG_P (SET_DEST (set)));
kono
parents:
diff changeset
272 sregno = REGNO (SET_SRC (set));
kono
parents:
diff changeset
273 dregno = REGNO (SET_DEST (set));
kono
parents:
diff changeset
274 if (first_coalesced_pseudo[sregno] == first_coalesced_pseudo[dregno])
kono
parents:
diff changeset
275 {
kono
parents:
diff changeset
276 coalesced_moves++;
kono
parents:
diff changeset
277 if (lra_dump_file != NULL)
kono
parents:
diff changeset
278 fprintf
kono
parents:
diff changeset
279 (lra_dump_file, " Coalescing move %i:r%d-r%d (freq=%d)\n",
kono
parents:
diff changeset
280 INSN_UID (mv), sregno, dregno,
kono
parents:
diff changeset
281 REG_FREQ_FROM_BB (BLOCK_FOR_INSN (mv)));
kono
parents:
diff changeset
282 /* We updated involved_insns_bitmap when doing the merge. */
kono
parents:
diff changeset
283 }
kono
parents:
diff changeset
284 else if (!(lra_intersected_live_ranges_p
kono
parents:
diff changeset
285 (lra_reg_info[first_coalesced_pseudo[sregno]].live_ranges,
kono
parents:
diff changeset
286 lra_reg_info[first_coalesced_pseudo[dregno]].live_ranges)))
kono
parents:
diff changeset
287 {
kono
parents:
diff changeset
288 coalesced_moves++;
kono
parents:
diff changeset
289 if (lra_dump_file != NULL)
kono
parents:
diff changeset
290 fprintf
kono
parents:
diff changeset
291 (lra_dump_file,
kono
parents:
diff changeset
292 " Coalescing move %i:r%d(%d)-r%d(%d) (freq=%d)\n",
kono
parents:
diff changeset
293 INSN_UID (mv), sregno, ORIGINAL_REGNO (SET_SRC (set)),
kono
parents:
diff changeset
294 dregno, ORIGINAL_REGNO (SET_DEST (set)),
kono
parents:
diff changeset
295 REG_FREQ_FROM_BB (BLOCK_FOR_INSN (mv)));
kono
parents:
diff changeset
296 bitmap_ior_into (&involved_insns_bitmap,
kono
parents:
diff changeset
297 &lra_reg_info[sregno].insn_bitmap);
kono
parents:
diff changeset
298 bitmap_ior_into (&involved_insns_bitmap,
kono
parents:
diff changeset
299 &lra_reg_info[dregno].insn_bitmap);
kono
parents:
diff changeset
300 merge_pseudos (sregno, dregno);
kono
parents:
diff changeset
301 }
kono
parents:
diff changeset
302 }
kono
parents:
diff changeset
303 bitmap_initialize (&used_pseudos_bitmap, &reg_obstack);
kono
parents:
diff changeset
304 FOR_EACH_BB_FN (bb, cfun)
kono
parents:
diff changeset
305 {
kono
parents:
diff changeset
306 update_live_info (df_get_live_in (bb));
kono
parents:
diff changeset
307 update_live_info (df_get_live_out (bb));
kono
parents:
diff changeset
308 FOR_BB_INSNS_SAFE (bb, insn, next)
kono
parents:
diff changeset
309 if (INSN_P (insn)
kono
parents:
diff changeset
310 && bitmap_bit_p (&involved_insns_bitmap, INSN_UID (insn)))
kono
parents:
diff changeset
311 {
kono
parents:
diff changeset
312 if (! substitute_within_insn (insn))
kono
parents:
diff changeset
313 continue;
kono
parents:
diff changeset
314 lra_update_insn_regno_info (insn);
kono
parents:
diff changeset
315 if ((set = single_set (insn)) != NULL_RTX && set_noop_p (set))
kono
parents:
diff changeset
316 {
kono
parents:
diff changeset
317 /* Coalesced move. */
kono
parents:
diff changeset
318 if (lra_dump_file != NULL)
kono
parents:
diff changeset
319 fprintf (lra_dump_file, " Removing move %i (freq=%d)\n",
kono
parents:
diff changeset
320 INSN_UID (insn),
kono
parents:
diff changeset
321 REG_FREQ_FROM_BB (BLOCK_FOR_INSN (insn)));
kono
parents:
diff changeset
322 lra_set_insn_deleted (insn);
kono
parents:
diff changeset
323 }
kono
parents:
diff changeset
324 }
kono
parents:
diff changeset
325 }
kono
parents:
diff changeset
326 /* If we have situation after inheritance pass:
kono
parents:
diff changeset
327
kono
parents:
diff changeset
328 r1 <- p1 insn originally setting p1
kono
parents:
diff changeset
329 i1 <- r1 setting inheritance i1 from reload r1
kono
parents:
diff changeset
330 ...
kono
parents:
diff changeset
331 ... <- ... p2 ... dead p2
kono
parents:
diff changeset
332 ..
kono
parents:
diff changeset
333 p1 <- i1
kono
parents:
diff changeset
334 r2 <- i1
kono
parents:
diff changeset
335 ...<- ... r2 ...
kono
parents:
diff changeset
336
kono
parents:
diff changeset
337 And we are coalescing p1 and p2 using p1. In this case i1 and p1
kono
parents:
diff changeset
338 should have different values, otherwise they can get the same
kono
parents:
diff changeset
339 hard reg and this is wrong for insn using p2 before coalescing.
kono
parents:
diff changeset
340 The situation even can be more complicated when new reload
kono
parents:
diff changeset
341 pseudos occur after the inheriatnce. So invalidate the result
kono
parents:
diff changeset
342 pseudos. */
kono
parents:
diff changeset
343 for (i = 0; i < max_regno; i++)
kono
parents:
diff changeset
344 if (first_coalesced_pseudo[i] == i
kono
parents:
diff changeset
345 && first_coalesced_pseudo[i] != next_coalesced_pseudo[i])
kono
parents:
diff changeset
346 {
kono
parents:
diff changeset
347 lra_set_regno_unique_value (i);
kono
parents:
diff changeset
348 if (lra_dump_file != NULL)
kono
parents:
diff changeset
349 fprintf (lra_dump_file,
kono
parents:
diff changeset
350 " Make unique value for coalescing result r%d\n", i);
kono
parents:
diff changeset
351 }
kono
parents:
diff changeset
352 bitmap_clear (&used_pseudos_bitmap);
kono
parents:
diff changeset
353 bitmap_clear (&involved_insns_bitmap);
kono
parents:
diff changeset
354 bitmap_clear (&coalesced_pseudos_bitmap);
kono
parents:
diff changeset
355 if (lra_dump_file != NULL && coalesced_moves != 0)
kono
parents:
diff changeset
356 fprintf (lra_dump_file, "Coalesced Moves = %d\n", coalesced_moves);
kono
parents:
diff changeset
357 free (sorted_moves);
kono
parents:
diff changeset
358 free (next_coalesced_pseudo);
kono
parents:
diff changeset
359 free (first_coalesced_pseudo);
kono
parents:
diff changeset
360 timevar_pop (TV_LRA_COALESCE);
kono
parents:
diff changeset
361 return coalesced_moves != 0;
kono
parents:
diff changeset
362 }