mirror of
https://gitee.com/openharmony/third_party_spirv-tools
synced 2024-11-24 07:49:46 +00:00
eb60e2945a
De-duplicate constants and unifies the uses of constants for a SPIR-V module. If two constants are defined exactly the same, only one of them will be kept and all the uses of the removed constant will be redirected to the kept one. This pass handles normal constants (defined with OpConstant{|True|False|Composite}), some spec constants (those defined with OpSpecConstant{Op|Composite}) and null constants (defined with OpConstantNull). There are several cases not handled by this pass: 1) If there are decorations for the result id of a constant defining instruction, that instruction will not be processed. This means the instruction won't be used to replace other instructions and other instructions won't be used to replace it either. 2) This pass does not unify null constants (defined with OpConstantNull instruction) with their equivalent zero-valued normal constants (defined with OpConstant{|False|Composite} with zero as the operand values or component values).
43 lines
879 B
CMake
43 lines
879 B
CMake
add_library(SPIRV-Tools-opt
|
|
basic_block.h
|
|
constants.h
|
|
def_use_manager.h
|
|
eliminate_dead_constant_pass.h
|
|
function.h
|
|
fold_spec_constant_op_and_composite_pass.h
|
|
freeze_spec_constant_value_pass.h
|
|
instruction.h
|
|
ir_loader.h
|
|
libspirv.hpp
|
|
module.h
|
|
null_pass.h
|
|
reflect.h
|
|
pass.h
|
|
passes.h
|
|
pass_manager.h
|
|
strip_debug_info_pass.h
|
|
types.h
|
|
type_manager.h
|
|
unify_const_pass.h
|
|
|
|
def_use_manager.cpp
|
|
eliminate_dead_constant_pass.cpp
|
|
function.cpp
|
|
fold_spec_constant_op_and_composite_pass.cpp
|
|
freeze_spec_constant_value_pass.cpp
|
|
instruction.cpp
|
|
ir_loader.cpp
|
|
libspirv.cpp
|
|
module.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
|
|
PRIVATE ${spirv-tools_SOURCE_DIR}/include
|
|
PUBLIC ${SPIRV_HEADER_INCLUDE_DIR}
|
|
)
|