summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVasily Khoruzhick <[email protected]>2019-08-18 23:03:57 -0700
committerVasily Khoruzhick <[email protected]>2019-08-23 18:19:47 -0700
commit4e695489df70abdcbe8e9c1094e222695c181d59 (patch)
tree172d6a919b0aff952632227578be9eda74f567d5 /src
parentd11e1b790937f6b0cacbd00bc3ecddf8d0931453 (diff)
lima/ppir: add dummy op
We can get following from NIR: (1) r1 = r2 (2) r2 = ssa1 Note that r2 is read before it's assigned, so there's no node for it in comp->var_nodes. We need to create a dummy node in this case which sole purpose is to hold ppir_dest with reg in it. Tested-by: Andreas Baierl <[email protected]> Reviewed-by: Qiang Yu <[email protected]> Reviewed-by: Erico Nunes <[email protected]> Signed-off-by: Vasily Khoruzhick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/lima/ir/pp/nir.c18
-rw-r--r--src/gallium/drivers/lima/ir/pp/node.c6
-rw-r--r--src/gallium/drivers/lima/ir/pp/ppir.h2
3 files changed, 21 insertions, 5 deletions
diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c
index 669e5fb4101..2375710f815 100644
--- a/src/gallium/drivers/lima/ir/pp/nir.c
+++ b/src/gallium/drivers/lima/ir/pp/nir.c
@@ -53,16 +53,16 @@ static void *ppir_node_create_ssa(ppir_block *block, ppir_op op, nir_ssa_def *ss
}
static void *ppir_node_create_reg(ppir_block *block, ppir_op op,
- nir_reg_dest *reg, unsigned mask)
+ nir_register *reg, unsigned mask)
{
- ppir_node *node = ppir_node_create(block, op, reg->reg->index, mask);
+ ppir_node *node = ppir_node_create(block, op, reg->index, mask);
if (!node)
return NULL;
ppir_dest *dest = ppir_node_get_dest(node);
list_for_each_entry(ppir_reg, r, &block->comp->reg_list, list) {
- if (r->index == reg->reg->index) {
+ if (r->index == reg->index) {
dest->reg = r;
break;
}
@@ -87,7 +87,7 @@ static void *ppir_node_create_dest(ppir_block *block, ppir_op op,
if (dest->is_ssa)
return ppir_node_create_ssa(block, op, &dest->ssa);
else
- return ppir_node_create_reg(block, op, &dest->reg, mask);
+ return ppir_node_create_reg(block, op, dest->reg.reg, mask);
}
return ppir_node_create(block, op, index, 0);
@@ -125,7 +125,15 @@ static void ppir_node_add_src(ppir_compiler *comp, ppir_node *node,
while (mask) {
int swizzle = ps->swizzle[u_bit_scan(&mask)];
child = comp->var_nodes[(reg->index << 2) + comp->reg_base + swizzle];
- ppir_node_add_dep(node, child);
+ /* Reg is read before it was written, create a dummy node for it */
+ if (!child) {
+ child = ppir_node_create_reg(node->block, ppir_op_dummy, reg,
+ u_bit_consecutive(0, 4));
+ comp->var_nodes[(reg->index << 2) + comp->reg_base + swizzle] = child;
+ }
+ /* Don't add dummies or recursive deps for ops like r1 = r1 + ssa1 */
+ if (child && node != child && child->op != ppir_op_dummy)
+ ppir_node_add_dep(node, child);
}
}
diff --git a/src/gallium/drivers/lima/ir/pp/node.c b/src/gallium/drivers/lima/ir/pp/node.c
index 1d4a0c91174..37dd65823fa 100644
--- a/src/gallium/drivers/lima/ir/pp/node.c
+++ b/src/gallium/drivers/lima/ir/pp/node.c
@@ -331,6 +331,12 @@ const ppir_op_info ppir_op_infos[] = {
PPIR_INSTR_SLOT_BRANCH, PPIR_INSTR_SLOT_END
},
},
+ [ppir_op_dummy] = {
+ .name = "dummy",
+ .type = ppir_node_type_alu,
+ .slots = (int []) {
+ },
+ },
};
void *ppir_node_create(ppir_block *block, ppir_op op, int index, unsigned mask)
diff --git a/src/gallium/drivers/lima/ir/pp/ppir.h b/src/gallium/drivers/lima/ir/pp/ppir.h
index bcea3b1dad0..3e852f27ebe 100644
--- a/src/gallium/drivers/lima/ir/pp/ppir.h
+++ b/src/gallium/drivers/lima/ir/pp/ppir.h
@@ -113,6 +113,8 @@ typedef enum {
ppir_op_discard,
ppir_op_branch,
+ ppir_op_dummy,
+
ppir_op_num,
} ppir_op;