glsl: Unify ir_constant::const_elements and ::components

There was no reason to treat array types and record types differently.
Unifying them saves a bunch of code and saves a few bytes in every
ir_constant.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
This commit is contained in:
Ian Romanick
2017-09-07 19:23:51 -07:00
parent 0e88153e99
commit 9ac8fece63
8 changed files with 28 additions and 115 deletions

View File

@@ -345,21 +345,7 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const
case GLSL_TYPE_IMAGE:
return new(mem_ctx) ir_constant(this->type, &this->value);
case GLSL_TYPE_STRUCT: {
ir_constant *c = new(mem_ctx) ir_constant;
c->type = this->type;
for (const exec_node *node = this->components.get_head_raw()
; !node->is_tail_sentinel()
; node = node->next) {
ir_constant *const orig = (ir_constant *) node;
c->components.push_tail(orig->clone(mem_ctx, NULL));
}
return c;
}
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_ARRAY: {
ir_constant *c = new(mem_ctx) ir_constant;