+struct pass_t {
+ ir_graph_pass_t pass;
+ unsigned assert_on_problem;
+};
+
+/**
+ * Wrapper to edges_verify to be run as an ir_graph pass.
+ */
+static int edges_verify_wrapper(ir_graph *irg, void *context)
+{
+ struct pass_t *pass = context;
+ int problems_found = edges_verify(irg);
+ /* do NOT rerun the pass if verify is ok :-) */
+ assert(problems_found && pass->assert_on_problem);
+ return 0;
+}
+
+/* Creates an ir_graph pass for edges_verify(). */
+ir_graph_pass_t *irg_verify_edges_pass(const char *name, unsigned assert_on_problem)
+{
+ struct pass_t *pass = XMALLOCZ(struct pass_t);
+
+ def_graph_pass_constructor(
+ &pass->pass, name ? name : "edges_verify", edges_verify_wrapper);
+
+ /* neither dump nor verify */
+ pass->pass.dump_irg = (DUMP_ON_IRG_FUNC)ir_prog_no_dump;
+ pass->pass.verify_irg = (RUN_ON_IRG_FUNC)ir_prog_no_verify;
+
+ pass->assert_on_problem = assert_on_problem;
+ return &pass->pass;
+}
+
+void init_edges(void)
+{