Add ir_dereference constructor for structure field dereferences
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 19 Apr 2010 22:40:49 +0000 (15:40 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 29 Apr 2010 01:22:54 +0000 (18:22 -0700)
ir.cpp
ir.h

diff --git a/ir.cpp b/ir.cpp
index 63135e35533cab94fd93db0f92f1fee7254f0e58..7ada145d53b6e600c39002bcc9618c8646e608c8 100644 (file)
--- a/ir.cpp
+++ b/ir.cpp
@@ -246,6 +246,14 @@ ir_dereference::ir_dereference(ir_instruction *var,
    this->selector.array_index = array_index;
 }
 
+ir_dereference::ir_dereference(ir_instruction *variable, const char *field)
+   : mode(ir_reference_record), var(variable)
+{
+   this->selector.field = field;
+   this->type = (var != NULL)
+      ? var->type->field_type(field) : glsl_type::error_type;
+}
+
 bool
 ir_dereference::is_lvalue()
 {
diff --git a/ir.h b/ir.h
index 42e8264d41da403a12b1163f28df820b428654e2..b3fb06d2c7b8fb3bf1b9560e71e9dfa31b68371d 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -749,6 +749,8 @@ public:
 
    ir_dereference(ir_instruction *variable, ir_rvalue *array_index);
 
+   ir_dereference(ir_instruction *variable, const char *field);
+
    virtual ir_dereference *as_dereference()
    {
       return this;