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

@@ -469,13 +469,10 @@ void ir_print_visitor::visit(ir_constant *ir)
for (unsigned i = 0; i < ir->type->length; i++)
ir->get_array_element(i)->accept(this);
} else if (ir->type->is_record()) {
ir_constant *value = (ir_constant *) ir->components.get_head();
for (unsigned i = 0; i < ir->type->length; i++) {
fprintf(f, "(%s ", ir->type->fields.structure[i].name);
value->accept(this);
ir->get_record_field(i)->accept(this);
fprintf(f, ")");
value = (ir_constant *) value->next;
}
} else {
for (unsigned i = 0; i < ir->type->components(); i++) {