diff options
author | Joseph Huber <jhuber6@vols.utk.edu> | 2022-07-21 14:38:11 -0400 |
---|---|---|
committer | Joseph Huber <jhuber6@vols.utk.edu> | 2022-07-22 08:24:35 -0400 |
commit | 908054df4f15d44a5e1e72d95aa2bcf92ddb6e1a (patch) | |
tree | 1966d4437eb9f38f9c4f3303ac774460385f7fe9 /openmp | |
parent | 3d0ab8638ba4c29563a6bcc2379abbdbce34fd47 (diff) | |
download | llvm-908054df4f15d44a5e1e72d95aa2bcf92ddb6e1a.zip llvm-908054df4f15d44a5e1e72d95aa2bcf92ddb6e1a.tar.gz llvm-908054df4f15d44a5e1e72d95aa2bcf92ddb6e1a.tar.bz2 |
[Libomptarget] Only export needed definitions in the BC library
This patch adds the use of the `-internalize-public-api-file` option in
the internalization pass to internalize any definition that isn't
explicitly needed for the interface. This will allow us to perform more
optimizations on the file that normally would not have been possible
with functions internal to the library not being internal.
Depends on D130293
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D130298
Diffstat (limited to 'openmp')
-rw-r--r-- | openmp/libomptarget/DeviceRTL/CMakeLists.txt | 12 | ||||
-rw-r--r-- | openmp/libomptarget/DeviceRTL/src/exports | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/openmp/libomptarget/DeviceRTL/CMakeLists.txt b/openmp/libomptarget/DeviceRTL/CMakeLists.txt index 0c74006..04ee959 100644 --- a/openmp/libomptarget/DeviceRTL/CMakeLists.txt +++ b/openmp/libomptarget/DeviceRTL/CMakeLists.txt @@ -108,6 +108,7 @@ set(src_files set(clang_opt_flags -O3 -mllvm -openmp-opt-disable -DSHARED_SCRATCHPAD_SIZE=512) set(link_opt_flags -O3 -openmp-opt-disable) +set(link_export_flag -passes=internalize -internalize-public-api-file=${source_directory}/exports) # Prepend -I to each list element set (LIBOMPTARGET_LLVM_INCLUDE_DIRS_DEVICERTL "${LIBOMPTARGET_LLVM_INCLUDE_DIRS}") @@ -173,10 +174,17 @@ function(compileDeviceRTLLibrary target_cpu target_name) COMMENT "Linking LLVM bitcode ${bclib_name}" ) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/internalized_${bclib_name} + COMMAND ${OPT_TOOL} ${link_export_flag} ${CMAKE_CURRENT_BINARY_DIR}/linked_${bclib_name} + -o ${CMAKE_CURRENT_BINARY_DIR}/internalized_${bclib_name} + DEPENDS ${source_directory}/exports ${CMAKE_CURRENT_BINARY_DIR}/linked_${bclib_name} + COMMENT "Internalizing LLVM bitcode ${bclib_name}" + ) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name} - COMMAND ${OPT_TOOL} ${link_opt_flags} ${CMAKE_CURRENT_BINARY_DIR}/linked_${bclib_name} + COMMAND ${OPT_TOOL} ${link_opt_flags} ${CMAKE_CURRENT_BINARY_DIR}/internalized_${bclib_name} -o ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/linked_${bclib_name} + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/internalized_${bclib_name} COMMENT "Optimizing LLVM bitcode ${bclib_name}" ) diff --git a/openmp/libomptarget/DeviceRTL/src/exports b/openmp/libomptarget/DeviceRTL/src/exports new file mode 100644 index 0000000..58cbeb1 --- /dev/null +++ b/openmp/libomptarget/DeviceRTL/src/exports @@ -0,0 +1,3 @@ +omp_* +*llvm_* +__kmpc_* |