1 /* Control flow graph building code for GNU compiler.
2 Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 /* find_basic_blocks divides the current function's rtl into basic
23 blocks and constructs the CFG. The blocks are recorded in the
24 basic_block_info array; the CFG exists in the edge structures
25 referenced by the blocks.
27 find_basic_blocks also finds any unreachable loops and deletes them.
29 Available functionality:
32 - Local CFG construction
33 find_sub_basic_blocks */
39 #include "hard-reg-set.h"
40 #include "basic-block.h"
49 static int count_basic_blocks
PARAMS ((rtx
));
50 static void find_basic_blocks_1
PARAMS ((rtx
));
51 static rtx find_label_refs
PARAMS ((rtx
, rtx
));
52 static void make_edges
PARAMS ((rtx
, basic_block
,
54 static void make_label_edge
PARAMS ((sbitmap
*, basic_block
,
56 static void make_eh_edge
PARAMS ((sbitmap
*, basic_block
, rtx
));
57 static void find_bb_boundaries
PARAMS ((basic_block
));
58 static void compute_outgoing_frequencies
PARAMS ((basic_block
));
59 static bool inside_basic_block_p
PARAMS ((rtx
));
60 static bool control_flow_insn_p
PARAMS ((rtx
));
62 /* Return true if insn is something that should be contained inside basic
66 inside_basic_block_p (insn
)
69 switch (GET_CODE (insn
))
72 /* Avoid creating of basic block for jumptables. */
73 return (NEXT_INSN (insn
) == 0
74 || GET_CODE (NEXT_INSN (insn
)) != JUMP_INSN
75 || (GET_CODE (PATTERN (NEXT_INSN (insn
))) != ADDR_VEC
76 && GET_CODE (PATTERN (NEXT_INSN (insn
))) != ADDR_DIFF_VEC
));
79 return (GET_CODE (PATTERN (insn
)) != ADDR_VEC
80 && GET_CODE (PATTERN (insn
)) != ADDR_DIFF_VEC
);
95 /* Return true if INSN may cause control flow transfer, so it should be last in
99 control_flow_insn_p (insn
)
104 switch (GET_CODE (insn
))
111 /* Jump insn always causes control transfer except for tablejumps. */
112 return (GET_CODE (PATTERN (insn
)) != ADDR_VEC
113 && GET_CODE (PATTERN (insn
)) != ADDR_DIFF_VEC
);
116 /* Call insn may return to the nonlocal goto handler. */
117 return ((nonlocal_goto_handler_labels
118 && (0 == (note
= find_reg_note (insn
, REG_EH_REGION
,
120 || INTVAL (XEXP (note
, 0)) >= 0))
122 || can_throw_internal (insn
));
125 return (flag_non_call_exceptions
&& can_throw_internal (insn
));
128 /* It is nonsence to reach barrier when looking for the
129 end of basic block, but before dead code is eliminated
138 /* Count the basic blocks of the function. */
141 count_basic_blocks (f
)
145 bool saw_insn
= false;
148 for (insn
= f
; insn
; insn
= NEXT_INSN (insn
))
150 /* Code labels and barriers causes curent basic block to be
151 terminated at previous real insn. */
152 if ((GET_CODE (insn
) == CODE_LABEL
|| GET_CODE (insn
) == BARRIER
)
154 count
++, saw_insn
= false;
156 /* Start basic block if needed. */
157 if (!saw_insn
&& inside_basic_block_p (insn
))
160 /* Control flow insn causes current basic block to be terminated. */
161 if (saw_insn
&& control_flow_insn_p (insn
))
162 count
++, saw_insn
= false;
168 /* The rest of the compiler works a bit smoother when we don't have to
169 check for the edge case of do-nothing functions with no basic blocks. */
172 emit_insn (gen_rtx_USE (VOIDmode
, const0_rtx
));
179 /* Scan a list of insns for labels referred to other than by jumps.
180 This is used to scan the alternatives of a call placeholder. */
183 find_label_refs (f
, lvl
)
189 for (insn
= f
; insn
; insn
= NEXT_INSN (insn
))
190 if (INSN_P (insn
) && GET_CODE (insn
) != JUMP_INSN
)
194 /* Make a list of all labels referred to other than by jumps
195 (which just don't have the REG_LABEL notes).
197 Make a special exception for labels followed by an ADDR*VEC,
198 as this would be a part of the tablejump setup code.
200 Make a special exception to registers loaded with label
201 values just before jump insns that use them. */
203 for (note
= REG_NOTES (insn
); note
; note
= XEXP (note
, 1))
204 if (REG_NOTE_KIND (note
) == REG_LABEL
)
206 rtx lab
= XEXP (note
, 0), next
;
208 if ((next
= next_nonnote_insn (lab
)) != NULL
209 && GET_CODE (next
) == JUMP_INSN
210 && (GET_CODE (PATTERN (next
)) == ADDR_VEC
211 || GET_CODE (PATTERN (next
)) == ADDR_DIFF_VEC
))
213 else if (GET_CODE (lab
) == NOTE
)
215 else if (GET_CODE (NEXT_INSN (insn
)) == JUMP_INSN
216 && find_reg_note (NEXT_INSN (insn
), REG_LABEL
, lab
))
219 lvl
= alloc_EXPR_LIST (0, XEXP (note
, 0), lvl
);
226 /* Create an edge between two basic blocks. FLAGS are auxiliary information
227 about the edge that is accumulated between calls. */
229 /* Create an edge from a basic block to a label. */
232 make_label_edge (edge_cache
, src
, label
, flags
)
238 if (GET_CODE (label
) != CODE_LABEL
)
241 /* If the label was never emitted, this insn is junk, but avoid a
242 crash trying to refer to BLOCK_FOR_INSN (label). This can happen
243 as a result of a syntax error and a diagnostic has already been
246 if (INSN_UID (label
) == 0)
249 cached_make_edge (edge_cache
, src
, BLOCK_FOR_INSN (label
), flags
);
252 /* Create the edges generated by INSN in REGION. */
255 make_eh_edge (edge_cache
, src
, insn
)
260 int is_call
= GET_CODE (insn
) == CALL_INSN
? EDGE_ABNORMAL_CALL
: 0;
263 handlers
= reachable_handlers (insn
);
265 for (i
= handlers
; i
; i
= XEXP (i
, 1))
266 make_label_edge (edge_cache
, src
, XEXP (i
, 0),
267 EDGE_ABNORMAL
| EDGE_EH
| is_call
);
269 free_INSN_LIST_list (&handlers
);
272 /* Identify the edges between basic blocks MIN to MAX.
274 NONLOCAL_LABEL_LIST is a list of non-local labels in the function. Blocks
275 that are otherwise unreachable may be reachable with a non-local goto.
277 BB_EH_END is an array indexed by basic block number in which we record
278 the list of exception regions active at the end of the basic block. */
281 make_edges (label_value_list
, min
, max
, update_p
)
282 rtx label_value_list
;
283 basic_block min
, max
;
287 sbitmap
*edge_cache
= NULL
;
289 /* Assume no computed jump; revise as we create edges. */
290 current_function_has_computed_jump
= 0;
292 /* Heavy use of computed goto in machine-generated code can lead to
293 nearly fully-connected CFGs. In that case we spend a significant
294 amount of time searching the edge lists for duplicates. */
295 if (forced_labels
|| label_value_list
|| cfun
->max_jumptable_ents
> 100)
297 edge_cache
= sbitmap_vector_alloc (last_basic_block
, last_basic_block
);
298 sbitmap_vector_zero (edge_cache
, last_basic_block
);
301 FOR_BB_BETWEEN (bb
, min
, max
->next_bb
, next_bb
)
305 for (e
= bb
->succ
; e
; e
= e
->succ_next
)
306 if (e
->dest
!= EXIT_BLOCK_PTR
)
307 SET_BIT (edge_cache
[bb
->index
], e
->dest
->index
);
311 /* By nature of the way these get numbered, ENTRY_BLOCK_PTR->next_bb block
312 is always the entry. */
313 if (min
== ENTRY_BLOCK_PTR
->next_bb
)
314 cached_make_edge (edge_cache
, ENTRY_BLOCK_PTR
, min
,
317 FOR_BB_BETWEEN (bb
, min
, max
->next_bb
, next_bb
)
321 int force_fallthru
= 0;
323 if (GET_CODE (bb
->head
) == CODE_LABEL
&& LABEL_ALT_ENTRY_P (bb
->head
))
324 cached_make_edge (NULL
, ENTRY_BLOCK_PTR
, bb
, 0);
326 /* Examine the last instruction of the block, and discover the
327 ways we can leave the block. */
330 code
= GET_CODE (insn
);
333 if (code
== JUMP_INSN
)
337 /* Recognize exception handling placeholders. */
338 if (GET_CODE (PATTERN (insn
)) == RESX
)
339 make_eh_edge (edge_cache
, bb
, insn
);
341 /* Recognize a non-local goto as a branch outside the
343 else if (find_reg_note (insn
, REG_NON_LOCAL_GOTO
, NULL_RTX
))
346 /* ??? Recognize a tablejump and do the right thing. */
347 else if ((tmp
= JUMP_LABEL (insn
)) != NULL_RTX
348 && (tmp
= NEXT_INSN (tmp
)) != NULL_RTX
349 && GET_CODE (tmp
) == JUMP_INSN
350 && (GET_CODE (PATTERN (tmp
)) == ADDR_VEC
351 || GET_CODE (PATTERN (tmp
)) == ADDR_DIFF_VEC
))
356 if (GET_CODE (PATTERN (tmp
)) == ADDR_VEC
)
357 vec
= XVEC (PATTERN (tmp
), 0);
359 vec
= XVEC (PATTERN (tmp
), 1);
361 for (j
= GET_NUM_ELEM (vec
) - 1; j
>= 0; --j
)
362 make_label_edge (edge_cache
, bb
,
363 XEXP (RTVEC_ELT (vec
, j
), 0), 0);
365 /* Some targets (eg, ARM) emit a conditional jump that also
366 contains the out-of-range target. Scan for these and
367 add an edge if necessary. */
368 if ((tmp
= single_set (insn
)) != NULL
369 && SET_DEST (tmp
) == pc_rtx
370 && GET_CODE (SET_SRC (tmp
)) == IF_THEN_ELSE
371 && GET_CODE (XEXP (SET_SRC (tmp
), 2)) == LABEL_REF
)
372 make_label_edge (edge_cache
, bb
,
373 XEXP (XEXP (SET_SRC (tmp
), 2), 0), 0);
375 #ifdef CASE_DROPS_THROUGH
376 /* Silly VAXen. The ADDR_VEC is going to be in the way of
377 us naturally detecting fallthru into the next block. */
382 /* If this is a computed jump, then mark it as reaching
383 everything on the label_value_list and forced_labels list. */
384 else if (computed_jump_p (insn
))
386 current_function_has_computed_jump
= 1;
388 for (x
= label_value_list
; x
; x
= XEXP (x
, 1))
389 make_label_edge (edge_cache
, bb
, XEXP (x
, 0), EDGE_ABNORMAL
);
391 for (x
= forced_labels
; x
; x
= XEXP (x
, 1))
392 make_label_edge (edge_cache
, bb
, XEXP (x
, 0), EDGE_ABNORMAL
);
395 /* Returns create an exit out. */
396 else if (returnjump_p (insn
))
397 cached_make_edge (edge_cache
, bb
, EXIT_BLOCK_PTR
, 0);
399 /* Otherwise, we have a plain conditional or unconditional jump. */
402 if (! JUMP_LABEL (insn
))
404 make_label_edge (edge_cache
, bb
, JUMP_LABEL (insn
), 0);
408 /* If this is a sibling call insn, then this is in effect a combined call
409 and return, and so we need an edge to the exit block. No need to
410 worry about EH edges, since we wouldn't have created the sibling call
411 in the first place. */
412 if (code
== CALL_INSN
&& SIBLING_CALL_P (insn
))
413 cached_make_edge (edge_cache
, bb
, EXIT_BLOCK_PTR
,
414 EDGE_ABNORMAL
| EDGE_ABNORMAL_CALL
);
416 /* If this is a CALL_INSN, then mark it as reaching the active EH
417 handler for this CALL_INSN. If we're handling non-call
418 exceptions then any insn can reach any of the active handlers.
419 Also mark the CALL_INSN as reaching any nonlocal goto handler. */
420 else if (code
== CALL_INSN
|| flag_non_call_exceptions
)
422 /* Add any appropriate EH edges. */
423 make_eh_edge (edge_cache
, bb
, insn
);
425 if (code
== CALL_INSN
&& nonlocal_goto_handler_labels
)
427 /* ??? This could be made smarter: in some cases it's possible
428 to tell that certain calls will not do a nonlocal goto.
429 For example, if the nested functions that do the nonlocal
430 gotos do not have their addresses taken, then only calls to
431 those functions or to other nested functions that use them
432 could possibly do nonlocal gotos. */
434 /* We do know that a REG_EH_REGION note with a value less
435 than 0 is guaranteed not to perform a non-local goto. */
436 rtx note
= find_reg_note (insn
, REG_EH_REGION
, NULL_RTX
);
438 if (!note
|| INTVAL (XEXP (note
, 0)) >= 0)
439 for (x
= nonlocal_goto_handler_labels
; x
; x
= XEXP (x
, 1))
440 make_label_edge (edge_cache
, bb
, XEXP (x
, 0),
441 EDGE_ABNORMAL
| EDGE_ABNORMAL_CALL
);
445 /* Find out if we can drop through to the next block. */
446 insn
= next_nonnote_insn (insn
);
447 if (!insn
|| (bb
->next_bb
== EXIT_BLOCK_PTR
&& force_fallthru
))
448 cached_make_edge (edge_cache
, bb
, EXIT_BLOCK_PTR
, EDGE_FALLTHRU
);
449 else if (bb
->next_bb
!= EXIT_BLOCK_PTR
)
451 rtx tmp
= bb
->next_bb
->head
;
452 if (GET_CODE (tmp
) == NOTE
)
453 tmp
= next_nonnote_insn (tmp
);
454 if (force_fallthru
|| insn
== tmp
)
455 cached_make_edge (edge_cache
, bb
, bb
->next_bb
, EDGE_FALLTHRU
);
460 sbitmap_vector_free (edge_cache
);
463 /* Find all basic blocks of the function whose first insn is F.
465 Collect and return a list of labels whose addresses are taken. This
466 will be used in make_edges for use with computed gotos. */
469 find_basic_blocks_1 (f
)
473 rtx bb_note
= NULL_RTX
;
478 basic_block prev
= ENTRY_BLOCK_PTR
;
480 /* We process the instructions in a slightly different way than we did
481 previously. This is so that we see a NOTE_BASIC_BLOCK after we have
482 closed out the previous block, so that it gets attached at the proper
483 place. Since this form should be equivalent to the previous,
484 count_basic_blocks continues to use the old form as a check. */
486 for (insn
= f
; insn
; insn
= next
)
488 enum rtx_code code
= GET_CODE (insn
);
490 next
= NEXT_INSN (insn
);
492 if ((GET_CODE (insn
) == CODE_LABEL
|| GET_CODE (insn
) == BARRIER
)
495 prev
= create_basic_block_structure (head
, end
, bb_note
, prev
);
496 head
= end
= NULL_RTX
;
500 if (inside_basic_block_p (insn
))
502 if (head
== NULL_RTX
)
507 if (head
&& control_flow_insn_p (insn
))
509 prev
= create_basic_block_structure (head
, end
, bb_note
, prev
);
510 head
= end
= NULL_RTX
;
518 int kind
= NOTE_LINE_NUMBER (insn
);
520 /* Look for basic block notes with which to keep the
521 basic_block_info pointers stable. Unthread the note now;
522 we'll put it back at the right place in create_basic_block.
523 Or not at all if we've already found a note in this block. */
524 if (kind
== NOTE_INSN_BASIC_BLOCK
)
526 if (bb_note
== NULL_RTX
)
529 next
= delete_insn (insn
);
541 if (GET_CODE (PATTERN (insn
)) == CALL_PLACEHOLDER
)
543 /* Scan each of the alternatives for label refs. */
544 lvl
= find_label_refs (XEXP (PATTERN (insn
), 0), lvl
);
545 lvl
= find_label_refs (XEXP (PATTERN (insn
), 1), lvl
);
546 lvl
= find_label_refs (XEXP (PATTERN (insn
), 2), lvl
);
547 /* Record its tail recursion label, if any. */
548 if (XEXP (PATTERN (insn
), 3) != NULL_RTX
)
549 trll
= alloc_EXPR_LIST (0, XEXP (PATTERN (insn
), 3), trll
);
557 if (GET_CODE (insn
) == INSN
|| GET_CODE (insn
) == CALL_INSN
)
561 /* Make a list of all labels referred to other than by jumps.
563 Make a special exception for labels followed by an ADDR*VEC,
564 as this would be a part of the tablejump setup code.
566 Make a special exception to registers loaded with label
567 values just before jump insns that use them. */
569 for (note
= REG_NOTES (insn
); note
; note
= XEXP (note
, 1))
570 if (REG_NOTE_KIND (note
) == REG_LABEL
)
572 rtx lab
= XEXP (note
, 0), next
;
574 if ((next
= next_nonnote_insn (lab
)) != NULL
575 && GET_CODE (next
) == JUMP_INSN
576 && (GET_CODE (PATTERN (next
)) == ADDR_VEC
577 || GET_CODE (PATTERN (next
)) == ADDR_DIFF_VEC
))
579 else if (GET_CODE (lab
) == NOTE
)
581 else if (GET_CODE (NEXT_INSN (insn
)) == JUMP_INSN
582 && find_reg_note (NEXT_INSN (insn
), REG_LABEL
, lab
))
585 lvl
= alloc_EXPR_LIST (0, XEXP (note
, 0), lvl
);
590 if (head
!= NULL_RTX
)
591 create_basic_block_structure (head
, end
, bb_note
, prev
);
593 delete_insn (bb_note
);
595 if (last_basic_block
!= n_basic_blocks
)
598 label_value_list
= lvl
;
599 tail_recursion_label_list
= trll
;
600 clear_aux_for_blocks ();
604 /* Find basic blocks of the current function.
605 F is the first insn of the function and NREGS the number of register
609 find_basic_blocks (f
, nregs
, file
)
611 int nregs ATTRIBUTE_UNUSED
;
612 FILE *file ATTRIBUTE_UNUSED
;
616 timevar_push (TV_CFG
);
618 /* Flush out existing data. */
619 if (basic_block_info
!= NULL
)
623 /* Clear bb->aux on all extant basic blocks. We'll use this as a
624 tag for reuse during create_basic_block, just in case some pass
625 copies around basic block notes improperly. */
629 VARRAY_FREE (basic_block_info
);
632 n_basic_blocks
= count_basic_blocks (f
);
633 last_basic_block
= 0;
634 ENTRY_BLOCK_PTR
->next_bb
= EXIT_BLOCK_PTR
;
635 EXIT_BLOCK_PTR
->prev_bb
= ENTRY_BLOCK_PTR
;
637 /* Size the basic block table. The actual structures will be allocated
638 by find_basic_blocks_1, since we want to keep the structure pointers
639 stable across calls to find_basic_blocks. */
640 /* ??? This whole issue would be much simpler if we called find_basic_blocks
641 exactly once, and thereafter we don't have a single long chain of
642 instructions at all until close to the end of compilation when we
643 actually lay them out. */
645 VARRAY_BB_INIT (basic_block_info
, n_basic_blocks
, "basic_block_info");
647 find_basic_blocks_1 (f
);
649 /* Discover the edges of our cfg. */
650 make_edges (label_value_list
, ENTRY_BLOCK_PTR
->next_bb
, EXIT_BLOCK_PTR
->prev_bb
, 0);
652 /* Do very simple cleanup now, for the benefit of code that runs between
653 here and cleanup_cfg, e.g. thread_prologue_and_epilogue_insns. */
654 tidy_fallthru_edges ();
656 #ifdef ENABLE_CHECKING
659 timevar_pop (TV_CFG
);
662 /* State of basic block as seen by find_sub_basic_blocks. */
663 enum state
{BLOCK_NEW
= 0, BLOCK_ORIGINAL
, BLOCK_TO_SPLIT
};
665 #define STATE(BB) (enum state) ((size_t) (BB)->aux)
666 #define SET_STATE(BB, STATE) ((BB)->aux = (void *) (size_t) (STATE))
668 /* Scan basic block BB for possible BB boundaries inside the block
669 and create new basic blocks in the progress. */
672 find_bb_boundaries (bb
)
677 rtx flow_transfer_insn
= NULL_RTX
;
678 edge fallthru
= NULL
;
683 if (GET_CODE (insn
) == CODE_LABEL
)
684 insn
= NEXT_INSN (insn
);
686 /* Scan insn chain and try to find new basic block boundaries. */
689 enum rtx_code code
= GET_CODE (insn
);
691 /* On code label, split current basic block. */
692 if (code
== CODE_LABEL
)
694 fallthru
= split_block (bb
, PREV_INSN (insn
));
695 if (flow_transfer_insn
)
696 bb
->end
= flow_transfer_insn
;
699 remove_edge (fallthru
);
700 flow_transfer_insn
= NULL_RTX
;
701 if (LABEL_ALT_ENTRY_P (insn
))
702 make_edge (ENTRY_BLOCK_PTR
, bb
, 0);
705 /* In case we've previously seen an insn that effects a control
706 flow transfer, split the block. */
707 if (flow_transfer_insn
&& inside_basic_block_p (insn
))
709 fallthru
= split_block (bb
, PREV_INSN (insn
));
710 bb
->end
= flow_transfer_insn
;
712 remove_edge (fallthru
);
713 flow_transfer_insn
= NULL_RTX
;
716 if (control_flow_insn_p (insn
))
717 flow_transfer_insn
= insn
;
720 insn
= NEXT_INSN (insn
);
723 /* In case expander replaced normal insn by sequence terminating by
724 return and barrier, or possibly other sequence not behaving like
725 ordinary jump, we need to take care and move basic block boundary. */
726 if (flow_transfer_insn
)
727 bb
->end
= flow_transfer_insn
;
729 /* We've possibly replaced the conditional jump by conditional jump
730 followed by cleanup at fallthru edge, so the outgoing edges may
732 purge_dead_edges (bb
);
735 /* Assume that frequency of basic block B is known. Compute frequencies
736 and probabilities of outgoing edges. */
739 compute_outgoing_frequencies (b
)
744 if (b
->succ
&& b
->succ
->succ_next
&& !b
->succ
->succ_next
->succ_next
)
746 rtx note
= find_reg_note (b
->end
, REG_BR_PROB
, NULL
);
752 probability
= INTVAL (XEXP (find_reg_note (b
->end
,
756 e
->probability
= probability
;
757 e
->count
= ((b
->count
* probability
+ REG_BR_PROB_BASE
/ 2)
759 f
= FALLTHRU_EDGE (b
);
760 f
->probability
= REG_BR_PROB_BASE
- probability
;
761 f
->count
= b
->count
- e
->count
;
764 if (b
->succ
&& !b
->succ
->succ_next
)
767 e
->probability
= REG_BR_PROB_BASE
;
772 /* Assume that someone emitted code with control flow instructions to the
773 basic block. Update the data structure. */
776 find_many_sub_basic_blocks (blocks
)
779 basic_block bb
, min
, max
;
783 TEST_BIT (blocks
, bb
->index
) ? BLOCK_TO_SPLIT
: BLOCK_ORIGINAL
);
786 if (STATE (bb
) == BLOCK_TO_SPLIT
)
787 find_bb_boundaries (bb
);
790 if (STATE (bb
) != BLOCK_ORIGINAL
)
794 for (; bb
!= EXIT_BLOCK_PTR
; bb
= bb
->next_bb
)
795 if (STATE (bb
) != BLOCK_ORIGINAL
)
798 /* Now re-scan and wire in all edges. This expect simple (conditional)
799 jumps at the end of each new basic blocks. */
800 make_edges (NULL
, min
, max
, 1);
802 /* Update branch probabilities. Expect only (un)conditional jumps
803 to be created with only the forward edges. */
804 FOR_BB_BETWEEN (bb
, min
, max
->next_bb
, next_bb
)
808 if (STATE (bb
) == BLOCK_ORIGINAL
)
810 if (STATE (bb
) == BLOCK_NEW
)
814 for (e
= bb
->pred
; e
; e
=e
->pred_next
)
816 bb
->count
+= e
->count
;
817 bb
->frequency
+= EDGE_FREQUENCY (e
);
821 compute_outgoing_frequencies (bb
);
828 /* Like above but for single basic block only. */
831 find_sub_basic_blocks (bb
)
834 basic_block min
, max
, b
;
835 basic_block next
= bb
->next_bb
;
838 find_bb_boundaries (bb
);
841 /* Now re-scan and wire in all edges. This expect simple (conditional)
842 jumps at the end of each new basic blocks. */
843 make_edges (NULL
, min
, max
, 1);
845 /* Update branch probabilities. Expect only (un)conditional jumps
846 to be created with only the forward edges. */
847 FOR_BB_BETWEEN (b
, min
, max
->next_bb
, next_bb
)
855 for (e
= b
->pred
; e
; e
=e
->pred_next
)
857 b
->count
+= e
->count
;
858 b
->frequency
+= EDGE_FREQUENCY (e
);
862 compute_outgoing_frequencies (b
);