From: Ian Romanick <ian.d.roman...@intel.com> I think this makes the next patch more clear.
text data bss dec hex filename 7528883 273096 28584 7830563 777c23 /tmp/i965_dri-64bit-before.so 7528835 273096 28584 7830515 777bf3 /tmp/i965_dri-64bit-after.so Signed-off-by: Ian Romanick <ian.d.roman...@intel.com> --- src/compiler/glsl/nir_intrinsic_map.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/compiler/glsl/nir_intrinsic_map.py b/src/compiler/glsl/nir_intrinsic_map.py index 337f1e9..c2b78a0 100644 --- a/src/compiler/glsl/nir_intrinsic_map.py +++ b/src/compiler/glsl/nir_intrinsic_map.py @@ -140,32 +140,31 @@ def emit_trie_leaf(indent, d): def trie_as_C_code(trie, indent=" ", prefix_string="__intrinsic_"): + offset = len(prefix_string) conditional = "if" c_code = "" for (s, t, d) in trie: if d is not None: - c_code += "{}{} (name[0] == '\\0') {{\n".format(indent, conditional) - c_code += "{} /* {} */\n".format(indent, prefix_string) + c_code += "{}{} (name[{}] == '\\0') {{\n".format(indent, conditional, offset) + c_code += "{} assert(strcmp(name, \"{}\") == 0);\n".format(indent, prefix_string) c_code += emit_trie_leaf(indent + " ", d); else: # Before emitting the string comparison, check to see of the # subtree has a single element with an empty string. In that - # case, use strcmp() instead of strncmp() and don't advance the - # name pointer. + # case, use strcmp() instead of strncmp(). if len(t) == 1 and t[0][2] is not None: if s == "": - c_code += "{}{} (name[0] == '\\0') {{\n".format(indent, conditional, s) + c_code += "{}{} (name[{}] == '\\0') {{\n".format(indent, conditional, offset) else: - c_code += "{}{} (strcmp(name, \"{}\") == 0) {{\n".format(indent, conditional, s) + c_code += "{}{} (strcmp(name + {}, \"{}\") == 0) {{\n".format(indent, conditional, offset, s) - c_code += "{} /* {} */\n".format(indent, prefix_string + s) + c_code += "{} assert(strcmp(name, \"{}\") == 0);\n".format(indent, prefix_string + s) c_code += emit_trie_leaf(indent + " ", t[0][2]); else: - c_code += "{}{} (strncmp(name, \"{}\", {}) == 0) {{\n".format(indent, conditional, s, len(s)) - c_code += "{} name += {};\n\n".format(indent, len(s)) + c_code += "{}{} (strncmp(name + {}, \"{}\", {}) == 0) {{\n".format(indent, conditional, offset, s, len(s)) c_code += trie_as_C_code(t, indent + " ", prefix_string + s) @@ -182,10 +181,7 @@ namespace _glsl_to_nir { nir_intrinsic_op get_intrinsic_opcode(const char *name, const ir_dereference *return_deref) { - if (strncmp(name, "__intrinsic_", 12) == 0) - name += 12; - else - unreachable("Intrinsic name does not begin with '__intrinsic_'"); + assert(strncmp(name, "__intrinsic_", 12) == 0); nir_intrinsic_op int_op; nir_intrinsic_op uint_op; -- 2.5.5 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev