mesa/src/compiler/isaspec
Christian Gmeiner b2e4972339 isaspec: Add BitSetEnumValue object
There might be cases where you describe an enum in isaspec and want it to use
for decoding but also for codegen with e.g. mako.

Lets have a look at the following exmaple:

<enum name="#cond">
	<value val="0" display=""/>    <!-- always: display nothing -->
	<value val="1" display=".gt"/>
	...
</enum>

In the decoding case we want that nothing gets displayed if #cond has the value of "0". For
codegen with mako this could result in the following C code:

enum PACKED cond {
   COND_ = 0,
   COND_GT = 1,
   ...
};

What you really want is this:

enum PACKED cond {
   COND_ALWAYS = 0,
   COND_GT = 1,
   ...
};

To make this possible introduce BitSetEnumValue class which represents
an isaspec xml enum. It holds the value, displayname and now a name.

With the  __str__ method the old behaviour is still intact.

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/25451>
2023-10-03 12:07:04 +00:00
..
.editorconfig isaspec: Add support for function and entrypoint labels 2023-07-28 18:41:58 +00:00
decode.py isaspec: python does not need ';' 2023-09-28 08:15:50 +00:00
encode.py isaspec: encode: Correct used regex 2023-10-03 12:07:04 +00:00
isa.py isaspec: Add BitSetEnumValue object 2023-10-03 12:07:04 +00:00
isaspec.h isaspec: Add initial decoding support 2023-07-28 18:41:58 +00:00
isaspec_decode_decl.h isaspec: Make possible to obtain gpu_id in <expr> blocks 2023-09-05 16:19:29 +00:00
isaspec_decode_impl.c isaspec: Make possible to obtain gpu_id in <expr> blocks 2023-09-05 16:19:29 +00:00
meson.build isaspec: Stop depending on glue headers and out-of-folder C files 2023-01-05 18:21:02 +00:00
README.rst