4 * @author Sebastian Hack
6 * Abstract graph implementations for the CFG of a ir_graph.
8 * Copyright (C) 2007 Universitaet Karlsruhe
9 * Released under the GPL
12 #include "irgraph_t.h"
13 #include "iredges_t.h"
16 static void *irg_cfg_succ_get_root(void *self)
19 edges_activate_kind(irg, EDGE_KIND_BLOCK);
20 return get_irg_start_block(irg);
23 static void irg_cfg_succ_grow_succs(void *self, void *node, struct obstack *obst)
26 const ir_edge_t *edge;
27 foreach_block_succ(bl, edge)
28 obstack_ptr_grow(obst, get_edge_src_irn(edge));
31 const absgraph_t absgraph_irg_cfg_succ = {
32 irg_cfg_succ_get_root,
33 irg_cfg_succ_grow_succs
36 static void *irg_cfg_pred_get_root(void *self)
38 return get_irg_end_block(self);
41 static void irg_cfg_pred_grow_succs(void *self, void *node, struct obstack *obst)
44 for (i = 0, n = get_irn_arity(node); i < n; ++i)
45 obstack_ptr_grow(obst, get_irn_n(node, i));
48 const absgraph_t absgraph_irg_cfg_pred = {
49 irg_cfg_pred_get_root,
50 irg_cfg_pred_grow_succs