return succ;
}
+/*
+ * Validate that phis only appear at the beginning of blocks.
+ */
+static bool
+bi_validate_phi_ordering(bi_context *ctx)
+{
+ bi_foreach_block(ctx, block) {
+ bool start = true;
+
+ bi_foreach_instr_in_block(block, I) {
+ if (start)
+ start = I->op == BI_OPCODE_PHI;
+ else if (I->op == BI_OPCODE_PHI)
+ return false;
+ }
+ }
+
+ return true;
+}
+
void
bi_validate(bi_context *ctx, const char *after)
{
fail = true;
}
+ if (!bi_validate_phi_ordering(ctx)) {
+ fprintf(stderr, "Unexpected phi ordering after %s\n", after);
+ fail = true;
+ }
+
if (fail) {
bi_print_shader(ctx, stderr);
exit(1);