2 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @author Sebastian Hack
27 * Abstract graph implementations for the CFG of a ir_graph.
29 #include "irgraph_t.h"
30 #include "iredges_t.h"
33 static void *irg_cfg_succ_get_root(void *self)
36 edges_activate_kind(irg, EDGE_KIND_BLOCK);
37 return get_irg_start_block(irg);
40 static void irg_cfg_succ_grow_succs(void *self, void *node, struct obstack *obst)
43 const ir_edge_t *edge;
44 foreach_block_succ(bl, edge)
45 obstack_ptr_grow(obst, get_edge_src_irn(edge));
48 const absgraph_t absgraph_irg_cfg_succ = {
49 irg_cfg_succ_get_root,
50 irg_cfg_succ_grow_succs
53 static void *irg_cfg_pred_get_root(void *self)
55 return get_irg_end_block(self);
58 static void irg_cfg_pred_grow_succs(void *self, void *node, struct obstack *obst)
61 for (i = 0, n = get_irn_arity(node); i < n; ++i)
62 obstack_ptr_grow(obst, get_irn_n(node, i));
65 const absgraph_t absgraph_irg_cfg_pred = {
66 irg_cfg_pred_get_root,
67 irg_cfg_pred_grow_succs