gallium/tools: improve handling of pointer arrays

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>
This commit is contained in:
Matti Hamalainen 2021-05-31 15:32:01 +03:00 committed by Marge Bot
parent 1e508777b4
commit aeaeef661a

View file

@ -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)