Added edges_assure and edge dumping hook
authorSebastian Hack <hack@ipd.info.uni-karlsruhe.de>
Thu, 16 Jun 2005 11:58:16 +0000 (11:58 +0000)
committerSebastian Hack <hack@ipd.info.uni-karlsruhe.de>
Thu, 16 Jun 2005 11:58:16 +0000 (11:58 +0000)
[r6025]

ir/ir/irdump.c
ir/ir/irdump.h
ir/ir/iredges_t.h

index ff85cd4..5fde09b 100644 (file)
@@ -6,7 +6,7 @@
  * Modified by: Goetz Lindenmaier, Hubert Schmidt
  * Created:
  * CVS-ID:      $Id$
- * Copyright:   (c) 1998-2003 Universität Karlsruhe
+ * Copyright:   (c) 1998-2003 Universitt Karlsruhe
  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
 #ifdef HAVE_CONFIG_H
@@ -443,6 +443,20 @@ bool opt_dump_pointer_values_to_info = 0;  /* default off: for test compares!! *
 
 static const char *overrule_nodecolor = NULL;
 
+/** An additional edge hook. */
+static DUMP_NODE_EDGE_FUNC dump_node_edge_hook = NULL;
+
+void set_dump_node_edge_hook(DUMP_NODE_EDGE_FUNC func)
+{
+    dump_node_edge_hook = func;
+}
+
+DUMP_NODE_EDGE_FUNC get_dump_node_edge_hook(void)
+{
+    return dump_node_edge_hook;
+}
+
+
 /** The vcg attribute hook. */
 static DUMP_NODE_VCGATTR_FUNC dump_node_vcgattr_hook = NULL;
 
@@ -909,6 +923,9 @@ static void dump_node(FILE *F, ir_node *n)
   dump_node_vcgattr(F, n, NULL, bad);
   fprintf(F, "}\n");
   dump_const_node_local(F, n);
+
+  if(dump_node_edge_hook)
+    dump_node_edge_hook(F, n);
 #if DO_HEAPANALYSIS
   dump_irn_chi_term(F, n);
   dump_irn_state(F, n);
index 5a5d30e..815f7d2 100644 (file)
@@ -52,6 +52,20 @@ typedef int (*DUMP_NODE_VCGATTR_FUNC)(FILE *F, ir_node *node, ir_node *local);
 /** Set the node_vcgattr hook. */
 void set_dump_node_vcgattr_hook(DUMP_NODE_VCGATTR_FUNC hook);
 
+typedef int (*DUMP_NODE_EDGE_FUNC)(FILE *f, ir_node *node);
+
+/**
+ * Set the hook to be called to dump additional edges to a node.
+ * @param func The hook to be called.
+ */
+void set_dump_node_edge_hook(DUMP_NODE_EDGE_FUNC func);
+
+/**
+ * Get the additional edge dump hook.
+ * @return The current additional edge dump hook.]
+ */
+DUMP_NODE_EDGE_FUNC get_dump_node_edge_hook(void);
+
 /** Dump a firm graph.
  *
  *  @param irg  The firm graph to be dumped.
index 2b3c81b..0efda43 100644 (file)
@@ -5,7 +5,7 @@
  * Author:      Sebastian Hack
  * Created:     15.01.2005
  * CVS-ID:      $Id$
- * Copyright:   (c) 1998-2005 Universität Karlsruhe
+ * Copyright:   (c) 1998-2005 Universitt Karlsruhe
  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
 
@@ -118,6 +118,16 @@ static INLINE int _edges_activated(const ir_graph *irg)
   return _get_irg_edge_info(irg)->activated;
 }
 
+/**
+ * Assure, that the edges information is present for a certain graph.
+ * @param irg The graph.
+ */
+static INLINE void _edges_assure(ir_graph *irg)
+{
+       if(!_edges_activated(irg))
+               edges_activate(irg);
+}
+
 void edges_reroute(ir_node *old, ir_node *nw, ir_graph *irg);
 
 void edges_init_graph(ir_graph *irg);
@@ -139,6 +149,7 @@ extern void init_edges(void);
 #define get_edge_src_irn(edge)           _get_edge_src_irn(edge)
 #define get_edge_src_pos(edge)           _get_edge_src_pos(edge)
 #define edges_activated(irg)             _edges_activated(irg)
+#define edges_assure(irg)                _edges_assure(irg)
 
 #else
 /* new edges are disabled */
@@ -154,6 +165,7 @@ extern void init_edges(void);
 #define get_edge_src_irn(edge)            NULL
 #define get_edge_src_pos(edge)            -1
 #define edges_activated(irg)              0
+#define edges_assure(irg)
 
 #endif /* FIRM_EDGES_INPLACE */