Move ir_constant cloning alongside the other cloning functions.
authorEric Anholt <eric@anholt.net>
Wed, 23 Jun 2010 23:42:37 +0000 (16:42 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 24 Jun 2010 20:32:35 +0000 (13:32 -0700)
ir.cpp
ir_clone.cpp

diff --git a/ir.cpp b/ir.cpp
index 98b085e91bfc1543f078002ef554065e524753f3..9252ccfd3a3431c52bd1bc87341c56264342b030 100644 (file)
--- 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
 {
index cb4b02b7de99c7e878d06a058683b60bcdb1e50e..fe66510bfdf1ff3b6f028d5cf98b09f3636d5ffe 100644 (file)
@@ -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;
+   }
+}