_mesa_set_add(instr->live_in_set, &instr->live_in[reg->regalloc_index]);
}
else {
- unsigned int mask = ppir_src_get_mask(node);
+ unsigned int mask = ppir_src_get_mask(src);
/* read reg is type register, need to check if this sets
* any additional bits in the current mask */
_mesa_set_remove_key(instr->live_in_set, &instr->live_in[reg->regalloc_index]);
}
else {
- unsigned int mask = ppir_src_get_mask(node);
+ unsigned int mask = dest->write_mask;
/* written reg is type register, need to check if this clears
* the remaining mask to remove it from the live set */
if (instr->live_in[reg->regalloc_index].mask ==
}
}
-static inline int ppir_src_get_mask(ppir_node *node)
-{
- ppir_dest *dest = ppir_node_get_dest(node);
- if (dest)
- return dest->write_mask;
-
- return 0x01;
-}
-
static inline int ppir_node_get_src_num(ppir_node *node)
{
switch (node->type) {
return -1;
}
+static inline int ppir_src_get_mask(ppir_src *src)
+{
+ ppir_reg *reg = ppir_src_get_reg(src);
+ int mask = 0;
+
+ for (int i = 0; i < reg->num_components; i++)
+ mask |= (1 << src->swizzle[i]);
+
+ return mask;
+}
+
static inline bool ppir_target_is_scaler(ppir_dest *dest)
{
switch (dest->type) {