- get_Block_cfgpred_arr() IS supported, but should not be in the official
[libfirm] / ir / ana / absgraph.c
index 1d483e2..02adff8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -26,9 +26,7 @@
  *
  * Abstract graph implementations for the CFG of a ir_graph.
  */
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include "irgraph_t.h"
 #include "iredges_t.h"
 static void *irg_cfg_succ_get_root(void *self)
 {
        ir_graph *irg = self;
-       edges_activate_kind(irg, EDGE_KIND_BLOCK);
+       edges_assure_kind(irg, EDGE_KIND_BLOCK);
        return get_irg_start_block(irg);
 }
 
+static void *irg_cfg_succ_get_end(void *self)
+{
+       ir_graph *irg = self;
+       return get_irg_end_block(irg);
+}
+
 static void irg_cfg_succ_grow_succs(void *self, void *node, struct obstack *obst)
 {
        ir_node *bl = node;
@@ -54,12 +58,18 @@ static void irg_cfg_succ_grow_succs(void *self, void *node, struct obstack *obst
 
 const absgraph_t absgraph_irg_cfg_succ = {
        irg_cfg_succ_get_root,
-       irg_cfg_succ_grow_succs
+       irg_cfg_succ_grow_succs,
+       irg_cfg_succ_get_end
 };
 
 static void *irg_cfg_pred_get_root(void *self)
 {
-       return get_irg_end_block(self);
+       return get_irg_end_block((ir_graph*) self);
+}
+
+static void *irg_cfg_pred_get_end(void *self)
+{
+       return get_irg_start_block((ir_graph*) self);
 }
 
 static void irg_cfg_pred_grow_succs(void *self, void *node, struct obstack *obst)
@@ -74,5 +84,6 @@ static void irg_cfg_pred_grow_succs(void *self, void *node, struct obstack *obst
 
 const absgraph_t absgraph_irg_cfg_pred = {
        irg_cfg_pred_get_root,
-       irg_cfg_pred_grow_succs
+       irg_cfg_pred_grow_succs,
+       irg_cfg_pred_get_end
 };