[Mesa-dev] [PATCH 4/5] glsl: move variables in to ir_variable::data, part III

Tapani Pälli tapani.palli at intel.com
Wed Dec 4 04:16:43 PST 2013


This patch moves following bitfields and variables to the data
structure:

from_named_ifc_block_nonarray, from_named_ifc_block_array, depth_layout,
location, index, binding, max_array_access, atomic

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
 src/glsl/ast_array_index.cpp                      |   6 +-
 src/glsl/ast_to_hir.cpp                           |  48 ++++----
 src/glsl/builtin_variables.cpp                    |   2 +-
 src/glsl/ir.cpp                                   |  11 +-
 src/glsl/ir.h                                     | 134 +++++++++++-----------
 src/glsl/ir_clone.cpp                             |  14 +--
 src/glsl/ir_set_program_inouts.cpp                |   4 +-
 src/glsl/ir_validate.cpp                          |   4 +-
 src/glsl/link_atomics.cpp                         |  20 ++--
 src/glsl/link_functions.cpp                       |   8 +-
 src/glsl/link_uniform_initializers.cpp            |   2 +-
 src/glsl/link_uniforms.cpp                        |  14 +--
 src/glsl/link_varyings.cpp                        |  10 +-
 src/glsl/linker.cpp                               |  54 ++++-----
 src/glsl/lower_clip_distance.cpp                  |   8 +-
 src/glsl/lower_named_interface_blocks.cpp         |   8 +-
 src/glsl/lower_packed_varyings.cpp                |   8 +-
 src/glsl/lower_ubo_reference.cpp                  |   2 +-
 src/glsl/opt_dead_builtin_varyings.cpp            |  12 +-
 src/glsl/opt_flip_matrices.cpp                    |   4 +-
 src/glsl/tests/builtin_variable_test.cpp          |  46 ++++----
 src/glsl/tests/invalidate_locations_test.cpp      |  36 +++---
 src/mesa/drivers/dri/i965/brw_fs.cpp              |   2 +-
 src/mesa/drivers/dri/i965/brw_fs_fp.cpp           |   2 +-
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp      |  28 ++---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp    |  16 +--
 src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp |   2 +-
 src/mesa/main/ff_fragment_shader.cpp              |   8 +-
 src/mesa/main/shader_query.cpp                    |  24 ++--
 src/mesa/program/ir_to_mesa.cpp                   |  14 +--
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp        |  12 +-
 31 files changed, 283 insertions(+), 280 deletions(-)

diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp
index 2fe838d..a5f2320 100644
--- a/src/glsl/ast_array_index.cpp
+++ b/src/glsl/ast_array_index.cpp
@@ -41,8 +41,8 @@ update_max_array_access(ir_rvalue *ir, unsigned idx, YYLTYPE *loc,
 {
    if (ir_dereference_variable *deref_var = ir->as_dereference_variable()) {
       ir_variable *var = deref_var->var;
-      if (idx > var->max_array_access) {
-         var->max_array_access = idx;
+      if (idx > var->data.max_array_access) {
+         var->data.max_array_access = idx;
 
          /* Check whether this access will, as a side effect, implicitly cause
           * the size of a built-in array to be too large.
@@ -184,7 +184,7 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
 	  */
 	 ir_variable *v = array->whole_variable_referenced();
 	 if (v != NULL)
-	    v->max_array_access = array->type->array_size() - 1;
+	    v->data.max_array_access = array->type->array_size() - 1;
       }
 
       /* From page 23 (29 of the PDF) of the GLSL 1.30 spec:
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 7847720..af0b58e 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -728,7 +728,7 @@ mark_whole_array_access(ir_rvalue *access)
    ir_dereference_variable *deref = access->as_dereference_variable();
 
    if (deref && deref->var) {
-      deref->var->max_array_access = deref->type->length - 1;
+      deref->var->data.max_array_access = deref->type->length - 1;
    }
 }
 
@@ -819,11 +819,11 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
 
 	 assert(var != NULL);
 
-	 if (var->max_array_access >= unsigned(rhs->type->array_size())) {
+	 if (var->data.max_array_access >= unsigned(rhs->type->array_size())) {
 	    /* FINISHME: This should actually log the location of the RHS. */
 	    _mesa_glsl_error(& lhs_loc, state, "array size must be > %u due to "
 			     "previous access",
-			     var->max_array_access);
+			     var->data.max_array_access);
 	 }
 
 	 var->type = glsl_type::get_array_instance(lhs->type->element_type(),
@@ -2122,11 +2122,11 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
        * ensures that negative values stay negative.
        */
       if (qual->location >= 0) {
-         var->location = (state->target == vertex_shader)
+         var->data.location = (state->target == vertex_shader)
             ? (qual->location + VERT_ATTRIB_GENERIC0)
             : (qual->location + FRAG_RESULT_DATA0);
       } else {
-         var->location = qual->location;
+         var->data.location = qual->location;
       }
 
       if (qual->flags.q.explicit_index) {
@@ -2144,7 +2144,7 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
                              "explicit index may only be 0 or 1");
          } else {
             var->data.explicit_index = true;
-            var->index = qual->index;
+            var->data.index = qual->index;
          }
       }
    }
@@ -2313,19 +2313,19 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
    if (qual->flags.q.explicit_binding &&
        validate_binding_qualifier(state, loc, var, qual)) {
       var->data.explicit_binding = true;
-      var->binding = qual->binding;
+      var->data.binding = qual->binding;
    }
 
    if (var->type->contains_atomic()) {
       if (var->data.mode == ir_var_uniform) {
          if (var->data.explicit_binding) {
-            unsigned *offset = &state->atomic_counter_offsets[var->binding];
+            unsigned *offset = &state->atomic_counter_offsets[var->data.binding];
 
             if (*offset % ATOMIC_COUNTER_SIZE)
                _mesa_glsl_error(loc, state,
                                 "misaligned atomic counter offset");
 
-            var->atomic.offset = *offset;
+            var->data.atomic.offset = *offset;
             *offset += var->type->atomic_size();
 
          } else {
@@ -2406,15 +2406,15 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
                        "gl_FragDepth");
    }
    if (qual->flags.q.depth_any)
-      var->depth_layout = ir_depth_layout_any;
+      var->data.depth_layout = ir_depth_layout_any;
    else if (qual->flags.q.depth_greater)
-      var->depth_layout = ir_depth_layout_greater;
+      var->data.depth_layout = ir_depth_layout_greater;
    else if (qual->flags.q.depth_less)
-      var->depth_layout = ir_depth_layout_less;
+      var->data.depth_layout = ir_depth_layout_less;
    else if (qual->flags.q.depth_unchanged)
-       var->depth_layout = ir_depth_layout_unchanged;
+       var->data.depth_layout = ir_depth_layout_unchanged;
    else
-       var->depth_layout = ir_depth_layout_none;
+       var->data.depth_layout = ir_depth_layout_none;
 
    if (qual->flags.q.std140 ||
        qual->flags.q.packed ||
@@ -2475,10 +2475,10 @@ get_variable_being_redeclared(ir_variable *var, YYLTYPE loc,
 
       const unsigned size = unsigned(var->type->array_size());
       check_builtin_array_max_size(var->name, size, loc, state);
-      if ((size > 0) && (size <= earlier->max_array_access)) {
+      if ((size > 0) && (size <= earlier->data.max_array_access)) {
 	 _mesa_glsl_error(& loc, state, "array size must be > %u due to "
 			  "previous access",
-			  earlier->max_array_access);
+			  earlier->data.max_array_access);
       }
 
       earlier->type = var->type;
@@ -2534,17 +2534,17 @@ get_variable_being_redeclared(ir_variable *var, YYLTYPE loc,
       }
 
       /* Prevent inconsistent redeclaration of depth layout qualifier. */
-      if (earlier->depth_layout != ir_depth_layout_none
-	  && earlier->depth_layout != var->depth_layout) {
+      if (earlier->data.depth_layout != ir_depth_layout_none
+	  && earlier->data.depth_layout != var->data.depth_layout) {
 	 _mesa_glsl_error(&loc, state,
 			  "gl_FragDepth: depth layout is declared here "
 			  "as '%s, but it was previously declared as "
 			  "'%s'",
-			  depth_layout_string(var->depth_layout),
-			  depth_layout_string(earlier->depth_layout));
+			  depth_layout_string(var->data.depth_layout),
+			  depth_layout_string(earlier->data.depth_layout));
       }
 
-      earlier->depth_layout = var->depth_layout;
+      earlier->data.depth_layout = var->data.depth_layout;
 
    } else if (allow_all_redeclarations) {
       if (earlier->data.mode != var->data.mode) {
@@ -5112,7 +5112,7 @@ ast_interface_block::hir(exec_list *instructions,
           * has an instance name.  This is ugly.
           */
          var->data.explicit_binding = this->layout.flags.q.explicit_binding;
-         var->binding = this->layout.binding;
+         var->data.binding = this->layout.binding;
 
          state->symbols->add_variable(var);
          instructions->push_tail(var);
@@ -5208,12 +5208,12 @@ ast_gs_input_layout::hir(exec_list *instructions,
        */
 
       if (var->type->is_unsized_array()) {
-         if (var->max_array_access >= num_vertices) {
+         if (var->data.max_array_access >= num_vertices) {
             _mesa_glsl_error(&loc, state,
                              "this geometry shader input layout implies %u"
                              " vertices, but an access to element %u of input"
                              " `%s' already exists", num_vertices,
-                             var->max_array_access, var->name);
+                             var->data.max_array_access, var->name);
          } else {
             var->type = glsl_type::get_array_instance(var->type->fields.array,
                                                       num_vertices);
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index e92728b..52e9a73 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -454,7 +454,7 @@ builtin_variable_generator::add_variable(const char *name,
       break;
    }
 
-   var->location = slot;
+   var->data.location = slot;
    var->data.explicit_location = (slot >= 0);
    var->data.explicit_index = 0;
 
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index c6ba7c9..b1f981b 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1584,21 +1584,21 @@ ir_swizzle::variable_referenced() const
 
 ir_variable::ir_variable(const struct glsl_type *type, const char *name,
 			 ir_variable_mode mode)
-   : max_array_access(0), max_ifc_array_access(NULL), atomic()
+   : max_ifc_array_access(NULL)
 {
    this->ir_type = ir_type_variable;
    this->type = type;
    this->name = ralloc_strdup(this, name);
    this->data.explicit_location = false;
    this->data.has_initializer = false;
-   this->location = -1;
+   this->data.location = -1;
    this->data.location_frac = 0;
    this->warn_extension = NULL;
    this->constant_value = NULL;
    this->constant_initializer = NULL;
    this->data.origin_upper_left = false;
    this->data.pixel_center_integer = false;
-   this->depth_layout = ir_depth_layout_none;
+   this->data.depth_layout = ir_depth_layout_none;
    this->data.used = false;
    this->data.read_only = false;
    this->data.centroid = false;
@@ -1606,6 +1606,9 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
    this->data.how_declared = ir_var_declared_normally;
    this->data.mode = mode;
    this->data.interpolation = INTERP_QUALIFIER_NONE;
+   this->data.max_array_access = 0;
+   this->data.atomic.buffer_index = 0;
+   this->data.atomic.offset = 0;
 
    if (type != NULL) {
       if (type->base_type == GLSL_TYPE_SAMPLER)
@@ -1639,7 +1642,7 @@ ir_variable::determine_interpolation_mode(bool flat_shade)
 {
    if (this->data.interpolation != INTERP_QUALIFIER_NONE)
       return (glsl_interp_qualifier) this->data.interpolation;
-   int location = this->location;
+   int location = this->data.location;
    bool is_gl_Color =
       location == VARYING_SLOT_COL0 || location == VARYING_SLOT_COL1;
    if (flat_shade && is_gl_Color)
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 610c459..bee89af 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -502,13 +502,6 @@ public:
    const char *name;
 
    /**
-    * Highest element accessed with a constant expression array index
-    *
-    * Not used for non-array variables.
-    */
-   unsigned max_array_access;
-
-   /**
     * For variables which satisfy the is_interface_instance() predicate, this
     * points to an array of integers such that if the ith member of the
     * interface block is an array, max_ifc_array_access[i] is the maximum
@@ -524,6 +517,13 @@ public:
    struct ir_variable_data
    {
       /**
+       * Highest element accessed with a constant expression array index
+       *
+       * Not used for non-array variables.
+       */
+      unsigned max_array_access;
+
+      /**
        * Is the variable read-only?
        *
        * This is set for variables declared as \c const, shader inputs,
@@ -629,73 +629,73 @@ public:
        */
       unsigned location_frac:2;
 
-   } data;
+      /**
+       * Non-zero if this variable was created by lowering a named interface
+       * block which was not an array.
+       *
+       * Note that this variable and \c from_named_ifc_block_array will never
+       * both be non-zero.
+       */
+      unsigned from_named_ifc_block_nonarray:1;
 
-   /**
-    * Non-zero if this variable was created by lowering a named interface
-    * block which was not an array.
-    *
-    * Note that this variable and \c from_named_ifc_block_array will never
-    * both be non-zero.
-    */
-   unsigned from_named_ifc_block_nonarray:1;
+      /**
+       * Non-zero if this variable was created by lowering a named interface
+       * block which was an array.
+       *
+       * Note that this variable and \c from_named_ifc_block_nonarray will never
+       * both be non-zero.
+       */
+      unsigned from_named_ifc_block_array:1;
 
-   /**
-    * Non-zero if this variable was created by lowering a named interface
-    * block which was an array.
-    *
-    * Note that this variable and \c from_named_ifc_block_nonarray will never
-    * both be non-zero.
-    */
-   unsigned from_named_ifc_block_array:1;
+      /**
+       * \brief Layout qualifier for gl_FragDepth.
+       *
+       * This is not equal to \c ir_depth_layout_none if and only if this
+       * variable is \c gl_FragDepth and a layout qualifier is specified.
+       */
+      ir_depth_layout depth_layout;
 
-   /**
-    * \brief Layout qualifier for gl_FragDepth.
-    *
-    * This is not equal to \c ir_depth_layout_none if and only if this
-    * variable is \c gl_FragDepth and a layout qualifier is specified.
-    */
-   ir_depth_layout depth_layout;
+      /**
+       * Storage location of the base of this variable
+       *
+       * The precise meaning of this field depends on the nature of the variable.
+       *
+       *   - Vertex shader input: one of the values from \c gl_vert_attrib.
+       *   - Vertex shader output: one of the values from \c gl_varying_slot.
+       *   - Geometry shader input: one of the values from \c gl_varying_slot.
+       *   - Geometry shader output: one of the values from \c gl_varying_slot.
+       *   - Fragment shader input: one of the values from \c gl_varying_slot.
+       *   - Fragment shader output: one of the values from \c gl_frag_result.
+       *   - Uniforms: Per-stage uniform slot number for default uniform block.
+       *   - Uniforms: Index within the uniform block definition for UBO members.
+       *   - Other: This field is not currently used.
+       *
+       * If the variable is a uniform, shader input, or shader output, and the
+       * slot has not been assigned, the value will be -1.
+       */
+      int location;
 
-   /**
-    * Storage location of the base of this variable
-    *
-    * The precise meaning of this field depends on the nature of the variable.
-    *
-    *   - Vertex shader input: one of the values from \c gl_vert_attrib.
-    *   - Vertex shader output: one of the values from \c gl_varying_slot.
-    *   - Geometry shader input: one of the values from \c gl_varying_slot.
-    *   - Geometry shader output: one of the values from \c gl_varying_slot.
-    *   - Fragment shader input: one of the values from \c gl_varying_slot.
-    *   - Fragment shader output: one of the values from \c gl_frag_result.
-    *   - Uniforms: Per-stage uniform slot number for default uniform block.
-    *   - Uniforms: Index within the uniform block definition for UBO members.
-    *   - Other: This field is not currently used.
-    *
-    * If the variable is a uniform, shader input, or shader output, and the
-    * slot has not been assigned, the value will be -1.
-    */
-   int location;
+      /**
+       * output index for dual source blending.
+       */
+      int index;
 
-   /**
-    * output index for dual source blending.
-    */
-   int index;
+      /**
+       * Initial binding point for a sampler or UBO.
+       *
+       * For array types, this represents the binding point for the first element.
+       */
+      int binding;
 
-   /**
-    * Initial binding point for a sampler or UBO.
-    *
-    * For array types, this represents the binding point for the first element.
-    */
-   int binding;
+      /**
+       * Location an atomic counter is stored at.
+       */
+      struct {
+         unsigned buffer_index;
+         unsigned offset;
+      } atomic;
 
-   /**
-    * Location an atomic counter is stored at.
-    */
-   struct {
-      unsigned buffer_index;
-      unsigned offset;
-   } atomic;
+   } data;
 
    /**
     * Built-in state that backs this uniform
diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp
index 8a0664e..d98ed95 100644
--- a/src/glsl/ir_clone.cpp
+++ b/src/glsl/ir_clone.cpp
@@ -43,7 +43,7 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const
    ir_variable *var = new(mem_ctx) ir_variable(this->type, this->name,
 					       (ir_variable_mode) this->data.mode);
 
-   var->max_array_access = this->max_array_access;
+   var->data.max_array_access = this->data.max_array_access;
    if (this->is_interface_instance()) {
       var->max_ifc_array_access =
          rzalloc_array(var, unsigned, this->interface_type->length);
@@ -54,11 +54,11 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const
    var->data.centroid = this->data.centroid;
    var->data.invariant = this->data.invariant;
    var->data.interpolation = this->data.interpolation;
-   var->location = this->location;
-   var->index = this->index;
-   var->binding = this->binding;
-   var->atomic.buffer_index = this->atomic.buffer_index;
-   var->atomic.offset = this->atomic.offset;
+   var->data.location = this->data.location;
+   var->data.index = this->data.index;
+   var->data.binding = this->data.binding;
+   var->data.atomic.buffer_index = this->data.atomic.buffer_index;
+   var->data.atomic.offset = this->data.atomic.offset;
    var->warn_extension = this->warn_extension;
    var->data.origin_upper_left = this->data.origin_upper_left;
    var->data.pixel_center_integer = this->data.pixel_center_integer;
@@ -66,7 +66,7 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const
    var->data.explicit_index = this->data.explicit_index;
    var->data.explicit_binding = this->data.explicit_binding;
    var->data.has_initializer = this->data.has_initializer;
-   var->depth_layout = this->depth_layout;
+   var->data.depth_layout = this->data.depth_layout;
    var->data.assigned = this->data.assigned;
    var->data.how_declared = this->data.how_declared;
    var->data.used = this->data.used;
diff --git a/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp
index 8ce6197..80ef57d 100644
--- a/src/glsl/ir_set_program_inouts.cpp
+++ b/src/glsl/ir_set_program_inouts.cpp
@@ -93,12 +93,12 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
     */
 
    for (int i = 0; i < len; i++) {
-      GLbitfield64 bitfield = BITFIELD64_BIT(var->location + var->index + offset + i);
+      GLbitfield64 bitfield = BITFIELD64_BIT(var->data.location + var->data.index + offset + i);
       if (var->data.mode == ir_var_shader_in) {
 	 prog->InputsRead |= bitfield;
          if (is_fragment_shader) {
             gl_fragment_program *fprog = (gl_fragment_program *) prog;
-            fprog->InterpQualifier[var->location + var->index + offset + i] =
+            fprog->InterpQualifier[var->data.location + var->data.index + offset + i] =
                (glsl_interp_qualifier) var->data.interpolation;
             if (var->data.centroid)
                fprog->IsCentroid |= bitfield;
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index c279208..86f1709 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -692,9 +692,9 @@ ir_validate::visit(ir_variable *ir)
     * to be out of bounds.
     */
    if (ir->type->array_size() > 0) {
-      if (ir->max_array_access >= ir->type->length) {
+      if (ir->data.max_array_access >= ir->type->length) {
 	 printf("ir_variable has maximum access out of bounds (%d vs %d)\n",
-		ir->max_array_access, ir->type->length - 1);
+		ir->data.max_array_access, ir->type->length - 1);
 	 ir->print();
 	 abort();
       }
diff --git a/src/glsl/link_atomics.cpp b/src/glsl/link_atomics.cpp
index 2466bbd..33903ad 100644
--- a/src/glsl/link_atomics.cpp
+++ b/src/glsl/link_atomics.cpp
@@ -73,16 +73,16 @@ namespace {
       const active_atomic_counter *const first = (active_atomic_counter *) a;
       const active_atomic_counter *const second = (active_atomic_counter *) b;
 
-      return int(first->var->atomic.offset) - int(second->var->atomic.offset);
+      return int(first->var->data.atomic.offset) - int(second->var->data.atomic.offset);
    }
 
    bool
    check_atomic_counters_overlap(const ir_variable *x, const ir_variable *y)
    {
-      return ((x->atomic.offset >= y->atomic.offset &&
-               x->atomic.offset < y->atomic.offset + y->type->atomic_size()) ||
-              (y->atomic.offset >= x->atomic.offset &&
-               y->atomic.offset < x->atomic.offset + x->type->atomic_size()));
+      return ((x->data.atomic.offset >= y->data.atomic.offset &&
+               x->data.atomic.offset < y->data.atomic.offset + y->type->atomic_size()) ||
+              (y->data.atomic.offset >= x->data.atomic.offset &&
+               y->data.atomic.offset < x->data.atomic.offset + x->type->atomic_size()));
    }
 
    active_atomic_buffer *
@@ -107,7 +107,7 @@ namespace {
                unsigned id;
                bool found = prog->UniformHash->get(id, var->name);
                assert(found);
-               active_atomic_buffer *buf = &buffers[var->binding];
+               active_atomic_buffer *buf = &buffers[var->data.binding];
 
                /* If this is the first time the buffer is used, increment
                 * the counter of buffers used.
@@ -118,7 +118,7 @@ namespace {
                buf->push_back(id, var);
 
                buf->stage_references[i]++;
-               buf->size = MAX2(buf->size, var->atomic.offset +
+               buf->size = MAX2(buf->size, var->data.atomic.offset +
                                 var->type->atomic_size());
             }
          }
@@ -143,7 +143,7 @@ namespace {
                linker_error(prog, "Atomic counter %s declared at offset %d "
                             "which is already in use.",
                             buffers[i].counters[j].var->name,
-                            buffers[i].counters[j].var->atomic.offset);
+                            buffers[i].counters[j].var->data.atomic.offset);
             }
          }
       }
@@ -190,9 +190,9 @@ link_assign_atomic_counter_resources(struct gl_context *ctx,
          gl_uniform_storage *const storage = &prog->UniformStorage[id];
 
          mab.Uniforms[j] = id;
-         var->atomic.buffer_index = i;
+         var->data.atomic.buffer_index = i;
          storage->atomic_buffer_index = i;
-         storage->offset = var->atomic.offset;
+         storage->offset = var->data.atomic.offset;
          storage->array_stride = (var->type->is_array() ?
                                   var->type->element_type()->atomic_size() : 0);
       }
diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp
index 68aa620..dc33840 100644
--- a/src/glsl/link_functions.cpp
+++ b/src/glsl/link_functions.cpp
@@ -201,8 +201,8 @@ public:
             if (formal_param->type->is_array()) {
                ir_dereference_variable *deref = actual_param->as_dereference_variable();
                if (deref && deref->var && deref->var->type->is_array()) {
-                  deref->var->max_array_access =
-                     MAX2(formal_param->max_array_access, deref->var->max_array_access);
+                  deref->var->data.max_array_access =
+                     MAX2(formal_param->data.max_array_access, deref->var->data.max_array_access);
                }
             }
          }
@@ -234,8 +234,8 @@ public:
                 * we need to track the maximal access to the array as linking
                 * pulls more functions in that access the array.
                 */
-               var->max_array_access =
-                  MAX2(var->max_array_access, ir->var->max_array_access);
+               var->data.max_array_access =
+                  MAX2(var->data.max_array_access, ir->var->data.max_array_access);
 
                if (var->type->length == 0 && ir->var->type->length != 0)
                   var->type = ir->var->type;
diff --git a/src/glsl/link_uniform_initializers.cpp b/src/glsl/link_uniform_initializers.cpp
index d59b7f3..04daa17 100644
--- a/src/glsl/link_uniform_initializers.cpp
+++ b/src/glsl/link_uniform_initializers.cpp
@@ -232,7 +232,7 @@ link_set_uniform_initializers(struct gl_shader_program *prog)
 
          if (var->data.explicit_binding) {
             linker::set_uniform_binding(mem_ctx, prog, var->name,
-                                        var->type, var->binding);
+                                        var->type, var->data.binding);
          } else if (var->constant_value) {
             linker::set_uniform_initializer(mem_ctx, prog, var->name,
                                             var->type, var->constant_value);
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 632167e..bda6e4f 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -75,7 +75,7 @@ program_resource_visitor::process(ir_variable *var)
     */
 
    /* Only strdup the name if we actually will need to modify it. */
-   if (var->from_named_ifc_block_array) {
+   if (var->data.from_named_ifc_block_array) {
       /* lower_named_interface_blocks created this variable by lowering an
        * interface block array to an array variable.  For example if the
        * original source code was:
@@ -108,7 +108,7 @@ program_resource_visitor::process(ir_variable *var)
          recursion(var->type, &name, new_length, false, NULL);
       }
       ralloc_free(name);
-   } else if (var->from_named_ifc_block_nonarray) {
+   } else if (var->data.from_named_ifc_block_nonarray) {
       /* lower_named_interface_blocks created this variable by lowering a
        * named interface block (non-array) to an ordinary variable.  For
        * example if the original source code was:
@@ -408,10 +408,10 @@ public:
             const struct gl_uniform_block *const block =
                &prog->UniformBlocks[ubo_block_index];
 
-            assert(var->location != -1);
+            assert(var->data.location != -1);
 
             const struct gl_uniform_buffer_variable *const ubo_var =
-               &block->Uniforms[var->location];
+               &block->Uniforms[var->data.location];
 
             ubo_row_major = ubo_var->RowMajor;
             ubo_byte_offset = ubo_var->Offset;
@@ -640,7 +640,7 @@ link_update_uniform_buffer_variables(struct gl_shader *shader)
       assert(var->data.mode == ir_var_uniform);
 
       if (var->is_interface_instance()) {
-         var->location = 0;
+         var->data.location = 0;
          continue;
       }
 
@@ -669,13 +669,13 @@ link_update_uniform_buffer_variables(struct gl_shader *shader)
 
                if (strncmp(var->name, begin, l) == 0) {
                   found = true;
-                  var->location = j;
+                  var->data.location = j;
                   break;
                }
             } else if (!strcmp(var->name,
                                shader->UniformBlocks[i].Uniforms[j].Name)) {
 	       found = true;
-	       var->location = j;
+	       var->data.location = j;
 	       break;
 	    }
 	 }
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index 7f136ac..3a26d98 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -317,7 +317,7 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
    assert(this->is_varying());
 
    unsigned fine_location
-      = this->matched_candidate->toplevel_var->location * 4
+      = this->matched_candidate->toplevel_var->data.location * 4
       + this->matched_candidate->toplevel_var->data.location_frac
       + this->matched_candidate->offset;
 
@@ -838,11 +838,11 @@ varying_matches::store_locations(unsigned producer_base,
       unsigned slot = generic_location / 4;
       unsigned offset = generic_location % 4;
 
-      producer_var->location = producer_base + slot;
+      producer_var->data.location = producer_base + slot;
       producer_var->data.location_frac = offset;
       if (consumer_var) {
-         assert(consumer_var->location == -1);
-         consumer_var->location = consumer_base + slot;
+         assert(consumer_var->data.location == -1);
+         consumer_var->data.location = consumer_base + slot;
          consumer_var->data.location_frac = offset;
       }
    }
@@ -934,7 +934,7 @@ is_varying_var(GLenum shaderType, const ir_variable *var)
    /* Only fragment shaders will take a varying variable as an input */
    if (shaderType == GL_FRAGMENT_SHADER &&
        var->data.mode == ir_var_shader_in) {
-      switch (var->location) {
+      switch (var->data.location) {
       case VARYING_SLOT_POS:
       case VARYING_SLOT_FACE:
       case VARYING_SLOT_PNTC:
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 77dc03f..5091284 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -217,16 +217,16 @@ public:
        * array using an index too large for its actual size assigned at link
        * time.
        */
-      if (var->max_array_access >= this->num_vertices) {
+      if (var->data.max_array_access >= this->num_vertices) {
          linker_error(this->prog, "geometry shader accesses element %i of "
                       "%s, but only %i input vertices\n",
-                      var->max_array_access, var->name, this->num_vertices);
+                      var->data.max_array_access, var->name, this->num_vertices);
          return visit_continue;
       }
 
       var->type = glsl_type::get_array_instance(var->type->element_type(),
                                                 this->num_vertices);
-      var->max_array_access = this->num_vertices - 1;
+      var->data.max_array_access = this->num_vertices - 1;
 
       return visit_continue;
    }
@@ -380,7 +380,7 @@ link_invalidate_variable_locations(exec_list *ir)
        * outputs (also via layout(location=...)).
        */
       if (!var->data.explicit_location) {
-         var->location = -1;
+         var->data.location = -1;
          var->data.location_frac = 0;
       }
 
@@ -621,14 +621,14 @@ cross_validate_globals(struct gl_shader_program *prog,
 
 	    if (var->data.explicit_location) {
 	       if (existing->data.explicit_location
-		   && (var->location != existing->location)) {
+		   && (var->data.location != existing->data.location)) {
 		     linker_error(prog, "explicit locations for %s "
 				  "`%s' have differing values\n",
 				  mode_string(var), var->name);
 		     return;
 	       }
 
-	       existing->location = var->location;
+	       existing->data.location = var->data.location;
 	       existing->data.explicit_location = true;
 	    }
 
@@ -640,19 +640,19 @@ cross_validate_globals(struct gl_shader_program *prog,
              */
             if (var->data.explicit_binding) {
                if (existing->data.explicit_binding &&
-                   var->binding != existing->binding) {
+                   var->data.binding != existing->data.binding) {
                   linker_error(prog, "explicit bindings for %s "
                                "`%s' have differing values\n",
                                mode_string(var), var->name);
                   return;
                }
 
-               existing->binding = var->binding;
+               existing->data.binding = var->data.binding;
                existing->data.explicit_binding = true;
             }
 
             if (var->type->contains_atomic() &&
-                var->atomic.offset != existing->atomic.offset) {
+                var->data.atomic.offset != existing->data.atomic.offset) {
                linker_error(prog, "offset specifications for %s "
                             "`%s' have differing values\n",
                             mode_string(var), var->name);
@@ -671,9 +671,9 @@ cross_validate_globals(struct gl_shader_program *prog,
 	     *    of qualifiers."
 	     */
 	    if (strcmp(var->name, "gl_FragDepth") == 0) {
-	       bool layout_declared = var->depth_layout != ir_depth_layout_none;
+	       bool layout_declared = var->data.depth_layout != ir_depth_layout_none;
 	       bool layout_differs =
-		  var->depth_layout != existing->depth_layout;
+		  var->data.depth_layout != existing->data.depth_layout;
 
 	       if (layout_declared && layout_differs) {
 		  linker_error(prog,
@@ -1036,7 +1036,7 @@ public:
 
    virtual ir_visitor_status visit(ir_variable *var)
    {
-      fixup_type(&var->type, var->max_array_access);
+      fixup_type(&var->type, var->data.max_array_access);
       if (var->type->is_interface()) {
          if (interface_contains_unsized_arrays(var->type)) {
             const glsl_type *new_type =
@@ -1503,7 +1503,7 @@ update_array_sizes(struct gl_shader_program *prog)
 	 if (var->is_in_uniform_block() || var->type->contains_atomic())
 	    continue;
 
-	 unsigned int size = var->max_array_access;
+	 unsigned int size = var->data.max_array_access;
 	 for (unsigned j = 0; j < MESA_SHADER_TYPES; j++) {
 	       if (prog->_LinkedShaders[j] == NULL)
 		  continue;
@@ -1514,8 +1514,8 @@ update_array_sizes(struct gl_shader_program *prog)
 		  continue;
 
 	       if (strcmp(var->name, other_var->name) == 0 &&
-		   other_var->max_array_access > size) {
-		  size = other_var->max_array_access;
+		   other_var->data.max_array_access > size) {
+		  size = other_var->data.max_array_access;
 	       }
 	    }
 	 }
@@ -1658,12 +1658,12 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
 	 continue;
 
       if (var->data.explicit_location) {
-	 if ((var->location >= (int)(max_index + generic_base))
-	     || (var->location < 0)) {
+	 if ((var->data.location >= (int)(max_index + generic_base))
+	     || (var->data.location < 0)) {
 	    linker_error(prog,
 			 "invalid explicit location %d specified for `%s'\n",
-			 (var->location < 0)
-			 ? var->location : var->location - generic_base,
+			 (var->data.location < 0)
+			 ? var->data.location : var->data.location - generic_base,
 			 var->name);
 	    return false;
 	 }
@@ -1672,7 +1672,7 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
 
 	 if (prog->AttributeBindings->get(binding, var->name)) {
 	    assert(binding >= VERT_ATTRIB_GENERIC0);
-	    var->location = binding;
+	    var->data.location = binding;
             var->data.is_unmatched_generic_inout = 0;
 	 }
       } else if (target_index == MESA_SHADER_FRAGMENT) {
@@ -1681,11 +1681,11 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
 
 	 if (prog->FragDataBindings->get(binding, var->name)) {
 	    assert(binding >= FRAG_RESULT_DATA0);
-	    var->location = binding;
+	    var->data.location = binding;
             var->data.is_unmatched_generic_inout = 0;
 
 	    if (prog->FragDataIndexBindings->get(index, var->name)) {
-	       var->index = index;
+	       var->data.index = index;
 	    }
 	 }
       }
@@ -1696,8 +1696,8 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
        * add it to the list of variables that need linker-assigned locations.
        */
       const unsigned slots = var->type->count_attribute_slots();
-      if (var->location != -1) {
-	 if (var->location >= generic_base && var->index < 1) {
+      if (var->data.location != -1) {
+	 if (var->data.location >= generic_base && var->data.index < 1) {
 	    /* From page 61 of the OpenGL 4.0 spec:
 	     *
 	     *     "LinkProgram will fail if the attribute bindings assigned
@@ -1731,7 +1731,7 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
 	    /* Mask representing the contiguous slots that will be used by
 	     * this attribute.
 	     */
-	    const unsigned attr = var->location - generic_base;
+	    const unsigned attr = var->data.location - generic_base;
 	    const unsigned use_mask = (1 << slots) - 1;
 
 	    /* Generate a link error if the set of bits requested for this
@@ -1797,7 +1797,7 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
 	 return false;
       }
 
-      to_assign[i].var->location = generic_base + location;
+      to_assign[i].var->data.location = generic_base + location;
       to_assign[i].var->data.is_unmatched_generic_inout = 0;
       used_locations |= (use_mask << location);
    }
@@ -1856,7 +1856,7 @@ store_fragdepth_layout(struct gl_shader_program *prog)
       }
 
       if (strcmp(var->name, "gl_FragDepth") == 0) {
-         switch (var->depth_layout) {
+         switch (var->data.depth_layout) {
          case ir_depth_layout_none:
             prog->FragDepthLayout = FRAG_DEPTH_LAYOUT_NONE;
             return;
diff --git a/src/glsl/lower_clip_distance.cpp b/src/glsl/lower_clip_distance.cpp
index 33e480b..bb4f6ab 100644
--- a/src/glsl/lower_clip_distance.cpp
+++ b/src/glsl/lower_clip_distance.cpp
@@ -135,8 +135,8 @@ lower_clip_distance_visitor::visit(ir_variable *ir)
                          "gl_ClipDistanceMESA");
       this->new_clip_distance_1d_var->type
          = glsl_type::get_array_instance(glsl_type::vec4_type, new_size);
-      this->new_clip_distance_1d_var->max_array_access
-         = ir->max_array_access / 4;
+      this->new_clip_distance_1d_var->data.max_array_access
+         = ir->data.max_array_access / 4;
 
       ir->replace_with(this->new_clip_distance_1d_var);
    } else {
@@ -161,8 +161,8 @@ lower_clip_distance_visitor::visit(ir_variable *ir)
          glsl_type::get_array_instance(glsl_type::vec4_type,
             new_size),
          ir->type->array_size());
-      this->new_clip_distance_2d_var->max_array_access
-         = ir->max_array_access / 4;
+      this->new_clip_distance_2d_var->data.max_array_access
+         = ir->data.max_array_access / 4;
 
       ir->replace_with(this->new_clip_distance_2d_var);
    }
diff --git a/src/glsl/lower_named_interface_blocks.cpp b/src/glsl/lower_named_interface_blocks.cpp
index 10b2025..42fcfe1 100644
--- a/src/glsl/lower_named_interface_blocks.cpp
+++ b/src/glsl/lower_named_interface_blocks.cpp
@@ -140,7 +140,7 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions)
                   new(mem_ctx) ir_variable(iface_t->fields.structure[i].type,
                                            var_name,
                                            (ir_variable_mode) var->data.mode);
-               new_var->from_named_ifc_block_nonarray = 1;
+               new_var->data.from_named_ifc_block_nonarray = 1;
             } else {
                const glsl_type *new_array_type =
                   glsl_type::get_array_instance(
@@ -150,10 +150,10 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions)
                   new(mem_ctx) ir_variable(new_array_type,
                                            var_name,
                                            (ir_variable_mode) var->data.mode);
-               new_var->from_named_ifc_block_array = 1;
+               new_var->data.from_named_ifc_block_array = 1;
             }
-            new_var->location = iface_t->fields.structure[i].location;
-            new_var->data.explicit_location = (new_var->location >= 0);
+            new_var->data.location = iface_t->fields.structure[i].location;
+            new_var->data.explicit_location = (new_var->data.location >= 0);
             new_var->data.interpolation =
                iface_t->fields.structure[i].interpolation;
             new_var->data.centroid = iface_t->fields.structure[i].centroid;
diff --git a/src/glsl/lower_packed_varyings.cpp b/src/glsl/lower_packed_varyings.cpp
index 6e87dd9..80fac85 100644
--- a/src/glsl/lower_packed_varyings.cpp
+++ b/src/glsl/lower_packed_varyings.cpp
@@ -259,7 +259,7 @@ lower_packed_varyings_visitor::run(exec_list *instructions)
          continue;
 
       if (var->data.mode != this->mode ||
-          var->location < (int) this->location_base ||
+          var->data.location < (int) this->location_base ||
           !this->needs_lowering(var))
          continue;
 
@@ -279,7 +279,7 @@ lower_packed_varyings_visitor::run(exec_list *instructions)
          = new(this->mem_ctx) ir_dereference_variable(var);
 
       /* Recursively pack or unpack it. */
-      this->lower_rvalue(deref, var->location * 4 + var->data.location_frac, var,
+      this->lower_rvalue(deref, var->data.location * 4 + var->data.location_frac, var,
                          var->name, this->gs_input_vertices != 0, 0);
    }
 }
@@ -562,11 +562,11 @@ lower_packed_varyings_visitor::get_packed_varying_deref(
          /* Prevent update_array_sizes() from messing with the size of the
           * array.
           */
-         packed_var->max_array_access = this->gs_input_vertices - 1;
+         packed_var->data.max_array_access = this->gs_input_vertices - 1;
       }
       packed_var->data.centroid = unpacked_var->data.centroid;
       packed_var->data.interpolation = unpacked_var->data.interpolation;
-      packed_var->location = location;
+      packed_var->data.location = location;
       unpacked_var->insert_before(packed_var);
       this->packed_varyings[slot] = packed_var;
    } else {
diff --git a/src/glsl/lower_ubo_reference.cpp b/src/glsl/lower_ubo_reference.cpp
index 16b6801..c73b148 100644
--- a/src/glsl/lower_ubo_reference.cpp
+++ b/src/glsl/lower_ubo_reference.cpp
@@ -143,7 +143,7 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue)
          struct gl_uniform_block *block = &shader->UniformBlocks[i];
 
          this->ubo_var = var->is_interface_instance()
-            ? &block->Uniforms[0] : &block->Uniforms[var->location];
+            ? &block->Uniforms[0] : &block->Uniforms[var->data.location];
 
          break;
       }
diff --git a/src/glsl/opt_dead_builtin_varyings.cpp b/src/glsl/opt_dead_builtin_varyings.cpp
index 9e6f11a..a939a2b 100644
--- a/src/glsl/opt_dead_builtin_varyings.cpp
+++ b/src/glsl/opt_dead_builtin_varyings.cpp
@@ -88,7 +88,7 @@ public:
       if (!var || var->data.mode != this->mode)
          return visit_continue;
 
-      if (this->find_frag_outputs && var->location == FRAG_RESULT_DATA0) {
+      if (this->find_frag_outputs && var->data.location == FRAG_RESULT_DATA0) {
          this->fragdata_array = var;
 
          ir_constant *index = ir->array_index->as_constant();
@@ -105,7 +105,7 @@ public:
          return visit_continue_with_parent;
       }
 
-      if (!this->find_frag_outputs && var->location == VARYING_SLOT_TEX0) {
+      if (!this->find_frag_outputs && var->data.location == VARYING_SLOT_TEX0) {
          this->texcoord_array = var;
 
          ir_constant *index = ir->array_index->as_constant();
@@ -133,14 +133,14 @@ public:
       if (var->data.mode != this->mode || !var->type->is_array())
          return visit_continue;
 
-      if (this->find_frag_outputs && var->location == FRAG_RESULT_DATA0) {
+      if (this->find_frag_outputs && var->data.location == FRAG_RESULT_DATA0) {
          /* This is a whole array dereference. */
          this->fragdata_usage |= (1 << var->type->array_size()) - 1;
          this->lower_fragdata_array = false;
          return visit_continue;
       }
 
-      if (!this->find_frag_outputs && var->location == VARYING_SLOT_TEX0) {
+      if (!this->find_frag_outputs && var->data.location == VARYING_SLOT_TEX0) {
          /* This is a whole array dereference like "gl_TexCoord = x;",
           * there's probably no point in lowering that.
           */
@@ -160,7 +160,7 @@ public:
          return visit_continue;
 
       /* Handle colors and fog. */
-      switch (var->location) {
+      switch (var->data.location) {
       case VARYING_SLOT_COL0:
          this->color[0] = var;
          this->color_usage |= 1;
@@ -358,7 +358,7 @@ public:
                new_var[i] =
                   new(ctx) ir_variable(glsl_type::vec4_type, name,
                                        this->info->mode);
-               new_var[i]->location = start_location + i;
+               new_var[i]->data.location = start_location + i;
                new_var[i]->data.explicit_location = true;
                new_var[i]->data.explicit_index = 0;
             }
diff --git a/src/glsl/opt_flip_matrices.cpp b/src/glsl/opt_flip_matrices.cpp
index 2107b1d..9044fd6 100644
--- a/src/glsl/opt_flip_matrices.cpp
+++ b/src/glsl/opt_flip_matrices.cpp
@@ -104,8 +104,8 @@ matrix_flipper::visit_enter(ir_expression *ir)
 
       var_ref->var = texmat_transpose;
 
-      texmat_transpose->max_array_access =
-         MAX2(texmat_transpose->max_array_access, mat_var->max_array_access);
+      texmat_transpose->data.max_array_access =
+         MAX2(texmat_transpose->data.max_array_access, mat_var->data.max_array_access);
 
       progress = true;
    }
diff --git a/src/glsl/tests/builtin_variable_test.cpp b/src/glsl/tests/builtin_variable_test.cpp
index a2008cb..63949ee 100644
--- a/src/glsl/tests/builtin_variable_test.cpp
+++ b/src/glsl/tests/builtin_variable_test.cpp
@@ -114,7 +114,7 @@ common_builtin::uniforms_and_system_values_dont_have_explicit_location()
          continue;
 
       EXPECT_FALSE(var->data.explicit_location);
-      EXPECT_EQ(-1, var->location);
+      EXPECT_EQ(-1, var->data.location);
    }
 }
 
@@ -128,7 +128,7 @@ common_builtin::constants_are_constant()
          continue;
 
       EXPECT_FALSE(var->data.explicit_location);
-      EXPECT_EQ(-1, var->location);
+      EXPECT_EQ(-1, var->data.location);
       EXPECT_TRUE(var->data.read_only);
    }
 }
@@ -180,8 +180,8 @@ TEST_F(vertex_builtin, inputs_have_explicit_location)
          continue;
 
       EXPECT_TRUE(var->data.explicit_location);
-      EXPECT_NE(-1, var->location);
-      EXPECT_GT(VERT_ATTRIB_GENERIC0, var->location);
+      EXPECT_NE(-1, var->data.location);
+      EXPECT_GT(VERT_ATTRIB_GENERIC0, var->data.location);
       EXPECT_EQ(0u, var->data.location_frac);
    }
 }
@@ -195,16 +195,16 @@ TEST_F(vertex_builtin, outputs_have_explicit_location)
          continue;
 
       EXPECT_TRUE(var->data.explicit_location);
-      EXPECT_NE(-1, var->location);
-      EXPECT_GT(VARYING_SLOT_VAR0, var->location);
+      EXPECT_NE(-1, var->data.location);
+      EXPECT_GT(VARYING_SLOT_VAR0, var->data.location);
       EXPECT_EQ(0u, var->data.location_frac);
 
       /* Several varyings only exist in the fragment shader.  Be sure that no
        * outputs with these locations exist.
        */
-      EXPECT_NE(VARYING_SLOT_PNTC, var->location);
-      EXPECT_NE(VARYING_SLOT_FACE, var->location);
-      EXPECT_NE(VARYING_SLOT_PRIMITIVE_ID, var->location);
+      EXPECT_NE(VARYING_SLOT_PNTC, var->data.location);
+      EXPECT_NE(VARYING_SLOT_FACE, var->data.location);
+      EXPECT_NE(VARYING_SLOT_PRIMITIVE_ID, var->data.location);
    }
 }
 
@@ -248,14 +248,14 @@ TEST_F(fragment_builtin, inputs_have_explicit_location)
 	 continue;
 
       EXPECT_TRUE(var->data.explicit_location);
-      EXPECT_NE(-1, var->location);
-      EXPECT_GT(VARYING_SLOT_VAR0, var->location);
+      EXPECT_NE(-1, var->data.location);
+      EXPECT_GT(VARYING_SLOT_VAR0, var->data.location);
       EXPECT_EQ(0u, var->data.location_frac);
 
       /* Several varyings only exist in the vertex / geometry shader.  Be sure
        * that no inputs with these locations exist.
        */
-      EXPECT_TRUE(_mesa_varying_slot_in_fs((gl_varying_slot) var->location));
+      EXPECT_TRUE(_mesa_varying_slot_in_fs((gl_varying_slot) var->data.location));
    }
 }
 
@@ -268,12 +268,12 @@ TEST_F(fragment_builtin, outputs_have_explicit_location)
 	 continue;
 
       EXPECT_TRUE(var->data.explicit_location);
-      EXPECT_NE(-1, var->location);
+      EXPECT_NE(-1, var->data.location);
 
       /* gl_FragData[] has location FRAG_RESULT_DATA0.  Locations beyond that
        * are invalid.
        */
-      EXPECT_GE(FRAG_RESULT_DATA0, var->location);
+      EXPECT_GE(FRAG_RESULT_DATA0, var->data.location);
 
       EXPECT_EQ(0u, var->data.location_frac);
    }
@@ -321,7 +321,7 @@ TEST_F(geometry_builtin, inputs_have_explicit_location)
       if (var->is_interface_instance()) {
          EXPECT_STREQ("gl_in", var->name);
          EXPECT_FALSE(var->data.explicit_location);
-         EXPECT_EQ(-1, var->location);
+         EXPECT_EQ(-1, var->data.location);
 
          ASSERT_TRUE(var->type->is_array());
 
@@ -343,16 +343,16 @@ TEST_F(geometry_builtin, inputs_have_explicit_location)
          }
       } else {
          EXPECT_TRUE(var->data.explicit_location);
-         EXPECT_NE(-1, var->location);
-         EXPECT_GT(VARYING_SLOT_VAR0, var->location);
+         EXPECT_NE(-1, var->data.location);
+         EXPECT_GT(VARYING_SLOT_VAR0, var->data.location);
          EXPECT_EQ(0u, var->data.location_frac);
       }
 
       /* Several varyings only exist in the fragment shader.  Be sure that no
        * inputs with these locations exist.
        */
-      EXPECT_NE(VARYING_SLOT_PNTC, var->location);
-      EXPECT_NE(VARYING_SLOT_FACE, var->location);
+      EXPECT_NE(VARYING_SLOT_PNTC, var->data.location);
+      EXPECT_NE(VARYING_SLOT_FACE, var->data.location);
    }
 }
 
@@ -365,15 +365,15 @@ TEST_F(geometry_builtin, outputs_have_explicit_location)
 	 continue;
 
       EXPECT_TRUE(var->data.explicit_location);
-      EXPECT_NE(-1, var->location);
-      EXPECT_GT(VARYING_SLOT_VAR0, var->location);
+      EXPECT_NE(-1, var->data.location);
+      EXPECT_GT(VARYING_SLOT_VAR0, var->data.location);
       EXPECT_EQ(0u, var->data.location_frac);
 
       /* Several varyings only exist in the fragment shader.  Be sure that no
        * outputs with these locations exist.
        */
-      EXPECT_NE(VARYING_SLOT_PNTC, var->location);
-      EXPECT_NE(VARYING_SLOT_FACE, var->location);
+      EXPECT_NE(VARYING_SLOT_PNTC, var->data.location);
+      EXPECT_NE(VARYING_SLOT_FACE, var->data.location);
    }
 }
 
diff --git a/src/glsl/tests/invalidate_locations_test.cpp b/src/glsl/tests/invalidate_locations_test.cpp
index b76491a..997592f 100644
--- a/src/glsl/tests/invalidate_locations_test.cpp
+++ b/src/glsl/tests/invalidate_locations_test.cpp
@@ -65,16 +65,16 @@ TEST_F(invalidate_locations, simple_vertex_in_generic)
                                ir_var_shader_in);
 
    EXPECT_FALSE(var->data.explicit_location);
-   EXPECT_EQ(-1, var->location);
+   EXPECT_EQ(-1, var->data.location);
 
-   var->location = VERT_ATTRIB_GENERIC0;
+   var->data.location = VERT_ATTRIB_GENERIC0;
    var->data.location_frac = 2;
 
    ir.push_tail(var);
 
    link_invalidate_variable_locations(&ir);
 
-   EXPECT_EQ(-1, var->location);
+   EXPECT_EQ(-1, var->data.location);
    EXPECT_EQ(0u, var->data.location_frac);
    EXPECT_FALSE(var->data.explicit_location);
    EXPECT_TRUE(var->data.is_unmatched_generic_inout);
@@ -88,16 +88,16 @@ TEST_F(invalidate_locations, explicit_location_vertex_in_generic)
                                ir_var_shader_in);
 
    EXPECT_FALSE(var->data.explicit_location);
-   EXPECT_EQ(-1, var->location);
+   EXPECT_EQ(-1, var->data.location);
 
-   var->location = VERT_ATTRIB_GENERIC0;
+   var->data.location = VERT_ATTRIB_GENERIC0;
    var->data.explicit_location = true;
 
    ir.push_tail(var);
 
    link_invalidate_variable_locations(&ir);
 
-   EXPECT_EQ(VERT_ATTRIB_GENERIC0, var->location);
+   EXPECT_EQ(VERT_ATTRIB_GENERIC0, var->data.location);
    EXPECT_EQ(0u, var->data.location_frac);
    EXPECT_TRUE(var->data.explicit_location);
    EXPECT_FALSE(var->data.is_unmatched_generic_inout);
@@ -111,9 +111,9 @@ TEST_F(invalidate_locations, explicit_location_frac_vertex_in_generic)
                                ir_var_shader_in);
 
    EXPECT_FALSE(var->data.explicit_location);
-   EXPECT_EQ(-1, var->location);
+   EXPECT_EQ(-1, var->data.location);
 
-   var->location = VERT_ATTRIB_GENERIC0;
+   var->data.location = VERT_ATTRIB_GENERIC0;
    var->data.location_frac = 2;
    var->data.explicit_location = true;
 
@@ -121,7 +121,7 @@ TEST_F(invalidate_locations, explicit_location_frac_vertex_in_generic)
 
    link_invalidate_variable_locations(&ir);
 
-   EXPECT_EQ(VERT_ATTRIB_GENERIC0, var->location);
+   EXPECT_EQ(VERT_ATTRIB_GENERIC0, var->data.location);
    EXPECT_EQ(2u, var->data.location_frac);
    EXPECT_TRUE(var->data.explicit_location);
    EXPECT_FALSE(var->data.is_unmatched_generic_inout);
@@ -135,16 +135,16 @@ TEST_F(invalidate_locations, vertex_in_builtin)
                                ir_var_shader_in);
 
    EXPECT_FALSE(var->data.explicit_location);
-   EXPECT_EQ(-1, var->location);
+   EXPECT_EQ(-1, var->data.location);
 
-   var->location = VERT_ATTRIB_POS;
+   var->data.location = VERT_ATTRIB_POS;
    var->data.explicit_location = true;
 
    ir.push_tail(var);
 
    link_invalidate_variable_locations(&ir);
 
-   EXPECT_EQ(VERT_ATTRIB_POS, var->location);
+   EXPECT_EQ(VERT_ATTRIB_POS, var->data.location);
    EXPECT_EQ(0u, var->data.location_frac);
    EXPECT_TRUE(var->data.explicit_location);
    EXPECT_FALSE(var->data.is_unmatched_generic_inout);
@@ -158,15 +158,15 @@ TEST_F(invalidate_locations, simple_vertex_out_generic)
                                ir_var_shader_out);
 
    EXPECT_FALSE(var->data.explicit_location);
-   EXPECT_EQ(-1, var->location);
+   EXPECT_EQ(-1, var->data.location);
 
-   var->location = VARYING_SLOT_VAR0;
+   var->data.location = VARYING_SLOT_VAR0;
 
    ir.push_tail(var);
 
    link_invalidate_variable_locations(&ir);
 
-   EXPECT_EQ(-1, var->location);
+   EXPECT_EQ(-1, var->data.location);
    EXPECT_EQ(0u, var->data.location_frac);
    EXPECT_FALSE(var->data.explicit_location);
    EXPECT_TRUE(var->data.is_unmatched_generic_inout);
@@ -180,16 +180,16 @@ TEST_F(invalidate_locations, vertex_out_builtin)
                                ir_var_shader_out);
 
    EXPECT_FALSE(var->data.explicit_location);
-   EXPECT_EQ(-1, var->location);
+   EXPECT_EQ(-1, var->data.location);
 
-   var->location = VARYING_SLOT_COL0;
+   var->data.location = VARYING_SLOT_COL0;
    var->data.explicit_location = true;
 
    ir.push_tail(var);
 
    link_invalidate_variable_locations(&ir);
 
-   EXPECT_EQ(VARYING_SLOT_COL0, var->location);
+   EXPECT_EQ(VARYING_SLOT_COL0, var->data.location);
    EXPECT_EQ(0u, var->data.location_frac);
    EXPECT_TRUE(var->data.explicit_location);
    EXPECT_FALSE(var->data.is_unmatched_generic_inout);
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index a7d446c..bb86f86 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1047,7 +1047,7 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
    glsl_interp_qualifier interpolation_mode =
       ir->determine_interpolation_mode(c->key.flat_shade);
 
-   int location = ir->location;
+   int location = ir->data.location;
    for (unsigned int i = 0; i < array_elements; i++) {
       for (unsigned int j = 0; j < type->matrix_columns; j++) {
 	 if (c->prog_data.urb_setup[location] == -1) {
diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
index ad01930..07eaacb 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
@@ -608,7 +608,7 @@ fs_visitor::setup_fp_regs()
          ir_variable *ir = new(mem_ctx) ir_variable(glsl_type::vec4_type,
                                                     "fp_input",
                                                     ir_var_shader_in);
-         ir->location = i;
+         ir->data.location = i;
 
          this->current_annotation = ralloc_asprintf(ctx, "interpolate input %d",
                                                     i);
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 3674a39..8c8989e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -70,24 +70,24 @@ fs_visitor::visit(ir_variable *ir)
    } else if (ir->data.mode == ir_var_shader_out) {
       reg = new(this->mem_ctx) fs_reg(this, ir->type);
 
-      if (ir->index > 0) {
-	 assert(ir->location == FRAG_RESULT_DATA0);
-	 assert(ir->index == 1);
+      if (ir->data.index > 0) {
+	 assert(ir->data.location == FRAG_RESULT_DATA0);
+	 assert(ir->data.index == 1);
 	 this->dual_src_output = *reg;
-      } else if (ir->location == FRAG_RESULT_COLOR) {
+      } else if (ir->data.location == FRAG_RESULT_COLOR) {
 	 /* Writing gl_FragColor outputs to all color regions. */
 	 for (unsigned int i = 0; i < MAX2(c->key.nr_color_regions, 1); i++) {
 	    this->outputs[i] = *reg;
 	    this->output_components[i] = 4;
 	 }
-      } else if (ir->location == FRAG_RESULT_DEPTH) {
+      } else if (ir->data.location == FRAG_RESULT_DEPTH) {
 	 this->frag_depth = *reg;
-      } else if (ir->location == FRAG_RESULT_SAMPLE_MASK) {
+      } else if (ir->data.location == FRAG_RESULT_SAMPLE_MASK) {
          this->sample_mask = *reg;
       } else {
 	 /* gl_FragData or a user-defined FS output */
-	 assert(ir->location >= FRAG_RESULT_DATA0 &&
-		ir->location < FRAG_RESULT_DATA0 + BRW_MAX_DRAW_BUFFERS);
+	 assert(ir->data.location >= FRAG_RESULT_DATA0 &&
+		ir->data.location < FRAG_RESULT_DATA0 + BRW_MAX_DRAW_BUFFERS);
 
 	 int vector_elements =
 	    ir->type->is_array() ? ir->type->fields.array->vector_elements
@@ -95,7 +95,7 @@ fs_visitor::visit(ir_variable *ir)
 
 	 /* General color output. */
 	 for (unsigned int i = 0; i < MAX2(1, ir->type->length); i++) {
-	    int output = ir->location - FRAG_RESULT_DATA0 + i;
+	    int output = ir->data.location - FRAG_RESULT_DATA0 + i;
 	    this->outputs[output] = *reg;
 	    this->outputs[output].reg_offset += vector_elements * i;
 	    this->output_components[output] = vector_elements;
@@ -132,9 +132,9 @@ fs_visitor::visit(ir_variable *ir)
       reg->type = brw_type_for_base_type(ir->type);
 
    } else if (ir->data.mode == ir_var_system_value) {
-      if (ir->location == SYSTEM_VALUE_SAMPLE_POS) {
+      if (ir->data.location == SYSTEM_VALUE_SAMPLE_POS) {
 	 reg = emit_samplepos_setup(ir);
-      } else if (ir->location == SYSTEM_VALUE_SAMPLE_ID) {
+      } else if (ir->data.location == SYSTEM_VALUE_SAMPLE_ID) {
 	 reg = emit_sampleid_setup(ir);
       }
    }
@@ -2205,7 +2205,7 @@ fs_visitor::visit_atomic_counter_intrinsic(ir_call *ir)
       ir->actual_parameters.get_head());
    ir_variable *location = deref->variable_referenced();
    unsigned surf_index = (c->prog_data.base.binding_table.abo_start +
-                          location->atomic.buffer_index);
+                          location->data.atomic.buffer_index);
 
    /* Calculate the surface offset */
    fs_reg offset(this, glsl_type::uint_type);
@@ -2216,9 +2216,9 @@ fs_visitor::visit_atomic_counter_intrinsic(ir_call *ir)
 
       fs_reg tmp(this, glsl_type::uint_type);
       emit(MUL(tmp, this->result, ATOMIC_COUNTER_SIZE));
-      emit(ADD(offset, tmp, location->atomic.offset));
+      emit(ADD(offset, tmp, location->data.atomic.offset));
    } else {
-      offset = location->atomic.offset;
+      offset = location->data.atomic.offset;
    }
 
    /* Emit the appropriate machine instruction */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 42d1c8d..2623999 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -947,18 +947,18 @@ vec4_visitor::visit(ir_variable *ir)
 
    switch (ir->data.mode) {
    case ir_var_shader_in:
-      reg = new(mem_ctx) dst_reg(ATTR, ir->location);
+      reg = new(mem_ctx) dst_reg(ATTR, ir->data.location);
       break;
 
    case ir_var_shader_out:
       reg = new(mem_ctx) dst_reg(this, ir->type);
 
       for (int i = 0; i < type_size(ir->type); i++) {
-	 output_reg[ir->location + i] = *reg;
-	 output_reg[ir->location + i].reg_offset = i;
-	 output_reg[ir->location + i].type =
+	 output_reg[ir->data.location + i] = *reg;
+	 output_reg[ir->data.location + i].reg_offset = i;
+	 output_reg[ir->data.location + i].type =
             brw_type_for_base_type(ir->type->get_scalar_type());
-	 output_reg_annotation[ir->location + i] = ir->name;
+	 output_reg_annotation[ir->data.location + i] = ir->name;
       }
       break;
 
@@ -2178,7 +2178,7 @@ vec4_visitor::visit_atomic_counter_intrinsic(ir_call *ir)
       ir->actual_parameters.get_head());
    ir_variable *location = deref->variable_referenced();
    unsigned surf_index = (prog_data->base.binding_table.abo_start +
-                          location->atomic.buffer_index);
+                          location->data.atomic.buffer_index);
 
    /* Calculate the surface offset */
    src_reg offset(this, glsl_type::uint_type);
@@ -2188,9 +2188,9 @@ vec4_visitor::visit_atomic_counter_intrinsic(ir_call *ir)
 
       src_reg tmp(this, glsl_type::uint_type);
       emit(MUL(dst_reg(tmp), this->result, ATOMIC_COUNTER_SIZE));
-      emit(ADD(dst_reg(offset), tmp, location->atomic.offset));
+      emit(ADD(dst_reg(offset), tmp, location->data.atomic.offset));
    } else {
-      offset = location->atomic.offset;
+      offset = location->data.atomic.offset;
    }
 
    /* Emit the appropriate machine instruction */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
index 31c42c4..0146cf9 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
@@ -153,7 +153,7 @@ vec4_vs_visitor::make_reg_for_system_value(ir_variable *ir)
    dst_reg *reg = new(mem_ctx) dst_reg(ATTR, VERT_ATTRIB_MAX);
    vs_prog_data->uses_vertexid = true;
 
-   switch (ir->location) {
+   switch (ir->data.location) {
    case SYSTEM_VALUE_VERTEX_ID:
       reg->writemask = WRITEMASK_X;
       break;
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 0d75702..ad004ac 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -543,7 +543,7 @@ get_current_attrib(texenv_fragment_program *p, GLuint attrib)
    ir_rvalue *val;
 
    current = p->shader->symbols->get_variable("gl_CurrentAttribFragMESA");
-   current->max_array_access = MAX2(current->max_array_access, attrib);
+   current->data.max_array_access = MAX2(current->data.max_array_access, attrib);
    val = new(p->mem_ctx) ir_dereference_variable(current);
    ir_rvalue *index = new(p->mem_ctx) ir_constant(attrib);
    return new(p->mem_ctx) ir_dereference_array(val, index);
@@ -587,7 +587,7 @@ get_source(texenv_fragment_program *p,
       var = p->shader->symbols->get_variable("gl_TextureEnvColor");
       assert(var);
       deref = new(p->mem_ctx) ir_dereference_variable(var);
-      var->max_array_access = MAX2(var->max_array_access, unit);
+      var->data.max_array_access = MAX2(var->data.max_array_access, unit);
       return new(p->mem_ctx) ir_dereference_array(deref,
 						  new(p->mem_ctx) ir_constant(unit));
 
@@ -927,7 +927,7 @@ static void load_texture( texenv_fragment_program *p, GLuint unit )
       texcoord = new(p->mem_ctx) ir_dereference_variable(tc_array);
       ir_rvalue *index = new(p->mem_ctx) ir_constant(unit);
       texcoord = new(p->mem_ctx) ir_dereference_array(texcoord, index);
-      tc_array->max_array_access = MAX2(tc_array->max_array_access, unit);
+      tc_array->data.max_array_access = MAX2(tc_array->data.max_array_access, unit);
    }
 
    if (!p->state->unit[unit].enabled) {
@@ -1103,7 +1103,7 @@ load_texunit_bumpmap( texenv_fragment_program *p, GLuint unit )
    texcoord = new(p->mem_ctx) ir_dereference_variable(tc_array);
    ir_rvalue *index = new(p->mem_ctx) ir_constant(bumpedUnitNr);
    texcoord = new(p->mem_ctx) ir_dereference_array(texcoord, index);
-   tc_array->max_array_access = MAX2(tc_array->max_array_access, unit);
+   tc_array->data.max_array_access = MAX2(tc_array->data.max_array_access, unit);
 
    load_texenv_source( p, unit + SRC_TEXTURE0, unit );
 
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 6db29d8..f14e1a5 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -107,7 +107,7 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
 
       if (var == NULL
 	  || var->data.mode != ir_var_shader_in
-	  || var->location == -1)
+	  || var->data.location == -1)
 	 continue;
 
       if (current_index == desired_index) {
@@ -170,12 +170,12 @@ _mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name)
        */
       if (var == NULL
 	  || var->data.mode != ir_var_shader_in
-	  || var->location == -1
-	  || var->location < VERT_ATTRIB_GENERIC0)
+	  || var->data.location == -1
+	  || var->data.location < VERT_ATTRIB_GENERIC0)
 	 continue;
 
       if (strcmp(var->name, name) == 0)
-	 return var->location - VERT_ATTRIB_GENERIC0;
+	 return var->data.location - VERT_ATTRIB_GENERIC0;
    }
 
    return -1;
@@ -198,7 +198,7 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg)
 
       if (var == NULL
 	  || var->data.mode != ir_var_shader_in
-	  || var->location == -1)
+	  || var->data.location == -1)
 	 continue;
 
       i++;
@@ -224,7 +224,7 @@ _mesa_longest_attribute_name_length(struct gl_shader_program *shProg)
 
       if (var == NULL
 	  || var->data.mode != ir_var_shader_in
-	  || var->location == -1)
+	  || var->data.location == -1)
 	 continue;
 
       const size_t len = strlen(var->name);
@@ -334,12 +334,12 @@ _mesa_GetFragDataIndex(GLuint program, const GLchar *name)
        */
       if (var == NULL
           || var->data.mode != ir_var_shader_out
-          || var->location == -1
-          || var->location < FRAG_RESULT_DATA0)
+          || var->data.location == -1
+          || var->data.location < FRAG_RESULT_DATA0)
          continue;
 
       if (strcmp(var->name, name) == 0)
-         return var->index;
+         return var->data.index;
    }
 
    return -1;
@@ -390,12 +390,12 @@ _mesa_GetFragDataLocation(GLuint program, const GLchar *name)
        */
       if (var == NULL
 	  || var->data.mode != ir_var_shader_out
-	  || var->location == -1
-	  || var->location < FRAG_RESULT_DATA0)
+	  || var->data.location == -1
+	  || var->data.location < FRAG_RESULT_DATA0)
 	 continue;
 
       if (strcmp(var->name, name) == 0)
-	 return var->location - FRAG_RESULT_DATA0;
+	 return var->data.location - FRAG_RESULT_DATA0;
    }
 
    return -1;
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index c63fb74..c50b483 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1570,7 +1570,7 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir)
       switch (var->data.mode) {
       case ir_var_uniform:
 	 entry = new(mem_ctx) variable_storage(var, PROGRAM_UNIFORM,
-					       var->location);
+					       var->data.location);
 	 this->variables.push_tail(entry);
 	 break;
       case ir_var_shader_in:
@@ -1579,21 +1579,21 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir)
 	  * user-assigned generic attributes (glBindVertexLocation),
 	  * and user-defined varyings.
 	  */
-	 assert(var->location != -1);
+	 assert(var->data.location != -1);
          entry = new(mem_ctx) variable_storage(var,
                                                PROGRAM_INPUT,
-                                               var->location);
+                                               var->data.location);
          break;
       case ir_var_shader_out:
-	 assert(var->location != -1);
+	 assert(var->data.location != -1);
          entry = new(mem_ctx) variable_storage(var,
                                                PROGRAM_OUTPUT,
-                                               var->location);
+                                               var->data.location);
 	 break;
       case ir_var_system_value:
          entry = new(mem_ctx) variable_storage(var,
                                                PROGRAM_SYSTEM_VALUE,
-                                               var->location);
+                                               var->data.location);
          break;
       case ir_var_auto:
       case ir_var_temporary:
@@ -2443,7 +2443,7 @@ public:
       this->idx = -1;
       this->program_resource_visitor::process(var);
 
-      var->location = this->idx;
+      var->data.location = this->idx;
    }
 
 private:
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index a7fba86..cbfe1c2 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2066,7 +2066,7 @@ glsl_to_tgsi_visitor::visit(ir_dereference_variable *ir)
       switch (var->data.mode) {
       case ir_var_uniform:
          entry = new(mem_ctx) variable_storage(var, PROGRAM_UNIFORM,
-        				       var->location);
+        				       var->data.location);
          this->variables.push_tail(entry);
          break;
       case ir_var_shader_in:
@@ -2075,21 +2075,21 @@ glsl_to_tgsi_visitor::visit(ir_dereference_variable *ir)
           * generic attributes (glBindVertexLocation), and
           * user-defined varyings.
           */
-         assert(var->location != -1);
+         assert(var->data.location != -1);
          entry = new(mem_ctx) variable_storage(var,
                                                PROGRAM_INPUT,
-                                               var->location);
+                                               var->data.location);
          break;
       case ir_var_shader_out:
-         assert(var->location != -1);
+         assert(var->data.location != -1);
          entry = new(mem_ctx) variable_storage(var,
                                                PROGRAM_OUTPUT,
-                                               var->location + var->index);
+                                               var->data.location + var->data.index);
          break;
       case ir_var_system_value:
          entry = new(mem_ctx) variable_storage(var,
                                                PROGRAM_SYSTEM_VALUE,
-                                               var->location);
+                                               var->data.location);
          break;
       case ir_var_auto:
       case ir_var_temporary:
-- 
1.8.3.1



More information about the mesa-dev mailing list