summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErico Nunes <[email protected]>2019-07-17 01:30:55 +0200
committerErico Nunes <[email protected]>2019-07-19 16:01:45 +0000
commit2292f0c4b5216624768b7f990c449556a624f45d (patch)
tree42287b7636cf8efaad0ca5354949d62a1bea6ffc
parent32b72cbca59a7d04a738087367bf886881a43f64 (diff)
lima/ppir: branch regalloc fixes
The branch instruction has sources which must be handled in src handling paths so that regalloc assigns registers to them properly. Signed-off-by: Erico Nunes <[email protected]> Reviewed-by: Vasily Khoruzhick <[email protected]>
-rw-r--r--src/gallium/drivers/lima/ir/pp/regalloc.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gallium/drivers/lima/ir/pp/regalloc.c b/src/gallium/drivers/lima/ir/pp/regalloc.c
index dee530ca2b6..62401150e3e 100644
--- a/src/gallium/drivers/lima/ir/pp/regalloc.c
+++ b/src/gallium/drivers/lima/ir/pp/regalloc.c
@@ -239,6 +239,16 @@ static ppir_reg *ppir_regalloc_build_liveness_info(ppir_compiler *comp)
reg->live_out = node->instr->seq;
break;
}
+ case ppir_node_type_branch:
+ {
+ ppir_branch_node *branch = ppir_node_to_branch(node);
+ for (int i = 0; i < 2; i++) {
+ ppir_reg *reg = get_src_reg(branch->src + i);
+ if (reg && node->instr->seq > reg->live_out)
+ reg->live_out = node->instr->seq;
+ }
+ break;
+ }
default:
break;
}
@@ -315,6 +325,17 @@ static void ppir_regalloc_print_result(ppir_compiler *comp)
printf("%d", ppir_target_get_src_reg_index(&load_tex->src_coords));
break;
}
+ case ppir_node_type_branch:
+ {
+ ppir_branch_node *branch = ppir_node_to_branch(node);
+ for (int j = 0; j < 2; j++) {
+ if (j)
+ printf(" ");
+
+ printf("%d", ppir_target_get_src_reg_index(branch->src + j));
+ }
+ break;
+ }
default:
break;
}
@@ -610,6 +631,18 @@ static bool ppir_regalloc_spill_reg(ppir_compiler *comp, ppir_reg *chosen)
}
break;
}
+ case ppir_node_type_branch:
+ {
+ ppir_branch_node *branch = ppir_node_to_branch(node);
+ for (int i = 0; i < 2; i++) {
+ reg = get_src_reg(branch->src + i);
+ if (reg == chosen) {
+ ppir_update_spilled_src(comp, block, node,
+ branch->src + i, NULL);
+ }
+ }
+ break;
+ }
default:
break;
}