diff options
author | Mathieu Bridon <[email protected]> | 2018-07-06 12:20:26 +0200 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2018-07-24 11:07:04 -0700 |
commit | 5530cb1296cef759ea2f94e581da0a4d853a9f5f (patch) | |
tree | 58a8bd7809d98f0fc8425615282b56b64c059086 /src/compiler/nir | |
parent | fdf946ffbfa23afde1b42fd8a342f5c42e413cc0 (diff) |
python: Better iterate over dictionaries
In Python 2, dictionaries have 2 sets of methods to iterate over their
keys and values: keys()/values()/items() and iterkeys()/itervalues()/iteritems().
The former return lists while the latter return iterators.
Python 3 dropped the method which return lists, and renamed the methods
returning iterators to keys()/values()/items().
Using those names makes the scripts compatible with both Python 2 and 3.
Signed-off-by: Mathieu Bridon <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Reviewed-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r-- | src/compiler/nir/nir_algebraic.py | 2 | ||||
-rw-r--r-- | src/compiler/nir/nir_builder_opcodes_h.py | 4 | ||||
-rw-r--r-- | src/compiler/nir/nir_constant_expressions.py | 4 | ||||
-rw-r--r-- | src/compiler/nir/nir_intrinsics_c.py | 2 | ||||
-rw-r--r-- | src/compiler/nir/nir_opcodes_c.py | 2 | ||||
-rw-r--r-- | src/compiler/nir/nir_opcodes_h.py | 2 |
6 files changed, 8 insertions, 8 deletions
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index 847c59dbd89..8c0b530f698 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -512,7 +512,7 @@ struct transform { #endif -% for (opcode, xform_list) in xform_dict.iteritems(): +% for (opcode, xform_list) in xform_dict.items(): % for xform in xform_list: ${xform.search.render()} ${xform.replace.render()} diff --git a/src/compiler/nir/nir_builder_opcodes_h.py b/src/compiler/nir/nir_builder_opcodes_h.py index 72cf5b4549d..e600093e9f6 100644 --- a/src/compiler/nir/nir_builder_opcodes_h.py +++ b/src/compiler/nir/nir_builder_opcodes_h.py @@ -34,7 +34,7 @@ def src_list(num_srcs): return ', '.join('src' + str(i) if i < num_srcs else 'NULL' for i in range(4)) %> -% for name, opcode in sorted(opcodes.iteritems()): +% for name, opcode in sorted(opcodes.items()): static inline nir_ssa_def * nir_${name}(nir_builder *build, ${src_decl_list(opcode.num_inputs)}) { @@ -55,7 +55,7 @@ nir_load_system_value(nir_builder *build, nir_intrinsic_op op, int index) return &load->dest.ssa; } -% for name, opcode in filter(lambda v: v[1].sysval, sorted(INTR_OPCODES.iteritems())): +% for name, opcode in filter(lambda v: v[1].sysval, sorted(INTR_OPCODES.items())): static inline nir_ssa_def * nir_${name}(nir_builder *build) { diff --git a/src/compiler/nir/nir_constant_expressions.py b/src/compiler/nir/nir_constant_expressions.py index 35dffe70ce7..118af9f7818 100644 --- a/src/compiler/nir/nir_constant_expressions.py +++ b/src/compiler/nir/nir_constant_expressions.py @@ -387,7 +387,7 @@ struct bool32_vec { % endif </%def> -% for name, op in sorted(opcodes.iteritems()): +% for name, op in sorted(opcodes.items()): static nir_const_value evaluate_${name}(MAYBE_UNUSED unsigned num_components, ${"UNUSED" if op_bit_sizes(op) is None else ""} unsigned bit_size, @@ -420,7 +420,7 @@ nir_eval_const_opcode(nir_op op, unsigned num_components, unsigned bit_width, nir_const_value *src) { switch (op) { -% for name in sorted(opcodes.iterkeys()): +% for name in sorted(opcodes.keys()): case nir_op_${name}: return evaluate_${name}(num_components, bit_width, src); % endfor diff --git a/src/compiler/nir/nir_intrinsics_c.py b/src/compiler/nir/nir_intrinsics_c.py index 9604fcdf623..98af67c38ae 100644 --- a/src/compiler/nir/nir_intrinsics_c.py +++ b/src/compiler/nir/nir_intrinsics_c.py @@ -25,7 +25,7 @@ template = """\ #include "nir.h" const nir_intrinsic_info nir_intrinsic_infos[nir_num_intrinsics] = { -% for name, opcode in sorted(INTR_OPCODES.iteritems()): +% for name, opcode in sorted(INTR_OPCODES.items()): { .name = "${name}", .num_srcs = ${opcode.num_srcs}, diff --git a/src/compiler/nir/nir_opcodes_c.py b/src/compiler/nir/nir_opcodes_c.py index 108e144b5f4..4603cd3d74f 100644 --- a/src/compiler/nir/nir_opcodes_c.py +++ b/src/compiler/nir/nir_opcodes_c.py @@ -116,7 +116,7 @@ nir_type_conversion_op(nir_alu_type src, nir_alu_type dst, nir_rounding_mode rnd } const nir_op_info nir_op_infos[nir_num_opcodes] = { -% for name, opcode in sorted(opcodes.iteritems()): +% for name, opcode in sorted(opcodes.items()): { .name = "${name}", .num_inputs = ${opcode.num_inputs}, diff --git a/src/compiler/nir/nir_opcodes_h.py b/src/compiler/nir/nir_opcodes_h.py index 8ad17c84d49..6b4e2fe052e 100644 --- a/src/compiler/nir/nir_opcodes_h.py +++ b/src/compiler/nir/nir_opcodes_h.py @@ -29,7 +29,7 @@ template = """\ #ifndef _NIR_OPCODES_ #define _NIR_OPCODES_ -<% opcode_names = sorted(opcodes.iterkeys()) %> +<% opcode_names = sorted(opcodes.keys()) %> typedef enum { % for name in opcode_names: |