* regclass.c (fix_register): Fix typo.
[official-gcc.git] / gcc / sibcall.c
bloba6638b7d2597d256e198155ea09682ead63ac134
1 /* Generic sibling call optimization support
2 Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 #include "config.h"
22 #include "system.h"
24 #include "rtl.h"
25 #include "regs.h"
26 #include "function.h"
27 #include "hard-reg-set.h"
28 #include "flags.h"
29 #include "insn-config.h"
30 #include "recog.h"
31 #include "basic-block.h"
32 #include "output.h"
33 #include "except.h"
35 /* In case alternate_exit_block contains copy from pseudo, to return value,
36 record the pseudo here. In such case the pseudo must be set to function
37 return in the sibcall sequence. */
38 static rtx return_value_pseudo;
40 static int identify_call_return_value PARAMS ((rtx, rtx *, rtx *));
41 static rtx skip_copy_to_return_value PARAMS ((rtx));
42 static rtx skip_use_of_return_value PARAMS ((rtx, enum rtx_code));
43 static rtx skip_stack_adjustment PARAMS ((rtx));
44 static rtx skip_pic_restore PARAMS ((rtx));
45 static rtx skip_jump_insn PARAMS ((rtx));
46 static int call_ends_block_p PARAMS ((rtx, rtx));
47 static int uses_addressof PARAMS ((rtx));
48 static int sequence_uses_addressof PARAMS ((rtx));
49 static void purge_reg_equiv_notes PARAMS ((void));
50 static void purge_mem_unchanging_flag PARAMS ((rtx));
51 static rtx skip_unreturned_value PARAMS ((rtx));
53 /* Examine a CALL_PLACEHOLDER pattern and determine where the call's
54 return value is located. P_HARD_RETURN receives the hard register
55 that the function used; P_SOFT_RETURN receives the pseudo register
56 that the sequence used. Return non-zero if the values were located. */
58 static int
59 identify_call_return_value (cp, p_hard_return, p_soft_return)
60 rtx cp;
61 rtx *p_hard_return, *p_soft_return;
63 rtx insn, set, hard, soft;
65 insn = XEXP (cp, 0);
66 /* Search backward through the "normal" call sequence to the CALL insn. */
67 while (NEXT_INSN (insn))
68 insn = NEXT_INSN (insn);
69 while (GET_CODE (insn) != CALL_INSN)
70 insn = PREV_INSN (insn);
72 /* Assume the pattern is (set (dest) (call ...)), or that the first
73 member of a parallel is. This is the hard return register used
74 by the function. */
75 if (GET_CODE (PATTERN (insn)) == SET
76 && GET_CODE (SET_SRC (PATTERN (insn))) == CALL)
77 hard = SET_DEST (PATTERN (insn));
78 else if (GET_CODE (PATTERN (insn)) == PARALLEL
79 && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == SET
80 && GET_CODE (SET_SRC (XVECEXP (PATTERN (insn), 0, 0))) == CALL)
81 hard = SET_DEST (XVECEXP (PATTERN (insn), 0, 0));
82 else
83 return 0;
85 /* If we didn't get a single hard register (e.g. a parallel), give up. */
86 if (GET_CODE (hard) != REG)
87 return 0;
89 /* Stack adjustment done after call may appear here. */
90 insn = skip_stack_adjustment (insn);
91 if (! insn)
92 return 0;
94 /* Restore of GP register may appear here. */
95 insn = skip_pic_restore (insn);
96 if (! insn)
97 return 0;
99 /* If there's nothing after, there's no soft return value. */
100 insn = NEXT_INSN (insn);
101 if (! insn)
102 return 0;
104 /* We're looking for a source of the hard return register. */
105 set = single_set (insn);
106 if (! set || SET_SRC (set) != hard)
107 return 0;
109 soft = SET_DEST (set);
110 insn = NEXT_INSN (insn);
112 /* Allow this first destination to be copied to a second register,
113 as might happen if the first register wasn't the particular pseudo
114 we'd been expecting. */
115 if (insn
116 && (set = single_set (insn)) != NULL_RTX
117 && SET_SRC (set) == soft)
119 soft = SET_DEST (set);
120 insn = NEXT_INSN (insn);
123 /* Don't fool with anything but pseudo registers. */
124 if (GET_CODE (soft) != REG || REGNO (soft) < FIRST_PSEUDO_REGISTER)
125 return 0;
127 /* This value must not be modified before the end of the sequence. */
128 if (reg_set_between_p (soft, insn, NULL_RTX))
129 return 0;
131 *p_hard_return = hard;
132 *p_soft_return = soft;
134 return 1;
137 /* If the first real insn after ORIG_INSN copies to this function's
138 return value from RETVAL, then return the insn which performs the
139 copy. Otherwise return ORIG_INSN. */
141 static rtx
142 skip_copy_to_return_value (orig_insn)
143 rtx orig_insn;
145 rtx insn, set = NULL_RTX;
146 rtx hardret, softret;
148 /* If there is no return value, we have nothing to do. */
149 if (! identify_call_return_value (PATTERN (orig_insn), &hardret, &softret))
150 return orig_insn;
152 insn = next_nonnote_insn (orig_insn);
153 if (! insn)
154 return orig_insn;
156 set = single_set (insn);
157 if (! set)
158 return orig_insn;
160 if (return_value_pseudo)
162 if (SET_DEST (set) == return_value_pseudo)
163 return insn;
164 return orig_insn;
167 /* The destination must be the same as the called function's return
168 value to ensure that any return value is put in the same place by the
169 current function and the function we're calling.
171 Further, the source must be the same as the pseudo into which the
172 called function's return value was copied. Otherwise we're returning
173 some other value. */
175 #ifndef OUTGOING_REGNO
176 #define OUTGOING_REGNO(N) (N)
177 #endif
179 if (SET_DEST (set) == current_function_return_rtx
180 && REG_P (SET_DEST (set))
181 && OUTGOING_REGNO (REGNO (SET_DEST (set))) == REGNO (hardret)
182 && SET_SRC (set) == softret)
183 return insn;
185 /* Recognize the situation when the called function's return value
186 is copied in two steps: first into an intermediate pseudo, then
187 the into the calling functions return value register. */
189 if (REG_P (SET_DEST (set))
190 && SET_SRC (set) == softret)
192 rtx x = SET_DEST (set);
194 insn = next_nonnote_insn (insn);
195 if (! insn)
196 return orig_insn;
198 set = single_set (insn);
199 if (! set)
200 return orig_insn;
202 if (SET_DEST (set) == current_function_return_rtx
203 && REG_P (SET_DEST (set))
204 && OUTGOING_REGNO (REGNO (SET_DEST (set))) == REGNO (hardret)
205 && SET_SRC (set) == x)
206 return insn;
209 /* It did not look like a copy of the return value, so return the
210 same insn we were passed. */
211 return orig_insn;
214 /* If the first real insn after ORIG_INSN is a CODE of this function's return
215 value, return insn. Otherwise return ORIG_INSN. */
217 static rtx
218 skip_use_of_return_value (orig_insn, code)
219 rtx orig_insn;
220 enum rtx_code code;
222 rtx insn;
224 insn = next_nonnote_insn (orig_insn);
226 if (insn
227 && GET_CODE (insn) == INSN
228 && GET_CODE (PATTERN (insn)) == code
229 && (XEXP (PATTERN (insn), 0) == current_function_return_rtx
230 || XEXP (PATTERN (insn), 0) == const0_rtx))
231 return insn;
233 return orig_insn;
236 /* In case function does not return value, we get clobber of pseudo followed
237 by set to hard return value. */
238 static rtx
239 skip_unreturned_value (orig_insn)
240 rtx orig_insn;
242 rtx insn = next_nonnote_insn (orig_insn);
244 /* Skip possible clobber of pseudo return register. */
245 if (insn
246 && GET_CODE (insn) == INSN
247 && GET_CODE (PATTERN (insn)) == CLOBBER
248 && REG_P (XEXP (PATTERN (insn), 0))
249 && (REGNO (XEXP (PATTERN (insn), 0)) >= FIRST_PSEUDO_REGISTER))
251 rtx set_insn = next_nonnote_insn (insn);
252 rtx set;
253 if (!set_insn)
254 return insn;
255 set = single_set (set_insn);
256 if (!set
257 || SET_SRC (set) != XEXP (PATTERN (insn), 0)
258 || SET_DEST (set) != current_function_return_rtx)
259 return insn;
260 return set_insn;
262 return orig_insn;
265 /* If the first real insn after ORIG_INSN adjusts the stack pointer
266 by a constant, return the insn with the stack pointer adjustment.
267 Otherwise return ORIG_INSN. */
269 static rtx
270 skip_stack_adjustment (orig_insn)
271 rtx orig_insn;
273 rtx insn, set = NULL_RTX;
275 insn = next_nonnote_insn (orig_insn);
277 if (insn)
278 set = single_set (insn);
280 if (insn
281 && set
282 && GET_CODE (SET_SRC (set)) == PLUS
283 && XEXP (SET_SRC (set), 0) == stack_pointer_rtx
284 && GET_CODE (XEXP (SET_SRC (set), 1)) == CONST_INT
285 && SET_DEST (set) == stack_pointer_rtx)
286 return insn;
288 return orig_insn;
291 /* If the first real insn after ORIG_INSN sets the pic register,
292 return it. Otherwise return ORIG_INSN. */
294 static rtx
295 skip_pic_restore (orig_insn)
296 rtx orig_insn;
298 rtx insn, set = NULL_RTX;
300 insn = next_nonnote_insn (orig_insn);
302 if (insn)
303 set = single_set (insn);
305 if (insn && set && SET_DEST (set) == pic_offset_table_rtx)
306 return insn;
308 return orig_insn;
311 /* If the first real insn after ORIG_INSN is a jump, return the JUMP_INSN.
312 Otherwise return ORIG_INSN. */
314 static rtx
315 skip_jump_insn (orig_insn)
316 rtx orig_insn;
318 rtx insn;
320 insn = next_nonnote_insn (orig_insn);
322 if (insn
323 && GET_CODE (insn) == JUMP_INSN
324 && any_uncondjump_p (insn))
325 return insn;
327 return orig_insn;
330 /* Using the above functions, see if INSN, skipping any of the above,
331 goes all the way to END, the end of a basic block. Return 1 if so. */
333 static int
334 call_ends_block_p (insn, end)
335 rtx insn;
336 rtx end;
338 rtx new_insn;
339 /* END might be a note, so get the last nonnote insn of the block. */
340 end = next_nonnote_insn (PREV_INSN (end));
342 /* If the call was the end of the block, then we're OK. */
343 if (insn == end)
344 return 1;
346 /* Skip over copying from the call's return value pseudo into
347 this function's hard return register and if that's the end
348 of the block, we're OK. */
349 new_insn = skip_copy_to_return_value (insn);
351 /* In case we return value in pseudo, we must set the pseudo to
352 return value of called function, otherwise we are returning
353 something else. */
354 if (return_value_pseudo && insn == new_insn)
355 return 0;
356 insn = new_insn;
358 if (insn == end)
359 return 1;
361 /* Skip any stack adjustment. */
362 insn = skip_stack_adjustment (insn);
363 if (insn == end)
364 return 1;
366 /* Skip over a CLOBBER of the return value as a hard reg. */
367 insn = skip_use_of_return_value (insn, CLOBBER);
368 if (insn == end)
369 return 1;
371 /* Skip over a CLOBBER of the return value as a hard reg. */
372 insn = skip_unreturned_value (insn);
373 if (insn == end)
374 return 1;
376 /* Skip over a USE of the return value (as a hard reg). */
377 insn = skip_use_of_return_value (insn, USE);
378 if (insn == end)
379 return 1;
381 /* Skip over a JUMP_INSN at the end of the block. If that doesn't end the
382 block, the original CALL_INSN didn't. */
383 insn = skip_jump_insn (insn);
384 return insn == end;
387 /* Scan the rtx X for ADDRESSOF expressions or
388 current_function_internal_arg_pointer registers.
389 Return nonzero if an ADDRESSOF or current_function_internal_arg_pointer
390 is found outside of some MEM expression, else return zero. */
392 static int
393 uses_addressof (x)
394 rtx x;
396 RTX_CODE code;
397 int i, j;
398 const char *fmt;
400 if (x == NULL_RTX)
401 return 0;
403 code = GET_CODE (x);
405 if (code == ADDRESSOF || x == current_function_internal_arg_pointer)
406 return 1;
408 if (code == MEM)
409 return 0;
411 /* Scan all subexpressions. */
412 fmt = GET_RTX_FORMAT (code);
413 for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
415 if (*fmt == 'e')
417 if (uses_addressof (XEXP (x, i)))
418 return 1;
420 else if (*fmt == 'E')
422 for (j = 0; j < XVECLEN (x, i); j++)
423 if (uses_addressof (XVECEXP (x, i, j)))
424 return 1;
427 return 0;
430 /* Scan the sequence of insns in SEQ to see if any have an ADDRESSOF
431 rtl expression or current_function_internal_arg_pointer occurences
432 not enclosed within a MEM. If an ADDRESSOF expression or
433 current_function_internal_arg_pointer is found, return nonzero, otherwise
434 return zero.
436 This function handles CALL_PLACEHOLDERs which contain multiple sequences
437 of insns. */
439 static int
440 sequence_uses_addressof (seq)
441 rtx seq;
443 rtx insn;
445 for (insn = seq; insn; insn = NEXT_INSN (insn))
446 if (INSN_P (insn))
448 /* If this is a CALL_PLACEHOLDER, then recursively call ourselves
449 with each nonempty sequence attached to the CALL_PLACEHOLDER. */
450 if (GET_CODE (insn) == CALL_INSN
451 && GET_CODE (PATTERN (insn)) == CALL_PLACEHOLDER)
453 if (XEXP (PATTERN (insn), 0) != NULL_RTX
454 && sequence_uses_addressof (XEXP (PATTERN (insn), 0)))
455 return 1;
456 if (XEXP (PATTERN (insn), 1) != NULL_RTX
457 && sequence_uses_addressof (XEXP (PATTERN (insn), 1)))
458 return 1;
459 if (XEXP (PATTERN (insn), 2) != NULL_RTX
460 && sequence_uses_addressof (XEXP (PATTERN (insn), 2)))
461 return 1;
463 else if (uses_addressof (PATTERN (insn))
464 || (REG_NOTES (insn) && uses_addressof (REG_NOTES (insn))))
465 return 1;
467 return 0;
470 /* Remove all REG_EQUIV notes found in the insn chain. */
472 static void
473 purge_reg_equiv_notes ()
475 rtx insn;
477 for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
479 while (1)
481 rtx note = find_reg_note (insn, REG_EQUIV, 0);
482 if (note)
484 /* Remove the note and keep looking at the notes for
485 this insn. */
486 remove_note (insn, note);
487 continue;
489 break;
494 /* Clear RTX_UNCHANGING_P flag of incoming argument MEMs. */
496 static void
497 purge_mem_unchanging_flag (x)
498 rtx x;
500 RTX_CODE code;
501 int i, j;
502 const char *fmt;
504 if (x == NULL_RTX)
505 return;
507 code = GET_CODE (x);
509 if (code == MEM)
511 if (RTX_UNCHANGING_P (x)
512 && (XEXP (x, 0) == current_function_internal_arg_pointer
513 || (GET_CODE (XEXP (x, 0)) == PLUS
514 && XEXP (XEXP (x, 0), 0) ==
515 current_function_internal_arg_pointer
516 && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT)))
517 RTX_UNCHANGING_P (x) = 0;
518 return;
521 /* Scan all subexpressions. */
522 fmt = GET_RTX_FORMAT (code);
523 for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
525 if (*fmt == 'e')
526 purge_mem_unchanging_flag (XEXP (x, i));
527 else if (*fmt == 'E')
528 for (j = 0; j < XVECLEN (x, i); j++)
529 purge_mem_unchanging_flag (XVECEXP (x, i, j));
533 /* Replace the CALL_PLACEHOLDER with one of its children. INSN should be
534 the CALL_PLACEHOLDER insn; USE tells which child to use. */
536 void
537 replace_call_placeholder (insn, use)
538 rtx insn;
539 sibcall_use_t use;
541 if (use == sibcall_use_tail_recursion)
542 emit_insns_before (XEXP (PATTERN (insn), 2), insn);
543 else if (use == sibcall_use_sibcall)
544 emit_insns_before (XEXP (PATTERN (insn), 1), insn);
545 else if (use == sibcall_use_normal)
546 emit_insns_before (XEXP (PATTERN (insn), 0), insn);
547 else
548 abort();
550 /* Turn off LABEL_PRESERVE_P for the tail recursion label if it
551 exists. We only had to set it long enough to keep the jump
552 pass above from deleting it as unused. */
553 if (XEXP (PATTERN (insn), 3))
554 LABEL_PRESERVE_P (XEXP (PATTERN (insn), 3)) = 0;
556 /* "Delete" the placeholder insn. */
557 PUT_CODE (insn, NOTE);
558 NOTE_SOURCE_FILE (insn) = 0;
559 NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
562 /* Given a (possibly empty) set of potential sibling or tail recursion call
563 sites, determine if optimization is possible.
565 Potential sibling or tail recursion calls are marked with CALL_PLACEHOLDER
566 insns. The CALL_PLACEHOLDER insn holds chains of insns to implement a
567 normal call, sibling call or tail recursive call.
569 Replace the CALL_PLACEHOLDER with an appropriate insn chain. */
571 void
572 optimize_sibling_and_tail_recursive_calls ()
574 rtx insn, insns;
575 basic_block alternate_exit = EXIT_BLOCK_PTR;
576 int current_function_uses_addressof;
577 int successful_sibling_call = 0;
578 int replaced_call_placeholder = 0;
579 edge e;
581 insns = get_insns ();
583 /* We do not perform these calls when flag_exceptions is true, so this
584 is probably a NOP at the current time. However, we may want to support
585 sibling and tail recursion optimizations in the future, so let's plan
586 ahead and find all the EH labels. */
587 find_exception_handler_labels ();
589 rebuild_jump_labels (insns);
590 /* We need cfg information to determine which blocks are succeeded
591 only by the epilogue. */
592 find_basic_blocks (insns, max_reg_num (), 0);
593 cleanup_cfg (CLEANUP_PRE_SIBCALL | CLEANUP_PRE_LOOP);
595 /* If there are no basic blocks, then there is nothing to do. */
596 if (n_basic_blocks == 0)
597 return;
599 return_value_pseudo = NULL_RTX;
601 /* Find the exit block.
603 It is possible that we have blocks which can reach the exit block
604 directly. However, most of the time a block will jump (or fall into)
605 N_BASIC_BLOCKS - 1, which in turn falls into the exit block. */
606 for (e = EXIT_BLOCK_PTR->pred;
607 e && alternate_exit == EXIT_BLOCK_PTR;
608 e = e->pred_next)
610 rtx insn;
612 if (e->dest != EXIT_BLOCK_PTR || e->succ_next != NULL)
613 continue;
615 /* Walk forwards through the last normal block and see if it
616 does nothing except fall into the exit block. */
617 for (insn = BLOCK_HEAD (n_basic_blocks - 1);
618 insn;
619 insn = NEXT_INSN (insn))
621 rtx set;
622 /* This should only happen once, at the start of this block. */
623 if (GET_CODE (insn) == CODE_LABEL)
624 continue;
626 if (GET_CODE (insn) == NOTE)
627 continue;
629 if (GET_CODE (insn) == INSN
630 && GET_CODE (PATTERN (insn)) == USE)
631 continue;
633 /* Exit block also may contain copy from pseudo containing
634 return value to hard register. */
635 if (GET_CODE (insn) == INSN
636 && (set = single_set (insn))
637 && SET_DEST (set) == current_function_return_rtx
638 && REG_P (SET_SRC (set))
639 && !return_value_pseudo)
641 return_value_pseudo = SET_SRC (set);
642 continue;
645 break;
648 /* If INSN is zero, then the search walked all the way through the
649 block without hitting anything interesting. This block is a
650 valid alternate exit block. */
651 if (insn == NULL)
652 alternate_exit = e->src;
653 else
654 return_value_pseudo = NULL;
657 /* If the function uses ADDRESSOF, we can't (easily) determine
658 at this point if the value will end up on the stack. */
659 current_function_uses_addressof = sequence_uses_addressof (insns);
661 /* Walk the insn chain and find any CALL_PLACEHOLDER insns. We need to
662 select one of the insn sequences attached to each CALL_PLACEHOLDER.
664 The different sequences represent different ways to implement the call,
665 ie, tail recursion, sibling call or normal call.
667 Since we do not create nested CALL_PLACEHOLDERs, the scan
668 continues with the insn that was after a replaced CALL_PLACEHOLDER;
669 we don't rescan the replacement insns. */
670 for (insn = insns; insn; insn = NEXT_INSN (insn))
672 if (GET_CODE (insn) == CALL_INSN
673 && GET_CODE (PATTERN (insn)) == CALL_PLACEHOLDER)
675 int sibcall = (XEXP (PATTERN (insn), 1) != NULL_RTX);
676 int tailrecursion = (XEXP (PATTERN (insn), 2) != NULL_RTX);
677 basic_block call_block = BLOCK_FOR_INSN (insn);
679 /* alloca (until we have stack slot life analysis) inhibits
680 sibling call optimizations, but not tail recursion.
681 Similarly if we use varargs or stdarg since they implicitly
682 may take the address of an argument. */
683 if (current_function_calls_alloca
684 || current_function_varargs || current_function_stdarg)
685 sibcall = 0;
687 /* See if there are any reasons we can't perform either sibling or
688 tail call optimizations. We must be careful with stack slots
689 which are live at potential optimization sites. ??? The first
690 test is overly conservative and should be replaced. */
691 if (frame_offset
692 /* Can't take address of local var if used by recursive call. */
693 || current_function_uses_addressof
694 /* Any function that calls setjmp might have longjmp called from
695 any called function. ??? We really should represent this
696 properly in the CFG so that this needn't be special cased. */
697 || current_function_calls_setjmp
698 /* Can't if more than one successor or single successor is not
699 exit block. These two tests prevent tail call optimization
700 in the presense of active exception handlers. */
701 || call_block->succ == NULL
702 || call_block->succ->succ_next != NULL
703 || (call_block->succ->dest != EXIT_BLOCK_PTR
704 && call_block->succ->dest != alternate_exit)
705 /* If this call doesn't end the block, there are operations at
706 the end of the block which we must execute after returning. */
707 || ! call_ends_block_p (insn, call_block->end))
708 sibcall = 0, tailrecursion = 0;
710 /* Select a set of insns to implement the call and emit them.
711 Tail recursion is the most efficient, so select it over
712 a tail/sibling call. */
713 if (sibcall)
714 successful_sibling_call = 1;
716 replaced_call_placeholder = 1;
717 replace_call_placeholder (insn,
718 tailrecursion != 0
719 ? sibcall_use_tail_recursion
720 : sibcall != 0
721 ? sibcall_use_sibcall
722 : sibcall_use_normal);
726 if (successful_sibling_call)
728 rtx insn;
730 /* A sibling call sequence invalidates any REG_EQUIV notes made for
731 this function's incoming arguments.
733 At the start of RTL generation we know the only REG_EQUIV notes
734 in the rtl chain are those for incoming arguments, so we can safely
735 flush any REG_EQUIV note.
737 This is (slight) overkill. We could keep track of the highest
738 argument we clobber and be more selective in removing notes, but it
739 does not seem to be worth the effort. */
740 purge_reg_equiv_notes ();
742 /* A sibling call sequence also may invalidate RTX_UNCHANGING_P
743 flag of some incoming arguments MEM RTLs, because it can write into
744 those slots. We clear all those bits now.
746 This is (slight) overkill, we could keep track of which arguments
747 we actually write into. */
748 for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
750 if (GET_CODE (insn) == NOTE)
752 if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG)
753 break;
755 else if (INSN_P (insn))
756 purge_mem_unchanging_flag (PATTERN (insn));
760 /* There may have been NOTE_INSN_BLOCK_{BEGIN,END} notes in the
761 CALL_PLACEHOLDER alternatives that we didn't emit. Rebuild the
762 lexical block tree to correspond to the notes that still exist. */
763 if (replaced_call_placeholder)
764 reorder_blocks ();
766 /* This information will be invalid after inline expansion. Kill it now. */
767 free_basic_block_vars (0);