Mercurial > hg > CbC > CbC_gcc
comparison gcc/combine-stack-adj.c @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | f6334be47118 |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
1 /* Combine stack adjustments. | 1 /* Combine stack adjustments. |
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, | 2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, |
3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 | 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
4 Free Software Foundation, Inc. | 4 Free Software Foundation, Inc. |
5 | 5 |
6 This file is part of GCC. | 6 This file is part of GCC. |
7 | 7 |
8 GCC is free software; you can redistribute it and/or modify it under | 8 GCC is free software; you can redistribute it and/or modify it under |
69 #define STACK_GROWS_DOWNWARD 1 | 69 #define STACK_GROWS_DOWNWARD 1 |
70 #else | 70 #else |
71 #define STACK_GROWS_DOWNWARD 0 | 71 #define STACK_GROWS_DOWNWARD 0 |
72 #endif | 72 #endif |
73 | 73 |
74 /* This structure records stack memory references between stack adjusting | 74 /* This structure records two kinds of stack references between stack |
75 instructions. */ | 75 adjusting instructions: stack references in memory addresses for |
76 | 76 regular insns and all stack references for debug insns. */ |
77 struct csa_memlist | 77 |
78 struct csa_reflist | |
78 { | 79 { |
79 HOST_WIDE_INT sp_offset; | 80 HOST_WIDE_INT sp_offset; |
80 rtx insn, *mem; | 81 rtx insn, *ref; |
81 struct csa_memlist *next; | 82 struct csa_reflist *next; |
82 }; | 83 }; |
83 | 84 |
84 static int stack_memref_p (rtx); | 85 static int stack_memref_p (rtx); |
85 static rtx single_set_for_csa (rtx); | 86 static rtx single_set_for_csa (rtx); |
86 static void free_csa_memlist (struct csa_memlist *); | 87 static void free_csa_reflist (struct csa_reflist *); |
87 static struct csa_memlist *record_one_stack_memref (rtx, rtx *, | 88 static struct csa_reflist *record_one_stack_ref (rtx, rtx *, |
88 struct csa_memlist *); | 89 struct csa_reflist *); |
89 static int try_apply_stack_adjustment (rtx, struct csa_memlist *, | 90 static int try_apply_stack_adjustment (rtx, struct csa_reflist *, |
90 HOST_WIDE_INT, HOST_WIDE_INT); | 91 HOST_WIDE_INT, HOST_WIDE_INT); |
91 static void combine_stack_adjustments_for_block (basic_block); | 92 static void combine_stack_adjustments_for_block (basic_block); |
92 static int record_stack_memrefs (rtx *, void *); | 93 static int record_stack_refs (rtx *, void *); |
93 | 94 |
94 | 95 |
95 /* Main entry point for stack adjustment combination. */ | 96 /* Main entry point for stack adjustment combination. */ |
96 | 97 |
97 static void | 98 static void |
114 | 115 |
115 if (x == stack_pointer_rtx) | 116 if (x == stack_pointer_rtx) |
116 return 1; | 117 return 1; |
117 if (GET_CODE (x) == PLUS | 118 if (GET_CODE (x) == PLUS |
118 && XEXP (x, 0) == stack_pointer_rtx | 119 && XEXP (x, 0) == stack_pointer_rtx |
119 && GET_CODE (XEXP (x, 1)) == CONST_INT) | 120 && CONST_INT_P (XEXP (x, 1))) |
120 return 1; | 121 return 1; |
121 | 122 |
122 return 0; | 123 return 0; |
123 } | 124 } |
124 | 125 |
155 } | 156 } |
156 | 157 |
157 return XVECEXP (tmp, 0, 0); | 158 return XVECEXP (tmp, 0, 0); |
158 } | 159 } |
159 | 160 |
160 /* Free the list of csa_memlist nodes. */ | 161 /* Free the list of csa_reflist nodes. */ |
161 | 162 |
162 static void | 163 static void |
163 free_csa_memlist (struct csa_memlist *memlist) | 164 free_csa_reflist (struct csa_reflist *reflist) |
164 { | 165 { |
165 struct csa_memlist *next; | 166 struct csa_reflist *next; |
166 for (; memlist ; memlist = next) | 167 for (; reflist ; reflist = next) |
167 { | 168 { |
168 next = memlist->next; | 169 next = reflist->next; |
169 free (memlist); | 170 free (reflist); |
170 } | 171 } |
171 } | 172 } |
172 | 173 |
173 /* Create a new csa_memlist node from the given memory reference. | 174 /* Create a new csa_reflist node from the given stack reference. |
174 It is already known that the memory is stack_memref_p. */ | 175 It is already known that the reference is either a MEM satisfying the |
175 | 176 predicate stack_memref_p or a REG representing the stack pointer. */ |
176 static struct csa_memlist * | 177 |
177 record_one_stack_memref (rtx insn, rtx *mem, struct csa_memlist *next_memlist) | 178 static struct csa_reflist * |
178 { | 179 record_one_stack_ref (rtx insn, rtx *ref, struct csa_reflist *next_reflist) |
179 struct csa_memlist *ml; | 180 { |
180 | 181 struct csa_reflist *ml; |
181 ml = XNEW (struct csa_memlist); | 182 |
182 | 183 ml = XNEW (struct csa_reflist); |
183 if (XEXP (*mem, 0) == stack_pointer_rtx) | 184 |
185 if (REG_P (*ref) || XEXP (*ref, 0) == stack_pointer_rtx) | |
184 ml->sp_offset = 0; | 186 ml->sp_offset = 0; |
185 else | 187 else |
186 ml->sp_offset = INTVAL (XEXP (XEXP (*mem, 0), 1)); | 188 ml->sp_offset = INTVAL (XEXP (XEXP (*ref, 0), 1)); |
187 | 189 |
188 ml->insn = insn; | 190 ml->insn = insn; |
189 ml->mem = mem; | 191 ml->ref = ref; |
190 ml->next = next_memlist; | 192 ml->next = next_reflist; |
191 | 193 |
192 return ml; | 194 return ml; |
193 } | 195 } |
194 | 196 |
195 /* Attempt to apply ADJUST to the stack adjusting insn INSN, as well | 197 /* Attempt to apply ADJUST to the stack adjusting insn INSN, as well |
196 as each of the memories in MEMLIST. Return true on success. */ | 198 as each of the memories and stack references in REFLIST. Return true |
199 on success. */ | |
197 | 200 |
198 static int | 201 static int |
199 try_apply_stack_adjustment (rtx insn, struct csa_memlist *memlist, HOST_WIDE_INT new_adjust, | 202 try_apply_stack_adjustment (rtx insn, struct csa_reflist *reflist, |
200 HOST_WIDE_INT delta) | 203 HOST_WIDE_INT new_adjust, HOST_WIDE_INT delta) |
201 { | 204 { |
202 struct csa_memlist *ml; | 205 struct csa_reflist *ml; |
203 rtx set; | 206 rtx set; |
204 | 207 |
205 set = single_set_for_csa (insn); | 208 set = single_set_for_csa (insn); |
206 validate_change (insn, &XEXP (SET_SRC (set), 1), GEN_INT (new_adjust), 1); | 209 if (MEM_P (SET_DEST (set))) |
207 | 210 validate_change (insn, &SET_DEST (set), |
208 for (ml = memlist; ml ; ml = ml->next) | 211 replace_equiv_address (SET_DEST (set), stack_pointer_rtx), |
209 validate_change | 212 1); |
210 (ml->insn, ml->mem, | 213 else |
211 replace_equiv_address_nv (*ml->mem, | 214 validate_change (insn, &XEXP (SET_SRC (set), 1), GEN_INT (new_adjust), 1); |
212 plus_constant (stack_pointer_rtx, | 215 |
213 ml->sp_offset - delta)), 1); | 216 for (ml = reflist; ml ; ml = ml->next) |
217 { | |
218 rtx new_addr = plus_constant (stack_pointer_rtx, ml->sp_offset - delta); | |
219 rtx new_val; | |
220 | |
221 if (MEM_P (*ml->ref)) | |
222 new_val = replace_equiv_address_nv (*ml->ref, new_addr); | |
223 else if (GET_MODE (*ml->ref) == GET_MODE (stack_pointer_rtx)) | |
224 new_val = new_addr; | |
225 else | |
226 new_val = lowpart_subreg (GET_MODE (*ml->ref), new_addr, | |
227 GET_MODE (new_addr)); | |
228 validate_change (ml->insn, ml->ref, new_val, 1); | |
229 } | |
214 | 230 |
215 if (apply_change_group ()) | 231 if (apply_change_group ()) |
216 { | 232 { |
217 /* Succeeded. Update our knowledge of the memory references. */ | 233 /* Succeeded. Update our knowledge of the stack references. */ |
218 for (ml = memlist; ml ; ml = ml->next) | 234 for (ml = reflist; ml ; ml = ml->next) |
219 ml->sp_offset -= delta; | 235 ml->sp_offset -= delta; |
220 | 236 |
221 return 1; | 237 return 1; |
222 } | 238 } |
223 else | 239 else |
224 return 0; | 240 return 0; |
225 } | 241 } |
226 | 242 |
227 /* Called via for_each_rtx and used to record all stack memory references in | 243 /* Called via for_each_rtx and used to record all stack memory and other |
228 the insn and discard all other stack pointer references. */ | 244 references in the insn and discard all other stack pointer references. */ |
229 struct record_stack_memrefs_data | 245 struct record_stack_refs_data |
230 { | 246 { |
231 rtx insn; | 247 rtx insn; |
232 struct csa_memlist *memlist; | 248 struct csa_reflist *reflist; |
233 }; | 249 }; |
234 | 250 |
235 static int | 251 static int |
236 record_stack_memrefs (rtx *xp, void *data) | 252 record_stack_refs (rtx *xp, void *data) |
237 { | 253 { |
238 rtx x = *xp; | 254 rtx x = *xp; |
239 struct record_stack_memrefs_data *d = | 255 struct record_stack_refs_data *d = |
240 (struct record_stack_memrefs_data *) data; | 256 (struct record_stack_refs_data *) data; |
241 if (!x) | 257 if (!x) |
242 return 0; | 258 return 0; |
243 switch (GET_CODE (x)) | 259 switch (GET_CODE (x)) |
244 { | 260 { |
245 case MEM: | 261 case MEM: |
247 return -1; | 263 return -1; |
248 /* We are not able to handle correctly all possible memrefs containing | 264 /* We are not able to handle correctly all possible memrefs containing |
249 stack pointer, so this check is necessary. */ | 265 stack pointer, so this check is necessary. */ |
250 if (stack_memref_p (x)) | 266 if (stack_memref_p (x)) |
251 { | 267 { |
252 d->memlist = record_one_stack_memref (d->insn, xp, d->memlist); | 268 d->reflist = record_one_stack_ref (d->insn, xp, d->reflist); |
253 return -1; | 269 return -1; |
254 } | 270 } |
255 return 1; | 271 /* Try harder for DEBUG_INSNs, handle e.g. (mem (mem (sp + 16) + 4). */ |
272 return !DEBUG_INSN_P (d->insn); | |
256 case REG: | 273 case REG: |
257 /* ??? We want be able to handle non-memory stack pointer | 274 /* ??? We want be able to handle non-memory stack pointer |
258 references later. For now just discard all insns referring to | 275 references later. For now just discard all insns referring to |
259 stack pointer outside mem expressions. We would probably | 276 stack pointer outside mem expressions. We would probably |
260 want to teach validate_replace to simplify expressions first. | 277 want to teach validate_replace to simplify expressions first. |
261 | 278 |
262 We can't just compare with STACK_POINTER_RTX because the | 279 We can't just compare with STACK_POINTER_RTX because the |
263 reference to the stack pointer might be in some other mode. | 280 reference to the stack pointer might be in some other mode. |
264 In particular, an explicit clobber in an asm statement will | 281 In particular, an explicit clobber in an asm statement will |
265 result in a QImode clobber. */ | 282 result in a QImode clobber. |
283 | |
284 In DEBUG_INSNs, we want to replace all occurrences, otherwise | |
285 they will cause -fcompare-debug failures. */ | |
266 if (REGNO (x) == STACK_POINTER_REGNUM) | 286 if (REGNO (x) == STACK_POINTER_REGNUM) |
267 return 1; | 287 { |
288 if (!DEBUG_INSN_P (d->insn)) | |
289 return 1; | |
290 d->reflist = record_one_stack_ref (d->insn, xp, d->reflist); | |
291 return -1; | |
292 } | |
268 break; | 293 break; |
269 default: | 294 default: |
270 break; | 295 break; |
271 } | 296 } |
272 return 0; | 297 return 0; |
296 if (GET_CODE (last) == SET | 321 if (GET_CODE (last) == SET |
297 && RTX_FRAME_RELATED_P (last) == RTX_FRAME_RELATED_P (insn) | 322 && RTX_FRAME_RELATED_P (last) == RTX_FRAME_RELATED_P (insn) |
298 && SET_DEST (last) == stack_pointer_rtx | 323 && SET_DEST (last) == stack_pointer_rtx |
299 && GET_CODE (SET_SRC (last)) == PLUS | 324 && GET_CODE (SET_SRC (last)) == PLUS |
300 && XEXP (SET_SRC (last), 0) == stack_pointer_rtx | 325 && XEXP (SET_SRC (last), 0) == stack_pointer_rtx |
301 && GET_CODE (XEXP (SET_SRC (last), 1)) == CONST_INT) | 326 && CONST_INT_P (XEXP (SET_SRC (last), 1))) |
302 { | 327 { |
303 XEXP (SET_SRC (last), 1) | 328 XEXP (SET_SRC (last), 1) |
304 = GEN_INT (INTVAL (XEXP (SET_SRC (last), 1)) + this_adjust); | 329 = GEN_INT (INTVAL (XEXP (SET_SRC (last), 1)) + this_adjust); |
305 return; | 330 return; |
306 } | 331 } |
331 RTX_FRAME_RELATED_P (XVECEXP (new_expr, 0, XVECLEN (new_expr, 0) - 1)) | 356 RTX_FRAME_RELATED_P (XVECEXP (new_expr, 0, XVECLEN (new_expr, 0) - 1)) |
332 = RTX_FRAME_RELATED_P (insn); | 357 = RTX_FRAME_RELATED_P (insn); |
333 if (note) | 358 if (note) |
334 XEXP (note, 0) = new_expr; | 359 XEXP (note, 0) = new_expr; |
335 else | 360 else |
336 REG_NOTES (last_sp_set) | 361 add_reg_note (last_sp_set, REG_FRAME_RELATED_EXPR, new_expr); |
337 = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, new_expr, | |
338 REG_NOTES (last_sp_set)); | |
339 } | 362 } |
340 | 363 |
341 /* Subroutine of combine_stack_adjustments, called for each basic block. */ | 364 /* Subroutine of combine_stack_adjustments, called for each basic block. */ |
342 | 365 |
343 static void | 366 static void |
344 combine_stack_adjustments_for_block (basic_block bb) | 367 combine_stack_adjustments_for_block (basic_block bb) |
345 { | 368 { |
346 HOST_WIDE_INT last_sp_adjust = 0; | 369 HOST_WIDE_INT last_sp_adjust = 0; |
347 rtx last_sp_set = NULL_RTX; | 370 rtx last_sp_set = NULL_RTX; |
348 struct csa_memlist *memlist = NULL; | 371 struct csa_reflist *reflist = NULL; |
349 rtx insn, next, set; | 372 rtx insn, next, set; |
350 struct record_stack_memrefs_data data; | 373 struct record_stack_refs_data data; |
351 bool end_of_block = false; | 374 bool end_of_block = false; |
352 | 375 |
353 for (insn = BB_HEAD (bb); !end_of_block ; insn = next) | 376 for (insn = BB_HEAD (bb); !end_of_block ; insn = next) |
354 { | 377 { |
355 end_of_block = insn == BB_END (bb); | 378 end_of_block = insn == BB_END (bb); |
366 | 389 |
367 /* Find constant additions to the stack pointer. */ | 390 /* Find constant additions to the stack pointer. */ |
368 if (dest == stack_pointer_rtx | 391 if (dest == stack_pointer_rtx |
369 && GET_CODE (src) == PLUS | 392 && GET_CODE (src) == PLUS |
370 && XEXP (src, 0) == stack_pointer_rtx | 393 && XEXP (src, 0) == stack_pointer_rtx |
371 && GET_CODE (XEXP (src, 1)) == CONST_INT) | 394 && CONST_INT_P (XEXP (src, 1))) |
372 { | 395 { |
373 HOST_WIDE_INT this_adjust = INTVAL (XEXP (src, 1)); | 396 HOST_WIDE_INT this_adjust = INTVAL (XEXP (src, 1)); |
374 | 397 |
375 /* If we've not seen an adjustment previously, record | 398 /* If we've not seen an adjustment previously, record |
376 it now and continue. */ | 399 it now and continue. */ |
379 last_sp_set = insn; | 402 last_sp_set = insn; |
380 last_sp_adjust = this_adjust; | 403 last_sp_adjust = this_adjust; |
381 continue; | 404 continue; |
382 } | 405 } |
383 | 406 |
384 /* If not all recorded memrefs can be adjusted, or the | 407 /* If not all recorded refs can be adjusted, or the |
385 adjustment is now too large for a constant addition, | 408 adjustment is now too large for a constant addition, |
386 we cannot merge the two stack adjustments. | 409 we cannot merge the two stack adjustments. |
387 | 410 |
388 Also we need to be careful to not move stack pointer | 411 Also we need to be careful to not move stack pointer |
389 such that we create stack accesses outside the allocated | 412 such that we create stack accesses outside the allocated |
403 gcc not to allocate stack for objects never used. */ | 426 gcc not to allocate stack for objects never used. */ |
404 | 427 |
405 /* Combine an allocation into the first instruction. */ | 428 /* Combine an allocation into the first instruction. */ |
406 if (STACK_GROWS_DOWNWARD ? this_adjust <= 0 : this_adjust >= 0) | 429 if (STACK_GROWS_DOWNWARD ? this_adjust <= 0 : this_adjust >= 0) |
407 { | 430 { |
408 if (try_apply_stack_adjustment (last_sp_set, memlist, | 431 if (try_apply_stack_adjustment (last_sp_set, reflist, |
409 last_sp_adjust + this_adjust, | 432 last_sp_adjust + this_adjust, |
410 this_adjust)) | 433 this_adjust)) |
411 { | 434 { |
412 if (RTX_FRAME_RELATED_P (last_sp_set)) | 435 if (RTX_FRAME_RELATED_P (last_sp_set)) |
413 adjust_frame_related_expr (last_sp_set, insn, | 436 adjust_frame_related_expr (last_sp_set, insn, |
422 /* Otherwise we have a deallocation. Do not combine with | 445 /* Otherwise we have a deallocation. Do not combine with |
423 a previous allocation. Combine into the second insn. */ | 446 a previous allocation. Combine into the second insn. */ |
424 else if (STACK_GROWS_DOWNWARD | 447 else if (STACK_GROWS_DOWNWARD |
425 ? last_sp_adjust >= 0 : last_sp_adjust <= 0) | 448 ? last_sp_adjust >= 0 : last_sp_adjust <= 0) |
426 { | 449 { |
427 if (try_apply_stack_adjustment (insn, memlist, | 450 if (try_apply_stack_adjustment (insn, reflist, |
428 last_sp_adjust + this_adjust, | 451 last_sp_adjust + this_adjust, |
429 -last_sp_adjust)) | 452 -last_sp_adjust)) |
430 { | 453 { |
431 /* It worked! */ | 454 /* It worked! */ |
432 delete_insn (last_sp_set); | 455 delete_insn (last_sp_set); |
433 last_sp_set = insn; | 456 last_sp_set = insn; |
434 last_sp_adjust += this_adjust; | 457 last_sp_adjust += this_adjust; |
435 free_csa_memlist (memlist); | 458 free_csa_reflist (reflist); |
436 memlist = NULL; | 459 reflist = NULL; |
437 continue; | 460 continue; |
438 } | 461 } |
439 } | 462 } |
440 | 463 |
441 /* Combination failed. Restart processing from here. If | 464 /* Combination failed. Restart processing from here. If |
442 deallocation+allocation conspired to cancel, we can | 465 deallocation+allocation conspired to cancel, we can |
443 delete the old deallocation insn. */ | 466 delete the old deallocation insn. */ |
444 if (last_sp_set && last_sp_adjust == 0) | 467 if (last_sp_set && last_sp_adjust == 0) |
445 delete_insn (last_sp_set); | 468 delete_insn (last_sp_set); |
446 free_csa_memlist (memlist); | 469 free_csa_reflist (reflist); |
447 memlist = NULL; | 470 reflist = NULL; |
448 last_sp_set = insn; | 471 last_sp_set = insn; |
449 last_sp_adjust = this_adjust; | 472 last_sp_adjust = this_adjust; |
450 continue; | 473 continue; |
451 } | 474 } |
452 | 475 |
453 /* Find a predecrement of exactly the previous adjustment and | 476 /* Find a store with pre-(dec|inc)rement or pre-modify of exactly |
454 turn it into a direct store. Obviously we can't do this if | 477 the previous adjustment and turn it into a simple store. This |
455 there were any intervening uses of the stack pointer. */ | 478 is equivalent to anticipating the stack adjustment so this must |
456 if (memlist == NULL | 479 be an allocation. */ |
457 && MEM_P (dest) | 480 if (MEM_P (dest) |
458 && ((GET_CODE (XEXP (dest, 0)) == PRE_DEC | 481 && ((STACK_GROWS_DOWNWARD |
459 && (last_sp_adjust | 482 ? (GET_CODE (XEXP (dest, 0)) == PRE_DEC |
460 == (HOST_WIDE_INT) GET_MODE_SIZE (GET_MODE (dest)))) | 483 && last_sp_adjust |
461 || (GET_CODE (XEXP (dest, 0)) == PRE_MODIFY | 484 == (HOST_WIDE_INT) GET_MODE_SIZE (GET_MODE (dest))) |
485 : (GET_CODE (XEXP (dest, 0)) == PRE_INC | |
486 && last_sp_adjust | |
487 == -(HOST_WIDE_INT) GET_MODE_SIZE (GET_MODE (dest)))) | |
488 || ((STACK_GROWS_DOWNWARD | |
489 ? last_sp_adjust >= 0 : last_sp_adjust <= 0) | |
490 && GET_CODE (XEXP (dest, 0)) == PRE_MODIFY | |
462 && GET_CODE (XEXP (XEXP (dest, 0), 1)) == PLUS | 491 && GET_CODE (XEXP (XEXP (dest, 0), 1)) == PLUS |
463 && XEXP (XEXP (XEXP (dest, 0), 1), 0) == stack_pointer_rtx | 492 && XEXP (XEXP (XEXP (dest, 0), 1), 0) |
464 && (GET_CODE (XEXP (XEXP (XEXP (dest, 0), 1), 1)) | 493 == stack_pointer_rtx |
465 == CONST_INT) | 494 && GET_CODE (XEXP (XEXP (XEXP (dest, 0), 1), 1)) |
466 && (INTVAL (XEXP (XEXP (XEXP (dest, 0), 1), 1)) | 495 == CONST_INT |
467 == -last_sp_adjust))) | 496 && INTVAL (XEXP (XEXP (XEXP (dest, 0), 1), 1)) |
497 == -last_sp_adjust)) | |
468 && XEXP (XEXP (dest, 0), 0) == stack_pointer_rtx | 498 && XEXP (XEXP (dest, 0), 0) == stack_pointer_rtx |
469 && ! reg_mentioned_p (stack_pointer_rtx, src) | 499 && !reg_mentioned_p (stack_pointer_rtx, src) |
470 && memory_address_p (GET_MODE (dest), stack_pointer_rtx) | 500 && memory_address_p (GET_MODE (dest), stack_pointer_rtx) |
471 && validate_change (insn, &SET_DEST (set), | 501 && try_apply_stack_adjustment (insn, reflist, 0, |
472 replace_equiv_address (dest, | 502 -last_sp_adjust)) |
473 stack_pointer_rtx), | |
474 0)) | |
475 { | 503 { |
476 delete_insn (last_sp_set); | 504 delete_insn (last_sp_set); |
477 free_csa_memlist (memlist); | 505 free_csa_reflist (reflist); |
478 memlist = NULL; | 506 reflist = NULL; |
479 last_sp_set = NULL_RTX; | 507 last_sp_set = NULL_RTX; |
480 last_sp_adjust = 0; | 508 last_sp_adjust = 0; |
481 continue; | 509 continue; |
482 } | 510 } |
483 } | 511 } |
484 | 512 |
485 data.insn = insn; | 513 data.insn = insn; |
486 data.memlist = memlist; | 514 data.reflist = reflist; |
487 if (!CALL_P (insn) && last_sp_set | 515 if (!CALL_P (insn) && last_sp_set |
488 && !for_each_rtx (&PATTERN (insn), record_stack_memrefs, &data)) | 516 && !for_each_rtx (&PATTERN (insn), record_stack_refs, &data)) |
489 { | 517 { |
490 memlist = data.memlist; | 518 reflist = data.reflist; |
491 continue; | 519 continue; |
492 } | 520 } |
493 memlist = data.memlist; | 521 reflist = data.reflist; |
494 | 522 |
495 /* Otherwise, we were not able to process the instruction. | 523 /* Otherwise, we were not able to process the instruction. |
496 Do not continue collecting data across such a one. */ | 524 Do not continue collecting data across such a one. */ |
497 if (last_sp_set | 525 if (last_sp_set |
498 && (CALL_P (insn) | 526 && (CALL_P (insn) |
499 || reg_mentioned_p (stack_pointer_rtx, PATTERN (insn)))) | 527 || reg_mentioned_p (stack_pointer_rtx, PATTERN (insn)))) |
500 { | 528 { |
501 if (last_sp_set && last_sp_adjust == 0) | 529 if (last_sp_set && last_sp_adjust == 0) |
502 delete_insn (last_sp_set); | 530 delete_insn (last_sp_set); |
503 free_csa_memlist (memlist); | 531 free_csa_reflist (reflist); |
504 memlist = NULL; | 532 reflist = NULL; |
505 last_sp_set = NULL_RTX; | 533 last_sp_set = NULL_RTX; |
506 last_sp_adjust = 0; | 534 last_sp_adjust = 0; |
507 } | 535 } |
508 } | 536 } |
509 | 537 |
510 if (last_sp_set && last_sp_adjust == 0) | 538 if (last_sp_set && last_sp_adjust == 0) |
511 delete_insn (last_sp_set); | 539 delete_insn (last_sp_set); |
512 | 540 |
513 if (memlist) | 541 if (reflist) |
514 free_csa_memlist (memlist); | 542 free_csa_reflist (reflist); |
515 } | 543 } |
516 | 544 |
517 | 545 |
518 static bool | 546 static bool |
519 gate_handle_stack_adjustments (void) | 547 gate_handle_stack_adjustments (void) |
549 gate_handle_stack_adjustments, /* gate */ | 577 gate_handle_stack_adjustments, /* gate */ |
550 rest_of_handle_stack_adjustments, /* execute */ | 578 rest_of_handle_stack_adjustments, /* execute */ |
551 NULL, /* sub */ | 579 NULL, /* sub */ |
552 NULL, /* next */ | 580 NULL, /* next */ |
553 0, /* static_pass_number */ | 581 0, /* static_pass_number */ |
554 0, /* tv_id */ | 582 TV_COMBINE_STACK_ADJUST, /* tv_id */ |
555 0, /* properties_required */ | 583 0, /* properties_required */ |
556 0, /* properties_provided */ | 584 0, /* properties_provided */ |
557 0, /* properties_destroyed */ | 585 0, /* properties_destroyed */ |
558 0, /* todo_flags_start */ | 586 0, /* todo_flags_start */ |
559 TODO_df_finish | TODO_verify_rtl_sharing | | 587 TODO_df_finish | TODO_verify_rtl_sharing | |
560 TODO_dump_func | | 588 TODO_dump_func | |
561 TODO_ggc_collect, /* todo_flags_finish */ | 589 TODO_ggc_collect, /* todo_flags_finish */ |
562 } | 590 } |
563 }; | 591 }; |
564 |