GCC Middle and Back End API Reference

#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "bitmap.h"
#include "graphds.h"
Functions  
void  dump_graph (FILE *f, struct graph *g) 
struct graph *  new_graph (int n_vertices) 
struct graph_edge *  add_edge (struct graph *g, int f, int t) 
void  identify_vertices (struct graph *g, int v, int u) 
static int  dfs_edge_src (struct graph_edge *e, bool forward) 
static int  dfs_edge_dest (struct graph_edge *e, bool forward) 
static struct graph_edge *  foll_in_subgraph (struct graph_edge *e, bool forward, bitmap subgraph, skip_edge_callback skip_edge_p) 
static struct graph_edge *  dfs_fst_edge (struct graph *g, int v, bool forward, bitmap subgraph, skip_edge_callback skip_edge_p) 
static struct graph_edge *  dfs_next_edge (struct graph_edge *e, bool forward, bitmap subgraph, skip_edge_callback skip_edge_p) 
int  graphds_dfs (struct graph *g, int *qs, int nq, vec< int > *qt, bool forward, bitmap subgraph, skip_edge_callback skip_edge_p) 
int  graphds_scc (struct graph *g, bitmap subgraph, skip_edge_callback skip_edge_p, vec< int > *scc_grouping) 
void  for_each_edge (struct graph *g, graphds_edge_callback callback, void *data) 
void  free_graph (struct graph *g) 
static int  tree_nca (int x, int y, int *parent, int *marks, int mark) 
void  graphds_domtree (struct graph *g, int entry, int *parent, int *son, int *brother) 
struct graph_edge * add_edge  (  struct graph *  g, 
int  f,  
int  t ) 
Adds an edge from F to T to graph G. The new edge is returned.
References graph_edge::data, graph_edge::dest, g, NULL, graph_edge::pred_next, graph_edge::src, and graph_edge::succ_next.
Referenced by add_partition_graph_edge(), vect_optimize_slp_pass::build_graph(), create_edge_for_control_dependence(), create_rdg_edges_for_scalar(), iterate_fix_dominators(), and mark_irreducible_loops().

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().

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().

inlinestatic 
Helper function for graphds_dfs. Select the first edge from V in G, in the direction given by FORWARD, that belongs to SUBGRAPH. If SKIP_EDGE_P is not NULL, it points to a callback function. Edge E will be skipped if callback function returns true.
References foll_in_subgraph(), and g.
Referenced by graphds_dfs().

inlinestatic 
Helper function for graphds_dfs. Returns the next edge after E, in the graph direction given by FORWARD, that belongs to SUBGRAPH. If SKIP_EDGE_P is not NULL, it points to a callback function. Edge E will be skipped if callback function returns true.
References foll_in_subgraph(), graph_edge::pred_next, and graph_edge::succ_next.
Referenced by graphds_dfs().
void dump_graph  (  FILE *  f, 
struct graph *  g ) 
Graph representation and manipulation functions. Copyright (C) 20072024 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 graph_edge::data, graph_edge::dest, g, i, graph_edge::pred_next, graph_edge::src, and graph_edge::succ_next.

inlinestatic 
Helper function for graphds_dfs. Returns the first edge after E (including E), in the graph direction given by FORWARD, that belongs to SUBGRAPH. If SKIP_EDGE_P is not NULL, it points to a callback function. Edge E will be skipped if callback function returns true.
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  (  struct graph *  g, 
graphds_edge_callback  callback,  
void *  data ) 
Runs CALLBACK for all edges in G. DATA is private data for CALLBACK.
References g, i, and graph_edge::succ_next.
Referenced by loop_distribution::break_alias_scc_partitions(), and loop_distribution::merge_dep_scc_partitions().
void free_graph  (  struct graph *  g  ) 
Releases the memory occupied by G.
References free(), g, and NULL.
Referenced by loop_distribution::break_alias_scc_partitions(), free_rdg(), iterate_fix_dominators(), mark_irreducible_loops(), loop_distribution::merge_dep_scc_partitions(), and vect_optimize_slp_pass::run().
int graphds_dfs  (  struct graph *  g, 
int *  qs,  
int  nq,  
vec< int > *  qt,  
bool  forward,  
bitmap  subgraph,  
skip_edge_callback  skip_edge_p ) 
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). If SKIP_EDGE_P is not NULL, it points to a callback function. Edge E will be skipped if callback function returns true.
References comp, dfs_edge_dest(), dfs_edge_src(), dfs_fst_edge(), dfs_next_edge(), EXECUTE_IF_SET_IN_BITMAP, free(), g, i, and tick.
Referenced by loop_distribution::build_rdg_partition_for_vertex(), vect_optimize_slp_pass::create_partitions(), graphds_domtree(), and graphds_scc().
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(), g, gcc_assert, graphds_dfs(), i, NULL, graph_edge::pred_next, graph_edge::src, tree_nca(), and vNULL.
Referenced by iterate_fix_dominators().
int graphds_scc  (  struct graph *  g, 
bitmap  subgraph,  
skip_edge_callback  skip_edge_p,  
vec< int > *  scc_grouping ) 
Determines the strongly connected components of G, using the algorithm of Kosaraju  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. If SKIP_EDGE_P is not NULL, it points to a callback function. Edge E will be skipped if callback function returns true. If SCC_GROUPING is not null, the nodes will be added to it in the following order:  If SCC A is a direct or indirect predecessor of SCC B in the SCC dag, A's nodes come before B's nodes.  All of an SCC's nodes are listed consecutively, although the order of the nodes within an SCC is not really meaningful. 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, EXECUTE_IF_SET_IN_BITMAP, free(), g, gcc_assert, graphds_dfs(), i, queue, and vNULL.
Referenced by loop_distribution::break_alias_scc_partitions(), vect_optimize_slp_pass::create_partitions(), determine_dominators_for_sons(), mark_irreducible_loops(), and loop_distribution::merge_dep_scc_partitions().
void identify_vertices  (  struct graph *  g, 
int  v,  
int  u ) 
Moves all the edges incident with U to V.
References graph_edge::dest, g, NULL, graph_edge::pred_next, graph_edge::src, and graph_edge::succ_next.
Referenced by determine_dominators_for_sons().
struct graph * new_graph  (  int  n_vertices  ) 
Creates a new graph with N_VERTICES vertices.
References g, gcc_obstack_init, and graph::n_vertices.
Referenced by vect_optimize_slp_pass::build_graph(), loop_distribution::build_partition_graph(), loop_distribution::build_rdg(), iterate_fix_dominators(), and mark_irreducible_loops().

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.
References y.
Referenced by graphds_domtree().