summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ir.h
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-10-07 22:26:58 +0200
committerMarek Olšák <[email protected]>2016-10-31 11:53:38 +0100
commit7a2387c3e0e91f649676661c607d71f3b4eba5d5 (patch)
tree7a83566e0a421b9850394f307bc8b4fa988717d4 /src/compiler/glsl/ir.h
parent21e11b528269153b2042f1ca22830698de07aadb (diff)
glsl: use a non-malloc'd storage for short ir_variable names
Tested-by: Edmondo Tommasina <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ir.h')
-rw-r--r--src/compiler/glsl/ir.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
index f07e3b20910..433ba193801 100644
--- a/src/compiler/glsl/ir.h
+++ b/src/compiler/glsl/ir.h
@@ -599,7 +599,8 @@ public:
inline bool is_name_ralloced() const
{
- return this->name != ir_variable::tmp_name;
+ return this->name != ir_variable::tmp_name &&
+ this->name != this->name_storage;
}
/**
@@ -624,6 +625,16 @@ public:
*/
const char *name;
+private:
+ /**
+ * If the name length fits into name_storage, it's used, otherwise
+ * the name is ralloc'd. shader-db mining showed that 70% of variables
+ * fit here. This is a win over ralloc where only ralloc_header has
+ * 20 bytes on 64-bit (28 bytes with DEBUG), and we can also skip malloc.
+ */
+ char name_storage[16];
+
+public:
struct ir_variable_data {
/**