2017-10-06 02:07:31 +03:00
|
|
|
LOCAL_PATH := $(call my-dir)
|
|
|
|
SPVTOOLS_OUT_PATH=$(if $(call host-path-is-absolute,$(TARGET_OUT)),$(TARGET_OUT),$(abspath $(TARGET_OUT)))
|
2018-11-28 17:13:38 +03:00
|
|
|
|
|
|
|
ifeq ($(SPVHEADERS_LOCAL_PATH),)
|
|
|
|
SPVHEADERS_LOCAL_PATH := $(LOCAL_PATH)/external/spirv-headers
|
|
|
|
endif
|
2017-10-06 02:07:31 +03:00
|
|
|
|
|
|
|
SPVTOOLS_SRC_FILES := \
|
|
|
|
source/assembly_grammar.cpp \
|
|
|
|
source/binary.cpp \
|
|
|
|
source/diagnostic.cpp \
|
|
|
|
source/disassemble.cpp \
|
|
|
|
source/ext_inst.cpp \
|
|
|
|
source/enum_string_mapping.cpp \
|
|
|
|
source/extensions.cpp \
|
|
|
|
source/libspirv.cpp \
|
|
|
|
source/name_mapper.cpp \
|
|
|
|
source/opcode.cpp \
|
|
|
|
source/operand.cpp \
|
|
|
|
source/parsed_operand.cpp \
|
|
|
|
source/print.cpp \
|
|
|
|
source/software_version.cpp \
|
|
|
|
source/spirv_endian.cpp \
|
2018-09-10 18:49:41 +03:00
|
|
|
source/spirv_optimizer_options.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/spirv_target_env.cpp \
|
|
|
|
source/spirv_validator_options.cpp \
|
|
|
|
source/table.cpp \
|
|
|
|
source/text.cpp \
|
|
|
|
source/text_handler.cpp \
|
2018-04-23 18:13:07 +03:00
|
|
|
source/util/bit_vector.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/util/parse_number.cpp \
|
|
|
|
source/util/string_utils.cpp \
|
2018-03-07 17:25:51 +03:00
|
|
|
source/util/timer.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/val/basic_block.cpp \
|
|
|
|
source/val/construct.cpp \
|
|
|
|
source/val/function.cpp \
|
|
|
|
source/val/instruction.cpp \
|
|
|
|
source/val/validation_state.cpp \
|
2018-07-11 17:27:34 +03:00
|
|
|
source/val/validate.cpp \
|
|
|
|
source/val/validate_adjacency.cpp \
|
2018-08-08 21:21:27 +03:00
|
|
|
source/val/validate_annotation.cpp \
|
2018-07-11 17:27:34 +03:00
|
|
|
source/val/validate_arithmetics.cpp \
|
|
|
|
source/val/validate_atomics.cpp \
|
|
|
|
source/val/validate_barriers.cpp \
|
|
|
|
source/val/validate_bitwise.cpp \
|
|
|
|
source/val/validate_builtins.cpp \
|
|
|
|
source/val/validate_capability.cpp \
|
|
|
|
source/val/validate_cfg.cpp \
|
|
|
|
source/val/validate_composites.cpp \
|
2018-08-17 18:20:55 +03:00
|
|
|
source/val/validate_constants.cpp \
|
2018-07-11 17:27:34 +03:00
|
|
|
source/val/validate_conversion.cpp \
|
2018-08-08 20:47:09 +03:00
|
|
|
source/val/validate_debug.cpp \
|
2018-07-11 17:27:34 +03:00
|
|
|
source/val/validate_decorations.cpp \
|
|
|
|
source/val/validate_derivatives.cpp \
|
2018-11-28 00:20:01 +03:00
|
|
|
source/val/validate_extensions.cpp \
|
2018-08-10 16:53:17 +03:00
|
|
|
source/val/validate_execution_limitations.cpp \
|
|
|
|
source/val/validate_function.cpp \
|
2018-07-11 17:27:34 +03:00
|
|
|
source/val/validate_id.cpp \
|
|
|
|
source/val/validate_image.cpp \
|
|
|
|
source/val/validate_interfaces.cpp \
|
|
|
|
source/val/validate_instruction.cpp \
|
2018-08-01 21:44:56 +03:00
|
|
|
source/val/validate_memory.cpp \
|
2018-12-06 22:38:15 +03:00
|
|
|
source/val/validate_memory_semantics.cpp \
|
2022-09-23 18:06:46 +03:00
|
|
|
source/val/validate_mesh_shading.cpp \
|
2019-06-03 17:55:07 +03:00
|
|
|
source/val/validate_misc.cpp \
|
2018-08-08 21:49:59 +03:00
|
|
|
source/val/validate_mode_setting.cpp \
|
2018-07-11 17:27:34 +03:00
|
|
|
source/val/validate_layout.cpp \
|
|
|
|
source/val/validate_literals.cpp \
|
|
|
|
source/val/validate_logicals.cpp \
|
|
|
|
source/val/validate_non_uniform.cpp \
|
|
|
|
source/val/validate_primitives.cpp \
|
2022-07-20 17:12:58 +03:00
|
|
|
source/val/validate_ray_query.cpp \
|
2022-08-08 21:45:04 +03:00
|
|
|
source/val/validate_ray_tracing.cpp \
|
2022-11-24 17:50:45 +03:00
|
|
|
source/val/validate_ray_tracing_reorder.cpp \
|
2018-11-29 21:48:42 +03:00
|
|
|
source/val/validate_scopes.cpp \
|
2019-07-11 20:05:14 +03:00
|
|
|
source/val/validate_small_type_uses.cpp \
|
2018-08-03 18:38:51 +03:00
|
|
|
source/val/validate_type.cpp
|
2017-10-06 02:07:31 +03:00
|
|
|
|
|
|
|
SPVTOOLS_OPT_SRC_FILES := \
|
|
|
|
source/opt/aggressive_dead_code_elim_pass.cpp \
|
2019-08-29 19:48:17 +03:00
|
|
|
source/opt/amd_ext_to_khr.cpp \
|
2022-11-02 20:23:25 +03:00
|
|
|
source/opt/analyze_live_input_pass.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/basic_block.cpp \
|
|
|
|
source/opt/block_merge_pass.cpp \
|
2019-01-25 13:57:13 +03:00
|
|
|
source/opt/block_merge_util.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/build_module.cpp \
|
2017-10-31 00:42:26 +03:00
|
|
|
source/opt/cfg.cpp \
|
2017-09-06 15:56:41 +03:00
|
|
|
source/opt/cfg_cleanup_pass.cpp \
|
2017-12-05 19:39:25 +03:00
|
|
|
source/opt/ccp_pass.cpp \
|
2019-01-17 23:56:36 +03:00
|
|
|
source/opt/code_sink.cpp \
|
2018-07-23 18:23:11 +03:00
|
|
|
source/opt/combine_access_chains.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/compact_ids_pass.cpp \
|
2018-01-27 03:05:33 +03:00
|
|
|
source/opt/composite.cpp \
|
2018-02-08 18:59:03 +03:00
|
|
|
source/opt/const_folding_rules.cpp \
|
2017-12-08 00:42:27 +03:00
|
|
|
source/opt/constants.cpp \
|
2021-07-28 19:44:32 +03:00
|
|
|
source/opt/control_dependence.cpp \
|
2021-08-18 15:30:48 +03:00
|
|
|
source/opt/convert_to_sampled_image_pass.cpp \
|
2019-09-03 20:22:13 +03:00
|
|
|
source/opt/convert_to_half_pass.cpp \
|
2018-03-21 06:33:24 +03:00
|
|
|
source/opt/copy_prop_arrays.cpp \
|
2021-08-09 23:43:36 +03:00
|
|
|
source/opt/dataflow.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/dead_branch_elim_pass.cpp \
|
2018-01-27 03:05:33 +03:00
|
|
|
source/opt/dead_insert_elim_pass.cpp \
|
2017-10-20 19:17:41 +03:00
|
|
|
source/opt/dead_variable_elimination.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/decoration_manager.cpp \
|
2020-04-27 22:18:55 +03:00
|
|
|
source/opt/debug_info_manager.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/def_use_manager.cpp \
|
2019-08-08 17:53:19 +03:00
|
|
|
source/opt/desc_sroa.cpp \
|
2021-10-27 00:20:58 +03:00
|
|
|
source/opt/desc_sroa_util.cpp \
|
2018-01-16 19:15:06 +03:00
|
|
|
source/opt/dominator_analysis.cpp \
|
2017-11-28 00:21:26 +03:00
|
|
|
source/opt/dominator_tree.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/eliminate_dead_constant_pass.cpp \
|
|
|
|
source/opt/eliminate_dead_functions_pass.cpp \
|
2019-02-08 19:20:29 +03:00
|
|
|
source/opt/eliminate_dead_functions_util.cpp \
|
2022-11-26 02:48:13 +03:00
|
|
|
source/opt/eliminate_dead_io_components_pass.cpp \
|
2019-02-14 21:42:35 +03:00
|
|
|
source/opt/eliminate_dead_members_pass.cpp \
|
2022-11-02 20:23:25 +03:00
|
|
|
source/opt/eliminate_dead_output_stores_pass.cpp \
|
2017-12-01 01:03:06 +03:00
|
|
|
source/opt/feature_manager.cpp \
|
2022-05-06 17:39:26 +03:00
|
|
|
source/opt/fix_func_call_arguments.cpp \
|
2019-04-05 20:12:08 +03:00
|
|
|
source/opt/fix_storage_class.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/flatten_decoration_pass.cpp \
|
2017-10-18 17:28:12 +03:00
|
|
|
source/opt/fold.cpp \
|
2018-01-24 21:26:33 +03:00
|
|
|
source/opt/folding_rules.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/fold_spec_constant_op_and_composite_pass.cpp \
|
|
|
|
source/opt/freeze_spec_constant_value_pass.cpp \
|
|
|
|
source/opt/function.cpp \
|
2019-07-31 02:52:46 +03:00
|
|
|
source/opt/graphics_robust_access_pass.cpp \
|
2018-01-16 19:15:06 +03:00
|
|
|
source/opt/if_conversion.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/inline_pass.cpp \
|
|
|
|
source/opt/inline_exhaustive_pass.cpp \
|
|
|
|
source/opt/inline_opaque_pass.cpp \
|
2018-11-08 21:54:54 +03:00
|
|
|
source/opt/inst_bindless_check_pass.cpp \
|
2019-08-16 16:18:34 +03:00
|
|
|
source/opt/inst_buff_addr_check_pass.cpp \
|
2020-03-12 16:19:52 +03:00
|
|
|
source/opt/inst_debug_printf_pass.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/instruction.cpp \
|
2017-10-20 21:38:50 +03:00
|
|
|
source/opt/instruction_list.cpp \
|
2018-11-08 21:54:54 +03:00
|
|
|
source/opt/instrument_pass.cpp \
|
2022-05-09 21:04:52 +03:00
|
|
|
source/opt/interface_var_sroa.cpp \
|
2021-03-31 21:26:36 +03:00
|
|
|
source/opt/interp_fixup_pass.cpp \
|
2017-11-02 21:25:48 +03:00
|
|
|
source/opt/ir_context.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/ir_loader.cpp \
|
2018-01-29 13:39:55 +03:00
|
|
|
source/opt/licm_pass.cpp \
|
2022-11-02 20:23:25 +03:00
|
|
|
source/opt/liveness.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/local_access_chain_convert_pass.cpp \
|
2017-11-11 04:26:55 +03:00
|
|
|
source/opt/local_redundancy_elimination.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/local_single_block_elim_pass.cpp \
|
|
|
|
source/opt/local_single_store_elim_pass.cpp \
|
2018-03-29 15:39:54 +03:00
|
|
|
source/opt/loop_dependence.cpp \
|
|
|
|
source/opt/loop_dependence_helpers.cpp \
|
2017-12-21 17:47:25 +03:00
|
|
|
source/opt/loop_descriptor.cpp \
|
2018-04-23 23:01:12 +03:00
|
|
|
source/opt/loop_fission.cpp \
|
2018-04-20 17:14:45 +03:00
|
|
|
source/opt/loop_fusion.cpp \
|
|
|
|
source/opt/loop_fusion_pass.cpp \
|
2018-03-07 21:21:11 +03:00
|
|
|
source/opt/loop_peeling.cpp \
|
2018-02-14 20:03:12 +03:00
|
|
|
source/opt/loop_unroller.cpp \
|
2018-02-13 00:42:15 +03:00
|
|
|
source/opt/loop_unswitch_pass.cpp \
|
|
|
|
source/opt/loop_utils.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/mem_pass.cpp \
|
2017-11-11 04:26:55 +03:00
|
|
|
source/opt/merge_return_pass.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/module.cpp \
|
|
|
|
source/opt/optimizer.cpp \
|
|
|
|
source/opt/pass.cpp \
|
|
|
|
source/opt/pass_manager.cpp \
|
2017-12-11 21:10:24 +03:00
|
|
|
source/opt/private_to_local_pass.cpp \
|
2017-11-17 16:59:25 +03:00
|
|
|
source/opt/propagator.cpp \
|
2018-05-07 19:31:03 +03:00
|
|
|
source/opt/reduce_load_size.cpp \
|
2017-12-04 20:29:51 +03:00
|
|
|
source/opt/redundancy_elimination.cpp \
|
2018-04-17 17:31:09 +03:00
|
|
|
source/opt/register_pressure.cpp \
|
2019-09-03 20:22:13 +03:00
|
|
|
source/opt/relax_float_ops_pass.cpp \
|
2022-03-07 20:45:17 +03:00
|
|
|
source/opt/remove_dontinline_pass.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/remove_duplicates_pass.cpp \
|
2021-06-29 18:33:58 +03:00
|
|
|
source/opt/remove_unused_interface_variables_pass.cpp \
|
2021-10-27 00:20:58 +03:00
|
|
|
source/opt/replace_desc_array_access_using_var_index.cpp \
|
2018-01-30 19:24:03 +03:00
|
|
|
source/opt/replace_invalid_opc.cpp \
|
2018-03-28 16:19:55 +03:00
|
|
|
source/opt/scalar_analysis.cpp \
|
|
|
|
source/opt/scalar_analysis_simplification.cpp \
|
2017-12-01 01:03:06 +03:00
|
|
|
source/opt/scalar_replacement_pass.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/set_spec_constant_default_value_pass.cpp \
|
2018-02-02 19:55:05 +03:00
|
|
|
source/opt/simplification_pass.cpp \
|
spirv-opt: add pass to Spread Volatile semantics (#4667)
Add a pass to spread Volatile semantics to variables with SMIDNV,
WarpIDNV, SubgroupSize, SubgroupLocalInvocationId, SubgroupEqMask,
SubgroupGeMask, SubgroupGtMask, SubgroupLeMask, or SubgroupLtMask BuiltIn
decorations or OpLoad for them when the shader model is the ray
generation, closest hit, miss, intersection, or callable shaders. This
pass can be used for VUID-StandaloneSpirv-VulkanMemoryModel-04678 and
VUID-StandaloneSpirv-VulkanMemoryModel-04679 (See "Standalone SPIR-V
Validation" section of Vulkan spec "Appendix A: Vulkan Environment for
SPIR-V").
Handle variables used by multiple entry points:
1. Update error check to make it working regardless of the order of
entry points.
2. For a variable, if it is used by two entry points E1 and E2 and
it needs the Volatile semantics for E1 while it does not for E2
- If VulkanMemoryModel capability is enabled, which means we have to
set memory operation of load instructions for the variable, we
update load instructions in E1, but do not update the ones in E2.
- If VulkanMemoryModel capability is disabled, which means we have
to add Volatile decoration for the variable, we report an error
because E1 needs to add Volatile decoration for the variable while
E2 does not.
For the simplicity of the implementation, we assume that all functions
other than entry point functions are inlined.
2022-01-25 21:14:36 +03:00
|
|
|
source/opt/spread_volatile_semantics.cpp \
|
SSA rewrite pass.
This pass replaces the load/store elimination passes. It implements the
SSA re-writing algorithm proposed in
Simple and Efficient Construction of Static Single Assignment Form.
Braun M., Buchwald S., Hack S., Leißa R., Mallon C., Zwinkau A. (2013)
In: Jhala R., De Bosschere K. (eds)
Compiler Construction. CC 2013.
Lecture Notes in Computer Science, vol 7791.
Springer, Berlin, Heidelberg
https://link.springer.com/chapter/10.1007/978-3-642-37051-9_6
In contrast to common eager algorithms based on dominance and dominance
frontier information, this algorithm works backwards from load operations.
When a target variable is loaded, it queries the variable's reaching
definition. If the reaching definition is unknown at the current location,
it searches backwards in the CFG, inserting Phi instructions at join points
in the CFG along the way until it finds the desired store instruction.
The algorithm avoids repeated lookups using memoization.
For reducible CFGs, which are a superset of the structured CFGs in SPIRV,
this algorithm is proven to produce minimal SSA. That is, it inserts the
minimal number of Phi instructions required to ensure the SSA property, but
some Phi instructions may be dead
(https://en.wikipedia.org/wiki/Static_single_assignment_form).
2018-02-23 00:18:29 +03:00
|
|
|
source/opt/ssa_rewrite_pass.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/strength_reduction_pass.cpp \
|
|
|
|
source/opt/strip_debug_info_pass.cpp \
|
2021-12-15 17:55:30 +03:00
|
|
|
source/opt/strip_nonsemantic_info_pass.cpp \
|
2018-09-17 20:00:24 +03:00
|
|
|
source/opt/struct_cfg_analysis.cpp \
|
2017-10-06 02:07:31 +03:00
|
|
|
source/opt/type_manager.cpp \
|
|
|
|
source/opt/types.cpp \
|
2017-11-09 00:22:10 +03:00
|
|
|
source/opt/unify_const_pass.cpp \
|
2018-11-30 22:15:51 +03:00
|
|
|
source/opt/upgrade_memory_model.cpp \
|
2018-01-17 22:57:37 +03:00
|
|
|
source/opt/value_number_table.cpp \
|
2018-04-23 18:13:07 +03:00
|
|
|
source/opt/vector_dce.cpp \
|
2019-08-14 16:27:12 +03:00
|
|
|
source/opt/workaround1209.cpp \
|
|
|
|
source/opt/wrap_opkill.cpp
|
2017-10-06 02:07:31 +03:00
|
|
|
|
|
|
|
# Locations of grammar files.
|
2018-02-09 22:29:02 +03:00
|
|
|
#
|
2018-03-02 23:24:15 +03:00
|
|
|
SPV_COREUNIFIED1_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/spirv.core.grammar.json
|
2020-07-30 19:08:53 +03:00
|
|
|
SPV_GLSL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.glsl.std.450.grammar.json
|
|
|
|
SPV_OPENCL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.opencl.std.100.grammar.json
|
|
|
|
SPV_DEBUGINFO_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.debuginfo.grammar.json
|
|
|
|
SPV_CLDEBUGINFO100_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json
|
2021-09-15 21:38:53 +03:00
|
|
|
SPV_VKDEBUGINFO100_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.nonsemantic.shader.debuginfo.100.grammar.json
|
2017-10-06 02:07:31 +03:00
|
|
|
|
|
|
|
define gen_spvtools_grammar_tables
|
2019-12-20 01:16:26 +03:00
|
|
|
$(call generate-file-dir,$(1)/core.insts-unified1.inc)
|
|
|
|
$(1)/core.insts-unified1.inc $(1)/operand.kinds-unified1.inc \
|
|
|
|
$(1)/glsl.std.450.insts.inc \
|
|
|
|
$(1)/opencl.std.insts.inc \
|
|
|
|
: \
|
2017-10-06 02:07:31 +03:00
|
|
|
$(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2019-12-20 01:16:26 +03:00
|
|
|
$(SPV_COREUNIFIED1_GRAMMAR) \
|
2017-10-06 02:07:31 +03:00
|
|
|
$(SPV_GLSL_GRAMMAR) \
|
2019-12-20 01:16:26 +03:00
|
|
|
$(SPV_OpenCL_GRAMMAR) \
|
|
|
|
$(SPV_DEBUGINFO_GRAMMAR) \
|
|
|
|
$(SPV_CLDEBUGINFO100_GRAMMAR)
|
2017-10-06 02:07:31 +03:00
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2019-12-20 01:16:26 +03:00
|
|
|
--spirv-core-grammar=$(SPV_COREUNIFIED1_GRAMMAR) \
|
2017-10-06 02:07:31 +03:00
|
|
|
--extinst-glsl-grammar=$(SPV_GLSL_GRAMMAR) \
|
|
|
|
--extinst-opencl-grammar=$(SPV_OPENCL_GRAMMAR) \
|
2017-12-03 20:30:08 +03:00
|
|
|
--extinst-debuginfo-grammar=$(SPV_DEBUGINFO_GRAMMAR) \
|
2019-12-20 01:16:26 +03:00
|
|
|
--extinst-cldebuginfo100-grammar=$(SPV_CLDEBUGINFO100_GRAMMAR) \
|
|
|
|
--core-insts-output=$(1)/core.insts-unified1.inc \
|
2017-12-14 01:55:00 +03:00
|
|
|
--glsl-insts-output=$(1)/glsl.std.450.insts.inc \
|
|
|
|
--opencl-insts-output=$(1)/opencl.std.insts.inc \
|
2022-11-05 00:27:10 +03:00
|
|
|
--operand-kinds-output=$(1)/operand.kinds-unified1.inc \
|
|
|
|
--output-language=c++
|
2019-12-20 01:16:26 +03:00
|
|
|
@echo "[$(TARGET_ARCH_ABI)] Grammar (from unified1) : instructions & operands <= grammar JSON files"
|
|
|
|
$(LOCAL_PATH)/source/opcode.cpp: $(1)/core.insts-unified1.inc
|
|
|
|
$(LOCAL_PATH)/source/operand.cpp: $(1)/operand.kinds-unified1.inc
|
2018-02-09 22:29:02 +03:00
|
|
|
$(LOCAL_PATH)/source/ext_inst.cpp: \
|
|
|
|
$(1)/glsl.std.450.insts.inc \
|
|
|
|
$(1)/opencl.std.insts.inc \
|
|
|
|
$(1)/debuginfo.insts.inc \
|
2019-12-20 01:16:26 +03:00
|
|
|
$(1)/opencl.debuginfo.100.insts.inc \
|
2021-09-15 21:38:53 +03:00
|
|
|
$(1)/nonsemantic.shader.debuginfo.100.insts.inc \
|
2018-02-09 22:29:02 +03:00
|
|
|
$(1)/spv-amd-gcn-shader.insts.inc \
|
|
|
|
$(1)/spv-amd-shader-ballot.insts.inc \
|
|
|
|
$(1)/spv-amd-shader-explicit-vertex-parameter.insts.inc \
|
|
|
|
$(1)/spv-amd-shader-trinary-minmax.insts.inc
|
2019-09-19 00:42:48 +03:00
|
|
|
$(LOCAL_PATH)/source/opt/amd_ext_to_khr.cpp: \
|
|
|
|
$(1)/spv-amd-shader-ballot.insts.inc
|
2017-10-06 02:07:31 +03:00
|
|
|
endef
|
|
|
|
$(eval $(call gen_spvtools_grammar_tables,$(SPVTOOLS_OUT_PATH)))
|
|
|
|
|
2017-12-03 20:30:08 +03:00
|
|
|
|
|
|
|
define gen_spvtools_lang_headers
|
|
|
|
# Generate language-specific headers. So far we only generate C headers
|
|
|
|
# $1 is the output directory.
|
|
|
|
# $2 is the base name of the header file, e.g. "DebugInfo".
|
|
|
|
# $3 is the grammar file containing token definitions.
|
|
|
|
$(call generate-file-dir,$(1)/$(2).h)
|
|
|
|
$(1)/$(2).h : \
|
|
|
|
$(LOCAL_PATH)/utils/generate_language_headers.py \
|
|
|
|
$(3)
|
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_language_headers.py \
|
|
|
|
--extinst-grammar=$(3) \
|
2020-02-25 08:46:52 +03:00
|
|
|
--extinst-output-path=$(1)/$(2).h
|
2017-12-03 20:30:08 +03:00
|
|
|
@echo "[$(TARGET_ARCH_ABI)] Generate language specific header for $(2): headers <= grammar"
|
2020-01-24 01:04:30 +03:00
|
|
|
$(foreach F,$(SPVTOOLS_SRC_FILES) $(SPVTOOLS_OPT_SRC_FILES),$(LOCAL_PATH)/$F ) \
|
|
|
|
: $(1)/$(2).h
|
2017-12-03 20:30:08 +03:00
|
|
|
endef
|
2019-12-20 01:16:26 +03:00
|
|
|
# We generate language-specific headers for DebugInfo and OpenCL.DebugInfo.100
|
2017-12-03 20:30:08 +03:00
|
|
|
$(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),DebugInfo,$(SPV_DEBUGINFO_GRAMMAR)))
|
2019-12-20 01:16:26 +03:00
|
|
|
$(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),OpenCLDebugInfo100,$(SPV_CLDEBUGINFO100_GRAMMAR)))
|
2021-09-15 21:38:53 +03:00
|
|
|
$(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),NonSemanticShaderDebugInfo100,$(SPV_VKDEBUGINFO100_GRAMMAR)))
|
2017-12-03 20:30:08 +03:00
|
|
|
|
|
|
|
|
2017-10-06 02:07:31 +03:00
|
|
|
define gen_spvtools_vendor_tables
|
|
|
|
$(call generate-file-dir,$(1)/$(2).insts.inc)
|
|
|
|
$(1)/$(2).insts.inc : \
|
|
|
|
$(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2020-07-30 19:08:53 +03:00
|
|
|
$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.$(2).grammar.json
|
2017-10-06 02:07:31 +03:00
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2020-07-30 19:08:53 +03:00
|
|
|
--extinst-vendor-grammar=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.$(2).grammar.json \
|
2019-12-20 01:16:26 +03:00
|
|
|
--vendor-insts-output=$(1)/$(2).insts.inc \
|
|
|
|
--vendor-operand-kind-prefix=$(3)
|
2017-10-06 02:07:31 +03:00
|
|
|
@echo "[$(TARGET_ARCH_ABI)] Vendor extended instruction set: $(2) tables <= grammar"
|
|
|
|
$(LOCAL_PATH)/source/ext_inst.cpp: $(1)/$(2).insts.inc
|
|
|
|
endef
|
2019-12-20 01:16:26 +03:00
|
|
|
# Vendor and debug extended instruction sets, with grammars from SPIRV-Tools source tree.
|
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),debuginfo,""))
|
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),opencl.debuginfo.100,"CLDEBUG100_"))
|
2021-09-15 21:38:53 +03:00
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),nonsemantic.shader.debuginfo.100,"SHDEBUG100_"))
|
2019-12-20 01:16:26 +03:00
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),spv-amd-gcn-shader,""))
|
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),spv-amd-shader-ballot,""))
|
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),spv-amd-shader-explicit-vertex-parameter,""))
|
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),spv-amd-shader-trinary-minmax,""))
|
2020-07-30 19:08:53 +03:00
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),nonsemantic.clspvreflection,""))
|
2017-10-06 02:07:31 +03:00
|
|
|
|
|
|
|
define gen_spvtools_enum_string_mapping
|
|
|
|
$(call generate-file-dir,$(1)/extension_enum.inc.inc)
|
|
|
|
$(1)/extension_enum.inc $(1)/enum_string_mapping.inc: \
|
|
|
|
$(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2019-12-20 01:16:26 +03:00
|
|
|
$(SPV_COREUNIFIED1_GRAMMAR)
|
2017-10-06 02:07:31 +03:00
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2019-12-20 01:16:26 +03:00
|
|
|
--spirv-core-grammar=$(SPV_COREUNIFIED1_GRAMMAR) \
|
2017-12-03 20:30:08 +03:00
|
|
|
--extinst-debuginfo-grammar=$(SPV_DEBUGINFO_GRAMMAR) \
|
2019-12-20 01:16:26 +03:00
|
|
|
--extinst-cldebuginfo100-grammar=$(SPV_CLDEBUGINFO100_GRAMMAR) \
|
2017-10-06 02:07:31 +03:00
|
|
|
--extension-enum-output=$(1)/extension_enum.inc \
|
2022-11-05 00:27:10 +03:00
|
|
|
--enum-string-mapping-output=$(1)/enum_string_mapping.inc \
|
|
|
|
--output-language=c++
|
2017-10-06 02:07:31 +03:00
|
|
|
@echo "[$(TARGET_ARCH_ABI)] Generate enum<->string mapping <= grammar JSON files"
|
|
|
|
# Generated header extension_enum.inc is transitively included by table.h, which is
|
|
|
|
# used pervasively. Capture the pervasive dependency.
|
|
|
|
$(foreach F,$(SPVTOOLS_SRC_FILES) $(SPVTOOLS_OPT_SRC_FILES),$(LOCAL_PATH)/$F ) \
|
|
|
|
: $(1)/extension_enum.inc
|
|
|
|
$(LOCAL_PATH)/source/enum_string_mapping.cpp: $(1)/enum_string_mapping.inc
|
|
|
|
endef
|
|
|
|
$(eval $(call gen_spvtools_enum_string_mapping,$(SPVTOOLS_OUT_PATH)))
|
|
|
|
|
|
|
|
define gen_spvtools_build_version_inc
|
|
|
|
$(call generate-file-dir,$(1)/dummy_filename)
|
|
|
|
$(1)/build-version.inc: \
|
|
|
|
$(LOCAL_PATH)/utils/update_build_version.py \
|
|
|
|
$(LOCAL_PATH)/CHANGES
|
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/update_build_version.py \
|
2022-04-07 16:19:05 +03:00
|
|
|
$(LOCAL_PATH)/CHANGES $(1)/build-version.inc
|
2017-10-06 02:07:31 +03:00
|
|
|
@echo "[$(TARGET_ARCH_ABI)] Generate : build-version.inc <= CHANGES"
|
|
|
|
$(LOCAL_PATH)/source/software_version.cpp: $(1)/build-version.inc
|
|
|
|
endef
|
|
|
|
$(eval $(call gen_spvtools_build_version_inc,$(SPVTOOLS_OUT_PATH)))
|
|
|
|
|
|
|
|
define gen_spvtools_generators_inc
|
|
|
|
$(call generate-file-dir,$(1)/dummy_filename)
|
|
|
|
$(1)/generators.inc: \
|
|
|
|
$(LOCAL_PATH)/utils/generate_registry_tables.py \
|
|
|
|
$(SPVHEADERS_LOCAL_PATH)/include/spirv/spir-v.xml
|
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_registry_tables.py \
|
|
|
|
--xml=$(SPVHEADERS_LOCAL_PATH)/include/spirv/spir-v.xml \
|
|
|
|
--generator-output=$(1)/generators.inc
|
|
|
|
@echo "[$(TARGET_ARCH_ABI)] Generate : generators.inc <= spir-v.xml"
|
|
|
|
$(LOCAL_PATH)/source/opcode.cpp: $(1)/generators.inc
|
|
|
|
endef
|
|
|
|
$(eval $(call gen_spvtools_generators_inc,$(SPVTOOLS_OUT_PATH)))
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE := SPIRV-Tools
|
|
|
|
LOCAL_C_INCLUDES := \
|
|
|
|
$(LOCAL_PATH)/include \
|
2018-11-28 17:13:38 +03:00
|
|
|
$(SPVHEADERS_LOCAL_PATH)/include \
|
2017-10-06 02:07:31 +03:00
|
|
|
$(SPVTOOLS_OUT_PATH)
|
|
|
|
LOCAL_EXPORT_C_INCLUDES := \
|
|
|
|
$(LOCAL_PATH)/include
|
|
|
|
LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror
|
|
|
|
LOCAL_SRC_FILES:= $(SPVTOOLS_SRC_FILES)
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE := SPIRV-Tools-opt
|
|
|
|
LOCAL_C_INCLUDES := \
|
|
|
|
$(LOCAL_PATH)/include \
|
|
|
|
$(LOCAL_PATH)/source \
|
2018-11-28 17:13:38 +03:00
|
|
|
$(SPVHEADERS_LOCAL_PATH)/include \
|
2017-10-06 02:07:31 +03:00
|
|
|
$(SPVTOOLS_OUT_PATH)
|
|
|
|
LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror
|
|
|
|
LOCAL_STATIC_LIBRARIES:=SPIRV-Tools
|
|
|
|
LOCAL_SRC_FILES:= $(SPVTOOLS_OPT_SRC_FILES)
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|