diff options
author | Erico Nunes <[email protected]> | 2019-07-17 01:31:01 +0200 |
---|---|---|
committer | Erico Nunes <[email protected]> | 2019-07-19 16:01:45 +0000 |
commit | 32ced14badc14f6b7d3c4c0738c83074ea68ea7d (patch) | |
tree | 9226beb6d7fca93f12518824948c2c224f8c8495 /src/gallium/drivers/lima | |
parent | 2292f0c4b5216624768b7f990c449556a624f45d (diff) |
lima/ppir: handle all node types in ppir_node_replace_child
ppir_node_replace_child is used by the const lowering routine in ppir.
All types need to be handled here, otherwise the src node is not updated
properly when one of the lowered nodes is a const, which results in, for
example, regalloc not assigning registers correctly.
Signed-off-by: Erico Nunes <[email protected]>
Reviewed-by: Vasily Khoruzhick <[email protected]>
Diffstat (limited to 'src/gallium/drivers/lima')
-rw-r--r-- | src/gallium/drivers/lima/ir/pp/node.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/gallium/drivers/lima/ir/pp/node.c b/src/gallium/drivers/lima/ir/pp/node.c index 280e08e9e2d..841303b8a86 100644 --- a/src/gallium/drivers/lima/ir/pp/node.c +++ b/src/gallium/drivers/lima/ir/pp/node.c @@ -394,14 +394,42 @@ static void _ppir_node_replace_child(ppir_src *src, ppir_node *old_child, ppir_n void ppir_node_replace_child(ppir_node *parent, ppir_node *old_child, ppir_node *new_child) { - if (parent->type == ppir_node_type_alu) { + switch (parent->type) { + case ppir_node_type_alu: + { ppir_alu_node *alu = ppir_node_to_alu(parent); for (int i = 0; i < alu->num_src; i++) _ppir_node_replace_child(alu->src + i, old_child, new_child); + break; } - else if (parent->type == ppir_node_type_store) { + case ppir_node_type_branch: + { + ppir_branch_node *branch = ppir_node_to_branch(parent); + for (int i = 0; i < 2; i++) + _ppir_node_replace_child(branch->src + i, old_child, new_child); + break; + } + case ppir_node_type_load: + { + ppir_load_node *load = ppir_node_to_load(parent); + _ppir_node_replace_child(&load->src, old_child, new_child); + break; + } + case ppir_node_type_load_texture: + { + ppir_load_texture_node *load_texture = ppir_node_to_load_texture(parent); + _ppir_node_replace_child(&load_texture->src_coords, old_child, new_child); + break; + } + case ppir_node_type_store: + { ppir_store_node *store = ppir_node_to_store(parent); _ppir_node_replace_child(&store->src, old_child, new_child); + break; + } + default: + ppir_debug("unknown node type in %s\n", __func__); + break; } } |