Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions libclc/cmake/modules/AddLibclc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ macro(add_libclc_builtin_set arch_suffix)

# Generate remangled variants if requested
if( LIBCLC_GENERATE_REMANGLED_VARIANTS )
set(dummy_in "${CMAKE_BINARY_DIR}/lib/clc/libclc_dummy_in.cc")
add_custom_command( OUTPUT ${dummy_in}
COMMAND ${CMAKE_COMMAND} -E touch ${dummy_in} )
set(long_widths l32 l64)
set(char_signedness signed unsigned)
if( ${obj_suffix} STREQUAL "libspirv-nvptx64--nvidiacl.bc")
Expand All @@ -128,10 +131,11 @@ macro(add_libclc_builtin_set arch_suffix)
-o "${builtins_remangle_path}"
--long-width=${long_width}
--char-signedness=${signedness}
"$<TARGET_PROPERTY:prepare-${obj_suffix},TARGET_FILE>"
DEPENDS "${builtins_obj_path}" "prepare-${obj_suffix}" libclc-remangler )
--input-ir="$<TARGET_PROPERTY:prepare-${obj_suffix},TARGET_FILE>"
${dummy_in}
DEPENDS "${builtins_obj_path}" "prepare-${obj_suffix}" libclc-remangler ${dummy_in})
add_custom_target( "remangled-${long_width}-${signedness}_char.${obj_suffix_mangled}" ALL
DEPENDS "${builtins_remangle_path}" )
DEPENDS "${builtins_remangle_path}" "${dummy_in}")
set_target_properties("remangled-${long_width}-${signedness}_char.${obj_suffix_mangled}"
PROPERTIES TARGET_FILE "${builtins_remangle_path}")

Expand Down
24 changes: 24 additions & 0 deletions libclc/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,27 @@ foreach( t ${LIBCLC_TARGET_TO_TEST} )

endforeach( d )
endforeach( t )

if(LIBCLC_GENERATE_REMANGLED_VARIANTS)
# Run remangler in test mode if generating remangled variants and make sure
# it depends on check-libclc target.
# Both `long_widths` and `char_signedness` are set in AddLibclc.cmake and can
# be used here.
foreach(long_width ${long_widths})
foreach(signedness ${char_signedness})
# In `-t` (TestRun) the remangler does not perform any substitutions, it
# needs to make sure that the remangled name matches the original mangled
# one.
set (test_target_name "test-remangled-${long_width}-${signedness}_char")
add_custom_target(${test_target_name}
COMMAND libclc-remangler
--long-width=${long_width}
--char-signedness=${signedness}
--input-ir="$<TARGET_PROPERTY:prepare-${obj_suffix},TARGET_FILE>"
${dummy_in} -t -o -
DEPENDS "${builtins_obj_path}" "prepare-${obj_suffix}" "${dummy_in}" libclc-remangler)

add_dependencies(check-libclc ${test_target_name})
endforeach()
endforeach()
endif()
10 changes: 9 additions & 1 deletion libclc/utils/libclc-remangler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ target_include_directories(libclc-remangler PRIVATE
${CMAKE_SOURCE_DIR}/../clang/include
${CMAKE_BINARY_DIR}/tools/clang/include)

clang_target_link_libraries(libclc-remangler PRIVATE clangBasic)
clang_target_link_libraries(libclc-remangler
PRIVATE
clangAST
clangBasic
clangFrontend
clangTooling
clangSerialization
LLVMOption
)
Loading