nir: set reg_alloc and ssa_alloc when indexing registers and SSA values
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 31 Oct 2014 04:18:22 +0000 (21:18 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 15 Jan 2015 15:19:00 +0000 (07:19 -0800)
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir.c
src/glsl/nir/nir.h

index 3c3afef..adb353b 100644 (file)
@@ -1340,6 +1340,7 @@ nir_index_local_regs(nir_function_impl *impl)
    foreach_list_typed(nir_register, reg, node, &impl->registers) {
       reg->index = index++;
    }
+   impl->reg_alloc = index;
 }
 
 void
@@ -1349,6 +1350,7 @@ nir_index_global_regs(nir_shader *shader)
    foreach_list_typed(nir_register, reg, node, &shader->registers) {
       reg->index = index++;
    }
+   shader->reg_alloc = index;
 }
 
 static bool
@@ -1771,4 +1773,5 @@ nir_index_ssa_defs(nir_function_impl *impl)
 {
    unsigned index = 0;
    nir_foreach_block(impl, index_ssa_block, &index);
+   impl->ssa_alloc = index;
 }
index 84be1d6..b9a17ed 100644 (file)
@@ -357,7 +357,7 @@ typedef struct {
    unsigned num_components; /** < number of vector components */
    unsigned num_array_elems; /** < size of array (0 for no array) */
 
-   /** for liveness analysis, the index in the bit-array of live variables */
+   /** generic register index. */
    unsigned index;
 
    /** only for debug purposes, can be NULL */
@@ -417,7 +417,7 @@ typedef struct {
    /** for debugging only, can be NULL */
    const char* name;
 
-   /** index into the bit-array for liveness analysis */
+   /** generic SSA definition index. */
    unsigned index;
 
    nir_instr *parent_instr;