[Mesa-dev] [PATCH 4/9] nir: Allocate register fields out of the register itself.

Kenneth Graunke kenneth at whitecape.org
Sat Mar 28 14:28:27 PDT 2015


The lifetime of each register's use/def/if_use sets needs to match the
register itself.  So, allocate them using the register itself as the
context.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/glsl/nir/nir.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index 0311d8d..e96f113 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -58,11 +58,11 @@ reg_create(void *mem_ctx, struct exec_list *list)
    nir_register *reg = ralloc(mem_ctx, nir_register);
 
    reg->parent_instr = NULL;
-   reg->uses = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+   reg->uses = _mesa_set_create(reg, _mesa_hash_pointer,
                                 _mesa_key_pointer_equal);
-   reg->defs = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+   reg->defs = _mesa_set_create(reg, _mesa_hash_pointer,
                                 _mesa_key_pointer_equal);
-   reg->if_uses = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+   reg->if_uses = _mesa_set_create(reg, _mesa_hash_pointer,
                                    _mesa_key_pointer_equal);
 
    reg->num_components = 0;
-- 
2.3.4



More information about the mesa-dev mailing list