]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/graphds.h
Optimize ODR enum streaming
[thirdparty/gcc.git] / gcc / graphds.h
CommitLineData
66f97d31 1/* Graph representation.
8d9254fc 2 Copyright (C) 2007-2020 Free Software Foundation, Inc.
66f97d31
ZD
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
9dcd6f09 8Software Foundation; either version 3, or (at your option) any later
66f97d31
ZD
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
9dcd6f09
NC
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
66f97d31 19
f1717f8d
KC
20#ifndef GCC_GRAPHDS_H
21#define GCC_GRAPHDS_H
22
66f97d31
ZD
23/* Structure representing edge of a graph. */
24
ae50c0cb 25struct graph_edge
66f97d31
ZD
26{
27 int src, dest; /* Source and destination. */
ae50c0cb 28 struct graph_edge *pred_next, *succ_next;
66f97d31
ZD
29 /* Next edge in predecessor and successor lists. */
30 void *data; /* Data attached to the edge. */
31};
32
33/* Structure representing vertex of a graph. */
34
35struct vertex
36{
ae50c0cb 37 struct graph_edge *pred, *succ;
66f97d31
ZD
38 /* Lists of predecessors and successors. */
39 int component; /* Number of dfs restarts before reaching the
40 vertex. */
41 int post; /* Postorder number. */
42 void *data; /* Data attached to the vertex. */
43};
44
45/* Structure representing a graph. */
46
47struct graph
48{
2c41c19d
RB
49 int n_vertices; /* Number of vertices. */
50 struct vertex *vertices; /* The vertices. */
51 struct obstack ob; /* Obstack for vertex and edge allocation. */
66f97d31
ZD
52};
53
54struct graph *new_graph (int);
55void dump_graph (FILE *, struct graph *);
ae50c0cb 56struct graph_edge *add_edge (struct graph *, int, int);
66f97d31 57void identify_vertices (struct graph *, int, int);
04939ee6 58typedef bool (*skip_edge_callback) (struct graph_edge *);
66f97d31 59int graphds_dfs (struct graph *, int *, int,
04939ee6
BC
60 vec<int> *, bool, bitmap, skip_edge_callback = NULL);
61int graphds_scc (struct graph *, bitmap, skip_edge_callback = NULL);
66f97d31 62void graphds_domtree (struct graph *, int, int *, int *, int *);
04939ee6
BC
63typedef void (*graphds_edge_callback) (struct graph *,
64 struct graph_edge *, void *);
65void for_each_edge (struct graph *, graphds_edge_callback, void *);
66f97d31 66void free_graph (struct graph *g);
f1717f8d
KC
67
68#endif /* GCC_GRAPHDS_H */