summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ir.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-08-09 13:34:03 +1000
committerTimothy Arceri <[email protected]>2017-08-11 10:43:16 +1000
commit43cbcbfee9ab4a6aa1fbb51a1af7fd9619d3b7f5 (patch)
tree0a2756508f551d2356d324520f71e14bf4858c32 /src/compiler/glsl/ir.cpp
parente2e2c5abd279df1b3aa99c52b81c9cb48fea35fb (diff)
glsl: tidy up get_num_operands()
Also add a comment that this should only be used by the ir_reader interface for testing purposes. v2: - fix grammar in comment - use unreachable rather than assert Reviewed-by: Thomas Helland <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ir.cpp')
-rw-r--r--src/compiler/glsl/ir.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index 51b875058b1..98bbd915396 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -556,7 +556,11 @@ ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1,
}
}
-unsigned int
+/**
+ * This is only here for ir_reader to used for testing purposes. Please use
+ * the precomputed num_operands field if you need the number of operands.
+ */
+unsigned
ir_expression::get_num_operands(ir_expression_operation op)
{
assert(op <= ir_last_opcode);
@@ -573,8 +577,7 @@ ir_expression::get_num_operands(ir_expression_operation op)
if (op <= ir_last_quadop)
return 4;
- assert(false);
- return 0;
+ unreachable("Could not calculate number of operands");
}
#include "ir_expression_operation_strings.h"