Skip to content

Commit

Permalink
[SYCL][libclc] Remangler fixes (#7723)
Browse files Browse the repository at this point in the history
@pvchupin I've fixed the issues you mentioned in
#7220 (comment) (the
last two commits):
* shared libs build: e0f3a52
* windows mangling: b88627f

The rest is as per #7220

Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Co-authored-by: premanandrao <premanand.m.rao@intel.com>
Co-authored-by: Steffen Larsen <steffen.larsen@intel.com>
  • Loading branch information
4 people authored Dec 9, 2022
1 parent f5fb759 commit f32d34f
Show file tree
Hide file tree
Showing 4 changed files with 777 additions and 455 deletions.
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

0 comments on commit f32d34f

Please sign in to comment.