2 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Various verify routines that check a scheduled graph for correctness.
23 * @author Matthias Braun
46 #include "besched_t.h"
49 #include "beintlive_t.h"
51 static int my_values_interfere(const ir_node *a, const ir_node *b);
53 typedef struct be_verify_register_pressure_env_t_ {
54 ir_graph *irg; /**< the irg to verify */
55 be_lv_t *lv; /**< Liveness information. */
56 const arch_env_t *arch_env; /**< an architecture environment */
57 const arch_register_class_t *cls; /**< the register class to check for */
58 int registers_available; /**< number of available registers */
59 int problem_found; /**< flag indicating if a problem was found */
60 } be_verify_register_pressure_env_t;
63 * Print all nodes of a pset into a file.
65 static void print_living_values(FILE *F, const ir_nodeset_t *live_nodes) {
66 ir_nodeset_iterator_t iter;
70 foreach_ir_nodeset(live_nodes, node, iter) {
71 ir_fprintf(F, "%+F ", node);
77 * Check if number of live nodes never exceeds the number of available registers.
79 static void verify_liveness_walker(ir_node *block, void *data) {
80 be_verify_register_pressure_env_t *env = (be_verify_register_pressure_env_t *)data;
81 ir_nodeset_t live_nodes;
85 /* collect register pressure info, start with end of a block */
86 ir_nodeset_init(&live_nodes);
87 be_liveness_end_of_block(env->lv, env->arch_env, env->cls, block,
90 pressure = ir_nodeset_size(&live_nodes);
91 if(pressure > env->registers_available) {
92 ir_fprintf(stderr, "Verify Warning: Register pressure too high at end of block %+F(%s) (%d/%d):\n",
93 block, get_irg_dump_name(env->irg), pressure, env->registers_available);
94 print_living_values(stderr, &live_nodes);
95 env->problem_found = 1;
98 sched_foreach_reverse(block, irn) {
102 be_liveness_transfer(env->arch_env, env->cls, irn, &live_nodes);
104 pressure = ir_nodeset_size(&live_nodes);
106 if(pressure > env->registers_available) {
107 ir_fprintf(stderr, "Verify Warning: Register pressure too high before node %+F in %+F(%s) (%d/%d):\n",
108 irn, block, get_irg_dump_name(env->irg), pressure, env->registers_available);
109 print_living_values(stderr, &live_nodes);
110 env->problem_found = 1;
113 ir_nodeset_destroy(&live_nodes);
117 * Start a walk over the irg and check the register pressure.
119 int be_verify_register_pressure(const be_irg_t *birg,
120 const arch_register_class_t *cls,
122 be_verify_register_pressure_env_t env;
124 env.lv = be_liveness(irg);
126 env.arch_env = birg->main_env->arch_env;
128 env.registers_available = env.cls->n_regs - be_put_ignore_regs(birg, env.cls, NULL);
129 env.problem_found = 0;
131 be_liveness_assure_sets(env.lv);
132 irg_block_walk_graph(irg, verify_liveness_walker, NULL, &env);
133 be_liveness_free(env.lv);
135 return ! env.problem_found;
140 /*--------------------------------------------------------------------------- */
144 typedef struct be_verify_schedule_env_t_ {
145 int problem_found; /**< flags indicating if there was a problem */
146 bitset_t *scheduled; /**< bitset of scheduled nodes */
147 ir_graph *irg; /**< the irg to check */
148 const arch_env_t *arch_env; /**< the arch_env */
149 } be_verify_schedule_env_t;
152 * Simple schedule checker.
154 static void verify_schedule_walker(ir_node *block, void *data) {
155 be_verify_schedule_env_t *env = (be_verify_schedule_env_t*) data;
157 int non_phi_found = 0;
158 int cfchange_found = 0;
159 /* TODO ask arch about delay branches */
160 int delay_branches = 0;
161 int last_timestep = INT_MIN;
164 * Tests for the following things:
165 * 1. Make sure that all phi nodes are scheduled at the beginning of the block
166 * 2. There is 1 or no control flow changing node scheduled and exactly delay_branches operations after it.
167 * 3. No value is defined after it has been used
168 * 4. mode_T nodes have all projs scheduled behind them followed by Keeps
169 * (except mode_X projs)
171 sched_foreach(block, node) {
175 /* this node is scheduled */
176 if(bitset_is_set(env->scheduled, get_irn_idx(node))) {
177 ir_fprintf(stderr, "Verify warning: %+F appears to be schedule twice\n");
178 env->problem_found = 1;
180 bitset_set(env->scheduled, get_irn_idx(node));
182 /* Check that scheduled nodes are in the correct block */
183 if(get_nodes_block(node) != block) {
184 ir_fprintf(stderr, "Verify warning: %+F is in block %+F but scheduled in %+F\n", node, get_nodes_block(node), block);
185 env->problem_found = 1;
188 /* Check that timesteps are increasing */
189 timestep = sched_get_time_step(node);
190 if(timestep <= last_timestep) {
191 ir_fprintf(stderr, "Verify warning: Schedule timestep did not increase at node %+F\n",
193 env->problem_found = 1;
195 last_timestep = timestep;
197 /* Check that phis come before any other node */
200 ir_fprintf(stderr, "Verify Warning: Phi node %+F scheduled after non-Phi nodes in block %+F (%s)\n",
201 node, block, get_irg_dump_name(env->irg));
202 env->problem_found = 1;
208 /* Check for control flow changing nodes */
209 if (is_cfop(node) && get_irn_opcode(node) != iro_Start) {
210 /* check, that only one CF operation is scheduled */
211 if (cfchange_found == 1) {
212 ir_fprintf(stderr, "Verify Warning: More than 1 control flow changing node (%+F) scheduled in block %+F (%s)\n",
213 node, block, get_irg_dump_name(env->irg));
214 env->problem_found = 1;
217 } else if (cfchange_found) {
218 /* proj and keepany aren't real instructions... */
219 if(!is_Proj(node) && !be_is_Keep(node)) {
220 /* check for delay branches */
221 if (delay_branches == 0) {
222 ir_fprintf(stderr, "Verify Warning: Node %+F scheduled after control flow changing node (+delay branches) in block %+F (%s)\n",
223 node, block, get_irg_dump_name(env->irg));
224 env->problem_found = 1;
231 /* Check that all uses come before their definitions */
233 int nodetime = sched_get_time_step(node);
234 for(i = 0, arity = get_irn_arity(node); i < arity; ++i) {
235 ir_node *arg = get_irn_n(node, i);
236 if(get_nodes_block(arg) != block
237 || !sched_is_scheduled(arg))
240 if(sched_get_time_step(arg) >= nodetime) {
241 ir_fprintf(stderr, "Verify Warning: Value %+F used by %+F before it was defined in block %+F (%s)\n",
242 arg, node, block, get_irg_dump_name(env->irg));
243 env->problem_found = 1;
248 /* Check that no dead nodes are scheduled */
249 if(get_irn_n_edges(node) == 0) {
250 ir_fprintf(stderr, "Verify warning: Node %+F is dead but scheduled in block %+F (%s)\n",
251 node, block, get_irg_dump_name(env->irg));
252 env->problem_found = 1;
255 if(be_is_Keep(node)) {
256 /* at least 1 of the keep arguments has to be it schedule
258 int arity = get_irn_arity(node);
260 ir_node *prev = sched_prev(node);
261 for(i = 0; i < arity; ++i) {
262 ir_node *in = get_irn_n(node, i);
268 ir_fprintf(stderr, "%+F not scheduled after its pred node in block %+F (%s)\n",
269 node, block, get_irg_dump_name(env->irg));
270 env->problem_found = 1;
275 /* check that all delay branches are filled (at least with NOPs) */
276 if (cfchange_found && delay_branches != 0) {
277 ir_fprintf(stderr, "Verify warning: Not all delay slots filled after jump (%d/%d) in block %+F (%s)\n",
278 block, get_irg_dump_name(env->irg));
279 env->problem_found = 1;
283 static int should_be_scheduled(be_verify_schedule_env_t *env, ir_node *node) {
287 if(get_irn_mode(node) == mode_M) {
290 if(is_Phi(node) || is_Sync(node) || is_Pin(node))
293 #ifdef SCHEDULE_PROJS
295 if(get_irn_mode(node) == mode_X)
297 return should_be_scheduled(env, get_Proj_pred(node));
303 if(be_is_Keep(node) && get_irn_opcode(get_nodes_block(node)) == iro_Bad)
306 switch(get_irn_opcode(node)) {
316 if(arch_irn_get_flags(env->arch_env, node) & arch_irn_flags_ignore)
322 static void check_schedule(ir_node *node, void *data) {
323 be_verify_schedule_env_t *env = data;
327 should_be = should_be_scheduled(env, node);
331 scheduled = bitset_is_set(env->scheduled, get_irn_idx(node)) ? 1 : 0;
332 should_be = should_be ? 1 : 0;
333 if(should_be != scheduled) {
334 ir_fprintf(stderr, "Verify warning: Node %+F in block %+F(%s) should%s be scheduled\n",
335 node, get_nodes_block(node), get_irg_dump_name(env->irg), should_be ? "" : " not");
336 env->problem_found = 1;
341 * Start a walk over the irg and check schedule.
343 int be_verify_schedule(const be_irg_t *birg)
345 be_verify_schedule_env_t env;
347 env.problem_found = 0;
348 env.irg = be_get_birg_irg(birg);
349 env.scheduled = bitset_alloca(get_irg_last_idx(env.irg));
350 env.arch_env = birg->main_env->arch_env;
352 irg_block_walk_graph(env.irg, verify_schedule_walker, NULL, &env);
353 /* check if all nodes are scheduled */
354 irg_walk_graph(env.irg, check_schedule, NULL, &env);
356 return ! env.problem_found;
361 /*--------------------------------------------------------------------------- */
365 typedef struct _spill_t {
371 const arch_env_t *arch_env;
376 } be_verify_spillslots_env_t;
378 static int cmp_spill(const void* d1, const void* d2, size_t size) {
379 const spill_t* s1 = d1;
380 const spill_t* s2 = d2;
383 return s1->spill != s2->spill;
386 static spill_t *find_spill(be_verify_spillslots_env_t *env, ir_node *node) {
390 return set_find(env->spills, &spill, sizeof(spill), HASH_PTR(node));
393 static spill_t *get_spill(be_verify_spillslots_env_t *env, ir_node *node, ir_entity *ent) {
395 int hash = HASH_PTR(node);
398 res = set_find(env->spills, &spill, sizeof(spill), hash);
402 res = set_insert(env->spills, &spill, sizeof(spill), hash);
408 static ir_node *get_memory_edge(const ir_node *node) {
410 ir_node *result = NULL;
412 arity = get_irn_arity(node);
413 for(i = arity - 1; i >= 0; --i) {
414 ir_node *arg = get_irn_n(node, i);
415 if(get_irn_mode(arg) == mode_M) {
416 assert(result == NULL);
425 void collect(be_verify_spillslots_env_t *env, ir_node *node, ir_node *reload, ir_entity* ent);
428 void be_check_entity(be_verify_spillslots_env_t *env, ir_node *node, ir_entity *ent) {
430 ir_fprintf(stderr, "Verify warning: Node %+F in block %+F(%s) should have an entity assigned\n",
431 node, get_nodes_block(node), get_irg_dump_name(env->irg));
436 void collect_spill(be_verify_spillslots_env_t *env, ir_node *node, ir_node *reload, ir_entity* ent) {
437 ir_entity *spillent = arch_get_frame_entity(env->arch_env, node);
438 be_check_entity(env, node, spillent);
439 get_spill(env, node, ent);
441 if(spillent != ent) {
442 ir_fprintf(stderr, "Verify warning: Spill %+F has different entity than reload %+F in block %+F(%s)\n",
443 node, reload, get_nodes_block(node), get_irg_dump_name(env->irg));
444 env->problem_found = 1;
448 static void collect_memperm(be_verify_spillslots_env_t *env, ir_node *node, ir_node *reload, ir_entity* ent) {
451 int hash = HASH_PTR(node);
456 assert(is_Proj(node));
458 memperm = get_Proj_pred(node);
459 out = get_Proj_proj(node);
461 spillent = be_get_MemPerm_out_entity(memperm, out);
462 be_check_entity(env, memperm, spillent);
463 if(spillent != ent) {
464 ir_fprintf(stderr, "Verify warning: MemPerm %+F has different entity than reload %+F in block %+F(%s)\n",
465 node, reload, get_nodes_block(node), get_irg_dump_name(env->irg));
466 env->problem_found = 1;
470 res = set_find(env->spills, &spill, sizeof(spill), hash);
475 spill.ent = spillent;
476 res = set_insert(env->spills, &spill, sizeof(spill), hash);
478 for(i = 0, arity = be_get_MemPerm_entity_arity(memperm); i < arity; ++i) {
479 ir_node* arg = get_irn_n(memperm, i + 1);
480 ir_entity* argent = be_get_MemPerm_in_entity(memperm, i);
482 collect(env, arg, memperm, argent);
486 static void collect_memphi(be_verify_spillslots_env_t *env, ir_node *node, ir_node *reload, ir_entity *ent) {
489 int hash = HASH_PTR(node);
491 assert(is_Phi(node));
494 res = set_find(env->spills, &spill, sizeof(spill), hash);
500 res = set_insert(env->spills, &spill, sizeof(spill), hash);
502 /* is 1 of the arguments a spill? */
503 for(i = 0, arity = get_irn_arity(node); i < arity; ++i) {
504 ir_node* arg = get_irn_n(node, i);
505 collect(env, arg, reload, ent);
509 static void collect(be_verify_spillslots_env_t *env, ir_node *node, ir_node *reload, ir_entity* ent) {
510 if(be_is_Spill(node)) {
511 collect_spill(env, node, reload, ent);
512 } else if(is_Proj(node)) {
513 collect_memperm(env, node, reload, ent);
514 } else if(is_Phi(node) && get_irn_mode(node) == mode_M) {
515 collect_memphi(env, node, reload, ent);
517 /* Disabled for now, spills might get transformed by the backend */
519 ir_fprintf(stderr, "Verify warning: No spill, memperm or memphi attached to node %+F found from node %+F in block %+F(%s)\n",
520 node, reload, get_nodes_block(node), get_irg_dump_name(env->irg));
521 env->problem_found = 1;
527 * This walker function searches for reloads and collects all the spills
528 * and memphis attached to them.
530 static void collect_spills_walker(ir_node *node, void *data) {
531 be_verify_spillslots_env_t *env = data;
532 const arch_env_t *arch_env = env->arch_env;
534 /* @@@ ia32_classify returns classification of Proj_pred :-/ */
538 if(arch_irn_class_is(arch_env, node, reload)) {
539 ir_node *spill = get_memory_edge(node);
543 ir_fprintf(stderr, "Verify warning: No spill attached to reload %+F in block %+F(%s)\n",
544 node, get_nodes_block(node), get_irg_dump_name(env->irg));
545 env->problem_found = 1;
548 ent = arch_get_frame_entity(env->arch_env, node);
549 be_check_entity(env, node, ent);
551 collect(env, spill, node, ent);
552 ARR_APP1(ir_node*, env->reloads, node);
556 static void check_spillslot_interference(be_verify_spillslots_env_t *env) {
557 int spillcount = set_count(env->spills);
558 spill_t **spills = alloca(spillcount * sizeof(spills[0]));
562 for(spill = set_first(env->spills), i = 0; spill != NULL; spill = set_next(env->spills), ++i) {
566 for(i = 0; i < spillcount; ++i) {
567 spill_t *sp1 = spills[i];
570 for(i2 = i+1; i2 < spillcount; ++i2) {
571 spill_t *sp2 = spills[i2];
573 if(sp1->ent != sp2->ent)
576 if(my_values_interfere(sp1->spill, sp2->spill)) {
577 ir_fprintf(stderr, "Verify warning: Spillslots for %+F in block %+F(%s) and %+F in block %+F(%s) interfere\n",
578 sp1->spill, get_nodes_block(sp1->spill), get_irg_dump_name(env->irg),
579 sp2->spill, get_nodes_block(sp2->spill), get_irg_dump_name(env->irg));
580 env->problem_found = 1;
581 my_values_interfere(sp1->spill, sp2->spill);
587 static void check_lonely_spills(ir_node *node, void *data) {
588 be_verify_spillslots_env_t *env = data;
590 if(be_is_Spill(node) || (is_Proj(node) && be_is_MemPerm(get_Proj_pred(node)))) {
591 spill_t *spill = find_spill(env, node);
592 if(be_is_Spill(node)) {
593 ir_entity *ent = arch_get_frame_entity(env->arch_env, node);
594 be_check_entity(env, node, ent);
598 ir_fprintf(stderr, "Verify warning: Node %+F in block %+F(%s) not connected to a reaload\n",
599 node, get_nodes_block(node), get_irg_dump_name(env->irg));
604 int be_verify_spillslots(const arch_env_t *arch_env, ir_graph *irg)
606 be_verify_spillslots_env_t env;
608 env.arch_env = arch_env;
610 env.spills = new_set(cmp_spill, 10);
611 env.reloads = NEW_ARR_F(ir_node*, 0);
612 env.problem_found = 0;
614 irg_walk_graph(irg, collect_spills_walker, NULL, &env);
615 irg_walk_graph(irg, check_lonely_spills, NULL, &env);
617 check_spillslot_interference(&env);
619 DEL_ARR_F(env.reloads);
622 return ! env.problem_found;
627 /*--------------------------------------------------------------------------- */
632 * Check, if two values interfere.
633 * @param a The first value.
634 * @param b The second value.
635 * @return 1, if a and b interfere, 0 if not.
637 static int my_values_interfere(const ir_node *a, const ir_node *b) {
638 const ir_edge_t *edge;
640 int a2b = value_dominates(a, b);
641 int b2a = value_dominates(b, a);
643 /* If there is no dominance relation, they do not interfere. */
648 * Adjust a and b so, that a dominates b if
649 * a dominates b or vice versa.
652 const ir_node *t = a;
657 bb = get_nodes_block(b);
660 * Look at all usages of a.
661 * If there's one usage of a in the block of b, then
662 * we check, if this use is dominated by b, if that's true
663 * a and b interfere. Note that b must strictly dominate the user,
664 * since if b is the last user of in the block, b and a do not
666 * Uses of a not in b's block can be disobeyed, because the
667 * check for a being live at the end of b's block is already
670 foreach_out_edge(a, edge) {
671 const ir_node *user = get_edge_src_irn(edge);
675 if(get_irn_opcode(user) == iro_End)
678 /* in case of phi arguments we compare with the block the value comes from */
680 ir_node *phiblock = get_nodes_block(user);
683 user = get_irn_n(phiblock, get_edge_src_pos(edge));
686 if(value_dominates(b, user))
695 /*--------------------------------------------------------------------------- */
699 typedef struct _be_verify_register_allocation_env_t {
700 const arch_env_t *arch_env;
704 } be_verify_register_allocation_env_t;
706 static void check_register_constraints(ir_node *node,
707 be_verify_register_allocation_env_t *env)
709 const arch_env_t *arch_env = env->arch_env;
710 const arch_register_t *reg;
713 /* verify output register */
714 if (arch_get_irn_reg_class(arch_env, node, -1) != NULL) {
715 reg = arch_get_irn_register(arch_env, node);
717 ir_fprintf(stderr, "Verify warning: Node %+F in block %+F(%s) should have a register assigned\n",
718 node, get_nodes_block(node), get_irg_dump_name(env->irg));
719 env->problem_found = 1;
721 else if (! arch_register_type_is(reg, joker) && !arch_reg_is_allocatable(arch_env, node, -1, reg)) {
722 ir_fprintf(stderr, "Verify warning: Register %s assigned as output of %+F not allowed (register constraint) in block %+F(%s)\n",
723 reg->name, node, get_nodes_block(node), get_irg_dump_name(env->irg));
724 env->problem_found = 1;
728 /* verify input register */
729 arity = get_irn_arity(node);
730 for (i = 0; i < arity; ++i) {
731 ir_node *pred = get_irn_n(node, i);
733 if (is_Unknown(pred))
737 ir_fprintf(stderr, "Verify warning: %+F in block %+F(%s) has Bad as input %d\n",
738 node, get_nodes_block(node), get_irg_dump_name(env->irg), i);
739 env->problem_found = 1;
743 if (arch_get_irn_reg_class(arch_env, node, i) == NULL)
746 reg = arch_get_irn_register(arch_env, pred);
748 ir_fprintf(stderr, "Verify warning: Node %+F in block %+F(%s) should have a register assigned\n",
749 pred, get_nodes_block(pred), get_irg_dump_name(env->irg));
750 env->problem_found = 1;
753 else if (! arch_register_type_is(reg, joker) && ! arch_reg_is_allocatable(arch_env, node, i, reg)) {
754 ir_fprintf(stderr, "Verify warning: Register %s as input %d of %+F not allowed (register constraint) in block %+F(%s)\n",
755 reg->name, i, node, get_nodes_block(node), get_irg_dump_name(env->irg));
756 env->problem_found = 1;
761 static void check_register_allocation(be_verify_register_allocation_env_t *env,
762 const arch_register_class_t *regclass,
765 const arch_env_t *arch_env = env->arch_env;
766 const arch_register_t *reg = NULL;
768 bitset_t *registers = bitset_alloca(arch_register_class_n_regs(regclass));
770 ir_nodeset_iterator_t iter;
772 foreach_ir_nodeset(nodes, node, iter) {
773 if (arch_get_irn_reg_class(arch_env, node, -1) != regclass)
776 reg = arch_get_irn_register(arch_env, node);
778 /* this problem is already reported in 'check_register_constraints' */
782 if (bitset_is_set(registers, reg->index)) {
786 bitset_set(registers, reg->index);
790 ir_fprintf(stderr, "Verify warning: Register %s assigned more than once in block %+F(%s)\n",
791 reg->name, get_nodes_block(node), get_irg_dump_name(env->irg));
792 env->problem_found = 1;
794 foreach_ir_nodeset(nodes, node, iter) {
795 if (arch_get_irn_register(arch_env, node) == reg) {
796 ir_fprintf(stderr, " at node %+F\n", node);
802 static void verify_block_register_allocation(ir_node *block, void *data) {
803 be_verify_register_allocation_env_t *env = data;
804 const arch_env_t *arch_env = env->arch_env;
805 const arch_isa_t *isa = arch_env->isa;
808 nregclasses = arch_isa_get_n_reg_class(isa);
809 for (i = 0; i < nregclasses; ++i) {
810 const arch_register_class_t *regclass = arch_isa_get_reg_class(isa, i);
812 ir_nodeset_t live_nodes;
814 ir_nodeset_init(&live_nodes);
816 be_liveness_end_of_block(env->lv, env->arch_env, regclass, block,
818 check_register_allocation(env, regclass, &live_nodes);
820 sched_foreach_reverse(block, node) {
824 be_liveness_transfer(env->arch_env, regclass, node, &live_nodes);
825 check_register_allocation(env, regclass, &live_nodes);
826 check_register_constraints(node, env);
829 ir_nodeset_destroy(&live_nodes);
833 int be_verify_register_allocation(const arch_env_t *arch_env, ir_graph *irg) {
834 be_verify_register_allocation_env_t env;
836 env.arch_env = arch_env;
838 env.lv = be_liveness(irg);
839 env.problem_found = 0;
841 be_liveness_assure_sets(env.lv);
842 irg_block_walk_graph(irg, verify_block_register_allocation, NULL, &env);
844 be_liveness_free(env.lv);
846 return !env.problem_found;
851 /*--------------------------------------------------------------------------- */
855 typedef struct _verify_out_dead_nodes_env {
859 } verify_out_dead_nodes_env;
861 static void check_out_edges(ir_node *node, verify_out_dead_nodes_env *env) {
862 ir_graph *irg = env->irg;
863 const ir_edge_t* edge;
865 if(irn_visited(node))
867 mark_irn_visited(node);
869 /* we find too many (uncritical) dead nodes in block out edges */
873 foreach_out_edge(node, edge) {
874 ir_node* src = get_edge_src_irn(edge);
876 if(!bitset_is_set(env->reachable, get_irn_idx(src)) && !is_Block(src)) {
877 ir_fprintf(stderr, "Verify warning: Node %+F in block %+F(%s) only reachable through out edges from %+F\n",
878 src, get_nodes_block(src), get_irg_dump_name(irg), node);
879 env->problem_found = 1;
883 check_out_edges(src, env);
887 static void set_reachable(ir_node *node, void* data)
889 bitset_t* reachable = data;
890 bitset_set(reachable, get_irn_idx(node));
893 int be_verify_out_edges(ir_graph *irg) {
894 verify_out_dead_nodes_env env;
897 env.reachable = bitset_alloca(get_irg_last_idx(irg));
898 env.problem_found = edges_verify(irg);
900 irg_walk_in_or_dep_graph(irg, set_reachable, NULL, env.reachable);
901 irg_walk_anchors(irg, set_reachable, NULL, env.reachable);
902 inc_irg_visited(irg);
903 check_out_edges(get_irg_start(irg), &env);
905 return ! env.problem_found;