+/** The tarval returned by Unknown nodes. */
+static tarval *tarval_UNKNOWN;
+
+/* forward */
+static node_t *identity(node_t *node);
+
+#ifdef CHECK_PARTITIONS
+/**
+ * Check a partition.
+ */
+static void check_partition(const partition_t *T) {
+ node_t *node;
+ unsigned n = 0;
+
+ list_for_each_entry(node_t, node, &T->Leader, node_list) {
+ assert(node->is_follower == 0);
+ assert(node->flagged == 0);
+ assert(node->part == T);
+ ++n;
+ }
+ assert(n == T->n_leader);
+
+ list_for_each_entry(node_t, node, &T->Follower, node_list) {
+ assert(node->is_follower == 1);
+ assert(node->flagged == 0);
+ assert(node->part == T);
+ }
+} /* check_partition */
+
+static void check_all_partitions(environment_t *env) {
+ partition_t *P;
+ node_t *node;
+
+#ifdef DEBUG_libfirm
+ for (P = env->dbg_list; P != NULL; P = P->dbg_next) {
+ check_partition(P);
+ list_for_each_entry(node_t, node, &P->Follower, node_list) {
+ node_t *leader = identity(node);
+
+ assert(leader != node && leader->part == node->part);
+ }
+ }
+#endif
+}
+
+/**
+ * Check list.
+ */
+static void do_check_list(const node_t *list, int ofs, const partition_t *Z) {
+ const node_t *e;
+
+#define NEXT(e) *((const node_t **)((char *)(e) + (ofs)))
+ for (e = list; e != NULL; e = NEXT(e)) {
+ assert(e->part == Z);
+ }
+#undef NEXT
+} /* ido_check_list */
+
+/**
+ * Check a local list.
+ */
+static void check_list(const node_t *list, const partition_t *Z) {
+ do_check_list(list, offsetof(node_t, next), Z);
+} /* check_list */
+
+#else
+#define check_partition(T)
+#define check_list(list, Z)
+#define check_all_partitions(env)
+#endif /* CHECK_PARTITIONS */
+