Implement Linker (module combiner)
authorPierre Moreau <dev@pmoreau.org>
Thu, 13 Jul 2017 00:16:51 +0000 (02:16 +0200)
committerDavid Neto <dneto@google.com>
Fri, 6 Oct 2017 22:33:53 +0000 (18:33 -0400)
commit86627f7b3f725d390b6e09078db0f41f10c9d165
treec23fb62e45ebdef060e07eac66cc862fe343d89f
parent4b1577a0cbcfdbdbbe540b7ba91945b70ac7fb46
Implement Linker (module combiner)

Add extra iterators for ir::Module's sections
Add extra getters to ir::Function
Add a const version of BasicBlock::GetLabelInst()

Use the max of all inputs' version as version

Split debug in debug1 and debug2
- Debug1 instructions have to be placed before debug2 instructions.

Error out if different addressing or memory models are found

Exit early if no binaries were given

Error out if entry points are redeclared

Implement copy ctors for Function and BasicBlock
- Visual Studio ends up generating copy constructors that call deleted
  functions while compiling the linker code, while GCC and clang do not.
  So explicitly write those functions to avoid Visual Studio messing up.

Move removing duplicate capabilities to its own pass

Add functions running on all IDs present in an instruction

Remove duplicate SpvOpExtInstImport

Give default options value for link functions

Remove linkage capability if not making a library

Check types before allowing to link

Detect if two types/variables/functions have different decorations

Remove decorations of imported variables/functions and their types

Add a DecorationManager

Add a method for removing all decorations of id

Add methods for removing operands from instructions

Error out if one of the modules has a non-zero schema

Update README.md to talk about the linker

Do not freak out if an imported built-in variable has no export
43 files changed:
CMakeLists.txt
README.md
include/spirv-tools/linker.hpp [new file with mode: 0644]
include/spirv-tools/optimizer.hpp
source/CMakeLists.txt
source/link/CMakeLists.txt [new file with mode: 0644]
source/link/linker.cpp [new file with mode: 0644]
source/opt/CMakeLists.txt
source/opt/aggressive_dead_code_elim_pass.cpp
source/opt/basic_block.cpp
source/opt/basic_block.h
source/opt/decoration_manager.cpp [new file with mode: 0644]
source/opt/decoration_manager.h [new file with mode: 0644]
source/opt/def_use_manager.cpp
source/opt/def_use_manager.h
source/opt/eliminate_dead_constant_pass.cpp
source/opt/flatten_decoration_pass.cpp
source/opt/function.cpp
source/opt/function.h
source/opt/instruction.h
source/opt/ir_loader.cpp
source/opt/mem_pass.cpp
source/opt/module.cpp
source/opt/module.h
source/opt/pass_manager.cpp
source/opt/pass_manager.h
source/opt/reflect.h
source/opt/remove_duplicates_pass.cpp [new file with mode: 0644]
source/opt/remove_duplicates_pass.h [new file with mode: 0644]
source/opt/strip_debug_info_pass.cpp
test/CMakeLists.txt
test/link/CMakeLists.txt [new file with mode: 0644]
test/link/binary_version_test.cpp [new file with mode: 0644]
test/link/entry_points_test.cpp [new file with mode: 0644]
test/link/global_values_amount_test.cpp [new file with mode: 0644]
test/link/ids_limit_test.cpp [new file with mode: 0644]
test/link/linker_fixture.h [new file with mode: 0644]
test/link/matching_imports_to_exports_test.cpp [new file with mode: 0644]
test/link/memory_model_test.cpp [new file with mode: 0644]
test/opt/pass_manager_test.cpp
tools/CMakeLists.txt
tools/link/linker.cpp [new file with mode: 0644]
utils/check_copyright.py