isaspec: Add bool_inv type to print inverted bools

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20144>
This commit is contained in:
Christian Gmeiner
2022-09-03 23:40:53 +02:00
committed by Marge Bot
parent 586c34b19c
commit a8a33ac5ae
3 changed files with 12 additions and 1 deletions

View File

@@ -561,7 +561,7 @@ class ISA(object):
# Validate that all bitset fields have valid types, and in
# the case of bitset type, the sizes match:
builtin_types = ['branch', 'absbranch', 'int', 'uint', 'hex', 'offset', 'uoffset', 'float', 'bool', 'enum', 'custom']
builtin_types = ['branch', 'absbranch', 'int', 'uint', 'hex', 'offset', 'uoffset', 'float', 'bool', 'bool_inv', 'enum', 'custom']
for bitset_name, bitset in self.bitsets.items():
if bitset.extends is not None:
assert bitset.extends in self.bitsets, "{} extends invalid type: {}".format(

View File

@@ -102,6 +102,7 @@ struct isa_field {
TYPE_UOFFSET, /* Like UINT but formated with + or omitted if ==0 */
TYPE_FLOAT,
TYPE_BOOL,
TYPE_BOOL_INV, /* Like BOOL but inverted */
TYPE_ENUM,
/* For fields that must be printed via a user-provided callback */

View File

@@ -686,6 +686,16 @@ display_field(struct decode_scope *scope, const char *field_name)
isa_print(print, "%u", (unsigned)val);
}
break;
case TYPE_BOOL_INV: {
if (field->display) {
if (!val) {
isa_print(print, "%s", field->display);
}
} else {
isa_print(print, "%u", (unsigned)!val);
}
break;
}
case TYPE_ENUM:
display_enum_field(scope, field, v);
break;