@@ -423,121 +423,6 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
423
423
if ( ARCH STREQUAL "aarch64" )
424
424
string ( APPEND CL_3_0_EXTENSIONS ",+cl_clang_storage_class_specifiers,+__opencl_c_fp64,+cl_khr_int64_base_atomics" )
425
425
endif ()
426
-
427
- string ( TOUPPER "CLC_${ARCH} " CLC_TARGET_DEFINE )
428
-
429
- list ( APPEND build_flags
430
- -D__CLC_INTERNAL
431
- -D${CLC_TARGET_DEFINE}
432
- -I${CMAKE_CURRENT_SOURCE_DIR}/generic/include
433
- # FIXME: Fix libclc to not require disabling this noisy warning
434
- -Wno-bitwise-conditional-parentheses
435
- )
436
-
437
- set ( bytecode_files "" )
438
- foreach ( file IN LISTS gen_files rel_files )
439
- # We need to take each file and produce an absolute input file, as well
440
- # as a unique architecture-specific output file. We deal with a mix of
441
- # different input files, which makes this trickier.
442
- if ( ${file} IN_LIST gen_files )
443
- # Generated files are given just as file names, which we must make
444
- # absolute to the binary directory.
445
- set ( input_file ${CMAKE_CURRENT_BINARY_DIR} /${file} )
446
- set ( output_file "${LIBCLC_ARCH_OBJFILE_DIR} /${file} .bc" )
447
- else ()
448
- # Other files are originally relative to each SOURCE file, which are
449
- # then make relative to the libclc root directory. We must normalize
450
- # the path (e.g., ironing out any ".."), then make it relative to the
451
- # root directory again, and use that relative path component for the
452
- # binary path.
453
- get_filename_component ( abs_path ${file} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
454
- file ( RELATIVE_PATH root_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${abs_path} )
455
- set ( input_file ${CMAKE_CURRENT_SOURCE_DIR} /${file} )
456
- set ( output_file "${LIBCLC_ARCH_OBJFILE_DIR} /${root_rel_path} .bc" )
457
- endif ()
458
-
459
- get_filename_component ( file_dir ${file} DIRECTORY )
460
-
461
- compile_to_bc (
462
- TRIPLE ${clang_triple}
463
- INPUT ${input_file}
464
- OUTPUT ${output_file}
465
- EXTRA_OPTS "${mcpu} " -fno-builtin -nostdlib
466
- "${build_flags} " -I${CMAKE_CURRENT_SOURCE_DIR}/${file_dir}
467
- DEPENDENCIES generate_convert.cl clspv-generate_convert.cl
468
- )
469
- list ( APPEND bytecode_files ${output_file} )
470
- endforeach ()
471
-
472
- set ( builtins_comp_lib_tgt builtins.comp.${arch_suffix} )
473
- add_custom_target ( ${builtins_comp_lib_tgt}
474
- DEPENDS ${bytecode_files}
475
- )
476
- set_target_properties ( ${builtins_comp_lib_tgt} PROPERTIES FOLDER "libclc/Device IR/Comp" )
477
-
478
- set ( builtins_link_lib_tgt builtins.link.${arch_suffix} )
479
- link_bc (
480
- TARGET ${builtins_link_lib_tgt}
481
- INPUTS ${bytecode_files}
482
- DEPENDENCIES ${builtins_comp_lib_tgt}
483
- )
484
-
485
- set ( builtins_link_lib $< TARGET_PROPERTY:${builtins_link_lib_tgt} ,TARGET_FILE> )
486
-
487
- if ( ARCH STREQUAL spirv OR ARCH STREQUAL spirv64 )
488
- set ( spv_suffix ${arch_suffix} .spv )
489
- add_custom_command ( OUTPUT ${spv_suffix}
490
- COMMAND libclc::llvm-spirv ${spvflags} -o ${spv_suffix} ${builtins_link_lib}
491
- DEPENDS ${builtins_link_lib} ${builtins_link_lib_tgt}
492
- )
493
- add_custom_target ( "prepare-${spv_suffix} " ALL DEPENDS "${spv_suffix} " )
494
- set_target_properties ( "prepare-${spv_suffix} " PROPERTIES FOLDER "libclc/Device IR/Prepare" )
495
- install ( FILES ${CMAKE_CURRENT_BINARY_DIR} /${spv_suffix}
496
- DESTINATION "${CMAKE_INSTALL_DATADIR} /clc" )
497
- else ()
498
- set ( builtins_opt_lib_tgt builtins.opt.${arch_suffix} )
499
-
500
- # Add opt target
501
- add_custom_command ( OUTPUT ${builtins_opt_lib_tgt} .bc
502
- COMMAND ${opt_exe} ${opt_flags} -o ${builtins_opt_lib_tgt} .bc
503
- ${builtins_link_lib}
504
- DEPENDS ${opt_target} ${builtins_link_lib} ${builtins_link_lib_tgt}
505
- )
506
- add_custom_target ( ${builtins_opt_lib_tgt}
507
- ALL DEPENDS ${builtins_opt_lib_tgt} .bc
508
- )
509
- set_target_properties ( ${builtins_opt_lib_tgt}
510
- PROPERTIES TARGET_FILE ${builtins_opt_lib_tgt} .bc
511
- FOLDER "libclc/Device IR/Opt"
512
- )
513
-
514
- set ( builtins_opt_lib $< TARGET_PROPERTY:${builtins_opt_lib_tgt} ,TARGET_FILE> )
515
-
516
- # Add prepare target
517
- set ( obj_suffix ${arch_suffix} .bc )
518
- add_custom_command ( OUTPUT ${obj_suffix}
519
- COMMAND ${prepare_builtins_exe} -o ${obj_suffix} ${builtins_opt_lib}
520
- DEPENDS ${builtins_opt_lib} ${builtins_opt_lib_tgt} ${prepare_builtins_target} )
521
- add_custom_target ( prepare-${obj_suffix} ALL DEPENDS ${obj_suffix} )
522
- set_target_properties ( "prepare-${obj_suffix} " PROPERTIES FOLDER "libclc/Device IR/Prepare" )
523
-
524
- # nvptx-- targets don't include workitem builtins
525
- if ( NOT clang_triple MATCHES ".*ptx.*--$" )
526
- add_test ( NAME external-calls-${obj_suffix}
527
- COMMAND ./check_external_calls.sh ${CMAKE_CURRENT_BINARY_DIR} /${obj_suffix} ${LLVM_TOOLS_BINARY_DIR}
528
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
529
- endif ()
530
-
531
- install ( FILES ${CMAKE_CURRENT_BINARY_DIR} /${obj_suffix} DESTINATION "${CMAKE_INSTALL_DATADIR} /clc" )
532
- foreach ( a ${${d}_aliases} )
533
- set ( alias_suffix "${a} -${clang_triple} .bc" )
534
- add_custom_target ( ${alias_suffix} ALL
535
- COMMAND ${CMAKE_COMMAND} -E create_symlink ${obj_suffix} ${alias_suffix}
536
- DEPENDS prepare-${obj_suffix} )
537
- set_target_properties ( "${alias_suffix} " PROPERTIES FOLDER "libclc/Device IR/Aliases" )
538
- install ( FILES ${CMAKE_CURRENT_BINARY_DIR} /${alias_suffix} DESTINATION "${CMAKE_INSTALL_DATADIR} /clc" )
539
- endforeach ( a )
540
- endif ()
541
426
if ( supports_generic_addrspace )
542
427
string ( APPEND CL_3_0_EXTENSIONS ",+__opencl_c_generic_address_space" )
543
428
if ( has_distinct_generic_addrspace )
0 commit comments