diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2013-09-18 14:11:32 -0700 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2013-09-21 09:17:21 -0700 |
commit | 4f1ebb8ddd0294698601a8c4fc38f1e39bfd51f6 (patch) | |
tree | de988eab944ebac1525f233ff33814d9f6e9fbda | |
parent | 81a3759bb51a1a12ba1c6c6ad586c5ff5f31c411 (diff) | |
download | external_mesa3d-4f1ebb8ddd0294698601a8c4fc38f1e39bfd51f6.zip external_mesa3d-4f1ebb8ddd0294698601a8c4fc38f1e39bfd51f6.tar.gz external_mesa3d-4f1ebb8ddd0294698601a8c4fc38f1e39bfd51f6.tar.bz2 |
i965, mesa: Use the new DECLARE_R[Z]ALLOC_CXX_OPERATORS macros.
These classes declared a placement new operator, but didn't declare a
delete operator. Switching to the macro gives them a delete operator,
which probably is a good idea anyway.
This also eliminates a lot of boilerplate.
v2: Properly use RZALLOC in Mesa IR/TGSI translators. Caught by Eric
and Chad.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_cfg.h | 20 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 34 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_live_variables.h | 10 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4.h | 36 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_live_variables.h | 10 | ||||
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 12 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 12 |
7 files changed, 12 insertions, 122 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.h b/src/mesa/drivers/dri/i965/brw_cfg.h index 95a18e9..27bc8b6 100644 --- a/src/mesa/drivers/dri/i965/brw_cfg.h +++ b/src/mesa/drivers/dri/i965/brw_cfg.h @@ -39,15 +39,7 @@ public: class bblock_t { public: - static void* operator new(size_t size, void *ctx) - { - void *node; - - node = rzalloc_size(ctx, size); - assert(node != NULL); - - return node; - } + DECLARE_RZALLOC_CXX_OPERATORS(bblock_t) bblock_link *make_list(void *mem_ctx); @@ -68,15 +60,7 @@ public: class cfg_t { public: - static void* operator new(size_t size, void *ctx) - { - void *node; - - node = rzalloc_size(ctx, size); - assert(node != NULL); - - return node; - } + DECLARE_RZALLOC_CXX_OPERATORS(cfg_t) cfg_t(backend_visitor *v); cfg_t(void *mem_ctx, exec_list *instructions); diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index b77d4de..b2aa041 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -57,17 +57,7 @@ namespace { class fs_reg { public: - /* Callers of this ralloc-based new need not call delete. It's - * easier to just ralloc_free 'ctx' (or any of its ancestors). */ - static void* operator new(size_t size, void *ctx) - { - void *node; - - node = ralloc_size(ctx, size); - assert(node != NULL); - - return node; - } + DECLARE_RALLOC_CXX_OPERATORS(fs_reg) void init(); @@ -122,15 +112,7 @@ static const fs_reg reg_null_d(ARF, BRW_ARF_NULL, BRW_REGISTER_TYPE_D); class ip_record : public exec_node { public: - static void* operator new(size_t size, void *ctx) - { - void *node; - - node = rzalloc_size(ctx, size); - assert(node != NULL); - - return node; - } + DECLARE_RZALLOC_CXX_OPERATORS(ip_record) ip_record(int ip) { @@ -142,17 +124,7 @@ public: class fs_inst : public backend_instruction { public: - /* Callers of this ralloc-based new need not call delete. It's - * easier to just ralloc_free 'ctx' (or any of its ancestors). */ - static void* operator new(size_t size, void *ctx) - { - void *node; - - node = rzalloc_size(ctx, size); - assert(node != NULL); - - return node; - } + DECLARE_RZALLOC_CXX_OPERATORS(fs_inst) void init(); diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.h b/src/mesa/drivers/dri/i965/brw_fs_live_variables.h index 1cde5f4..fa8b61d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.h +++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.h @@ -53,15 +53,7 @@ struct block_data { class fs_live_variables { public: - static void* operator new(size_t size, void *ctx) - { - void *node; - - node = rzalloc_size(ctx, size); - assert(node != NULL); - - return node; - } + DECLARE_RZALLOC_CXX_OPERATORS(fs_live_variables) fs_live_variables(fs_visitor *v, cfg_t *cfg); ~fs_live_variables(); diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h index f0ab53d..689040b 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.h +++ b/src/mesa/drivers/dri/i965/brw_vec4.h @@ -118,17 +118,7 @@ public: class src_reg : public reg { public: - /* Callers of this ralloc-based new need not call delete. It's - * easier to just ralloc_free 'ctx' (or any of its ancestors). */ - static void* operator new(size_t size, void *ctx) - { - void *node; - - node = ralloc_size(ctx, size); - assert(node != NULL); - - return node; - } + DECLARE_RALLOC_CXX_OPERATORS(src_reg) void init(); @@ -156,17 +146,7 @@ public: class dst_reg : public reg { public: - /* Callers of this ralloc-based new need not call delete. It's - * easier to just ralloc_free 'ctx' (or any of its ancestors). */ - static void* operator new(size_t size, void *ctx) - { - void *node; - - node = ralloc_size(ctx, size); - assert(node != NULL); - - return node; - } + DECLARE_RALLOC_CXX_OPERATORS(dst_reg) void init(); @@ -188,17 +168,7 @@ with_writemask(dst_reg const &r, int mask); class vec4_instruction : public backend_instruction { public: - /* Callers of this ralloc-based new need not call delete. It's - * easier to just ralloc_free 'ctx' (or any of its ancestors). */ - static void* operator new(size_t size, void *ctx) - { - void *node; - - node = rzalloc_size(ctx, size); - assert(node != NULL); - - return node; - } + DECLARE_RZALLOC_CXX_OPERATORS(vec4_instruction) vec4_instruction(vec4_visitor *v, enum opcode opcode, dst_reg dst = dst_reg(), diff --git a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.h b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.h index 438a03e..b8ab95a 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.h +++ b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.h @@ -52,15 +52,7 @@ struct block_data { class vec4_live_variables { public: - static void* operator new(size_t size, void *ctx) - { - void *node; - - node = rzalloc_size(ctx, size); - assert(node != NULL); - - return node; - } + DECLARE_RZALLOC_CXX_OPERATORS(vec4_live_variables) vec4_live_variables(vec4_visitor *v, cfg_t *cfg); ~vec4_live_variables(); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index cef32dc..c46a3d0 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -149,17 +149,7 @@ dst_reg::dst_reg(src_reg reg) class ir_to_mesa_instruction : public exec_node { public: - /* Callers of this ralloc-based new need not call delete. It's - * easier to just ralloc_free 'ctx' (or any of its ancestors). */ - static void* operator new(size_t size, void *ctx) - { - void *node; - - node = rzalloc_size(ctx, size); - assert(node != NULL); - - return node; - } + DECLARE_RZALLOC_CXX_OPERATORS(ir_to_mesa_instruction) enum prog_opcode op; dst_reg dst; diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 0a1837f..271cf05 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -217,17 +217,7 @@ st_dst_reg::st_dst_reg(st_src_reg reg) class glsl_to_tgsi_instruction : public exec_node { public: - /* Callers of this ralloc-based new need not call delete. It's - * easier to just ralloc_free 'ctx' (or any of its ancestors). */ - static void* operator new(size_t size, void *ctx) - { - void *node; - - node = rzalloc_size(ctx, size); - assert(node != NULL); - - return node; - } + DECLARE_RZALLOC_CXX_OPERATORS(glsl_to_tgsi_instruction) unsigned op; st_dst_reg dst; |