SPIRV-Tools/source/opt/CMakeLists.txt
GregF 9de4e69856 Add AggressiveDCEPass
Create aggressive dead code elimination pass
This pass eliminates unused code from functions. In addition,
it detects and eliminates code which may have spurious uses but which do
not contribute to the output of the function. The most common cause of
such code sequences is summations in loops whose result is no longer used
due to dead code elimination. This optimization has additional compile
time cost over standard dead code elimination.

This pass only processes entry point functions. It also only processes
shaders with logical addressing. It currently will not process functions
with function calls. It currently only supports the GLSL.std.450 extended
instruction set. It currently does not support any extensions.

This pass will be made more effective by first running passes that remove
dead control flow and inlines function calls.

This pass can be especially useful after running Local Access Chain
Conversion, which tends to cause cycles of dead code to be left after
Store/Load elimination passes are completed. These cycles cannot be
eliminated with standard dead code elimination.

Additionally: This transform uses a whitelist of instructions that it
knows do have side effects, (a.k.a. combinators).  It assumes other
instructions have side effects: it will not remove them, and assumes
they have side effects via their ID operands.
2017-07-10 11:30:25 -04:00

98 lines
2.7 KiB
CMake

# 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.
add_library(SPIRV-Tools-opt
aggressive_dead_code_elim_pass.h
basic_block.h
block_merge_pass.h
build_module.h
compact_ids_pass.h
constants.h
dead_branch_elim_pass.h
def_use_manager.h
eliminate_dead_constant_pass.h
flatten_decoration_pass.h
function.h
fold_spec_constant_op_and_composite_pass.h
freeze_spec_constant_value_pass.h
inline_pass.h
insert_extract_elim.h
instruction.h
ir_loader.h
local_access_chain_convert_pass.h
local_single_block_elim_pass.h
local_single_store_elim_pass.h
local_ssa_elim_pass.h
log.h
module.h
null_pass.h
reflect.h
pass.h
passes.h
pass_manager.h
set_spec_constant_default_value_pass.h
strip_debug_info_pass.h
types.h
type_manager.h
unify_const_pass.h
aggressive_dead_code_elim_pass.cpp
basic_block.cpp
block_merge_pass.cpp
build_module.cpp
compact_ids_pass.cpp
def_use_manager.cpp
dead_branch_elim_pass.cpp
eliminate_dead_constant_pass.cpp
flatten_decoration_pass.cpp
function.cpp
fold_spec_constant_op_and_composite_pass.cpp
freeze_spec_constant_value_pass.cpp
inline_pass.cpp
insert_extract_elim.cpp
instruction.cpp
ir_loader.cpp
local_access_chain_convert_pass.cpp
local_single_block_elim_pass.cpp
local_single_store_elim_pass.cpp
local_ssa_elim_pass.cpp
module.cpp
set_spec_constant_default_value_pass.cpp
optimizer.cpp
pass_manager.cpp
strip_debug_info_pass.cpp
types.cpp
type_manager.cpp
unify_const_pass.cpp
)
spvtools_default_compile_options(SPIRV-Tools-opt)
target_include_directories(SPIRV-Tools-opt
PUBLIC ${spirv-tools_SOURCE_DIR}/include
PUBLIC ${SPIRV_HEADER_INCLUDE_DIR}
PRIVATE ${spirv-tools_BINARY_DIR}
)
# We need the assembling and disassembling functionalities in the main library.
target_link_libraries(SPIRV-Tools-opt
PUBLIC ${SPIRV_TOOLS})
set_property(TARGET SPIRV-Tools-opt PROPERTY FOLDER "SPIRV-Tools libraries")
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)