* An edge.
*/
struct _ir_edge_t {
-#ifdef DEBUG_libfirm
- long src_nr; /**< The node number of the source node. */
-#endif
ir_node *src; /**< The source node of the edge. */
int pos; /**< The position of the edge at @p src. */
unsigned invalid : 1; /**< edges that are removed are marked invalid. */
unsigned present : 1; /**< Used by the verifier. Don't rely on its content. */
struct list_head list; /**< The list head to queue all out edges at a node. */
+#ifdef DEBUG_libfirm
+ long src_nr; /**< The node number of the source node. */
+#endif
};
/**
*/
static INLINE int _get_irn_n_edges(const ir_node *irn)
{
- return _get_irn_edge_info(irn)->out_count;
+/* Perhaps out_count was buggy. This code does it more safely.
+
+ int res = 0;
+ struct list_head *pos, *head = _get_irn_outs_head(irn);
+ list_for_each(pos, head)
+ res++;
+ return res;
+*/
+ return _get_irn_edge_info(irn)->out_count;
}
static INLINE int _edges_activated(const ir_graph *irg)
void edges_init_graph(ir_graph *irg);
+/**
+ * Notify of a edge change.
+ * The edge from (src, pos) -> old_tgt is redirected to tgt
+ */
void edges_notify_edge(ir_node *src, int pos, ir_node *tgt, ir_node *old_tgt, ir_graph *irg);
+/**
+ * A node is deleted.
+ */
void edges_node_deleted(ir_node *old, ir_graph *irg);
void edges_invalidate(ir_node *irn, ir_graph *irg);