From 5f384088336c23c4fe332d2735450bf455c88200 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 23 Jun 2010 16:42:37 -0700 Subject: Move ir_constant cloning alongside the other cloning functions. --- ir.cpp | 31 ------------------------------- ir_clone.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/ir.cpp b/ir.cpp index 98b085e..9252ccf 100644 --- a/ir.cpp +++ b/ir.cpp @@ -297,37 +297,6 @@ ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) } } -ir_instruction * -ir_constant::clone(struct hash_table *ht) const -{ - switch (this->type->base_type) { - case GLSL_TYPE_UINT: - case GLSL_TYPE_INT: - case GLSL_TYPE_FLOAT: - case GLSL_TYPE_BOOL: - return new ir_constant(this->type, &this->value); - - case GLSL_TYPE_STRUCT: { - ir_constant *c = new ir_constant; - - c->type = this->type; - for (exec_node *node = this->components.head - ; !node->is_tail_sentinal() - ; node = node->next) { - ir_constant *const orig = (ir_constant *) node; - - c->components.push_tail(orig->clone(NULL)); - } - - return c; - } - - default: - assert(!"Should not get here."); break; - return NULL; - } -} - bool ir_constant::get_bool_component(unsigned i) const { diff --git a/ir_clone.cpp b/ir_clone.cpp index cb4b02b..fe66510 100644 --- a/ir_clone.cpp +++ b/ir_clone.cpp @@ -238,3 +238,34 @@ ir_function_signature::clone(struct hash_table *ht) const /* FINISHME */ abort(); } + +ir_instruction * +ir_constant::clone(struct hash_table *ht) const +{ + switch (this->type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_BOOL: + return new ir_constant(this->type, &this->value); + + case GLSL_TYPE_STRUCT: { + ir_constant *c = new ir_constant; + + c->type = this->type; + for (exec_node *node = this->components.head + ; !node->is_tail_sentinal() + ; node = node->next) { + ir_constant *const orig = (ir_constant *) node; + + c->components.push_tail(orig->clone(NULL)); + } + + return c; + } + + default: + assert(!"Should not get here."); break; + return NULL; + } +} -- cgit v1.2.3