OSDN Git Service

* cfgloopmanip.c (remove_path, loopify, duplicate_loop_to_header_edge):
[pf3gnuchains/gcc-fork.git] / gcc / graphds.h
1 /* Graph representation.
2    Copyright (C) 2007
3    Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING.  If not, write to the Free
19 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20 02110-1301, USA.  */
21
22 /* Structure representing edge of a graph.  */
23
24 struct edge
25 {
26   int src, dest;        /* Source and destination.  */
27   struct edge *pred_next, *succ_next;
28                         /* Next edge in predecessor and successor lists.  */
29   void *data;           /* Data attached to the edge.  */
30 };
31
32 /* Structure representing vertex of a graph.  */
33
34 struct vertex
35 {
36   struct edge *pred, *succ;
37                         /* Lists of predecessors and successors.  */
38   int component;        /* Number of dfs restarts before reaching the
39                            vertex.  */
40   int post;             /* Postorder number.  */
41   void *data;           /* Data attached to the vertex.  */
42 };
43
44 /* Structure representing a graph.  */
45
46 struct graph
47 {
48   int n_vertices;       /* Number of vertices.  */
49   struct vertex *vertices;
50                         /* The vertices.  */
51 };
52
53 struct graph *new_graph (int);
54 void dump_graph (FILE *, struct graph *);
55 struct edge *add_edge (struct graph *, int, int);
56 void identify_vertices (struct graph *, int, int);
57 int graphds_dfs (struct graph *, int *, int,
58                  VEC (int, heap) **, bool, bitmap);
59 int graphds_scc (struct graph *, bitmap);
60 void graphds_domtree (struct graph *, int, int *, int *, int *);
61 typedef void (*graphds_edge_callback) (struct graph *, struct edge *);
62 void for_each_edge (struct graph *, graphds_edge_callback);
63 void free_graph (struct graph *g);