freedreno/isa: assert if field's range is out of bitset's range

Also, update outdated comment along the way.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9628>
This commit is contained in:
Danylo Piliaiev 2021-03-16 21:04:02 +02:00 committed by Marge Bot
parent 42c81e1901
commit b804abd61d

View file

@ -458,6 +458,12 @@ class ISA(object):
for field_name, field in case.fields.items():
if field.type == 'float':
assert field.get_size() == 32 or field.get_size() == 16
if not isinstance(field, BitSetDerivedField):
assert field.high < bitset.get_size(), \
"{}.{}: invalid bit range: [{}, {}] is not in [{}, {}]".format(
bitset_name, field_name, field.low, field.high, 0, bitset.get_size() - 1)
if field.type in builtin_types:
continue
if field.type in self.enums:
@ -481,4 +487,4 @@ class ISA(object):
# TODO we should probably be able to look at the contexts where
# an expression is evaluated and verify that it doesn't have any
# <var/> references that would be unresolved at evaluation time
# {VARNAME} references that would be unresolved at evaluation time