Mesa (master): glsl: use the linear allocator in opt_copy_propagation_elements
Marek Olšák
mareko at kemper.freedesktop.org
Mon Oct 31 11:26:38 UTC 2016
Module: Mesa
Branch: master
Commit: b6f50e4640c5e4ab27d50422269b54eb6efa955a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6f50e4640c5e4ab27d50422269b54eb6efa955a
Author: Marek Olšák <marek.olsak at amd.com>
Date: Fri Oct 7 20:57:04 2016 +0200
glsl: use the linear allocator in opt_copy_propagation_elements
Tested-by: Edmondo Tommasina <edmondo.tommasina at gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/compiler/glsl/opt_copy_propagation_elements.cpp | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp b/src/compiler/glsl/opt_copy_propagation_elements.cpp
index be89116..9f79fa9 100644
--- a/src/compiler/glsl/opt_copy_propagation_elements.cpp
+++ b/src/compiler/glsl/opt_copy_propagation_elements.cpp
@@ -70,6 +70,9 @@ public:
class acp_entry : public exec_node
{
public:
+ /* override operator new from exec_node */
+ DECLARE_LINEAR_ZALLOC_CXX_OPERATORS(acp_entry)
+
acp_entry(ir_variable *lhs, ir_variable *rhs, int write_mask, int swizzle[4])
: rhs_node(this)
{
@@ -90,6 +93,9 @@ public:
class kill_entry : public exec_node
{
public:
+ /* override operator new from exec_node */
+ DECLARE_LINEAR_ZALLOC_CXX_OPERATORS(kill_entry)
+
kill_entry(ir_variable *var, int write_mask)
{
this->var = var;
@@ -107,6 +113,7 @@ public:
this->progress = false;
this->killed_all = false;
this->mem_ctx = ralloc_context(NULL);
+ this->lin_ctx = linear_alloc_parent(this->mem_ctx, 0);
this->shader_mem_ctx = NULL;
this->kills = new(mem_ctx) exec_list;
@@ -174,6 +181,7 @@ public:
/* Context for our local data structures. */
void *mem_ctx;
+ void *lin_ctx;
/* Context for allocating new shader nodes. */
void *shader_mem_ctx;
};
@@ -223,9 +231,9 @@ ir_copy_propagation_elements_visitor::visit_leave(ir_assignment *ir)
kill_entry *k;
if (lhs)
- k = new(this->kills) kill_entry(var, ir->write_mask);
+ k = new(this->lin_ctx) kill_entry(var, ir->write_mask);
else
- k = new(this->kills) kill_entry(var, ~0);
+ k = new(this->lin_ctx) kill_entry(var, ~0);
kill(k);
}
@@ -524,7 +532,6 @@ ir_copy_propagation_elements_visitor::kill(kill_entry *k)
if (k->next)
k->remove();
- ralloc_steal(this->kills, k);
this->kills->push_tail(k);
}
@@ -588,7 +595,7 @@ ir_copy_propagation_elements_visitor::add_copy(ir_assignment *ir)
if (lhs->var->data.precise != rhs->var->data.precise)
return;
- entry = new(this->mem_ctx) acp_entry(lhs->var, rhs->var, write_mask,
+ entry = new(this->lin_ctx) acp_entry(lhs->var, rhs->var, write_mask,
swizzle);
/* lhs hash, hash of lhs -> acp_entry lists */
More information about the mesa-commit
mailing list