GCC Middle and Back End API Reference
cfgbuild.c File Reference

Enumerations

enum  state { BLOCK_NEW = 0, BLOCK_ORIGINAL, BLOCK_TO_SPLIT }

Functions

static void make_edges (basic_block, basic_block, int)
static void make_label_edge (sbitmap, basic_block, rtx, int)
static void find_bb_boundaries (basic_block)
static void compute_outgoing_frequencies (basic_block)
bool inside_basic_block_p ()
bool control_flow_insn_p ()
static void make_label_edge ()
void rtl_make_eh_edge ()
static void make_edges ()
static void mark_tablejump_edge ()
static void purge_dead_tablejump_edges ()
static void find_bb_boundaries ()
static void compute_outgoing_frequencies ()
void find_many_sub_basic_blocks ()

Enumeration Type Documentation

enum state
   States of basic block as seen by find_many_sub_basic_blocks.  
Enumerator:
BLOCK_NEW 
     Basic blocks created via split_block belong to this state.
     make_edges will examine these basic blocks to see if we need to
     create edges going out of them.  
BLOCK_ORIGINAL 
     Basic blocks that do not need examining belong to this state.
     These blocks will be left intact.  In particular, make_edges will
     not create edges going out of these basic blocks.  
BLOCK_TO_SPLIT 
     Basic blocks that may need splitting (due to a label appearing in
     the middle, etc) belong to this state.  After splitting them,
     make_edges will create edges going out of them as needed.  

Function Documentation

static void compute_outgoing_frequencies ( basic_block  )
static
static void compute_outgoing_frequencies ( )
static
    Assume that frequency of basic block B is known.  Compute frequencies
    and probabilities of outgoing edges.  
         We rely on BBs with more than two successors to have sane probabilities
         and do not guess them here. For BBs terminated by switch statements
         expanded to jump-table jump, we have done the right thing during
         expansion. For EH edges, we still guess the probabilities here.  
bool control_flow_insn_p ( )
   Return true if INSN may cause control flow transfer, so it should be last in
   the basic block.  
         Noreturn and sibling call instructions terminate the basic blocks
         (but only if they happen unconditionally).  
         Call insn may return to the nonlocal goto handler.  
         Treat trap instructions like noreturn calls (same provision).  
         It is nonsense to reach this when looking for the
         end of basic block, but before dead code is eliminated
         this may happen.  
static void find_bb_boundaries ( basic_block  )
static
static void find_bb_boundaries ( )
static
   Scan basic block BB for possible BB boundaries inside the block
   and create new basic blocks in the progress.  
     Scan insn chain and try to find new basic block boundaries.  
         In case we've previously seen an insn that effects a control
         flow transfer, split the block.  
                 Clean up the bb field for the insns between the blocks.  
             __builtin_unreachable () may cause a barrier to be emitted in
             the middle of a BB.  We need to split it in the same manner as
             if the barrier were preceded by a control_flow_insn_p insn.  
     In case expander replaced normal insn by sequence terminating by
     return and barrier, or possibly other sequence not behaving like
     ordinary jump, we need to take care and move basic block boundary.  
         Clean up the bb field for the insns that do not belong to BB.  
     We've possibly replaced the conditional jump by conditional jump
     followed by cleanup at fallthru edge, so the outgoing edges may
     be dead.  
     purge_dead_edges doesn't handle tablejump's, but if we have split the
     basic block, we might need to kill some edges.  
void find_many_sub_basic_blocks ( )
   Assume that some pass has inserted labels or control flow
   instructions within a basic block.  Split basic blocks as needed
   and create edges.  
     Now re-scan and wire in all edges.  This expect simple (conditional)
     jumps at the end of each new basic blocks.  
     Update branch probabilities.  Expect only (un)conditional jumps
     to be created with only the forward edges.  
bool inside_basic_block_p ( )
   Return true if insn is something that should be contained inside basic
   block.  
         Avoid creating of basic block for jumptables.  
static void make_edges ( basic_block  ,
basic_block  ,
int   
)
static
@verbatim 

Control flow graph building code for GNU compiler. Copyright (C) 1987-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

static void make_edges ( void  )
static
   Identify the edges going out of basic blocks between MIN and MAX,
   inclusive, that have their states set to BLOCK_NEW or
   BLOCK_TO_SPLIT.

   UPDATE_P should be nonzero if we are updating CFG and zero if we
   are building CFG from scratch.  
     Heavy use of computed goto in machine-generated code can lead to
     nearly fully-connected CFGs.  In that case we spend a significant
     amount of time searching the edge lists for duplicates.  
     By nature of the way these get numbered, ENTRY_BLOCK_PTR->next_bb block
     is always the entry.  
         If we have an edge cache, cache edges going out of BB.  
         Examine the last instruction of the block, and discover the
         ways we can leave the block.  
         A branch.  
             Recognize a non-local goto as a branch outside the
             current function.  
             Recognize a tablejump and do the right thing.  
                 Some targets (eg, ARM) emit a conditional jump that also
                 contains the out-of-range target.  Scan for these and
                 add an edge if necessary.  
             If this is a computed jump, then mark it as reaching
             everything on the forced_labels list.  
             Returns create an exit out.  
             Recognize asm goto and do the right thing.  
             Otherwise, we have a plain conditional or unconditional jump.  
         If this is a sibling call insn, then this is in effect a combined call
         and return, and so we need an edge to the exit block.  No need to
         worry about EH edges, since we wouldn't have created the sibling call
         in the first place.  
         If this is a CALL_INSN, then mark it as reaching the active EH
         handler for this CALL_INSN.  If we're handling non-call
         exceptions then any insn can reach any of the active handlers.
         Also mark the CALL_INSN as reaching any nonlocal goto handler.  
             Add any appropriate EH edges.  
                     ??? This could be made smarter: in some cases it's
                     possible to tell that certain calls will not do a
                     nonlocal goto.  For example, if the nested functions
                     that do the nonlocal gotos do not have their addresses
                     taken, then only calls to those functions or to other
                     nested functions that use them could possibly do
                     nonlocal gotos.  
         Find out if we can drop through to the next block.  

References bitmap_clear(), bitmap_set_bit(), edge_def::dest, basic_block_def::index, and basic_block_def::succs.

static void make_label_edge ( sbitmap  ,
basic_block  ,
rtx  ,
int   
)
static
static void make_label_edge ( )
static
   Create an edge between two basic blocks.  FLAGS are auxiliary information
   about the edge that is accumulated between calls.  
   Create an edge from a basic block to a label.  
     If the label was never emitted, this insn is junk, but avoid a
     crash trying to refer to BLOCK_FOR_INSN (label).  This can happen
     as a result of a syntax error and a diagnostic has already been
     printed.  
static void mark_tablejump_edge ( )
static
     See comment in make_label_edge.  
static void purge_dead_tablejump_edges ( )
static
     Some targets (eg, ARM) emit a conditional jump that also
     contains the out-of-range target.  Scan for these and
     add an edge if necessary.  
void rtl_make_eh_edge ( )
   Create the edges generated by INSN in REGION.  
         During initial rtl generation, use the post_landing_pad.