Add ir_variable::clone
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 1 Apr 2010 00:52:44 +0000 (17:52 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 1 Apr 2010 00:52:44 +0000 (17:52 -0700)
ir.h

diff --git a/ir.h b/ir.h
index c3c5369bfc0bb3bc51e4456d7f29b363f3ce37aa..de6f09318adac56a20b9cff6325f916765cefba8 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -110,6 +110,26 @@ public:
       v->visit(this);
    }
 
+   /**
+    * Duplicate an IR variable
+    *
+    * \note
+    * This will probably be made \c virtual and moved to the base class
+    * eventually.
+    */
+   ir_variable *clone() const
+   {
+      ir_variable *var = new ir_variable(type, name);
+
+      var->read_only = this->read_only;
+      var->centroid = this->centroid;
+      var->invariant = this->invariant;
+      var->mode = this->mode;
+      var->interpolation = this->interpolation;
+
+      return var;
+   }
+
    const char *name;
 
    unsigned read_only:1;