2016-09-01 19:33:59 +00:00
|
|
|
# Copyright (c) 2016 Google Inc.
|
|
|
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2018-10-15 15:12:02 +00:00
|
|
|
set(SPIRV_TOOLS_OPT_SOURCES
|
2017-06-08 16:37:21 +00:00
|
|
|
aggressive_dead_code_elim_pass.h
|
2019-08-29 16:48:17 +00:00
|
|
|
amd_ext_to_khr.h
|
2016-05-22 18:11:24 +00:00
|
|
|
basic_block.h
|
2017-06-07 21:28:53 +00:00
|
|
|
block_merge_pass.h
|
2019-01-25 10:57:13 +00:00
|
|
|
block_merge_util.h
|
2016-09-09 18:45:18 +00:00
|
|
|
build_module.h
|
2017-12-05 16:39:25 +00:00
|
|
|
ccp_pass.h
|
2017-09-06 12:56:41 +00:00
|
|
|
cfg_cleanup_pass.h
|
2017-10-30 21:42:26 +00:00
|
|
|
cfg.h
|
2019-01-17 20:56:36 +00:00
|
|
|
code_sink.h
|
2018-07-23 15:23:11 +00:00
|
|
|
combine_access_chains.h
|
2017-04-11 19:11:04 +00:00
|
|
|
compact_ids_pass.h
|
2018-01-27 00:05:33 +00:00
|
|
|
composite.h
|
2018-02-08 15:59:03 +00:00
|
|
|
const_folding_rules.h
|
2016-08-04 17:24:08 +00:00
|
|
|
constants.h
|
2018-03-21 03:33:24 +00:00
|
|
|
copy_prop_arrays.h
|
2017-06-02 19:23:20 +00:00
|
|
|
dead_branch_elim_pass.h
|
2018-01-27 00:05:33 +00:00
|
|
|
dead_insert_elim_pass.h
|
2017-10-23 19:48:29 +00:00
|
|
|
dead_variable_elimination.h
|
2019-04-16 18:31:36 +00:00
|
|
|
decompose_initialized_variables_pass.h
|
2017-07-13 00:16:51 +00:00
|
|
|
decoration_manager.h
|
2016-07-27 21:37:04 +00:00
|
|
|
def_use_manager.h
|
2019-08-08 14:53:19 +00:00
|
|
|
desc_sroa.h
|
2017-11-27 21:21:26 +00:00
|
|
|
dominator_analysis.h
|
|
|
|
dominator_tree.h
|
2016-08-29 19:46:09 +00:00
|
|
|
eliminate_dead_constant_pass.h
|
2017-11-17 13:59:25 +00:00
|
|
|
eliminate_dead_functions_pass.h
|
2019-02-08 16:20:29 +00:00
|
|
|
eliminate_dead_functions_util.h
|
2019-02-14 18:42:35 +00:00
|
|
|
eliminate_dead_members_pass.h
|
2017-11-30 22:03:06 +00:00
|
|
|
feature_manager.h
|
2019-04-05 17:12:08 +00:00
|
|
|
fix_storage_class.h
|
2017-04-01 20:10:16 +00:00
|
|
|
flatten_decoration_pass.h
|
2017-10-17 23:41:37 +00:00
|
|
|
fold.h
|
2018-01-24 18:26:33 +00:00
|
|
|
folding_rules.h
|
2016-08-29 19:46:09 +00:00
|
|
|
fold_spec_constant_op_and_composite_pass.h
|
|
|
|
freeze_spec_constant_value_pass.h
|
2017-11-17 13:59:25 +00:00
|
|
|
function.h
|
2019-04-03 15:44:09 +00:00
|
|
|
generate_webgpu_initializers_pass.h
|
2019-07-30 23:52:46 +00:00
|
|
|
graphics_robust_access_pass.h
|
2018-01-16 16:15:06 +00:00
|
|
|
if_conversion.h
|
2017-08-01 23:20:13 +00:00
|
|
|
inline_exhaustive_pass.h
|
2017-08-15 23:58:28 +00:00
|
|
|
inline_opaque_pass.h
|
2017-11-17 13:59:25 +00:00
|
|
|
inline_pass.h
|
2018-11-08 18:54:54 +00:00
|
|
|
inst_bindless_check_pass.h
|
2019-08-16 13:18:34 +00:00
|
|
|
inst_buff_addr_check_pass.h
|
2016-05-22 18:11:24 +00:00
|
|
|
instruction.h
|
2018-02-08 16:03:48 +00:00
|
|
|
instruction_list.h
|
2018-11-08 18:54:54 +00:00
|
|
|
instrument_pass.h
|
2018-02-08 16:03:48 +00:00
|
|
|
ir_builder.h
|
2017-10-30 15:13:24 +00:00
|
|
|
ir_context.h
|
2017-11-17 13:59:25 +00:00
|
|
|
ir_loader.h
|
2018-01-29 10:39:55 +00:00
|
|
|
licm_pass.h
|
2017-05-12 23:27:21 +00:00
|
|
|
local_access_chain_convert_pass.h
|
2017-11-11 01:26:55 +00:00
|
|
|
local_redundancy_elimination.h
|
2017-05-18 20:51:55 +00:00
|
|
|
local_single_block_elim_pass.h
|
2017-05-19 23:31:28 +00:00
|
|
|
local_single_store_elim_pass.h
|
2017-06-16 21:37:31 +00:00
|
|
|
local_ssa_elim_pass.h
|
2016-09-08 15:43:48 +00:00
|
|
|
log.h
|
2018-03-29 12:39:54 +00:00
|
|
|
loop_dependence.h
|
2017-12-21 14:47:25 +00:00
|
|
|
loop_descriptor.h
|
2018-04-23 20:01:12 +00:00
|
|
|
loop_fission.h
|
2018-04-20 14:14:45 +00:00
|
|
|
loop_fusion.h
|
|
|
|
loop_fusion_pass.h
|
2018-03-07 18:21:11 +00:00
|
|
|
loop_peeling.h
|
2018-02-14 17:03:12 +00:00
|
|
|
loop_unroller.h
|
2018-01-26 12:07:10 +00:00
|
|
|
loop_utils.h
|
2018-02-12 21:42:15 +00:00
|
|
|
loop_unswitch_pass.h
|
2017-11-17 13:59:25 +00:00
|
|
|
mem_pass.h
|
2017-11-08 21:22:10 +00:00
|
|
|
merge_return_pass.h
|
2016-05-22 18:11:24 +00:00
|
|
|
module.h
|
2016-08-29 19:46:09 +00:00
|
|
|
null_pass.h
|
2017-10-19 19:22:02 +00:00
|
|
|
passes.h
|
2017-11-17 13:59:25 +00:00
|
|
|
pass.h
|
2016-06-28 18:58:17 +00:00
|
|
|
pass_manager.h
|
2017-12-11 18:10:24 +00:00
|
|
|
private_to_local_pass.h
|
2018-11-15 19:06:17 +00:00
|
|
|
process_lines_pass.h
|
2017-11-17 13:59:25 +00:00
|
|
|
propagator.h
|
2018-05-07 16:31:03 +00:00
|
|
|
reduce_load_size.h
|
2017-12-04 17:29:51 +00:00
|
|
|
redundancy_elimination.h
|
2017-11-17 13:59:25 +00:00
|
|
|
reflect.h
|
2018-04-17 14:31:09 +00:00
|
|
|
register_pressure.h
|
2017-07-13 00:16:51 +00:00
|
|
|
remove_duplicates_pass.h
|
2018-01-30 16:24:03 +00:00
|
|
|
replace_invalid_opc.h
|
2018-03-28 13:19:55 +00:00
|
|
|
scalar_analysis.h
|
|
|
|
scalar_analysis_nodes.h
|
2017-11-30 22:03:06 +00:00
|
|
|
scalar_replacement_pass.h
|
2016-08-30 18:57:56 +00:00
|
|
|
set_spec_constant_default_value_pass.h
|
2018-02-02 16:55:05 +00:00
|
|
|
simplification_pass.h
|
2019-05-09 16:56:10 +00:00
|
|
|
split_invalid_unreachable_pass.h
|
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
|
|
|
ssa_rewrite_pass.h
|
2017-09-08 16:08:03 +00:00
|
|
|
strength_reduction_pass.h
|
2019-03-14 17:34:33 +00:00
|
|
|
strip_atomic_counter_memory_pass.h
|
2016-08-29 19:46:09 +00:00
|
|
|
strip_debug_info_pass.h
|
2018-03-09 21:08:57 +00:00
|
|
|
strip_reflect_info_pass.h
|
2018-09-17 17:00:24 +00:00
|
|
|
struct_cfg_analysis.h
|
2017-12-04 14:36:05 +00:00
|
|
|
tree_iterator.h
|
2017-10-19 19:22:02 +00:00
|
|
|
type_manager.h
|
2017-11-17 13:59:25 +00:00
|
|
|
types.h
|
2016-08-17 21:19:48 +00:00
|
|
|
unify_const_pass.h
|
2018-11-30 19:15:51 +00:00
|
|
|
upgrade_memory_model.h
|
2017-11-11 01:26:55 +00:00
|
|
|
value_number_table.h
|
2018-04-23 15:13:07 +00:00
|
|
|
vector_dce.h
|
2018-01-17 19:57:37 +00:00
|
|
|
workaround1209.h
|
2019-08-14 13:27:12 +00:00
|
|
|
wrap_opkill.h
|
2016-05-22 18:11:24 +00:00
|
|
|
|
2017-06-08 16:37:21 +00:00
|
|
|
aggressive_dead_code_elim_pass.cpp
|
2019-08-29 16:48:17 +00:00
|
|
|
amd_ext_to_khr.cpp
|
2016-11-10 17:11:50 +00:00
|
|
|
basic_block.cpp
|
2017-06-07 21:28:53 +00:00
|
|
|
block_merge_pass.cpp
|
2019-01-25 10:57:13 +00:00
|
|
|
block_merge_util.cpp
|
2016-09-09 18:45:18 +00:00
|
|
|
build_module.cpp
|
2017-12-05 16:39:25 +00:00
|
|
|
ccp_pass.cpp
|
2017-09-06 12:56:41 +00:00
|
|
|
cfg_cleanup_pass.cpp
|
2017-10-30 21:42:26 +00:00
|
|
|
cfg.cpp
|
2019-01-17 20:56:36 +00:00
|
|
|
code_sink.cpp
|
2018-07-23 15:23:11 +00:00
|
|
|
combine_access_chains.cpp
|
2017-04-11 19:11:04 +00:00
|
|
|
compact_ids_pass.cpp
|
2018-01-27 00:05:33 +00:00
|
|
|
composite.cpp
|
2018-02-08 15:59:03 +00:00
|
|
|
const_folding_rules.cpp
|
2017-12-07 21:42:27 +00:00
|
|
|
constants.cpp
|
2018-03-21 03:33:24 +00:00
|
|
|
copy_prop_arrays.cpp
|
2017-10-19 19:22:02 +00:00
|
|
|
dead_branch_elim_pass.cpp
|
2018-01-27 00:05:33 +00:00
|
|
|
dead_insert_elim_pass.cpp
|
2017-10-23 19:48:29 +00:00
|
|
|
dead_variable_elimination.cpp
|
2019-04-16 18:31:36 +00:00
|
|
|
decompose_initialized_variables_pass.cpp
|
2017-11-17 13:59:25 +00:00
|
|
|
decoration_manager.cpp
|
|
|
|
def_use_manager.cpp
|
2019-08-08 14:53:19 +00:00
|
|
|
desc_sroa.cpp
|
2018-01-16 16:15:06 +00:00
|
|
|
dominator_analysis.cpp
|
2017-11-27 21:21:26 +00:00
|
|
|
dominator_tree.cpp
|
2016-08-29 19:46:09 +00:00
|
|
|
eliminate_dead_constant_pass.cpp
|
2017-11-17 13:59:25 +00:00
|
|
|
eliminate_dead_functions_pass.cpp
|
2019-02-08 16:20:29 +00:00
|
|
|
eliminate_dead_functions_util.cpp
|
2019-02-14 18:42:35 +00:00
|
|
|
eliminate_dead_members_pass.cpp
|
2017-11-30 22:03:06 +00:00
|
|
|
feature_manager.cpp
|
2019-04-05 17:12:08 +00:00
|
|
|
fix_storage_class.cpp
|
2017-04-01 20:10:16 +00:00
|
|
|
flatten_decoration_pass.cpp
|
2017-10-17 23:41:37 +00:00
|
|
|
fold.cpp
|
2018-01-24 18:26:33 +00:00
|
|
|
folding_rules.cpp
|
2016-08-29 19:46:09 +00:00
|
|
|
fold_spec_constant_op_and_composite_pass.cpp
|
|
|
|
freeze_spec_constant_value_pass.cpp
|
2017-10-17 23:41:37 +00:00
|
|
|
function.cpp
|
2019-07-30 23:52:46 +00:00
|
|
|
graphics_robust_access_pass.cpp
|
2019-04-03 15:44:09 +00:00
|
|
|
generate_webgpu_initializers_pass.cpp
|
2018-01-16 16:15:06 +00:00
|
|
|
if_conversion.cpp
|
2017-08-01 23:20:13 +00:00
|
|
|
inline_exhaustive_pass.cpp
|
2017-08-15 23:58:28 +00:00
|
|
|
inline_opaque_pass.cpp
|
2017-11-17 13:59:25 +00:00
|
|
|
inline_pass.cpp
|
2018-11-08 18:54:54 +00:00
|
|
|
inst_bindless_check_pass.cpp
|
2019-08-16 13:18:34 +00:00
|
|
|
inst_buff_addr_check_pass.cpp
|
2016-05-22 18:11:24 +00:00
|
|
|
instruction.cpp
|
2017-11-11 01:26:55 +00:00
|
|
|
instruction_list.cpp
|
2018-11-08 18:54:54 +00:00
|
|
|
instrument_pass.cpp
|
2017-10-30 15:13:24 +00:00
|
|
|
ir_context.cpp
|
2017-11-17 13:59:25 +00:00
|
|
|
ir_loader.cpp
|
2019-04-12 16:14:23 +00:00
|
|
|
legalize_vector_shuffle_pass.cpp
|
2018-01-29 10:39:55 +00:00
|
|
|
licm_pass.cpp
|
2017-05-12 23:27:21 +00:00
|
|
|
local_access_chain_convert_pass.cpp
|
2017-11-11 01:26:55 +00:00
|
|
|
local_redundancy_elimination.cpp
|
2017-05-18 20:51:55 +00:00
|
|
|
local_single_block_elim_pass.cpp
|
2017-05-19 23:31:28 +00:00
|
|
|
local_single_store_elim_pass.cpp
|
2017-06-16 21:37:31 +00:00
|
|
|
local_ssa_elim_pass.cpp
|
2018-03-29 12:39:54 +00:00
|
|
|
loop_dependence.cpp
|
|
|
|
loop_dependence_helpers.cpp
|
2017-12-21 14:47:25 +00:00
|
|
|
loop_descriptor.cpp
|
2018-04-23 20:01:12 +00:00
|
|
|
loop_fission.cpp
|
2018-04-20 14:14:45 +00:00
|
|
|
loop_fusion.cpp
|
|
|
|
loop_fusion_pass.cpp
|
2018-03-07 18:21:11 +00:00
|
|
|
loop_peeling.cpp
|
2018-01-26 12:07:10 +00:00
|
|
|
loop_utils.cpp
|
2018-02-14 17:03:12 +00:00
|
|
|
loop_unroller.cpp
|
2018-02-12 21:42:15 +00:00
|
|
|
loop_unswitch_pass.cpp
|
2017-11-17 13:59:25 +00:00
|
|
|
mem_pass.cpp
|
2017-11-08 21:22:10 +00:00
|
|
|
merge_return_pass.cpp
|
2016-05-22 18:11:24 +00:00
|
|
|
module.cpp
|
2016-09-12 18:11:46 +00:00
|
|
|
optimizer.cpp
|
2017-08-10 22:42:16 +00:00
|
|
|
pass.cpp
|
2016-09-12 16:39:44 +00:00
|
|
|
pass_manager.cpp
|
2017-12-11 18:10:24 +00:00
|
|
|
private_to_local_pass.cpp
|
2018-11-15 19:06:17 +00:00
|
|
|
process_lines_pass.cpp
|
2017-11-17 13:59:25 +00:00
|
|
|
propagator.cpp
|
2018-05-07 16:31:03 +00:00
|
|
|
reduce_load_size.cpp
|
2017-12-04 17:29:51 +00:00
|
|
|
redundancy_elimination.cpp
|
2018-04-17 14:31:09 +00:00
|
|
|
register_pressure.cpp
|
2017-11-17 13:59:25 +00:00
|
|
|
remove_duplicates_pass.cpp
|
2018-01-30 16:24:03 +00:00
|
|
|
replace_invalid_opc.cpp
|
2018-03-28 13:19:55 +00:00
|
|
|
scalar_analysis.cpp
|
|
|
|
scalar_analysis_simplification.cpp
|
2017-11-30 22:03:06 +00:00
|
|
|
scalar_replacement_pass.cpp
|
2017-11-17 13:59:25 +00:00
|
|
|
set_spec_constant_default_value_pass.cpp
|
2018-02-02 16:55:05 +00:00
|
|
|
simplification_pass.cpp
|
2019-05-09 16:56:10 +00:00
|
|
|
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
|
|
|
ssa_rewrite_pass.cpp
|
2017-09-08 16:08:03 +00:00
|
|
|
strength_reduction_pass.cpp
|
2019-03-14 17:34:33 +00:00
|
|
|
strip_atomic_counter_memory_pass.cpp
|
2016-08-29 19:46:09 +00:00
|
|
|
strip_debug_info_pass.cpp
|
2018-03-09 21:08:57 +00:00
|
|
|
strip_reflect_info_pass.cpp
|
2018-09-17 17:00:24 +00:00
|
|
|
struct_cfg_analysis.cpp
|
2017-10-19 19:22:02 +00:00
|
|
|
type_manager.cpp
|
2017-11-17 13:59:25 +00:00
|
|
|
types.cpp
|
2016-08-17 21:19:48 +00:00
|
|
|
unify_const_pass.cpp
|
2018-11-30 19:15:51 +00:00
|
|
|
upgrade_memory_model.cpp
|
2017-11-11 01:26:55 +00:00
|
|
|
value_number_table.cpp
|
2018-04-23 15:13:07 +00:00
|
|
|
vector_dce.cpp
|
2018-01-17 19:57:37 +00:00
|
|
|
workaround1209.cpp
|
2019-08-14 13:27:12 +00:00
|
|
|
wrap_opkill.cpp
|
2017-10-30 15:13:24 +00:00
|
|
|
)
|
2016-05-22 18:11:24 +00:00
|
|
|
|
2018-10-15 15:12:02 +00:00
|
|
|
if(MSVC)
|
|
|
|
# Enable parallel builds across four cores for this lib
|
|
|
|
add_definitions(/MP4)
|
|
|
|
endif()
|
|
|
|
|
2018-11-07 14:15:04 +00:00
|
|
|
spvtools_pch(SPIRV_TOOLS_OPT_SOURCES pch_source_opt)
|
2018-11-06 14:26:23 +00:00
|
|
|
|
2018-10-15 15:12:02 +00:00
|
|
|
add_library(SPIRV-Tools-opt ${SPIRV_TOOLS_OPT_SOURCES})
|
|
|
|
|
2016-05-22 18:11:24 +00:00
|
|
|
spvtools_default_compile_options(SPIRV-Tools-opt)
|
|
|
|
target_include_directories(SPIRV-Tools-opt
|
2016-09-16 20:12:04 +00:00
|
|
|
PUBLIC ${spirv-tools_SOURCE_DIR}/include
|
2016-05-22 18:11:24 +00:00
|
|
|
PUBLIC ${SPIRV_HEADER_INCLUDE_DIR}
|
2017-03-15 21:28:24 +00:00
|
|
|
PRIVATE ${spirv-tools_BINARY_DIR}
|
2016-05-22 18:11:24 +00:00
|
|
|
)
|
2016-09-16 20:12:04 +00:00
|
|
|
# We need the assembling and disassembling functionalities in the main library.
|
|
|
|
target_link_libraries(SPIRV-Tools-opt
|
|
|
|
PUBLIC ${SPIRV_TOOLS})
|
|
|
|
|
2017-04-05 21:32:39 +00:00
|
|
|
set_property(TARGET SPIRV-Tools-opt PROPERTY FOLDER "SPIRV-Tools libraries")
|
2017-11-22 22:03:55 +00:00
|
|
|
spvtools_check_symbol_exports(SPIRV-Tools-opt)
|
2017-04-05 21:32:39 +00:00
|
|
|
|
2017-07-04 13:11:40 +00:00
|
|
|
if(ENABLE_SPIRV_TOOLS_INSTALL)
|
|
|
|
install(TARGETS SPIRV-Tools-opt
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
endif(ENABLE_SPIRV_TOOLS_INSTALL)
|