FIRM_API const ir_edge_t *get_irn_out_edge_first_kind(const ir_node *irn,
ir_edge_kind_t kind);
+/**
+ * Returns the first edge pointing to some node.
+ * @note There is no order on out edges. First in this context only
+ * means, that you get some starting point into the list of edges.
+ * @param irn The node.
+ * @return The first out edge that points to this node.
+ */
+FIRM_API const ir_edge_t *get_irn_out_edge_first(const ir_node *irn);
+
+/**
+ * Returns the first edge pointing to a successor block.
+ *
+ * You can navigate the list with the usual get_irn_out_edge_next().
+ * @param block the Block
+ * @return first block successor edge
+ */
+FIRM_API const ir_edge_t *get_block_succ_first(const ir_node *block);
+
/**
* Returns the next edge in the out list of some node.
* @param irn The node.
* @param last The last out edge you have seen.
+ * @param kind the kind of edge that are iterated
* @return The next out edge in @p irn 's out list after @p last.
*/
FIRM_API const ir_edge_t *get_irn_out_edge_next(const ir_node *irn,
- const ir_edge_t *last);
+ const ir_edge_t *last,
+ ir_edge_kind_t kind);
/**
* A convenience iteration macro over all out edges of a node.
* edge.
*/
#define foreach_out_edge_kind(irn, edge, kind) \
- for (ir_edge_t const *edge = get_irn_out_edge_first_kind(irn, kind); edge; edge = get_irn_out_edge_next(irn, edge))
+ for (ir_edge_t const *edge = get_irn_out_edge_first_kind(irn, kind); edge; edge = get_irn_out_edge_next(irn, edge, kind))
/**
* A convenience iteration macro over all out edges of a node, which is safe
* @param kind The kind of the edge.
*/
#define foreach_out_edge_kind_safe(irn, edge, kind) \
- for (ir_edge_t const *edge = get_irn_out_edge_first_kind((irn), (kind)), *edge##__next; \
- edge ? edge##__next = get_irn_out_edge_next((irn), edge), 1 : (edge##__next = NULL, 0); \
- edge = edge##__next)
+ for (ir_edge_t const *edge = get_irn_out_edge_first_kind((irn), (kind)), *edge##__next; edge; edge = edge##__next) \
+ if (edge##__next = get_irn_out_edge_next((irn), edge, (kind)), 0) {} else
/**
* Convenience macro for normal out edges.
*/
FIRM_API int get_irn_n_edges_kind(const ir_node *irn, ir_edge_kind_t kind);
+/**
+ * Returns the number of registered out edges with EDGE_KIND_NORMAL
+ * @param irn The node.
+ */
+FIRM_API int get_irn_n_edges(const ir_node *irn);
+
/**
* Checks if the out edges are activated.
*
*/
FIRM_API int edges_activated_kind(const ir_graph *irg, ir_edge_kind_t kind);
+/**
+ * Checks if out edges with EDG_KIND_NORMAL and EDGE_KIND_BLOCK are activated.
+ * @param irg The graph.
+ * @return 1, if the edges are present for the given irg, 0 if not.
+ */
+FIRM_API int edges_activated(const ir_graph *irg);
+
/**
* Activates the edges for an irg.
*
*/
FIRM_API void edges_reroute_kind(ir_node *old, ir_node *nw, ir_edge_kind_t kind);
+/**
+ * Reroutes edges of EDGE_KIND_NORMAL from an old node to a new one.
+ *
+ * @param old the old node
+ * @param nw the new node
+ */
+FIRM_API void edges_reroute(ir_node *old, ir_node *nw);
+
/**
* reroutes (normal) edges from an old node to a new node, except for the
* @p exception which keeps its input even if it is old.
FIRM_API ir_graph_pass_t *irg_verify_edges_pass(const char *name,
unsigned assert_on_problem);
-/** Convenience version of edges_reroute_kind() with #EDGE_KIND_NORMAL */
-#define edges_reroute(old, nw) edges_reroute_kind(old, nw, EDGE_KIND_NORMAL)
-/** Conventience version of edges_activated_kind() for #EDGE_KIND_NORMAL and #EDGE_KIND_BLOCK */
-#define edges_activated(irg) (edges_activated_kind(irg, EDGE_KIND_NORMAL) && edges_activated_kind(irg, EDGE_KIND_BLOCK))
-
-#ifndef get_irn_n_edges
-/** Conventience version of get_irn_n_edges_kind() with #EDGE_KIND_NORMAL. */
-#define get_irn_n_edges(irn) get_irn_n_edges_kind(irn, EDGE_KIND_NORMAL)
-#endif
-
-#ifndef get_irn_out_edge_first
-/** Convenience version of get_irn_out_edge_first_kind() with #EDGE_KIND_NORMAL */
-#define get_irn_out_edge_first(irn) get_irn_out_edge_first_kind(irn, EDGE_KIND_NORMAL)
-#endif
-
-#ifndef get_block_succ_first
-/** Convenience version of get_irn_out_edge_first_kind() with #EDGE_KIND_BLOCK */
-#define get_block_succ_first(irn) get_irn_out_edge_first_kind(irn, EDGE_KIND_BLOCK)
-#endif
-
-#ifndef get_block_succ_next
-/** Convenience version of get_irn_out_edge_next() with #EDGE_KIND_BLOCK */
-#define get_block_succ_next(irn, last) get_irn_out_edge_next(irn, last)
-#endif
-
/**
* Activates data and block edges for an irg.
* If the irg phase is phase_backend, Dependence edges are
FIRM_API void irg_walk_edges(ir_node *start, irg_walk_func *pre,
irg_walk_func *post, void *env);
-/**
- * Reset the user's private data at offset 'offset'
- * The user has to remember his offset and the size of his data!
- * Caution: Using wrong values here can destroy other users private data!
- *
- * @param irg the IR graph to operate on
- * @param offset offset of the private data inside the edge
- * @param size length of the private data inside the edge
- */
-FIRM_API void edges_reset_private_data(ir_graph *irg, int offset,
- unsigned size);
-
/** @} */
#include "end.h"