GCC Middle and Back End API Reference
graphds.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  graph_edge
 
struct  vertex
 
struct  graph
 

Typedefs

typedef bool(* skip_edge_callback) (struct graph_edge *)
 
typedef void(* graphds_edge_callback) (struct graph *, struct graph_edge *, void *)
 

Functions

struct graphnew_graph (int)
 
void dump_graph (FILE *, struct graph *)
 
struct graph_edgeadd_edge (struct graph *, int, int)
 
void identify_vertices (struct graph *, int, int)
 
int graphds_dfs (struct graph *, int *, int, vec< int > *, bool, bitmap, skip_edge_callback=NULL)
 
int graphds_scc (struct graph *, bitmap, skip_edge_callback=NULL, vec< int > *=NULL)
 
void graphds_domtree (struct graph *, int, int *, int *, int *)
 
void for_each_edge (struct graph *, graphds_edge_callback, void *)
 
void free_graph (struct graph *g)
 

Typedef Documentation

◆ graphds_edge_callback

typedef void(* graphds_edge_callback) (struct graph *, struct graph_edge *, void *)

◆ skip_edge_callback

typedef bool(* skip_edge_callback) (struct graph_edge *)

Function Documentation

◆ add_edge()

◆ dump_graph()

void dump_graph ( FILE * f,
struct graph * g )
Graph representation and manipulation functions.
   Copyright (C) 2007-2024 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, ggc_alloc(), i, graph_edge::pred_next, graph_edge::src, and graph_edge::succ_next.

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

◆ free_graph()

◆ graphds_dfs()

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, ggc_alloc(), i, and tick.

Referenced by loop_distribution::build_rdg_partition_for_vertex(), vect_optimize_slp_pass::create_partitions(), graphds_domtree(), and graphds_scc().

◆ graphds_domtree()

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, ggc_alloc(), graphds_dfs(), i, NULL, graph_edge::pred_next, graph_edge::src, tree_nca(), and vNULL.

Referenced by iterate_fix_dominators().

◆ graphds_scc()

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

◆ identify_vertices()

void identify_vertices ( struct graph * g,
int v,
int u )
Moves all the edges incident with U to V.   

References graph_edge::dest, g, ggc_alloc(), NULL, graph_edge::pred_next, graph_edge::src, and graph_edge::succ_next.

Referenced by determine_dominators_for_sons().

◆ new_graph()