mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-12-27 02:10:15 +00:00
93c4c184d5
By using forward pointers, we are able to define a struct that has a pointer to itself. This could be directly or indirectly. The current implementation of the type manager did not handle this case. There are three changes that are made in this commit inorder to handle this case: 1) Change the handling of OpTypeForwardPointer The current handling of OpTypeForwardsPointer is broken if there is a reference to the pointer before the real definition. When build the type that contain the forward delared pointer, the type manager will ask for the type for that ID, and will get a nullptr because it does not exists. This nullptr is not handleded very well. The change is to keep track of the incomplete types the first time through all of the types. An incomplete type is a ForwardPointer or any type that references an incomplete type. Then we implement a second pass through the incomplete types that will complete them. 2) Hashing types. When hashing a type, we want to uses all of the subtypes as part of the hash. However, with types that reference them selves, this creates an infinite recursion. To get around this, we keep track of which types have been seen on the path from the root type. If we have see the current type already then we can stop the recursion. 3) Comparing types. In order to check if two types are the same, we must check that all of their subtypes are the same as well. This also causes an infinit recursion. The solution is to stop comparing the subtypes if we are trying to compare two pointer types that we are already in the middle of comparing. The ideas is that if the two pointer are different, then in progress compare will return false itself. Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1578. |
||
---|---|---|
.. | ||
comp | ||
link | ||
opt | ||
scripts | ||
stats | ||
util | ||
val | ||
assembly_context_test.cpp | ||
assembly_format_test.cpp | ||
binary_destroy_test.cpp | ||
binary_endianness_test.cpp | ||
binary_header_get_test.cpp | ||
binary_parse_test.cpp | ||
binary_strnlen_s_test.cpp | ||
binary_to_text_test.cpp | ||
binary_to_text.literal_test.cpp | ||
bit_stream.cpp | ||
c_interface_test.cpp | ||
CMakeLists.txt | ||
comment_test.cpp | ||
cpp_interface_test.cpp | ||
diagnostic_test.cpp | ||
enum_set_test.cpp | ||
enum_string_mapping_test.cpp | ||
ext_inst.debuginfo_test.cpp | ||
ext_inst.glsl_test.cpp | ||
ext_inst.opencl_test.cpp | ||
fix_word_test.cpp | ||
generator_magic_number_test.cpp | ||
hex_float_test.cpp | ||
huffman_codec.cpp | ||
immediate_int_test.cpp | ||
libspirv_macros_test.cpp | ||
log_test.cpp | ||
move_to_front_test.cpp | ||
name_mapper_test.cpp | ||
named_id_test.cpp | ||
opcode_make_test.cpp | ||
opcode_require_capabilities_test.cpp | ||
opcode_split_test.cpp | ||
opcode_table_get_test.cpp | ||
operand_capabilities_test.cpp | ||
operand_pattern_test.cpp | ||
operand_test.cpp | ||
operand-class-test-coverage.csv | ||
parse_number_test.cpp | ||
preserve_numeric_ids_test.cpp | ||
software_version_test.cpp | ||
string_utils_test.cpp | ||
target_env_test.cpp | ||
test_fixture.h | ||
text_advance_test.cpp | ||
text_destroy_test.cpp | ||
text_literal_test.cpp | ||
text_start_new_inst_test.cpp | ||
text_to_binary_test.cpp | ||
text_to_binary.annotation_test.cpp | ||
text_to_binary.barrier_test.cpp | ||
text_to_binary.constant_test.cpp | ||
text_to_binary.control_flow_test.cpp | ||
text_to_binary.debug_test.cpp | ||
text_to_binary.device_side_enqueue_test.cpp | ||
text_to_binary.extension_test.cpp | ||
text_to_binary.function_test.cpp | ||
text_to_binary.group_test.cpp | ||
text_to_binary.image_test.cpp | ||
text_to_binary.literal_test.cpp | ||
text_to_binary.memory_test.cpp | ||
text_to_binary.misc_test.cpp | ||
text_to_binary.mode_setting_test.cpp | ||
text_to_binary.pipe_storage_test.cpp | ||
text_to_binary.reserved_sampling_test.cpp | ||
text_to_binary.subgroup_dispatch_test.cpp | ||
text_to_binary.type_declaration_test.cpp | ||
text_word_get_test.cpp | ||
timer_test.cpp | ||
unit_spirv.cpp | ||
unit_spirv.h |