gallium/tools: improve handling of pointer arrays
authorMatti Hamalainen <ccr@tnsp.org>
Mon, 31 May 2021 12:32:01 +0000 (15:32 +0300)
committerMarge Bot <eric+marge@anholt.net>
Mon, 21 Jun 2021 18:33:41 +0000 (18:33 +0000)
Extend the special handling of return types to also include pointer
type array list elements, so we ignore the initial "name" of the
element until we know a better type for them. This improves the type
"detection" of such pointer array elements when parsing the logs
with dump.py / tracediff.sh

Related to Mesa issue #4609

Signed-off-by: Matti Hamalainen <ccr@tnsp.org>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11492>

src/gallium/tools/trace/model.py

index 275ad18..8350daf 100755 (executable)
@@ -108,6 +108,7 @@ class Pointer(Node):
     ptr_list = {}
     ptr_type_list = {}
     ptr_types_list = {}
+    ptr_ignore_list = ["ret", "elem"]
 
     def __init__(self, address, pname):
         self.address = address
@@ -115,15 +116,17 @@ class Pointer(Node):
         # Check if address exists in list and if it is a return value address
         t1 = address in self.ptr_list
         if t1:
-            t2 = self.ptr_type_list[address] == "ret" and pname != "ret"
+            rname = self.ptr_type_list[address]
+            t2 = rname in self.ptr_ignore_list and pname not in self.ptr_ignore_list
         else:
+            rname = pname
             t2 = False
 
         # If address does NOT exist (add it), OR IS a ret value (update with new type)
         if not t1 or t2:
             # If previously set to ret value, remove one from count
             if t1 and t2:
-                self.adjust_ptr_type_count("ret", -1)
+                self.adjust_ptr_type_count(rname, -1)
 
             # Add / update
             self.adjust_ptr_type_count(pname, 1)