/* if some other op on this same instruction is writing,
* we just need to reserve a register for this particular
- * instruction. Add the register to live_out to make that
- * interference happen without propagating its liveness. */
+ * instruction. */
if (src->node && src->node->instr == instr) {
- instr->live_out[reg->regalloc_index].reg = reg;
- _mesa_set_add(instr->live_out_set, &instr->live_out[reg->regalloc_index]);
+ instr->live_internal[reg->regalloc_index].reg = reg;
+ _mesa_set_add(instr->live_internal_set, &instr->live_internal[reg->regalloc_index]);
continue;
}
* either dead code or a bug. For now, assign an interference to it to
* ensure it doesn't get assigned a live register and overwrites it. */
if (!live) {
- instr->live_out[reg->regalloc_index].reg = reg;
- _mesa_set_add(instr->live_out_set, &instr->live_out[reg->regalloc_index]);
+ instr->live_internal[reg->regalloc_index].reg = reg;
+ _mesa_set_add(instr->live_internal_set, &instr->live_internal[reg->regalloc_index]);
continue;
}
/* for liveness analysis */
struct ppir_liveness *live_in;
struct ppir_liveness *live_out;
+ /* live_internal is to mark registers only live within an
+ * instruction, without propagation */
+ struct ppir_liveness *live_internal;
struct set *live_in_set;
struct set *live_out_set;
+ struct set *live_internal_set;
} ppir_instr;
typedef struct ppir_block {
_mesa_hash_pointer,
_mesa_key_pointer_equal);
+ if (instr->live_internal)
+ ralloc_free(instr->live_internal);
+ instr->live_internal = rzalloc_array(comp,
+ struct ppir_liveness, list_length(&comp->reg_list));
+
+ if (instr->live_internal_set)
+ _mesa_set_destroy(instr->live_internal_set, NULL);
+ instr->live_internal_set = _mesa_set_create(comp,
+ _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
+
if (instr->live_out)
ralloc_free(instr->live_out);
instr->live_out = rzalloc_array(comp,
list_for_each_entry(ppir_block, block, &comp->block_list, list) {
list_for_each_entry(ppir_instr, instr, &block->instr_list, list) {
+ set_foreach(instr->live_internal_set, entry) {
+ _mesa_set_add(instr->live_in_set, entry->key);
+ _mesa_set_add(instr->live_out_set, entry->key);
+ }
ppir_all_interference(comp, g, instr->live_in_set);
ppir_all_interference(comp, g, instr->live_out_set);
}