Mesa (master): nir: Trivial clean ups in the generated nir_constant_expressions.c
Ian Romanick
idr at kemper.freedesktop.org
Tue Dec 20 01:34:07 UTC 2016
Module: Mesa
Branch: master
Commit: ee1f35eb69999933498d97b6fa7dbeb5ab06af74
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee1f35eb69999933498d97b6fa7dbeb5ab06af74
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Tue Aug 25 18:11:17 2015 +0100
nir: Trivial clean ups in the generated nir_constant_expressions.c
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/compiler/nir/nir_constant_expressions.py | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/compiler/nir/nir_constant_expressions.py b/src/compiler/nir/nir_constant_expressions.py
index 2cc106d..273d6ce 100644
--- a/src/compiler/nir/nir_constant_expressions.py
+++ b/src/compiler/nir/nir_constant_expressions.py
@@ -291,7 +291,7 @@ evaluate_${name}(MAYBE_UNUSED unsigned num_components, unsigned bit_size,
<% continue %>
%endif
- struct ${input_types[j]}_vec src${j} = {
+ const struct ${input_types[j]}_vec src${j} = {
% for k in range(op.input_sizes[j]):
% if input_types[j] == "bool32":
_src[${j}].u32[${k}] != 0,
@@ -319,9 +319,9 @@ evaluate_${name}(MAYBE_UNUSED unsigned num_components, unsigned bit_size,
## Avoid unused variable warnings
<% continue %>
% elif input_types[j] == "bool32":
- bool src${j} = _src[${j}].u32[_i] != 0;
+ const bool src${j} = _src[${j}].u32[_i] != 0;
% else:
- ${input_types[j]}_t src${j} =
+ const ${input_types[j]}_t src${j} =
_src[${j}].${get_const_field(input_types[j])}[_i];
% endif
% endfor
@@ -331,6 +331,7 @@ evaluate_${name}(MAYBE_UNUSED unsigned num_components, unsigned bit_size,
## writes to dst, just include const_expr directly.
% if "dst" in op.const_expr:
${output_type}_t dst;
+
${op.const_expr}
% else:
${output_type}_t dst = ${op.const_expr};
@@ -392,10 +393,8 @@ nir_eval_const_opcode(nir_op op, unsigned num_components,
{
switch (op) {
% for name in sorted(opcodes.iterkeys()):
- case nir_op_${name}: {
+ case nir_op_${name}:
return evaluate_${name}(num_components, bit_width, src);
- break;
- }
% endfor
default:
unreachable("shouldn't get here");
More information about the mesa-commit
mailing list