GCC Middle and Back End API Reference
cfganal.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "cfghooks.h"
#include "timevar.h"
#include "cfganal.h"
#include "cfgloop.h"
#include "diagnostic.h"
Include dependency graph for cfganal.cc:

Data Structures

struct  rpoamdbs_bb_data
 

Macros

#define MARK_VISITED(BB)   ((BB)->flags |= visited)
 
#define UNMARK_VISITED(BB)   ((BB)->flags &= ~visited)
 
#define VISITED_P(BB)   (((BB)->flags & visited) != 0)
 
#define MARK_VISITED(BB)   (bitmap_set_bit (visited, (BB)->index))
 
#define VISITED_P(BB)   (bitmap_bit_p (visited, (BB)->index))
 

Typedefs

typedef auto_vec< int, 2 > scc_exit_vec_t
 

Functions

bool mark_dfs_back_edges (struct function *fun)
 
bool mark_dfs_back_edges (void)
 
void verify_marked_backedges (struct function *fun)
 
void find_unreachable_blocks (void)
 
void verify_no_unreachable_blocks (void)
 
struct edge_listcreate_edge_list (void)
 
void free_edge_list (struct edge_list *elist)
 
DEBUG_FUNCTION void print_edge_list (FILE *f, struct edge_list *elist)
 
DEBUG_FUNCTION void verify_edge_list (FILE *f, struct edge_list *elist)
 
edge find_edge (basic_block pred, basic_block succ)
 
int find_edge_index (struct edge_list *edge_list, basic_block pred, basic_block succ)
 
static void remove_fake_predecessors (basic_block bb)
 
void remove_fake_edges (void)
 
void remove_fake_exit_edges (void)
 
void add_noreturn_fake_exit_edges (void)
 
void connect_infinite_loops_to_exit (void)
 
int post_order_compute (int *post_order, bool include_entry_exit, bool delete_unreachable)
 
basic_block dfs_find_deadend (basic_block bb)
 
int inverted_rev_post_order_compute (struct function *fn, int *rev_post_order, sbitmap *start_points)
 
int pre_and_rev_post_order_compute_fn (struct function *fn, int *pre_order, int *rev_post_order, bool include_entry_exit)
 
int pre_and_rev_post_order_compute (int *pre_order, int *rev_post_order, bool include_entry_exit)
 
static void tag_header (int b, int h, rpoamdbs_bb_data *bb_data)
 
static int cmp_edge_dest_pre (const void *e1_, const void *e2_, void *data_)
 
int rev_post_order_and_mark_dfs_back_seme (struct function *fn, edge entry, bitmap exit_bbs, bool for_iteration, int *rev_post_order, vec< std::pair< int, int > > *toplevel_scc_extents)
 
int dfs_enumerate_from (basic_block bb, int reverse, bool(*predicate)(const_basic_block, const void *), basic_block *rslt, int rslt_max, const void *data)
 
void compute_dominance_frontiers (bitmap_head *frontiers)
 
bitmap compute_idf (bitmap def_blocks, bitmap_head *dfs)
 
void bitmap_intersection_of_succs (sbitmap dst, sbitmap *src, basic_block b)
 
void bitmap_intersection_of_preds (sbitmap dst, sbitmap *src, basic_block b)
 
void bitmap_union_of_succs (sbitmap dst, sbitmap *src, basic_block b)
 
void bitmap_union_of_preds (sbitmap dst, sbitmap *src, basic_block b)
 
basic_blocksingle_pred_before_succ_order (void)
 
edge single_pred_edge_ignoring_loop_edges (basic_block bb, bool ignore_not_executable)
 

Macro Definition Documentation

◆ MARK_VISITED [1/2]

#define MARK_VISITED ( BB)    ((BB)->flags |= visited)

◆ MARK_VISITED [2/2]

#define MARK_VISITED ( BB)    (bitmap_set_bit (visited, (BB)->index))

◆ UNMARK_VISITED

#define UNMARK_VISITED ( BB)    ((BB)->flags &= ~visited)

◆ VISITED_P [1/2]

#define VISITED_P ( BB)    (((BB)->flags & visited) != 0)

◆ VISITED_P [2/2]

#define VISITED_P ( BB)    (bitmap_bit_p (visited, (BB)->index))

Typedef Documentation

◆ scc_exit_vec_t

Per basic-block data for rev_post_order_and_mark_dfs_back_seme,
element of a sparsely populated array indexed by basic-block number.   

Function Documentation

◆ add_noreturn_fake_exit_edges()

void add_noreturn_fake_exit_edges ( void )
This function will add a fake edge between any block which has no
successors, and the exit block. Some data flow equations require these
edges to exist.   

References cfun, EDGE_COUNT, EXIT_BLOCK_PTR_FOR_FN, FOR_EACH_BB_FN, ggc_alloc(), make_single_succ_edge(), and basic_block_def::succs.

Referenced by branch_prob(), cleanup_cfg(), connect_infinite_loops_to_exit(), and one_pre_gcse_pass().

◆ bitmap_intersection_of_preds()

void bitmap_intersection_of_preds ( sbitmap dst,
sbitmap * src,
basic_block b )
Set the bitmap DST to the intersection of SRC of predecessors of
basic block B.   

References b, bitmap_copy(), bitmap_ones(), cfun, EDGE_COUNT, EDGE_PRED, simple_bitmap_def::elms, ENTRY_BLOCK_PTR_FOR_FN, ggc_alloc(), i, NULL, r, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.

Referenced by compute_available().

◆ bitmap_intersection_of_succs()

void bitmap_intersection_of_succs ( sbitmap dst,
sbitmap * src,
basic_block b )
Intersection and union of preds/succs for sbitmap based data flow
solvers.  All four functions defined below take the same arguments:
B is the basic block to perform the operation for.  DST is the
target sbitmap, i.e. the result.  SRC is an sbitmap vector of size
last_basic_block so that it can be indexed with basic block indices.
DST may be (but does not have to be) SRC[B->index].   
Set the bitmap DST to the intersection of SRC of successors of
basic block B.   

References b, bitmap_copy(), bitmap_ones(), cfun, EDGE_COUNT, EDGE_SUCC, simple_bitmap_def::elms, EXIT_BLOCK_PTR_FOR_FN, ggc_alloc(), i, NULL, r, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.

Referenced by compute_antinout_edge(), and compute_code_hoist_vbeinout().

◆ bitmap_union_of_preds()

void bitmap_union_of_preds ( sbitmap dst,
sbitmap * src,
basic_block b )
Set the bitmap DST to the union of SRC of predecessors of
basic block B.   

References b, bitmap_clear(), bitmap_copy(), cfun, EDGE_COUNT, EDGE_PRED, simple_bitmap_def::elms, ENTRY_BLOCK_PTR_FOR_FN, ggc_alloc(), i, r, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.

◆ bitmap_union_of_succs()

void bitmap_union_of_succs ( sbitmap dst,
sbitmap * src,
basic_block b )
Set the bitmap DST to the union of SRC of successors of
basic block B.   

References b, bitmap_clear(), bitmap_copy(), cfun, EDGE_COUNT, EDGE_SUCC, simple_bitmap_def::elms, EXIT_BLOCK_PTR_FOR_FN, ggc_alloc(), i, r, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.

◆ cmp_edge_dest_pre()

static int cmp_edge_dest_pre ( const void * e1_,
const void * e2_,
void * data_ )
static
Comparator for a sort of two edges destinations E1 and E2 after their index
in the PRE array as specified by BB_TO_PRE.   

References ggc_alloc().

Referenced by rev_post_order_and_mark_dfs_back_seme().

◆ compute_dominance_frontiers()

void compute_dominance_frontiers ( bitmap_head * frontiers)
Compute dominance frontiers, ala Harvey, Ferrante, et al.

  This algorithm can be found in Timothy Harvey's PhD thesis, at
  http://www.cs.rice.edu/~harv/dissertation.pdf in the section on iterative
  dominance algorithms.

  First, we identify each join point, j (any node with more than one
  incoming edge is a join point).

  We then examine each predecessor, p, of j and walk up the dominator tree
  starting at p.

  We stop the walk when we reach j's immediate dominator - j is in the
  dominance frontier of each of  the nodes in the walk, except for j's
  immediate dominator. Intuitively, all of the rest of j's dominators are
  shared by j's predecessors as well.
  Since they dominate j, they will not have j in their dominance frontiers.

  The number of nodes touched by this algorithm is equal to the size
  of the dominance frontiers, no more, no less.

References b, bitmap_set_bit, CDI_DOMINATORS, cfun, EDGE_COUNT, ENTRY_BLOCK_PTR_FOR_FN, FOR_EACH_BB_FN, FOR_EACH_EDGE, get_immediate_dominator(), ggc_alloc(), timevar_pop(), and timevar_push().

Referenced by df_md_local_compute(), and update_ssa().

◆ compute_idf()

bitmap compute_idf ( bitmap def_blocks,
bitmap_head * dfs )
Given a set of blocks with variable definitions (DEF_BLOCKS),
return a bitmap with all the blocks in the iterated dominance
frontier of the blocks in DEF_BLOCKS.  DFS contains dominance
frontier information as returned by compute_dominance_frontiers.

The resulting set of blocks are the potential sites where PHI nodes
are needed.  The caller is responsible for freeing the memory
allocated for the return value.   

References BITMAP_ALLOC, bitmap_clear_first_set_bit(), bitmap_copy(), bitmap_empty_p(), bitmap_set_bit, bitmap_tree_view(), cfun, EXECUTE_IF_SET_IN_BITMAP, gcc_checking_assert, ggc_alloc(), i, last_basic_block_for_fn, and NULL.

Referenced by insert_phi_nodes(), and insert_updated_phi_nodes_for().

◆ connect_infinite_loops_to_exit()

void connect_infinite_loops_to_exit ( void )
This function adds a fake edge between any noreturn block and
infinite loops to the exit block.  Some optimizations require a path
from each node to the exit node.

See also Morgan, Figure 3.10, pp. 82-83.

The current implementation is ugly, not attempting to minimize the
number of inserted fake edges.  To reduce the number of fake edges
to insert, add fake edges from _innermost_ loops containing only
nodes not reachable from the exit block.   

References add_noreturn_fake_exit_edges(), cfun, dfs_find_deadend(), EXIT_BLOCK_PTR_FOR_FN, ggc_alloc(), make_edge(), and profile_probability::never().

Referenced by init_pre(), one_store_motion_pass(), rebuild_frequencies(), and tree_estimate_probability().

◆ create_edge_list()

struct edge_list * create_edge_list ( void )
Functions to access an edge list with a vector representation.
Enough data is kept such that given an index number, the
pred and succ that edge represents can be determined, or
given a pred and a succ, its index number can be returned.
This allows algorithms which consume a lot of memory to
represent the normally full matrix of edge (pred,succ) with a
single indexed vector,  edge (EDGE_INDEX (pred, succ)), with no
wasted space in the client code due to sparse flow graphs.   
This functions initializes the edge list. Basically the entire
flowgraph is processed, and all edges are assigned a number,
and the data structure is filled in.   

References cfun, EDGE_COUNT, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, FOR_BB_BETWEEN, FOR_EACH_EDGE, ggc_alloc(), edge_list::num_edges, and basic_block_def::succs.

Referenced by branch_prob(), pre_edge_lcm_avs(), and pre_edge_rev_lcm().

◆ dfs_enumerate_from()

int dfs_enumerate_from ( basic_block bb,
int reverse,
bool(*)(const_basic_block, const void *) predicate,
basic_block * rslt,
int rslt_max,
const void * data )
Performs dfs search from BB over vertices satisfying PREDICATE;
if REVERSE, go against direction of edges.  Returns number of blocks
found and their list in RSLT.  RSLT can contain at most RSLT_MAX items.   

References cfun, FOR_EACH_EDGE, free(), gcc_assert, ggc_alloc(), MARK_VISITED, UNMARK_VISITED, visited, and VISITED_P.

Referenced by _loop_vec_info::_loop_vec_info(), determine_bb_domination_status(), find_path(), and get_loop_body_with_size().

◆ dfs_find_deadend()

basic_block dfs_find_deadend ( basic_block bb)
Helper routine for inverted_rev_post_order_compute
flow_dfs_compute_reverse_execute, and the reverse-CFG
deapth first search in dominance.cc.
BB has to belong to a region of CFG
unreachable by inverted traversal from the exit.
i.e. there's no control flow path from ENTRY to EXIT
that contains this BB.
This can happen in two cases - if there's an infinite loop
or if there's a block that has no successor
(call to a function with no return).
Some RTL passes deal with this condition by
calling connect_infinite_loops_to_exit () and/or
add_noreturn_fake_exit_edges ().
However, those methods involve modifying the CFG itself
which may not be desirable.
Hence, we deal with the infinite loop/no return cases
by identifying a unique basic block that can reach all blocks
in such a region by inverted traversal.
This function returns a basic block that guarantees
that all blocks in the region are reachable
by starting an inverted traversal from the returned block.   

References bitmap_set_bit, EDGE_COUNT, EDGE_SUCC, FOR_EACH_EDGE, basic_block_def::index, loop_exit_edge_p(), basic_block_def::loop_father, loop_outer(), basic_block_def::succs, and visited.

Referenced by connect_infinite_loops_to_exit(), and inverted_rev_post_order_compute().

◆ find_edge()

edge find_edge ( basic_block pred,
basic_block succ )
Given PRED and SUCC blocks, return the edge which connects the blocks.
If no such edge exists, return NULL.   

References EDGE_COUNT, FOR_EACH_EDGE, NULL, basic_block_def::preds, and basic_block_def::succs.

Referenced by add_phi_args_after_copy_edge(), tree_switch_conversion::switch_decision_tree::analyze_switch_statement(), associate_equivalences_with_edges(), branch_fixup(), tree_switch_conversion::switch_conversion::build_constructors(), bypass_block(), cached_make_edge(), tree_switch_conversion::switch_conversion::check_all_empty_except_final(), clean_up_after_unswitching(), cleanup_empty_eh_merge_phis(), path_range_query::compute_phi_relations(), path_range_query::compute_ranges_in_block(), cond_move_process_if_block(), convert_if_conditions_to_switch(), convert_single_case_switch(), copy_bbs(), copy_edges_for_bb(), copy_phis_for_bb(), create_cond_insert_point(), create_new_iv(), cse_extended_basic_block(), cse_find_path(), disambiguate_multiple_latches(), dump_gimple_switch(), back_jt_path_registry::duplicate_thread_path(), tree_switch_conversion::jump_table_cluster::emit(), evaluate_control_stmt_using_entry_checks(), execute_sm_if_changed(), execute_split_functions(), expand_case(), expand_complex_multiplication(), expand_omp_for_generic(), expand_omp_for_init_counts(), expand_omp_for_init_vars(), expand_omp_for_static_chunk(), expand_omp_for_static_nochunk(), expand_omp_simd(), expand_omp_taskloop_for_inner(), find_block_to_duplicate_for_splitting_paths(), find_implicit_erroneous_behavior(), find_implicit_sets(), find_taken_edge_computed_goto(), back_threader::find_taken_edge_switch(), find_taken_edge_switch_expr(), find_unswitching_predicates_for_bb(), fix_up_fall_thru_edges(), force_single_succ_latches(), tree_switch_conversion::switch_conversion::gather_default_values(), tree_switch_conversion::switch_conversion::gen_inbound_check(), get_cases_for_edge(), gimple_flow_call_edges_add(), gimple_lv_adjust_loop_header_phi(), gimple_redirect_edge_and_branch(), gimple_switch_edge(), group_case_labels_stmt(), ipa_simd_modify_function_body(), is_inconsistent(), loop_latch_edge(), lower_eh_dispatch(), make_edge(), make_edges(), make_forwarder_block(), fwd_jt_path_registry::mark_threaded_blocks(), maybe_optimize_range_tests(), move_sese_in_condition(), noce_convert_multiple_sets(), noce_process_if_block(), back_threader_profitability::possibly_profitable_path_p(), propagate_freq(), prune_bbs_to_update_dominators(), redirect_edge_and_branch_force(), redirect_edge_succ_nodup(), back_threader_registry::register_path(), remove_unreachable::remove_and_update_globals(), remove_forwarder_block(), remove_forwarder_block_with_phi(), replace_block_by(), replace_phi_edge_with_variable(), back_jt_path_registry::rewire_first_differing_edge(), rtl_flow_call_edges_add(), same_phi_alternatives(), same_phi_args_p(), same_succ_hash(), simd_clone_adjust(), simplify_using_ranges::simplify_switch_using_ranges(), split_edge_bb_loc(), ssa_fix_duplicate_block_edges(), path_range_query::ssa_range_in_phi(), suitable_cond_bb(), jump_threader::thread_around_empty_blocks(), jump_threader::thread_through_normal_block(), transform_duplicate(), ubsan_expand_null_ifn(), unsplit_eh(), update_destination_phis(), update_profile_after_ifcombine(), update_ssa_across_abnormal_edges(), verify_eh_dispatch_edge(), verify_loop_structure(), and vt_initialize().

◆ find_edge_index()

int find_edge_index ( struct edge_list * edge_list,
basic_block pred,
basic_block succ )
This routine will determine what, if any, edge there is between
a specified predecessor and successor.   

References EDGE_INDEX_NO_EDGE, INDEX_EDGE_PRED_BB, INDEX_EDGE_SUCC_BB, and NUM_EDGES.

◆ find_unreachable_blocks()

void find_unreachable_blocks ( void )
Find unreachable blocks.  An unreachable block will have 0 in
the reachable bit in block->flags.  A nonzero value indicates the
block is reachable.   

References b, cfun, ENTRY_BLOCK_PTR_FOR_FN, basic_block_def::flags, FOR_EACH_BB_FN, FOR_EACH_EDGE, free(), ggc_alloc(), n_basic_blocks_for_fn, and worklist.

Referenced by delete_unreachable_blocks(), delete_unreachable_blocks_update_callgraph(), eliminate_unnecessary_stmts(), and verify_no_unreachable_blocks().

◆ free_edge_list()

void free_edge_list ( struct edge_list * elist)
This function free's memory associated with an edge list.   

References free(), and ggc_alloc().

Referenced by branch_prob(), one_pre_gcse_pass(), and one_store_motion_pass().

◆ inverted_rev_post_order_compute()

int inverted_rev_post_order_compute ( struct function * fn,
int * rev_post_order,
sbitmap * start_points )
Compute the reverse top sort order of the inverted CFG
i.e. starting from the exit block and following the edges backward
(from successors to predecessors).
This ordering can be used for forward dataflow problems among others.

Optionally if START_POINTS is specified, start from exit block and all
basic blocks in START_POINTS.  This is used by CD-DCE.

This function assumes that all blocks in the CFG are reachable
from the ENTRY (but not necessarily from EXIT).

If there's an infinite loop,
a simple inverted traversal starting from the blocks
with no successors can't visit all blocks.
To solve this problem, we first do inverted traversal
starting from the blocks with no successor.
And if there's any block left that's not visited by the regular
inverted traversal from EXIT,
those blocks are in such problematic region.
Among those, we find one block that has
any visited predecessor (which is an entry into such a region),
and start looking for a "dead end" from that block
and do another inverted traversal from that block.   

References bitmap_bit_p, bitmap_clear(), bitmap_set_bit, cfun, dfs_find_deadend(), EDGE_COUNT, ei_edge(), ei_next(), ei_one_before_end_p(), ei_start, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK, EXIT_BLOCK_PTR_FOR_FN, FOR_ALL_BB_FN, FOR_BB_BETWEEN, FOR_EACH_EDGE, gcc_assert, ggc_alloc(), basic_block_def::index, last_basic_block_for_fn, n_basic_blocks_for_fn, NULL, basic_block_def::preds, basic_block_def::succs, verify_no_unreachable_blocks(), and visited.

Referenced by compute_antic(), compute_antinout_edge(), df_analyze(), lra_create_live_ranges_1(), and remove_dead_stmt().

◆ mark_dfs_back_edges() [1/2]

bool mark_dfs_back_edges ( struct function * fun)
Mark the back edges in DFS traversal.
Return nonzero if a loop (natural or otherwise) is present.
Inspired by Depth_First_Search_PP described in:

  Advanced Compiler Design and Implementation
  Steven Muchnick
  Morgan Kaufmann, 1997

and heavily borrowed from pre_and_rev_post_order_compute.   

References bitmap_bit_p, bitmap_clear(), bitmap_set_bit, EDGE_COUNT, ei_edge(), ei_next(), ei_one_before_end_p(), ei_start, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, basic_block_def::flags, free(), ggc_alloc(), basic_block_def::index, last_basic_block_for_fn, n_basic_blocks_for_fn, basic_block_def::succs, and visited.

◆ mark_dfs_back_edges() [2/2]

◆ post_order_compute()

int post_order_compute ( int * post_order,
bool include_entry_exit,
bool delete_unreachable )
Compute reverse top sort order.  This is computing a post order
numbering of the graph.  If INCLUDE_ENTRY_EXIT is true, then
ENTRY_BLOCK and EXIT_BLOCK are included.  If DELETE_UNREACHABLE is
true, unreachable blocks are deleted.   

References b, bitmap_bit_p, bitmap_clear(), bitmap_set_bit, cfun, count, delete_basic_block(), EDGE_COUNT, ei_edge(), ei_next(), ei_one_before_end_p(), ei_start, ENTRY_BLOCK, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK, EXIT_BLOCK_PTR_FOR_FN, ggc_alloc(), basic_block_def::index, last_basic_block_for_fn, n_basic_blocks_for_fn, basic_block_def::next_bb, basic_block_def::succs, tidy_fallthru_edges(), and visited.

Referenced by df_analyze(), and fwd_jt_path_registry::update_cfg().

◆ pre_and_rev_post_order_compute()

int pre_and_rev_post_order_compute ( int * pre_order,
int * rev_post_order,
bool include_entry_exit )
Like pre_and_rev_post_order_compute_fn but operating on the
current function and asserting that all nodes were visited.   

References cfun, gcc_assert, ggc_alloc(), n_basic_blocks_for_fn, NUM_FIXED_BLOCKS, and pre_and_rev_post_order_compute_fn().

Referenced by add_scope_conflicts(), analyze_function_body(), cse_main(), flow_loops_find(), init_alias_analysis(), init_reassoc(), insert(), regrename_analyze(), tree_lower_complex(), and dom_walker::walk().

◆ pre_and_rev_post_order_compute_fn()

int pre_and_rev_post_order_compute_fn ( struct function * fn,
int * pre_order,
int * rev_post_order,
bool include_entry_exit )
Compute the depth first search order of FN and store in the array
PRE_ORDER if nonzero.  If REV_POST_ORDER is nonzero, return the
reverse completion number for each node.  Returns the number of nodes
visited.  A depth first search tries to get as far away from the starting
point as quickly as possible.

In case the function has unreachable blocks the number of nodes
visited does not include them.

pre_order is a really a preorder numbering of the graph.
rev_post_order is really a reverse postorder numbering of the graph.   

References BASIC_BLOCK_FOR_FN, EDGE_COUNT, ei_edge(), ei_next(), ei_one_before_end_p(), ei_start, ENTRY_BLOCK, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK, EXIT_BLOCK_PTR_FOR_FN, basic_block_def::flags, ggc_alloc(), i, basic_block_def::index, n_basic_blocks_for_fn, NUM_FIXED_BLOCKS, basic_block_def::succs, and visited.

Referenced by compute_available(), compute_laterin(), compute_live_vars(), draw_cfg_nodes_no_loops(), loop_invariant_motion_in_fun(), pre_and_rev_post_order_compute(), sort_sibling_loops(), and ssa_prop_init().

◆ print_edge_list()

DEBUG_FUNCTION void print_edge_list ( FILE * f,
struct edge_list * elist )
This function provides debug output showing an edge list.   

References cfun, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, ggc_alloc(), INDEX_EDGE_PRED_BB, INDEX_EDGE_SUCC_BB, and n_basic_blocks_for_fn.

Referenced by pre_edge_lcm_avs(), and pre_edge_rev_lcm().

◆ remove_fake_edges()

void remove_fake_edges ( void )
This routine will remove all fake edges from the flow graph.  If
we remove all fake successors, it will automatically remove all
fake predecessors.   

References cfun, ENTRY_BLOCK_PTR_FOR_FN, FOR_BB_BETWEEN, NULL, and remove_fake_predecessors().

Referenced by branch_prob().

◆ remove_fake_exit_edges()

void remove_fake_exit_edges ( void )
This routine will remove all fake edges to the EXIT_BLOCK.   

References cfun, EXIT_BLOCK_PTR_FOR_FN, and remove_fake_predecessors().

Referenced by cleanup_cfg(), one_pre_gcse_pass(), one_store_motion_pass(), rebuild_frequencies(), and tree_estimate_probability().

◆ remove_fake_predecessors()

static void remove_fake_predecessors ( basic_block bb)
static
This routine will remove any fake predecessor edges for a basic block.
When the edge is removed, it is also removed from whatever successor
list it is in.   

References ei_next(), ei_safe_edge(), ei_start, ggc_alloc(), basic_block_def::preds, and remove_edge().

Referenced by remove_fake_edges(), and remove_fake_exit_edges().

◆ rev_post_order_and_mark_dfs_back_seme()

int rev_post_order_and_mark_dfs_back_seme ( struct function * fn,
edge entry,
bitmap exit_bbs,
bool for_iteration,
int * rev_post_order,
vec< std::pair< int, int > > * toplevel_scc_extents )
Compute the reverse completion number of a depth first search
on the SEME region denoted by the ENTRY edge and the EXIT_BBS set of
exit block indexes and store it in the array REV_POST_ORDER.
Also sets the EDGE_DFS_BACK edge flags according to this visitation
order.
Returns the number of nodes visited.

In case the function has unreachable blocks the number of nodes
visited does not include them.

If FOR_ITERATION is true then compute an RPO where SCCs form a
contiguous region in the RPO array.
*TOPLEVEL_SCC_EXTENTS if not NULL is filled with pairs of
*REV_POST_ORDER indexes denoting extents of the toplevel SCCs in
this region.   

References BASIC_BLOCK_FOR_FN, bitmap_bit_p, cmp_edge_dest_pre(), EDGE_COUNT, EDGE_SUCC, ei_edge(), ei_end_p(), ei_next(), ei_start, basic_block_def::flags, FOR_EACH_EDGE, gcc_assert, gcc_checking_assert, gcc_sort_r(), ggc_alloc(), i, basic_block_def::index, last_basic_block_for_fn, n_basic_blocks_for_fn, basic_block_def::succs, tag_header(), and visited.

Referenced by loop_distribution::bb_top_order_init(), do_rpo_vn_1(), vect_slp_function(), and vt_find_locations().

◆ single_pred_before_succ_order()

basic_block * single_pred_before_succ_order ( void )
Returns the list of basic blocks in the function in an order that guarantees
that if a block X has just a single predecessor Y, then Y is after X in the
ordering.   

References bitmap_clear(), cfun, ENTRY_BLOCK_PTR_FOR_FN, FOR_EACH_BB_FN, gcc_assert, ggc_alloc(), i, last_basic_block_for_fn, MARK_VISITED, n_basic_blocks_for_fn, NUM_FIXED_BLOCKS, single_pred(), single_pred_p(), visited, VISITED_P, and y.

◆ single_pred_edge_ignoring_loop_edges()

edge single_pred_edge_ignoring_loop_edges ( basic_block bb,
bool ignore_not_executable )
Ignoring loop backedges, if BB has precisely one incoming edge then
return that edge.  Otherwise return NULL.

When IGNORE_NOT_EXECUTABLE is true, also ignore edges that are not marked
as executable.   

References CDI_DOMINATORS, dominated_by_p(), FOR_EACH_EDGE, ggc_alloc(), NULL, and basic_block_def::preds.

Referenced by uncprop_dom_walker::before_dom_children(), pointer_equiv_analyzer::enter(), record_equivalences_from_incoming_edge(), and dom_opt_dom_walker::set_global_ranges_from_unreachable_edges().

◆ tag_header()

static void tag_header ( int b,
int h,
rpoamdbs_bb_data * bb_data )
static
Tag H as a header of B, weaving H and its loop header list into the
current loop header list of B.   

References b, and ggc_alloc().

Referenced by rev_post_order_and_mark_dfs_back_seme().

◆ verify_edge_list()

DEBUG_FUNCTION void verify_edge_list ( FILE * f,
struct edge_list * elist )
This function provides an internal consistency check of an edge list,
verifying that all edges are present, and that there are no
extra edges.   

References cfun, EDGE_INDEX, EDGE_INDEX_NO_EDGE, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, FOR_BB_BETWEEN, FOR_EACH_EDGE, ggc_alloc(), basic_block_def::index, edge_iterator::index, INDEX_EDGE_PRED_BB, INDEX_EDGE_SUCC_BB, NULL, basic_block_def::preds, and basic_block_def::succs.

Referenced by pre_edge_lcm_avs(), and pre_edge_rev_lcm().

◆ verify_marked_backedges()

void verify_marked_backedges ( struct function * fun)
Return TRUE if EDGE_DFS_BACK is up to date for CFUN.   

References FOR_EACH_BB_FN, FOR_EACH_EDGE, ggc_alloc(), internal_error(), mark_dfs_back_edges(), and basic_block_def::succs.

◆ verify_no_unreachable_blocks()

void verify_no_unreachable_blocks ( void )
Verify that there are no unreachable blocks in the current function.   

References cfun, find_unreachable_blocks(), basic_block_def::flags, FOR_EACH_BB_FN, gcc_assert, and ggc_alloc().

Referenced by inverted_rev_post_order_compute().