glsl: Add ir_variable::is_in_uniform_block predicate

The way a variable is tested for this property is about to change, and
this makes the code easier to modify.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 9fdfb18..14212df 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -350,6 +350,14 @@
    glsl_interp_qualifier determine_interpolation_mode(bool flat_shade);
 
    /**
+    * Determine whether or not a variable is part of a uniform block.
+    */
+   inline bool is_in_uniform_block() const
+   {
+      return this->mode == ir_var_uniform && this->uniform_block != -1;
+   }
+
+   /**
     * Declared type of the variable
     */
    const struct glsl_type *type;
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 25bba15..c639a3d 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -228,7 +228,7 @@
 			ir_variable *var)
    {
       ubo_var = NULL;
-      if (var->uniform_block != -1) {
+      if (var->is_in_uniform_block()) {
 	 struct gl_uniform_block *block =
 	    &shader->UniformBlocks[var->uniform_block];
 
@@ -442,7 +442,7 @@
    foreach_list(node, shader->ir) {
       ir_variable *const var = ((ir_instruction *) node)->as_variable();
 
-      if ((var == NULL) || (var->uniform_block == -1))
+      if ((var == NULL) || !var->is_in_uniform_block())
 	 continue;
 
       assert(var->mode == ir_var_uniform);
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 1d4e2f6..a480dd0 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1077,7 +1077,7 @@
 	  * will not be eliminated.  Since we always do std140, just
 	  * don't resize arrays in UBOs.
 	  */
-	 if (var->uniform_block != -1)
+	 if (var->is_in_uniform_block())
 	    continue;
 
 	 unsigned int size = var->max_array_access;
diff --git a/src/glsl/lower_ubo_reference.cpp b/src/glsl/lower_ubo_reference.cpp
index e8d2c47..1d08009 100644
--- a/src/glsl/lower_ubo_reference.cpp
+++ b/src/glsl/lower_ubo_reference.cpp
@@ -78,7 +78,7 @@
       return;
 
    ir_variable *var = deref->variable_referenced();
-   if (!var || var->uniform_block == -1)
+   if (!var || !var->is_in_uniform_block())
       return;
 
    mem_ctx = ralloc_parent(*rvalue);
diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp
index dad307a..78d31cf 100644
--- a/src/glsl/opt_dead_code.cpp
+++ b/src/glsl/opt_dead_code.cpp
@@ -106,7 +106,7 @@
 	 if (entry->var->mode == ir_var_uniform &&
 	     (uniform_locations_assigned ||
 	      entry->var->constant_value ||
-	      entry->var->uniform_block != -1))
+	      entry->var->is_in_uniform_block()))
 	    continue;
 
 	 entry->var->remove();