}
static void irg_out_walk_2(ir_node *node, irg_walk_func *pre,
- irg_walk_func *post, void *env) {
+ irg_walk_func *post, void *env)
+{
int i, n;
ir_node *succ;
if (post) post(node, env);
}
-void irg_out_walk(ir_node *node,
- irg_walk_func *pre, irg_walk_func *post,
- void *env) {
+void irg_out_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post,
+ void *env)
+{
assert(node);
if (get_irg_outs_state(current_ir_graph) != outs_none) {
inc_irg_visited (current_ir_graph);
}
}
-static void irg_out_block_walk2(ir_node *bl,
- irg_walk_func *pre, irg_walk_func *post,
- void *env) {
+static void irg_out_block_walk2(ir_node *bl, irg_walk_func *pre,
+ irg_walk_func *post, void *env)
+{
int i, n;
if (!Block_block_visited(bl)) {
/* Walks only over Block nodes in the graph. Has it's own visited
flag, so that it can be interleaved with the other walker. */
-void irg_out_block_walk(ir_node *node,
- irg_walk_func *pre, irg_walk_func *post,
- void *env) {
+void irg_out_block_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post,
+ void *env)
+{
assert(is_Block(node) || (get_irn_mode(node) == mode_X));
irg_walk_graph (irg, reset_outs, NULL, NULL);
#endif /* defined DEBUG_libfirm */
}
-
-static void check_out_edges(ir_node *irn, void *env)
-{
- int i, j, pos;
- int *pError = env;
- int error = *pError;
- int last = is_Block(irn) ? 0 : -1;
-
- /* check forward: every input must have an out edge */
- for (i = get_irn_arity(irn) - 1; i >= last; --i) {
- ir_node *pred = get_irn_n(irn, i);
-
- for (j = get_irn_n_outs(pred) - 1; j >= 0; --j) {
- ir_node *user = get_irn_out_ex(pred, j, &pos);
-
- if (user == irn && pos == i) {
- break;
- }
- }
- if (j < 0) {
- ir_fprintf(stderr, "Missing out edge from %+F input %d to %+F", irn, i, pred);
- ++error;
- }
- }
-
- /* checking backward */
- for (i = get_irn_n_outs(irn) - 1; i >= 0; --i) {
- ir_node *user = get_irn_out_ex(irn, i, &pos);
-
- if (get_irn_n(user, pos) != irn) {
- ir_fprintf(stderr, "Spurious out edge from %+F output %d to %+F", irn, i, user);
- ++error;
- }
- }
- *pError = error;
-}
-
-/* verify outs edges. */
-void verify_outs(ir_graph *irg)
-{
- int errors = 0;
- irg_walk_graph(irg, NULL, check_out_edges, &errors);
- if (errors > 0)
- panic("Out edges are corrupt");
-}