diff --git a/src/panfrost/bifrost/meson.build b/src/panfrost/bifrost/meson.build index 7a1df35eacd..a15e781ed20 100644 --- a/src/panfrost/bifrost/meson.build +++ b/src/panfrost/bifrost/meson.build @@ -138,7 +138,7 @@ libpanfrost_bifrost = static_library( 'panfrost_bifrost', [libpanfrost_bifrost_files, bi_opcodes_c, bi_printer_c, bi_packer_c, bifrost_nir_algebraic_c, valhall_c], include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_panfrost_hw, inc_valhall], - dependencies: [idep_nir, idep_bi_opcodes_h, idep_bi_builder_h], + dependencies: [idep_nir, idep_bi_opcodes_h, idep_bi_builder_h, idep_valhall_enums_h], link_with: [libpanfrost_util, libpanfrost_bifrost_disasm, libpanfrost_valhall_disasm], c_args : [no_override_init_args], gnu_symbol_visibility : 'hidden', diff --git a/src/panfrost/bifrost/valhall/meson.build b/src/panfrost/bifrost/valhall/meson.build index e78a4ab4d97..b3e54197b05 100644 --- a/src/panfrost/bifrost/valhall/meson.build +++ b/src/panfrost/bifrost/valhall/meson.build @@ -28,6 +28,20 @@ valhall_c = custom_target( depend_files : files('valhall.py'), ) +valhall_enums_h = custom_target( + 'valhall_enums.h', + input : ['valhall_enums.h.py', 'ISA.xml'], + output : 'valhall_enums.h', + command : [prog_python, '@INPUT@'], + capture : true, + depend_files : files('valhall.py'), +) + +idep_valhall_enums_h = declare_dependency( + sources : [valhall_enums_h], + include_directories : include_directories('.'), +) + valhall_disasm_c = custom_target( 'valhall_disasm_c', input : ['disasm.py', 'ISA.xml'], diff --git a/src/panfrost/bifrost/valhall/valhall_enums.h.py b/src/panfrost/bifrost/valhall/valhall_enums.h.py new file mode 100644 index 00000000000..25ed606a2ca --- /dev/null +++ b/src/panfrost/bifrost/valhall/valhall_enums.h.py @@ -0,0 +1,34 @@ +#encoding=utf-8 + +# Copyright (C) 2021 Collabora, Ltd. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +from valhall import safe_name, enums + +for enum in sorted(enums): + print(f"enum va_{safe_name(enum)} {{") + + for i, value in enumerate(enums[enum].values): + if value.value != 'reserved': + key = safe_name(f"va_{enum}_{value.value}") + print(f" {key.upper()} = {i},") + + print("};\n")