lima/ppir: introduce liveness internal live set
[mesa.git] / src / gallium / drivers / lima / ir / pp / regalloc.c
index 0b5af3c6bf45d85b0c8878bccce25c765eccd484..4b5d3a8bb1d42307a4884784a974330737b8fbe3 100644 (file)
@@ -599,6 +599,17 @@ static void ppir_regalloc_reset_liveness_info(ppir_compiler *comp)
                                                _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,
@@ -648,6 +659,10 @@ static bool ppir_regalloc_prog_try(ppir_compiler *comp, bool *spilled)
 
    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);
       }