diff --git a/src/compiler/nir/nir_builder_opcodes_h.py b/src/compiler/nir/nir_builder_opcodes_h.py index 688884b9ea3..81aec095f53 100644 --- a/src/compiler/nir/nir_builder_opcodes_h.py +++ b/src/compiler/nir/nir_builder_opcodes_h.py @@ -33,6 +33,12 @@ def src_list(num_srcs): def needs_num_components(opcode): return "replicated" in opcode.name + +def intrinsic_prefix(name): + if name in build_prefixed_intrinsics: + return 'nir_build' + else: + return 'nir' %> % for name, opcode in sorted(opcodes.items()): @@ -155,16 +161,18 @@ _nir_build_${name}(nir_builder *build${intrinsic_decl_list(opcode)}) % for name, opcode in sorted(INTR_OPCODES.items()): % if opcode.indices: #ifdef __cplusplus -#define nir_build_${name}(build${intrinsic_macro_list(opcode)}, ...) ${'\\\\'} +#define ${intrinsic_prefix(name)}_${name}(build${intrinsic_macro_list(opcode)}, ...) ${'\\\\'} _nir_build_${name}(build${intrinsic_macro_list(opcode)}, _nir_${name}_indices{0, __VA_ARGS__}) #else -#define nir_build_${name}(build${intrinsic_macro_list(opcode)}, ...) ${'\\\\'} +#define ${intrinsic_prefix(name)}_${name}(build${intrinsic_macro_list(opcode)}, ...) ${'\\\\'} _nir_build_${name}(build${intrinsic_macro_list(opcode)}, (struct _nir_${name}_indices){0, __VA_ARGS__}) #endif % else: -#define nir_build_${name} _nir_build_${name} +#define nir_${name} _nir_build_${name} % endif +% if name in build_prefixed_intrinsics: #define nir_${name} nir_build_${name} +% endif % endfor % for name in ['flt', 'fge', 'feq', 'fneu']: @@ -203,9 +211,26 @@ from nir_opcodes import opcodes, type_size, type_base_type from nir_intrinsics import INTR_OPCODES, WRITE_MASK, ALIGN_MUL from mako.template import Template +# List of intrinsics that also need a nir_build_ prefixed factory macro. +build_prefixed_intrinsics = [ + "load_deref", + "store_deref", + "copy_deref", + "memcpy_deref", + + "load_param", + + "load_global", + "load_global_constant", + "store_global", + + "deref_mode_is", +] + print(Template(template).render(opcodes=opcodes, type_size=type_size, type_base_type=type_base_type, INTR_OPCODES=INTR_OPCODES, WRITE_MASK=WRITE_MASK, - ALIGN_MUL=ALIGN_MUL)) + ALIGN_MUL=ALIGN_MUL, + build_prefixed_intrinsics=build_prefixed_intrinsics))