genxml: Fix parsing of address fields in groups.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 15 May 2017 23:53:25 +0000 (16:53 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 1 Jun 2017 18:49:45 +0000 (11:49 -0700)
For example,

    <group count="4" start="64" size="64">
      <field name="Pointer" start="5" end="63" type="address"/>
    </group>

used to generate:

   const uint64_t v2_address =
      __gen_combine_address(data, &dw[2], values->Pointer, 0);
   ...
   const uint64_t v4_address =
      __gen_combine_address(data, &dw[4], values->Pointer, 0);
   ...

but now generates code with proper subscripts:

   const uint64_t v2_address =
      __gen_combine_address(data, &dw[2], values->Pointer[0], 0);
   ...
   const uint64_t v4_address =
      __gen_combine_address(data, &dw[4], values->Pointer[1], 0);
   ...

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/genxml/gen_pack_header.py

index 020dbe4..fefbc9a 100644 (file)
@@ -467,13 +467,13 @@ class Group(object):
 
             if dw.size == 32:
                 if dw.address:
-                    print("   dw[%d] = __gen_combine_address(data, &dw[%d], values->%s, %s);" % (index, index, dw.address.name, v))
+                    print("   dw[%d] = __gen_combine_address(data, &dw[%d], values->%s, %s);" % (index, index, dw.address.name + field.dim, v))
                 continue
 
             if dw.address:
                 v_address = "v%d_address" % index
                 print("   const uint64_t %s =\n      __gen_combine_address(data, &dw[%d], values->%s, %s);" %
-                      (v_address, index, dw.address.name, v))
+                      (v_address, index, dw.address.name + field.dim, v))
                 v = v_address
 
             print("   dw[%d] = %s;" % (index, v))