Mesa (master): glsl: use the linear allocator in opt_copy_propagation

Marek Olšák mareko at kemper.freedesktop.org
Mon Oct 31 11:26:38 UTC 2016


Module: Mesa
Branch: master
Commit: 565b2c4c4bc87557922f298350b14305e9b77fc4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=565b2c4c4bc87557922f298350b14305e9b77fc4

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

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.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/opt_copy_propagation.cpp b/src/compiler/glsl/opt_copy_propagation.cpp
index 02628cd..247c498 100644
--- a/src/compiler/glsl/opt_copy_propagation.cpp
+++ b/src/compiler/glsl/opt_copy_propagation.cpp
@@ -44,6 +44,9 @@ namespace {
 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)
    {
       assert(var);
@@ -59,6 +62,7 @@ public:
    {
       progress = false;
       mem_ctx = ralloc_context(0);
+      lin_ctx = linear_alloc_parent(mem_ctx, 0);
       acp = _mesa_hash_table_create(mem_ctx, _mesa_hash_pointer,
                                     _mesa_key_pointer_equal);
       this->kills = new(mem_ctx) exec_list;
@@ -95,6 +99,7 @@ public:
    bool killed_all;
 
    void *mem_ctx;
+   void *lin_ctx;
 };
 
 } /* unnamed namespace */
@@ -313,7 +318,7 @@ ir_copy_propagation_visitor::kill(ir_variable *var)
 
    /* Add the LHS variable to the list of killed variables in this block.
     */
-   this->kills->push_tail(new(this->kills) kill_entry(var));
+   this->kills->push_tail(new(this->lin_ctx) kill_entry(var));
 }
 
 /**




More information about the mesa-commit mailing list