+ fprintf(output, " storage:");
+ int printed = 0;
+ if (storage & storage_buffer)
+ printed += fprintf(output, "%sbuffer", printed ? "," : "");
+ if (storage & storage_atomic_counter)
+ printed += fprintf(output, "%satomic_counter", printed ? "," : "");
+ if (storage & storage_image)
+ printed += fprintf(output, "%simage", printed ? "," : "");
+ if (storage & storage_shared)
+ printed += fprintf(output, "%sshared", printed ? "," : "");
+ if (storage & storage_vmem_output)
+ printed += fprintf(output, "%svmem_output", printed ? "," : "");
+ if (storage & storage_scratch)
+ printed += fprintf(output, "%sscratch", printed ? "," : "");
+ if (storage & storage_vgpr_spill)
+ printed += fprintf(output, "%svgpr_spill", printed ? "," : "");
+}
+
+static void print_semantics(memory_semantics sem, FILE *output)
+{
+ fprintf(output, " semantics:");
+ int printed = 0;
+ if (sem & semantic_acquire)
+ printed += fprintf(output, "%sacquire", printed ? "," : "");
+ if (sem & semantic_release)
+ printed += fprintf(output, "%srelease", printed ? "," : "");
+ if (sem & semantic_volatile)
+ printed += fprintf(output, "%svolatile", printed ? "," : "");
+ if (sem & semantic_private)
+ printed += fprintf(output, "%sprivate", printed ? "," : "");
+ if (sem & semantic_can_reorder)
+ printed += fprintf(output, "%sreorder", printed ? "," : "");
+ if (sem & semantic_atomic)
+ printed += fprintf(output, "%satomic", printed ? "," : "");
+ if (sem & semantic_rmw)
+ printed += fprintf(output, "%srmw", printed ? "," : "");
+}
+
+static void print_scope(sync_scope scope, FILE *output, const char *prefix="scope")
+{
+ fprintf(output, " %s:", prefix);
+ switch (scope) {
+ case scope_invocation:
+ fprintf(output, "invocation");
+ break;
+ case scope_subgroup:
+ fprintf(output, "subgroup");
+ break;
+ case scope_workgroup:
+ fprintf(output, "workgroup");
+ break;
+ case scope_queuefamily:
+ fprintf(output, "queuefamily");
+ break;
+ case scope_device:
+ fprintf(output, "device");
+ break;
+ }
+}