Mesa (master): glsl: Move ir_type_unset to end of enumeration.

Matt Turner mattst88 at kemper.freedesktop.org
Wed Jun 4 00:59:27 UTC 2014


Module: Mesa
Branch: master
Commit: 773544f0e95e6732e27ce8f6c4567f221f0d2dac
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=773544f0e95e6732e27ce8f6c4567f221f0d2dac

Author: Matt Turner <mattst88 at gmail.com>
Date:   Sat May 31 16:27:20 2014 -0700

glsl: Move ir_type_unset to end of enumeration.

Now that the constructors set a type, ir_type_unset is not very useful.
Move it to the end of the enum (specifically out of position 0) so that
enums checks for dereferences and rvalues can save an instruction.

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>

---

 src/glsl/ir.h            |    8 ++------
 src/glsl/ir_validate.cpp |    2 +-
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 57552e0..585c31c 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -59,11 +59,6 @@
  * types, this allows writing very straightforward, readable code.
  */
 enum ir_node_type {
-   /**
-    * Zero is unused so that the IR validator can detect cases where
-    * \c ir_instruction::ir_type has not been initialized.
-    */
-   ir_type_unset,
    ir_type_dereference_array,
    ir_type_dereference_record,
    ir_type_dereference_variable,
@@ -83,7 +78,8 @@ enum ir_node_type {
    ir_type_discard,
    ir_type_emit_vertex,
    ir_type_end_primitive,
-   ir_type_max /**< maximum ir_type enum number, for validation */
+   ir_type_max, /**< maximum ir_type enum number, for validation */
+   ir_type_unset = ir_type_max
 };
 
 
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index 71defc8..17a74ea 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -795,7 +795,7 @@ check_node_type(ir_instruction *ir, void *data)
 {
    (void) data;
 
-   if (ir->ir_type <= ir_type_unset || ir->ir_type >= ir_type_max) {
+   if (ir->ir_type >= ir_type_max) {
       printf("Instruction node with unset type\n");
       ir->print(); printf("\n");
    }




More information about the mesa-commit mailing list