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

Data Structures

struct  htab_bb_copy_original_entry
struct  bb_copy_hasher

Functions

void init_flow ()
static void free_edge ()
void clear_edges ()
basic_block alloc_block ()
void link_block ()
void unlink_block ()
void compact_blocks ()
void expunge_block ()
static void connect_src ()
static void connect_dest ()
static void disconnect_src ()
static void disconnect_dest ()
edge unchecked_make_edge ()
edge cached_make_edge ()
edge make_edge ()
edge make_single_succ_edge ()
void remove_edge_raw ()
void redirect_edge_succ ()
void redirect_edge_pred ()
void clear_bb_flags ()
static void check_bb_profile ()
void dump_edge_info ()
DEBUG_FUNCTION void debug ()
static void alloc_aux_for_block ()
void alloc_aux_for_blocks ()
void clear_aux_for_blocks ()
void free_aux_for_blocks ()
void alloc_aux_for_edge ()
void alloc_aux_for_edges ()
void clear_aux_for_edges ()
void free_aux_for_edges ()
DEBUG_FUNCTION void debug_bb ()
DEBUG_FUNCTION basic_block debug_bb_n ()
void dump_bb_info (FILE *outf, basic_block bb, int indent, int flags, bool do_header, bool do_footer)
void brief_dump_cfg ()
void update_bb_profile_for_threading (basic_block bb, int edge_frequency, gcov_type count, edge taken_edge)
void scale_bbs_frequencies_int ()
void scale_bbs_frequencies_gcov_type (basic_block *bbs, int nbbs, gcov_type num, gcov_type den)
void initialize_original_copy_tables ()
void free_original_copy_tables ()
static void copy_original_table_clear ()
static void copy_original_table_set (hash_table< bb_copy_hasher > tab, unsigned obj, unsigned val)
void set_bb_original ()
basic_block get_bb_original ()
void set_bb_copy ()
basic_block get_bb_copy ()
void set_loop_copy ()
struct loopget_loop_copy ()

Variables

static struct obstack block_aux_obstack
static void * first_block_aux_obj = 0
static struct obstack edge_aux_obstack
static void * first_edge_aux_obj = 0
static hash_table< bb_copy_hasherbb_original
static hash_table< bb_copy_hasherbb_copy
static hash_table< bb_copy_hasherloop_copy
static alloc_pool original_copy_bb_pool

Function Documentation

static void alloc_aux_for_block ( )
static
Allocate a memory block of SIZE as BB->aux.  The obstack must
   be first initialized by alloc_aux_for_blocks.   

References basic_block_def::aux, block_aux_obstack, and memset().

Referenced by alloc_aux_for_blocks().

void alloc_aux_for_blocks ( )
Initialize the block_aux_obstack and if SIZE is nonzero, call
   alloc_aux_for_block for each basic block.   

References alloc_aux_for_block(), block_aux_obstack, and initialized.

void alloc_aux_for_edge ( )
Allocate a memory edge of SIZE as E->aux.  The obstack must
   be first initialized by alloc_aux_for_edges.   

References edge_def::aux, edge_aux_obstack, and memset().

void alloc_aux_for_edges ( )
Initialize the edge_aux_obstack and if SIZE is nonzero, call
   alloc_aux_for_edge for each basic edge.   

References alloc_aux_for_edge(), edge_aux_obstack, initialized, and basic_block_def::succs.

basic_block alloc_block ( void  )
Allocate memory for basic_block.   

Referenced by create_basic_block_structure(), create_bb(), and make_new_block().

void brief_dump_cfg ( )
Dumps a brief description of cfg to FILE.   

References dump_bb_info().

edge cached_make_edge ( )
Create an edge connecting SRC and DST with FLAGS optionally using
   edge cache CACHE.  Return the new edge, NULL if already exist.   

References bitmap_bit_p(), bitmap_set_bit(), find_edge(), edge_def::flags, basic_block_def::index, make_edge(), and unchecked_make_edge().

static void check_bb_profile ( )
static
Check the consistency of profile information.  We can't do that
   in verify_flow_info, as the counts may get invalid for incompletely
   solved graphs, later eliminating of conditionals or roundoff errors.
   It is still practical to have them reported for debugging of simple
   testcases.   

References edge_def::count, basic_block_def::count, current_function_decl, basic_block_def::frequency, indent, memset(), basic_block_def::preds, edge_def::probability, PROFILE_ABSENT, and basic_block_def::succs.

Referenced by dump_bb_info().

void clear_aux_for_edges ( void  )
void clear_bb_flags ( void  )
Clear all basic block flags that do not have to be preserved.   

References basic_block_def::flags.

Referenced by combine_instructions(), duplicate_computed_gotos(), and try_optimize_cfg().

void clear_edges ( void  )
Free the memory associated with the edge structures.   

References free_edge(), basic_block_def::preds, basic_block_def::succs, and vec_safe_truncate().

Referenced by release_function_body().

void compact_blocks ( void  )
Sequentially order blocks and compact the arrays.   

References df, df_compact_blocks(), and basic_block_def::index.

Referenced by analyze_function(), branch_prob(), cleanup_cfg(), cleanup_tree_cfg_noloop(), and relink_block_chain().

static void connect_dest ( )
inlinestatic
static void connect_src ( )
inlinestatic
static void copy_original_table_clear ( )
static
static void copy_original_table_set ( hash_table< bb_copy_hasher tab,
unsigned  obj,
unsigned  val 
)
static
Sets the value associated with OBJ in table TAB to VAL.
   Do nothing when data structures are not initialized.   

References hash_table< Descriptor, Allocator >::find_slot(), htab_bb_copy_original_entry::index1, and pool_alloc().

Referenced by set_bb_copy(), set_bb_original(), and set_loop_copy().

DEBUG_FUNCTION void debug ( )

References dump_edge_info().

DEBUG_FUNCTION void debug_bb ( )

References dump_bb(), and dump_flags.

DEBUG_FUNCTION basic_block debug_bb_n ( )

References debug_bb().

static void disconnect_dest ( )
inlinestatic
Disconnect edge E from E->dest.   

References edge_def::dest, edge_def::dest_idx, df_mark_solutions_dirty(), and basic_block_def::preds.

Referenced by redirect_edge_succ(), and remove_edge_raw().

static void disconnect_src ( )
inlinestatic
void dump_bb_info ( FILE *  outf,
basic_block  bb,
int  indent,
int  flags,
bool  do_header,
bool  do_footer 
)
Dumps cfg related information about basic block BB to OUTF.
   If HEADER is true, dump things that appear before the instructions
   contained in BB.  If FOOTER is true, dump things that appear after.
   Flags are the TDF_* masks as documented in dumpfile.h.
   NB: With TDF_DETAILS, it is assumed that cfun is available, so
   that maybe_hot_bb_p and probably_never_executed_bb_p don't ICE.   

References bb_loop_depth(), check_bb_profile(), basic_block_def::count, current_function_decl, dump_edge_info(), first, basic_block_def::flags, basic_block_def::frequency, HOST_WIDEST_INT, HOST_WIDEST_INT_PRINT_DEC, indent, basic_block_def::index, maybe_hot_bb_p(), memset(), basic_block_def::next_bb, basic_block_def::preds, basic_block_def::prev_bb, probably_never_executed_bb_p(), and basic_block_def::succs.

Referenced by brief_dump_cfg(), dump_bb(), and print_rtl_with_bb().

void expunge_block ( )
Remove block B from the basic block array.   

References basic_block_def::index, and unlink_block().

void free_aux_for_blocks ( void  )
Free data allocated in block_aux_obstack and clear AUX pointers
   of all blocks.   

References block_aux_obstack, and clear_aux_for_blocks().

Referenced by compute_branch_probabilities(), delete_worklist(), estimate_bb_frequencies(), fini_pre(), one_code_hoisting_pass(), reg_to_stack(), and vt_finalize().

void free_aux_for_edges ( void  )
Free data allocated in edge_aux_obstack and clear AUX pointers
   of all edges.   

References clear_aux_for_edges(), and edge_aux_obstack.

Referenced by branch_prob(), estimate_bb_frequencies(), and tree_ssa_lim_finalize().

static void free_edge ( )
static
Helper function for remove_edge and clear_edges.  Frees edge structure
   without actually removing it from the pred/succ arrays.   

References ggc_free().

Referenced by clear_edges(), and remove_edge_raw().

void init_flow ( )
Called once at initialization time.   
void link_block ( )
Link block B to chain after AFTER.   

References basic_block_def::next_bb, and basic_block_def::prev_bb.

edge make_edge ( )
Create an edge connecting SRC and DEST with flags FLAGS.  Return newly
   created edge or NULL if already exist.   

References find_edge(), edge_def::flags, and unchecked_make_edge().

edge make_single_succ_edge ( )
Create an edge connecting SRC to DEST and set probability by knowing
   that it is the single edge leaving SRC.   

References edge_def::count, basic_block_def::count, make_edge(), and edge_def::probability.

void redirect_edge_pred ( )
Redirect an edge's predecessor from one block to another.   

References connect_src(), disconnect_src(), and edge_def::src.

void redirect_edge_succ ( )
Redirect an edge's successor from one block to another.   

References connect_dest(), edge_def::dest, disconnect_dest(), execute_on_growing_pred(), and execute_on_shrinking_pred().

void remove_edge_raw ( )
This function will remove an edge from the flow graph.   

References disconnect_dest(), disconnect_src(), execute_on_shrinking_pred(), free_edge(), and remove_predictions_associated_with_edge().

void scale_bbs_frequencies_gcov_type ( basic_block bbs,
int  nbbs,
gcov_type  num,
gcov_type  den 
)
Multiply all frequencies of basic blocks in array BBS of length NBBS
   by NUM/DEN, in gcov_type arithmetic.  More accurate than previous
   function but considerably slower.   

References count, edge_def::count, basic_block_def::count, frequency, and basic_block_def::frequency.

Referenced by gimple_duplicate_sese_region(), and gimple_duplicate_sese_tail().

void scale_bbs_frequencies_int ( )
Multiply all frequencies of basic blocks in array BBS of length NBBS
   by NUM/DEN, in int arithmetic.  May lose some accuracy.   

References count, edge_def::count, basic_block_def::count, frequency, and basic_block_def::frequency.

void set_bb_copy ( )
Set copy for basic block.  Do nothing when data structures are not
   initialized so passes not needing this don't need to care.   

References copy_original_table_set(), and basic_block_def::index.

void set_bb_original ( )
Set original for basic block.  Do nothing when data structures are not
   initialized so passes not needing this don't need to care.   

References copy_original_table_set(), and basic_block_def::index.

void set_loop_copy ( )
Set copy for LOOP to COPY.  Do nothing when data structures are not
   initialized so passes not needing this don't need to care.   

References copy_original_table_clear(), copy_original_table_set(), and loop::num.

edge unchecked_make_edge ( )
Create an edge connecting SRC and DEST with flags FLAGS.  Return newly
   created edge.  Use this only if you are sure that this edge can't
   possibly already exist.   

References connect_dest(), connect_src(), edge_def::dest, execute_on_growing_pred(), edge_def::flags, and edge_def::src.

void unlink_block ( )
Unlink block B from chain.   

References basic_block_def::next_bb, and basic_block_def::prev_bb.

void update_bb_profile_for_threading ( basic_block  bb,
int  edge_frequency,
gcov_type  count,
edge  taken_edge 
)
An edge originally destinating BB of FREQUENCY and COUNT has been proved to
   leave the block by TAKEN_EDGE.  Update profile of BB such that edge E can be
   redirected to destination of TAKEN_EDGE.

   This function may leave the profile inconsistent in the case TAKEN_EDGE
   frequency or count is believed to be lower than FREQUENCY or COUNT
   respectively.   

References count, edge_def::count, basic_block_def::count, edge_def::dest, dump_file, ei_next(), ei_safe_edge(), basic_block_def::frequency, basic_block_def::index, prob, edge_def::probability, edge_def::src, and basic_block_def::succs.

Referenced by thread_block(), thread_single_edge(), and try_forward_edges().


Variable Documentation

hash_table<bb_copy_hasher> bb_original
static
Data structures used to maintain mapping between basic blocks and
   copies.   
struct obstack block_aux_obstack
static
Simple routines to easily allocate AUX fields of basic blocks.   

Referenced by alloc_aux_for_block(), alloc_aux_for_blocks(), and free_aux_for_blocks().

struct obstack edge_aux_obstack
static
void* first_block_aux_obj = 0
static
void* first_edge_aux_obj = 0
static
hash_table<bb_copy_hasher> loop_copy
static
And between loops and copies.   
alloc_pool original_copy_bb_pool
static