freedreno/registers: Generate _HI/LO builders for reg64

Mesa has shifted more things to reg64 instead of seperate 32b HI/LO
reg32's.  This works better with the "new-style" c++ builders that
mesa has been migrating to for a6xx+ (to better handle register
shuffling between gens), but it leaves the C builders with missing
_HI/LO builders.

So handle the special case of reg64, automatically generating the
missing _HI/LO builders.  (This is for the benefit of the kernel
which cannot use the c++ builders.)

Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37216>
This commit is contained in:
Rob Clark 2025-09-07 09:28:22 -07:00 committed by Marge Bot
parent 04e2140d8b
commit a31dc3c5af

View file

@ -161,6 +161,7 @@ class Bitset(object):
def __init__(self, name, template):
self.name = name
self.inline = False
self.reg = None
if template:
self.fields = template.fields[:]
else:
@ -266,6 +267,11 @@ class Bitset(object):
def dump(self, is_deprecated, prefix=None):
if prefix is None:
prefix = self.name
if self.reg and self.reg.bit_size == 64:
print("static inline uint32_t %s_LO(uint32_t val)\n{" % prefix)
print("\treturn val;\n}")
print("static inline uint32_t %s_HI(uint32_t val)\n{" % prefix)
print("\treturn val;\n}")
for f in self.fields:
if f.name:
name = prefix + "_" + f.name
@ -645,6 +651,7 @@ class Parser(object):
self.current_reg = Reg(attrs, self.prefix(variant), self.current_array, bit_size)
self.current_reg.bitset = self.current_bitset
self.current_bitset.reg = self.current_reg
if len(self.stack) == 1:
self.file.append(self.current_reg)