lima/ppir: add ppir_node to ppir_src
We'll need it if we want to walk through node sources Reviewed-by: Qiang Yu <yuq825@gmail.com> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
This commit is contained in:
parent
afa64a2105
commit
a5e7c12ced
|
@ -54,7 +54,7 @@ static bool ppir_lower_const(ppir_block *block, ppir_node *node)
|
|||
ppir_alu_node *alu = ppir_node_to_alu(move);
|
||||
alu->dest = *dest;
|
||||
alu->num_src = 1;
|
||||
ppir_node_target_assign(alu->src, dest);
|
||||
ppir_node_target_assign(alu->src, node);
|
||||
for (int i = 0; i < 4; i++)
|
||||
alu->src->swizzle[i] = i;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ static bool ppir_lower_load(ppir_block *block, ppir_node *node)
|
|||
dest->pipeline = ppir_pipeline_reg_uniform;
|
||||
|
||||
alu->num_src = 1;
|
||||
ppir_node_target_assign(&alu->src[0], dest);
|
||||
ppir_node_target_assign(&alu->src[0], node);
|
||||
for (int i = 0; i < 4; i++)
|
||||
alu->src->swizzle[i] = i;
|
||||
|
||||
|
@ -174,7 +174,7 @@ static bool ppir_lower_texture(ppir_block *block, ppir_node *node)
|
|||
dest->pipeline = ppir_pipeline_reg_sampler;
|
||||
|
||||
alu->num_src = 1;
|
||||
ppir_node_target_assign(&alu->src[0], dest);
|
||||
ppir_node_target_assign(&alu->src[0], node);
|
||||
for (int i = 0; i < 4; i++)
|
||||
alu->src->swizzle[i] = i;
|
||||
|
||||
|
@ -223,7 +223,7 @@ static bool ppir_lower_select(ppir_block *block, ppir_node *node)
|
|||
assert(ppir_node_first_pred(node) == move);
|
||||
|
||||
src->swizzle[0] = 0;
|
||||
ppir_node_target_assign(alu->src, move_dest);
|
||||
ppir_node_target_assign(alu->src, move);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,8 +111,7 @@ static void ppir_node_add_src(ppir_compiler *comp, ppir_node *node,
|
|||
}
|
||||
}
|
||||
|
||||
ppir_dest *dest = ppir_node_get_dest(child);
|
||||
ppir_node_target_assign(ps, dest);
|
||||
ppir_node_target_assign(ps, child);
|
||||
}
|
||||
|
||||
static int nir_to_ppir_opcodes[nir_num_opcodes] = {
|
||||
|
|
|
@ -407,8 +407,7 @@ static void _ppir_node_replace_child(ppir_src *src, ppir_node *old_child, ppir_n
|
|||
{
|
||||
ppir_dest *od = ppir_node_get_dest(old_child);
|
||||
if (ppir_node_target_equal(src, od)) {
|
||||
ppir_dest *nd = ppir_node_get_dest(new_child);
|
||||
ppir_node_target_assign(src, nd);
|
||||
ppir_node_target_assign(src, new_child);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ static bool insert_to_each_succ_instr(ppir_block *block, ppir_node *node)
|
|||
ppir_alu_node *alu = ppir_node_to_alu(move);
|
||||
alu->dest = *dest;
|
||||
alu->num_src = 1;
|
||||
ppir_node_target_assign(alu->src, dest);
|
||||
ppir_node_target_assign(alu->src, node);
|
||||
for (int i = 0; i < 4; i++)
|
||||
alu->src->swizzle[i] = i;
|
||||
}
|
||||
|
|
|
@ -188,6 +188,7 @@ typedef enum {
|
|||
|
||||
typedef struct ppir_src {
|
||||
ppir_target type;
|
||||
ppir_node *node;
|
||||
|
||||
union {
|
||||
ppir_reg *ssa;
|
||||
|
@ -467,18 +468,25 @@ static inline ppir_src *ppir_node_get_src(ppir_node *node, int idx)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline void ppir_node_target_assign(ppir_src *src, ppir_dest *dest)
|
||||
static inline void ppir_node_target_assign(ppir_src *src, ppir_node *node)
|
||||
{
|
||||
ppir_dest *dest = ppir_node_get_dest(node);
|
||||
src->type = dest->type;
|
||||
switch (src->type) {
|
||||
case ppir_target_ssa:
|
||||
src->ssa = &dest->ssa;
|
||||
src->node = node;
|
||||
break;
|
||||
case ppir_target_register:
|
||||
src->reg = dest->reg;
|
||||
/* Registers can be assigned from multiple nodes, so don't keep
|
||||
* pointer to the node here
|
||||
*/
|
||||
src->node = NULL;
|
||||
break;
|
||||
case ppir_target_pipeline:
|
||||
src->pipeline = dest->pipeline;
|
||||
src->node = node;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue