summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/lima
diff options
context:
space:
mode:
authorVasily Khoruzhick <[email protected]>2019-08-01 21:27:17 -0700
committerVasily Khoruzhick <[email protected]>2019-08-13 22:44:07 -0700
commitb579af77f3c8e6bacbab06002cae386eae68a357 (patch)
tree13143f9d07fca983e85ad6d71d2dbd03fd3cb374 /src/gallium/drivers/lima
parent6920710af5ad9239f741d69735272621a1b7074f (diff)
lima/ppir: print srcs and dests in ppir_node_print_prog()
Now we have an accessors for ppir src, so it's possible to easily print all srcs and dests while dumping ppir representation. Reviewed-by: Qiang Yu <[email protected]> Signed-off-by: Vasily Khoruzhick <[email protected]>
Diffstat (limited to 'src/gallium/drivers/lima')
-rw-r--r--src/gallium/drivers/lima/ir/pp/node.c58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/gallium/drivers/lima/ir/pp/node.c b/src/gallium/drivers/lima/ir/pp/node.c
index 061fc4efaa4..a121e87a5a9 100644
--- a/src/gallium/drivers/lima/ir/pp/node.c
+++ b/src/gallium/drivers/lima/ir/pp/node.c
@@ -479,12 +479,66 @@ void ppir_node_delete(ppir_node *node)
ralloc_free(node);
}
+static void ppir_node_print_dest(ppir_dest *dest)
+{
+ switch (dest->type) {
+ case ppir_target_ssa:
+ printf("ssa%d", dest->ssa.index);
+ break;
+ case ppir_target_pipeline:
+ printf("pipeline %d", dest->pipeline);
+ break;
+ case ppir_target_register:
+ printf("reg %d", dest->reg->index);
+ break;
+ }
+}
+
+static void ppir_node_print_src(ppir_src *src)
+{
+ switch (src->type) {
+ case ppir_target_ssa: {
+ if (src->node)
+ printf("ssa node %d", src->node->index);
+ else
+ printf("ssa idx %d", src->ssa ? src->ssa->index : -1);
+ break;
+ }
+ case ppir_target_pipeline:
+ if (src->node)
+ printf("pipeline %d node %d", src->pipeline, src->node->index);
+ else
+ printf("pipeline %d", src->pipeline);
+ break;
+ case ppir_target_register:
+ printf("reg %d", src->reg->index);
+ break;
+ }
+}
+
static void ppir_node_print_node(ppir_node *node, int space)
{
for (int i = 0; i < space; i++)
printf(" ");
- printf("%s%s %d %s\n", node->printed && !ppir_node_is_leaf(node) ? "+" : "",
- ppir_op_infos[node->op].name, node->index, node->name);
+
+ printf("%s%d: %s %s: ", node->printed && !ppir_node_is_leaf(node) ? "+" : "",
+ node->index, ppir_op_infos[node->op].name, node->name);
+
+ ppir_dest *dest = ppir_node_get_dest(node);
+ if (dest) {
+ printf("dest: ");
+ ppir_node_print_dest(dest);
+ }
+
+ if (ppir_node_get_src_num(node) > 0) {
+ printf(" src: ");
+ }
+ for (int i = 0; i < ppir_node_get_src_num(node); i++) {
+ ppir_node_print_src(ppir_node_get_src(node, i));
+ if (i != (ppir_node_get_src_num(node) - 1))
+ printf(", ");
+ }
+ printf("\n");
if (!node->printed) {
ppir_node_foreach_pred(node, dep) {