+void
+bi_print_clause(bi_clause *clause, FILE *fp)
+{
+ fprintf(fp, "\tid(%u)", clause->scoreboard_id);
+
+ if (clause->dependencies) {
+ fprintf(fp, ", wait(");
+
+ for (unsigned i = 0; i < 8; ++i) {
+ if (clause->dependencies & (1 << i))
+ fprintf(fp, "%u ", i);
+ }
+
+ fprintf(fp, ")");
+ }
+
+ if (!clause->back_to_back)
+ fprintf(fp, " nbb %s", clause->branch_conditional ? "branch-cond" : "branch-uncond");
+
+ if (clause->data_register_write_barrier)
+ fprintf(fp, " drwb");
+
+ fprintf(fp, "\n");
+
+ if (clause->instruction_count) {
+ assert(!clause->bundle_count);
+
+ for (unsigned i = 0; i < clause->instruction_count; ++i)
+ bi_print_instruction(clause->instructions[i], fp);
+ } else {
+ assert(clause->bundle_count);
+
+ for (unsigned i = 0; i < clause->bundle_count; ++i)
+ bi_print_bundle(&clause->bundles[i], fp);
+ }
+
+ if (clause->constant_count) {
+ for (unsigned i = 0; i < clause->constant_count; ++i)
+ fprintf(fp, "%" PRIx64 " ", clause->constants[i]);
+
+ fprintf(fp, "\n");
+ }
+}
+
+void
+bi_print_block(bi_block *block, FILE *fp)
+{
+ fprintf(fp, "block%u {\n", block->base.name);
+
+ if (block->scheduled) {
+ bi_foreach_clause_in_block(block, clause)
+ bi_print_clause(clause, fp);
+ } else {
+ bi_foreach_instr_in_block(block, ins)
+ bi_print_instruction(ins, fp);
+ }
+
+ fprintf(fp, "}");
+
+ if (block->base.successors[0]) {
+ fprintf(fp, " -> ");
+
+ pan_foreach_successor((&block->base), succ)
+ fprintf(fp, "block%u ", succ->name);
+ }
+
+ if (block->base.predecessors->entries) {
+ fprintf(fp, " from");
+
+ bi_foreach_predecessor(block, pred)
+ fprintf(fp, " block%u", pred->base.name);
+ }
+
+ fprintf(fp, "\n\n");
+}
+
+void
+bi_print_shader(bi_context *ctx, FILE *fp)
+{
+ bi_foreach_block(ctx, block)
+ bi_print_block((bi_block *) block, fp);
+}