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

Functions

void dump_graph ()
struct graphnew_graph ()
struct graph_edgeadd_edge ()
void identify_vertices ()
static int dfs_edge_src ()
static int dfs_edge_dest ()
static struct graph_edgefoll_in_subgraph ()
static struct graph_edgedfs_fst_edge ()
static struct graph_edgedfs_next_edge ()
int graphds_dfs (struct graph *g, int *qs, int nq, vec< int > *qt, bool forward, bitmap subgraph)
int graphds_scc ()
void for_each_edge ()
void free_graph ()
static int tree_nca ()
void graphds_domtree (struct graph *g, int entry, int *parent, int *son, int *brother)

Function Documentation

static int dfs_edge_dest ( )
inlinestatic
Helper function for graphds_dfs.  Returns the destination vertex of E, in
   the direction given by FORWARD.   

References graph_edge::dest, and graph_edge::src.

Referenced by foll_in_subgraph(), and graphds_dfs().

static int dfs_edge_src ( )
inlinestatic
Helper function for graphds_dfs.  Returns the source vertex of E, in the
   direction given by FORWARD.   

References graph_edge::dest, and graph_edge::src.

Referenced by graphds_dfs().

static struct graph_edge* dfs_fst_edge ( )
staticread
Helper function for graphds_dfs.  Select the first edge from V in G, in the
   direction given by FORWARD, that belongs to SUBGRAPH.   

References foll_in_subgraph(), vertex::pred, vertex::succ, and graph::vertices.

Referenced by graphds_dfs().

static struct graph_edge* dfs_next_edge ( )
staticread
Helper function for graphds_dfs.  Returns the next edge after E, in the
   graph direction given by FORWARD, that belongs to SUBGRAPH.   

References foll_in_subgraph(), graph_edge::pred_next, and graph_edge::succ_next.

Referenced by graphds_dfs().

void dump_graph ( )
@verbatim Graph representation and manipulation functions.

Copyright (C) 2007-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/.

Dumps graph G into F.   

References vertex::component, graph_edge::dest, graph::n_vertices, vertex::pred, graph_edge::pred_next, graph_edge::src, vertex::succ, graph_edge::succ_next, and graph::vertices.

static struct graph_edge* foll_in_subgraph ( )
staticread
Helper function for graphds_dfs.  Returns the first edge after E (including
   E), in the graph direction given by FORWARD, that belongs to SUBGRAPH.   

References bitmap_bit_p(), dfs_edge_dest(), graph_edge::pred_next, and graph_edge::succ_next.

Referenced by dfs_fst_edge(), and dfs_next_edge().

void for_each_edge ( )
Runs CALLBACK for all edges in G.   

References graph::n_vertices, vertex::succ, graph_edge::succ_next, and graph::vertices.

void free_graph ( )
int graphds_dfs ( struct graph g,
int *  qs,
int  nq,
vec< int > *  qt,
bool  forward,
bitmap  subgraph 
)
Runs dfs search over vertices of G, from NQ vertices in queue QS.
   The vertices in postorder are stored into QT.  If FORWARD is false,
   backward dfs is run.  If SUBGRAPH is not NULL, it specifies the
   subgraph of G to run DFS on.  Returns the number of the components
   of the graph (number of the restarts of DFS).   

References comp, vertex::component, dfs_edge_dest(), dfs_edge_src(), dfs_fst_edge(), dfs_next_edge(), free(), graph::n_vertices, vertex::post, stack, tick, and graph::vertices.

Referenced by build_alias_set_optimal_p(), build_base_obj_set_for_drs(), graphds_domtree(), graphds_scc(), mark_nodes_having_upstream_mem_writes(), and rdg_flag_vertex_and_dependent().

void graphds_domtree ( struct graph g,
int  entry,
int *  parent,
int *  son,
int *  brother 
)
Determines the dominance tree of G (stored in the PARENT, SON and BROTHER
   arrays), where the entry node is ENTRY.   

References changed, free(), graphds_dfs(), graph::n_vertices, postorder, vertex::pred, graph_edge::pred_next, graph_edge::src, tree_nca(), graph::vertices, and vNULL.

Referenced by iterate_fix_dominators().

int graphds_scc ( )
Determines the strongly connected components of G, using the algorithm of
   Tarjan -- first determine the postorder dfs numbering in reversed graph,
   then run the dfs on the original graph in the order given by decreasing
   numbers assigned by the previous pass.  If SUBGRAPH is not NULL, it
   specifies the subgraph of G whose strongly connected components we want
   to determine.

   After running this function, v->component is the number of the strongly
   connected component for each vertex of G.  Returns the number of the
   sccs of G.   

References comp, free(), graphds_dfs(), graph::n_vertices, postorder, queue, and vNULL.

Referenced by determine_dominators_for_sons(), mark_irreducible_loops(), and rdg_build_components().

void identify_vertices ( )
struct graph* new_graph ( )
read
static int tree_nca ( )
static
Returns the nearest common ancestor of X and Y in tree whose parent
   links are given by PARENT.  MARKS is the array used to mark the
   vertices of the tree, and MARK is the number currently used as a mark.   

Referenced by graphds_domtree().