diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt index 8dcb27ad2941c..51f6ee10babb8 100644 --- a/libclc/CMakeLists.txt +++ b/libclc/CMakeLists.txt @@ -423,121 +423,6 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} ) if( ARCH STREQUAL "aarch64") string( APPEND CL_3_0_EXTENSIONS ",+cl_clang_storage_class_specifiers,+__opencl_c_fp64,+cl_khr_int64_base_atomics" ) endif() - - string( TOUPPER "CLC_${ARCH}" CLC_TARGET_DEFINE ) - - list( APPEND build_flags - -D__CLC_INTERNAL - -D${CLC_TARGET_DEFINE} - -I${CMAKE_CURRENT_SOURCE_DIR}/generic/include - # FIXME: Fix libclc to not require disabling this noisy warning - -Wno-bitwise-conditional-parentheses - ) - - set( bytecode_files "" ) - foreach( file IN LISTS gen_files rel_files ) - # We need to take each file and produce an absolute input file, as well - # as a unique architecture-specific output file. We deal with a mix of - # different input files, which makes this trickier. - if( ${file} IN_LIST gen_files ) - # Generated files are given just as file names, which we must make - # absolute to the binary directory. - set( input_file ${CMAKE_CURRENT_BINARY_DIR}/${file} ) - set( output_file "${LIBCLC_ARCH_OBJFILE_DIR}/${file}.bc" ) - else() - # Other files are originally relative to each SOURCE file, which are - # then make relative to the libclc root directory. We must normalize - # the path (e.g., ironing out any ".."), then make it relative to the - # root directory again, and use that relative path component for the - # binary path. - get_filename_component( abs_path ${file} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) - file( RELATIVE_PATH root_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${abs_path} ) - set( input_file ${CMAKE_CURRENT_SOURCE_DIR}/${file} ) - set( output_file "${LIBCLC_ARCH_OBJFILE_DIR}/${root_rel_path}.bc" ) - endif() - - get_filename_component( file_dir ${file} DIRECTORY ) - - compile_to_bc( - TRIPLE ${clang_triple} - INPUT ${input_file} - OUTPUT ${output_file} - EXTRA_OPTS "${mcpu}" -fno-builtin -nostdlib - "${build_flags}" -I${CMAKE_CURRENT_SOURCE_DIR}/${file_dir} - DEPENDENCIES generate_convert.cl clspv-generate_convert.cl - ) - list( APPEND bytecode_files ${output_file} ) - endforeach() - - set( builtins_comp_lib_tgt builtins.comp.${arch_suffix} ) - add_custom_target( ${builtins_comp_lib_tgt} - DEPENDS ${bytecode_files} - ) - set_target_properties( ${builtins_comp_lib_tgt} PROPERTIES FOLDER "libclc/Device IR/Comp" ) - - set( builtins_link_lib_tgt builtins.link.${arch_suffix} ) - link_bc( - TARGET ${builtins_link_lib_tgt} - INPUTS ${bytecode_files} - DEPENDENCIES ${builtins_comp_lib_tgt} - ) - - set( builtins_link_lib $ ) - - if( ARCH STREQUAL spirv OR ARCH STREQUAL spirv64 ) - set( spv_suffix ${arch_suffix}.spv ) - add_custom_command( OUTPUT ${spv_suffix} - COMMAND libclc::llvm-spirv ${spvflags} -o ${spv_suffix} ${builtins_link_lib} - DEPENDS ${builtins_link_lib} ${builtins_link_lib_tgt} - ) - add_custom_target( "prepare-${spv_suffix}" ALL DEPENDS "${spv_suffix}" ) - set_target_properties( "prepare-${spv_suffix}" PROPERTIES FOLDER "libclc/Device IR/Prepare" ) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${spv_suffix} - DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" ) - else() - set( builtins_opt_lib_tgt builtins.opt.${arch_suffix} ) - - # Add opt target - add_custom_command( OUTPUT ${builtins_opt_lib_tgt}.bc - COMMAND ${opt_exe} ${opt_flags} -o ${builtins_opt_lib_tgt}.bc - ${builtins_link_lib} - DEPENDS ${opt_target} ${builtins_link_lib} ${builtins_link_lib_tgt} - ) - add_custom_target( ${builtins_opt_lib_tgt} - ALL DEPENDS ${builtins_opt_lib_tgt}.bc - ) - set_target_properties( ${builtins_opt_lib_tgt} - PROPERTIES TARGET_FILE ${builtins_opt_lib_tgt}.bc - FOLDER "libclc/Device IR/Opt" - ) - - set( builtins_opt_lib $ ) - - # Add prepare target - set( obj_suffix ${arch_suffix}.bc ) - add_custom_command( OUTPUT ${obj_suffix} - COMMAND ${prepare_builtins_exe} -o ${obj_suffix} ${builtins_opt_lib} - DEPENDS ${builtins_opt_lib} ${builtins_opt_lib_tgt} ${prepare_builtins_target} ) - add_custom_target( prepare-${obj_suffix} ALL DEPENDS ${obj_suffix} ) - set_target_properties( "prepare-${obj_suffix}" PROPERTIES FOLDER "libclc/Device IR/Prepare" ) - - # nvptx-- targets don't include workitem builtins - if( NOT clang_triple MATCHES ".*ptx.*--$" ) - add_test( NAME external-calls-${obj_suffix} - COMMAND ./check_external_calls.sh ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} ${LLVM_TOOLS_BINARY_DIR} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) - endif() - - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" ) - foreach( a ${${d}_aliases} ) - set( alias_suffix "${a}-${clang_triple}.bc" ) - add_custom_target( ${alias_suffix} ALL - COMMAND ${CMAKE_COMMAND} -E create_symlink ${obj_suffix} ${alias_suffix} - DEPENDS prepare-${obj_suffix} ) - set_target_properties( "${alias_suffix}" PROPERTIES FOLDER "libclc/Device IR/Aliases" ) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${alias_suffix} DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" ) - endforeach( a ) - endif() if( supports_generic_addrspace ) string( APPEND CL_3_0_EXTENSIONS ",+__opencl_c_generic_address_space" ) if( has_distinct_generic_addrspace )