2017-10-05 23:07:31 +00: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 14:13:38 +00:00
|
|
|
|
|
|
|
ifeq ($(SPVHEADERS_LOCAL_PATH),)
|
|
|
|
SPVHEADERS_LOCAL_PATH := $(LOCAL_PATH)/external/spirv-headers
|
|
|
|
endif
|
2017-10-05 23:07:31 +00: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 15:49:41 +00:00
|
|
|
source/spirv_optimizer_options.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/spirv_target_env.cpp \
|
|
|
|
source/spirv_validator_options.cpp \
|
|
|
|
source/table.cpp \
|
|
|
|
source/text.cpp \
|
|
|
|
source/text_handler.cpp \
|
2018-04-23 15:13:07 +00:00
|
|
|
source/util/bit_vector.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/util/parse_number.cpp \
|
|
|
|
source/util/string_utils.cpp \
|
2018-03-07 14:25:51 +00:00
|
|
|
source/util/timer.cpp \
|
2017-10-05 23:07:31 +00: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 14:27:34 +00:00
|
|
|
source/val/validate.cpp \
|
|
|
|
source/val/validate_adjacency.cpp \
|
2018-08-08 18:21:27 +00:00
|
|
|
source/val/validate_annotation.cpp \
|
2018-07-11 14:27:34 +00: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 15:20:55 +00:00
|
|
|
source/val/validate_constants.cpp \
|
2018-07-11 14:27:34 +00:00
|
|
|
source/val/validate_conversion.cpp \
|
2018-08-08 17:47:09 +00:00
|
|
|
source/val/validate_debug.cpp \
|
2018-07-11 14:27:34 +00:00
|
|
|
source/val/validate_decorations.cpp \
|
|
|
|
source/val/validate_derivatives.cpp \
|
2018-11-27 21:20:01 +00:00
|
|
|
source/val/validate_extensions.cpp \
|
2018-08-10 13:53:17 +00:00
|
|
|
source/val/validate_execution_limitations.cpp \
|
|
|
|
source/val/validate_function.cpp \
|
2018-07-11 14:27:34 +00:00
|
|
|
source/val/validate_id.cpp \
|
|
|
|
source/val/validate_image.cpp \
|
|
|
|
source/val/validate_interfaces.cpp \
|
|
|
|
source/val/validate_instruction.cpp \
|
2018-08-01 18:44:56 +00:00
|
|
|
source/val/validate_memory.cpp \
|
2018-12-06 19:38:15 +00:00
|
|
|
source/val/validate_memory_semantics.cpp \
|
2019-06-03 14:55:07 +00:00
|
|
|
source/val/validate_misc.cpp \
|
2018-08-08 18:49:59 +00:00
|
|
|
source/val/validate_mode_setting.cpp \
|
2018-07-11 14:27:34 +00: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 \
|
2018-11-29 18:48:42 +00:00
|
|
|
source/val/validate_scopes.cpp \
|
2019-07-11 17:05:14 +00:00
|
|
|
source/val/validate_small_type_uses.cpp \
|
2018-08-03 15:38:51 +00:00
|
|
|
source/val/validate_type.cpp
|
2017-10-05 23:07:31 +00:00
|
|
|
|
|
|
|
SPVTOOLS_OPT_SRC_FILES := \
|
|
|
|
source/opt/aggressive_dead_code_elim_pass.cpp \
|
2019-08-29 16:48:17 +00:00
|
|
|
source/opt/amd_ext_to_khr.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/basic_block.cpp \
|
|
|
|
source/opt/block_merge_pass.cpp \
|
2019-01-25 10:57:13 +00:00
|
|
|
source/opt/block_merge_util.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/build_module.cpp \
|
2017-10-30 21:42:26 +00:00
|
|
|
source/opt/cfg.cpp \
|
2017-09-06 12:56:41 +00:00
|
|
|
source/opt/cfg_cleanup_pass.cpp \
|
2017-12-05 16:39:25 +00:00
|
|
|
source/opt/ccp_pass.cpp \
|
2019-01-17 20:56:36 +00:00
|
|
|
source/opt/code_sink.cpp \
|
2018-07-23 15:23:11 +00:00
|
|
|
source/opt/combine_access_chains.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/compact_ids_pass.cpp \
|
2018-01-27 00:05:33 +00:00
|
|
|
source/opt/composite.cpp \
|
2018-02-08 15:59:03 +00:00
|
|
|
source/opt/const_folding_rules.cpp \
|
2017-12-07 21:42:27 +00:00
|
|
|
source/opt/constants.cpp \
|
2019-09-03 17:22:13 +00:00
|
|
|
source/opt/convert_to_half_pass.cpp \
|
2018-03-21 03:33:24 +00:00
|
|
|
source/opt/copy_prop_arrays.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/dead_branch_elim_pass.cpp \
|
2018-01-27 00:05:33 +00:00
|
|
|
source/opt/dead_insert_elim_pass.cpp \
|
2017-10-20 16:17:41 +00:00
|
|
|
source/opt/dead_variable_elimination.cpp \
|
2019-04-16 18:31:36 +00:00
|
|
|
source/opt/decompose_initialized_variables_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/decoration_manager.cpp \
|
2020-04-27 19:18:55 +00:00
|
|
|
source/opt/debug_info_manager.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/def_use_manager.cpp \
|
2019-08-08 14:53:19 +00:00
|
|
|
source/opt/desc_sroa.cpp \
|
2018-01-16 16:15:06 +00:00
|
|
|
source/opt/dominator_analysis.cpp \
|
2017-11-27 21:21:26 +00:00
|
|
|
source/opt/dominator_tree.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/eliminate_dead_constant_pass.cpp \
|
|
|
|
source/opt/eliminate_dead_functions_pass.cpp \
|
2019-02-08 16:20:29 +00:00
|
|
|
source/opt/eliminate_dead_functions_util.cpp \
|
2019-02-14 18:42:35 +00:00
|
|
|
source/opt/eliminate_dead_members_pass.cpp \
|
2017-11-30 22:03:06 +00:00
|
|
|
source/opt/feature_manager.cpp \
|
2019-04-05 17:12:08 +00:00
|
|
|
source/opt/fix_storage_class.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/flatten_decoration_pass.cpp \
|
2017-10-18 14:28:12 +00:00
|
|
|
source/opt/fold.cpp \
|
2018-01-24 18:26:33 +00:00
|
|
|
source/opt/folding_rules.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/fold_spec_constant_op_and_composite_pass.cpp \
|
|
|
|
source/opt/freeze_spec_constant_value_pass.cpp \
|
|
|
|
source/opt/function.cpp \
|
2019-04-03 15:44:09 +00:00
|
|
|
source/opt/generate_webgpu_initializers_pass.cpp \
|
2019-07-30 23:52:46 +00:00
|
|
|
source/opt/graphics_robust_access_pass.cpp \
|
2018-01-16 16:15:06 +00:00
|
|
|
source/opt/if_conversion.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/inline_pass.cpp \
|
|
|
|
source/opt/inline_exhaustive_pass.cpp \
|
|
|
|
source/opt/inline_opaque_pass.cpp \
|
2018-11-08 18:54:54 +00:00
|
|
|
source/opt/inst_bindless_check_pass.cpp \
|
2019-08-16 13:18:34 +00:00
|
|
|
source/opt/inst_buff_addr_check_pass.cpp \
|
2020-03-12 13:19:52 +00:00
|
|
|
source/opt/inst_debug_printf_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/instruction.cpp \
|
2017-10-20 18:38:50 +00:00
|
|
|
source/opt/instruction_list.cpp \
|
2018-11-08 18:54:54 +00:00
|
|
|
source/opt/instrument_pass.cpp \
|
2017-11-02 18:25:48 +00:00
|
|
|
source/opt/ir_context.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/ir_loader.cpp \
|
2019-04-12 16:14:23 +00:00
|
|
|
source/opt/legalize_vector_shuffle_pass.cpp \
|
2018-01-29 10:39:55 +00:00
|
|
|
source/opt/licm_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/local_access_chain_convert_pass.cpp \
|
2017-11-11 01:26:55 +00:00
|
|
|
source/opt/local_redundancy_elimination.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/local_single_block_elim_pass.cpp \
|
|
|
|
source/opt/local_single_store_elim_pass.cpp \
|
2018-03-29 12:39:54 +00:00
|
|
|
source/opt/loop_dependence.cpp \
|
|
|
|
source/opt/loop_dependence_helpers.cpp \
|
2017-12-21 14:47:25 +00:00
|
|
|
source/opt/loop_descriptor.cpp \
|
2018-04-23 20:01:12 +00:00
|
|
|
source/opt/loop_fission.cpp \
|
2018-04-20 14:14:45 +00:00
|
|
|
source/opt/loop_fusion.cpp \
|
|
|
|
source/opt/loop_fusion_pass.cpp \
|
2018-03-07 18:21:11 +00:00
|
|
|
source/opt/loop_peeling.cpp \
|
2018-02-14 17:03:12 +00:00
|
|
|
source/opt/loop_unroller.cpp \
|
2018-02-12 21:42:15 +00:00
|
|
|
source/opt/loop_unswitch_pass.cpp \
|
|
|
|
source/opt/loop_utils.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/mem_pass.cpp \
|
2017-11-11 01:26:55 +00:00
|
|
|
source/opt/merge_return_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/module.cpp \
|
|
|
|
source/opt/optimizer.cpp \
|
|
|
|
source/opt/pass.cpp \
|
|
|
|
source/opt/pass_manager.cpp \
|
2017-12-11 18:10:24 +00:00
|
|
|
source/opt/private_to_local_pass.cpp \
|
2018-11-15 19:06:17 +00:00
|
|
|
source/opt/process_lines_pass.cpp \
|
2017-11-17 13:59:25 +00:00
|
|
|
source/opt/propagator.cpp \
|
2018-05-07 16:31:03 +00:00
|
|
|
source/opt/reduce_load_size.cpp \
|
2017-12-04 17:29:51 +00:00
|
|
|
source/opt/redundancy_elimination.cpp \
|
2018-04-17 14:31:09 +00:00
|
|
|
source/opt/register_pressure.cpp \
|
2019-09-03 17:22:13 +00:00
|
|
|
source/opt/relax_float_ops_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/remove_duplicates_pass.cpp \
|
2018-01-30 16:24:03 +00:00
|
|
|
source/opt/replace_invalid_opc.cpp \
|
2018-03-28 13:19:55 +00:00
|
|
|
source/opt/scalar_analysis.cpp \
|
|
|
|
source/opt/scalar_analysis_simplification.cpp \
|
2017-11-30 22:03:06 +00:00
|
|
|
source/opt/scalar_replacement_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/set_spec_constant_default_value_pass.cpp \
|
2018-02-02 16:55:05 +00:00
|
|
|
source/opt/simplification_pass.cpp \
|
2019-05-09 16:56:10 +00:00
|
|
|
source/opt/split_invalid_unreachable_pass.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-22 21:18:29 +00:00
|
|
|
source/opt/ssa_rewrite_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/strength_reduction_pass.cpp \
|
2019-03-14 17:34:33 +00:00
|
|
|
source/opt/strip_atomic_counter_memory_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/strip_debug_info_pass.cpp \
|
2018-03-09 21:08:57 +00:00
|
|
|
source/opt/strip_reflect_info_pass.cpp \
|
2018-09-17 17:00:24 +00:00
|
|
|
source/opt/struct_cfg_analysis.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/type_manager.cpp \
|
|
|
|
source/opt/types.cpp \
|
2017-11-08 21:22:10 +00:00
|
|
|
source/opt/unify_const_pass.cpp \
|
2018-11-30 19:15:51 +00:00
|
|
|
source/opt/upgrade_memory_model.cpp \
|
2018-01-17 19:57:37 +00:00
|
|
|
source/opt/value_number_table.cpp \
|
2018-04-23 15:13:07 +00:00
|
|
|
source/opt/vector_dce.cpp \
|
2019-08-14 13:27:12 +00:00
|
|
|
source/opt/workaround1209.cpp \
|
|
|
|
source/opt/wrap_opkill.cpp
|
2017-10-05 23:07:31 +00:00
|
|
|
|
|
|
|
# Locations of grammar files.
|
2018-02-09 19:29:02 +00:00
|
|
|
#
|
2018-03-02 20:24:15 +00:00
|
|
|
SPV_COREUNIFIED1_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/spirv.core.grammar.json
|
2017-12-13 22:55:00 +00:00
|
|
|
SPV_GLSL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.2/extinst.glsl.std.450.grammar.json
|
|
|
|
SPV_OPENCL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.2/extinst.opencl.std.100.grammar.json
|
2017-12-03 17:30:08 +00:00
|
|
|
# TODO(dneto): I expect the DebugInfo grammar file to eventually migrate to SPIRV-Headers
|
|
|
|
SPV_DEBUGINFO_GRAMMAR=$(LOCAL_PATH)/source/extinst.debuginfo.grammar.json
|
2019-12-19 22:16:26 +00:00
|
|
|
SPV_CLDEBUGINFO100_GRAMMAR=$(LOCAL_PATH)/source/extinst.opencl.debuginfo.100.grammar.json
|
2017-10-05 23:07:31 +00:00
|
|
|
|
|
|
|
define gen_spvtools_grammar_tables
|
2019-12-19 22:16:26 +00: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-05 23:07:31 +00:00
|
|
|
$(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2019-12-19 22:16:26 +00:00
|
|
|
$(SPV_COREUNIFIED1_GRAMMAR) \
|
2017-10-05 23:07:31 +00:00
|
|
|
$(SPV_GLSL_GRAMMAR) \
|
2019-12-19 22:16:26 +00:00
|
|
|
$(SPV_OpenCL_GRAMMAR) \
|
|
|
|
$(SPV_DEBUGINFO_GRAMMAR) \
|
|
|
|
$(SPV_CLDEBUGINFO100_GRAMMAR)
|
2017-10-05 23:07:31 +00:00
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2019-12-19 22:16:26 +00:00
|
|
|
--spirv-core-grammar=$(SPV_COREUNIFIED1_GRAMMAR) \
|
2017-10-05 23:07:31 +00:00
|
|
|
--extinst-glsl-grammar=$(SPV_GLSL_GRAMMAR) \
|
|
|
|
--extinst-opencl-grammar=$(SPV_OPENCL_GRAMMAR) \
|
2017-12-03 17:30:08 +00:00
|
|
|
--extinst-debuginfo-grammar=$(SPV_DEBUGINFO_GRAMMAR) \
|
2019-12-19 22:16:26 +00:00
|
|
|
--extinst-cldebuginfo100-grammar=$(SPV_CLDEBUGINFO100_GRAMMAR) \
|
|
|
|
--core-insts-output=$(1)/core.insts-unified1.inc \
|
2017-12-13 22:55:00 +00:00
|
|
|
--glsl-insts-output=$(1)/glsl.std.450.insts.inc \
|
|
|
|
--opencl-insts-output=$(1)/opencl.std.insts.inc \
|
2018-02-09 19:29:02 +00:00
|
|
|
--operand-kinds-output=$(1)/operand.kinds-unified1.inc
|
2019-12-19 22:16:26 +00: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 19:29:02 +00:00
|
|
|
$(LOCAL_PATH)/source/ext_inst.cpp: \
|
|
|
|
$(1)/glsl.std.450.insts.inc \
|
|
|
|
$(1)/opencl.std.insts.inc \
|
|
|
|
$(1)/debuginfo.insts.inc \
|
2019-12-19 22:16:26 +00:00
|
|
|
$(1)/opencl.debuginfo.100.insts.inc \
|
2018-02-09 19:29:02 +00: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-18 21:42:48 +00:00
|
|
|
$(LOCAL_PATH)/source/opt/amd_ext_to_khr.cpp: \
|
|
|
|
$(1)/spv-amd-shader-ballot.insts.inc
|
2017-10-05 23:07:31 +00:00
|
|
|
endef
|
|
|
|
$(eval $(call gen_spvtools_grammar_tables,$(SPVTOOLS_OUT_PATH)))
|
|
|
|
|
2017-12-03 17:30:08 +00: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 05:46:52 +00:00
|
|
|
--extinst-output-path=$(1)/$(2).h
|
2017-12-03 17:30:08 +00:00
|
|
|
@echo "[$(TARGET_ARCH_ABI)] Generate language specific header for $(2): headers <= grammar"
|
2020-01-23 22:04:30 +00:00
|
|
|
$(foreach F,$(SPVTOOLS_SRC_FILES) $(SPVTOOLS_OPT_SRC_FILES),$(LOCAL_PATH)/$F ) \
|
|
|
|
: $(1)/$(2).h
|
2017-12-03 17:30:08 +00:00
|
|
|
endef
|
2019-12-19 22:16:26 +00:00
|
|
|
# We generate language-specific headers for DebugInfo and OpenCL.DebugInfo.100
|
2017-12-03 17:30:08 +00:00
|
|
|
$(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),DebugInfo,$(SPV_DEBUGINFO_GRAMMAR)))
|
2019-12-19 22:16:26 +00:00
|
|
|
$(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),OpenCLDebugInfo100,$(SPV_CLDEBUGINFO100_GRAMMAR)))
|
2017-12-03 17:30:08 +00:00
|
|
|
|
|
|
|
|
2017-10-05 23:07:31 +00: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 \
|
|
|
|
$(LOCAL_PATH)/source/extinst.$(2).grammar.json
|
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
|
|
|
--extinst-vendor-grammar=$(LOCAL_PATH)/source/extinst.$(2).grammar.json \
|
2019-12-19 22:16:26 +00:00
|
|
|
--vendor-insts-output=$(1)/$(2).insts.inc \
|
|
|
|
--vendor-operand-kind-prefix=$(3)
|
2017-10-05 23:07:31 +00: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-19 22:16:26 +00: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_"))
|
|
|
|
$(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,""))
|
2017-10-05 23:07:31 +00: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-19 22:16:26 +00:00
|
|
|
$(SPV_COREUNIFIED1_GRAMMAR)
|
2017-10-05 23:07:31 +00:00
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2019-12-19 22:16:26 +00:00
|
|
|
--spirv-core-grammar=$(SPV_COREUNIFIED1_GRAMMAR) \
|
2017-12-03 17:30:08 +00:00
|
|
|
--extinst-debuginfo-grammar=$(SPV_DEBUGINFO_GRAMMAR) \
|
2019-12-19 22:16:26 +00:00
|
|
|
--extinst-cldebuginfo100-grammar=$(SPV_CLDEBUGINFO100_GRAMMAR) \
|
2017-10-05 23:07:31 +00:00
|
|
|
--extension-enum-output=$(1)/extension_enum.inc \
|
|
|
|
--enum-string-mapping-output=$(1)/enum_string_mapping.inc
|
|
|
|
@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 \
|
|
|
|
$(LOCAL_PATH) $(1)/build-version.inc
|
|
|
|
@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 14:13:38 +00:00
|
|
|
$(SPVHEADERS_LOCAL_PATH)/include \
|
2017-10-05 23:07:31 +00: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 14:13:38 +00:00
|
|
|
$(SPVHEADERS_LOCAL_PATH)/include \
|
2017-10-05 23:07:31 +00: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)
|