summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2014-07-08 16:57:33 -0700
committerIan Romanick <ian.d.romanick@intel.com>2014-09-30 13:34:42 -0700
commit7625babfae6c5e86ab349c1a081816fbbcc48d17 (patch)
treec7e04493ac25f718bbebab5f62d206c9841ab5c6 /src/glsl/ir.cpp
parent0e654ab1b9a20671f755cbe71fe51ff6ec849459 (diff)
glsl: Add the possibility for ir_variable to have a non-ralloced name
Specifically, ir_var_temporary variables constructed with a NULL name will all have the name "compiler_temp" in static storage. No change Valgrind massif results for a trimmed apitrace of dota2. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/glsl/ir.cpp')
-rw-r--r--src/glsl/ir.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 0ae9b899c0a..9c58f869dc4 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1543,12 +1543,30 @@ ir_swizzle::variable_referenced() const
}
+const char ir_variable::tmp_name[] = "compiler_temp";
+
ir_variable::ir_variable(const struct glsl_type *type, const char *name,
ir_variable_mode mode)
: ir_instruction(ir_type_variable)
{
this->type = type;
- this->name = ralloc_strdup(this, name);
+
+ /* The ir_variable clone method may call this constructor with name set to
+ * tmp_name.
+ */
+ assert(name != NULL
+ || mode == ir_var_temporary
+ || mode == ir_var_function_in
+ || mode == ir_var_function_out
+ || mode == ir_var_function_inout);
+ assert(name != ir_variable::tmp_name
+ || mode == ir_var_temporary);
+ if (mode == ir_var_temporary
+ && (name == NULL || name == ir_variable::tmp_name)) {
+ this->name = ir_variable::tmp_name;
+ } else {
+ this->name = ralloc_strdup(this, name);
+ }
this->u.max_ifc_array_access = NULL;