[llvm] r346127 - [CMake] Expose opt-remark tooling through libOptRemarks.dylib

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 20 15:31:44 PST 2018


On 11/05/2018 03:57 AM, Francis Visoiu Mistrih via llvm-commits wrote:
> Author: thegameg
> Date: Mon Nov  5 03:57:44 2018
> New Revision: 346127
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=346127&view=rev
> Log:
> [CMake] Expose opt-remark tooling through libOptRemarks.dylib
> 
> * Create an install target for it
> * Add it under tools/opt-remarks
> * Add an export file for the dylib
> * Install the llvm-c/OptRemarks.h header
> * Add an API to query its version
> 

Hi Francis,

Why is this library always built as a separate shared object instead
of being part of libLLVM.so?

-Tom

> rdar://45458839
> 
> Added:
>     llvm/trunk/tools/opt-remarks/
>     llvm/trunk/tools/opt-remarks/CMakeLists.txt
>     llvm/trunk/tools/opt-remarks/OptRemarks.exports
>     llvm/trunk/tools/opt-remarks/liboptremarks.cpp
> Modified:
>     llvm/trunk/cmake/modules/AddLLVM.cmake
>     llvm/trunk/include/llvm-c/OptRemarks.h
> 
> Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=346127&r1=346126&r2=346127&view=diff
> ==============================================================================
> --- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
> +++ llvm/trunk/cmake/modules/AddLLVM.cmake Mon Nov  5 03:57:44 2018
> @@ -635,6 +635,7 @@ macro(add_llvm_library name)
>      set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
>    else()
>      if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO" OR
> +        ${name} STREQUAL "OptRemarks" OR
>          (LLVM_LINK_LLVM_DYLIB AND ${name} STREQUAL "LLVM"))
>        set(install_dir lib${LLVM_LIBDIR_SUFFIX})
>        if(ARG_SHARED OR BUILD_SHARED_LIBS)
> 
> Modified: llvm/trunk/include/llvm-c/OptRemarks.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/OptRemarks.h?rev=346127&r1=346126&r2=346127&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm-c/OptRemarks.h (original)
> +++ llvm/trunk/include/llvm-c/OptRemarks.h Mon Nov  5 03:57:44 2018
> @@ -187,6 +187,13 @@ LLVMOptRemarkParserGetErrorMessage(LLVMO
>  extern void LLVMOptRemarkParserDispose(LLVMOptRemarkParserRef Parser);
>  
>  /**
> + * Returns the version of the opt-remarks dylib.
> + *
> + * \since OPT_REMARKS_API_VERSION=0
> + */
> +extern uint32_t LLVMOptRemarkVersion(void);
> +
> +/**
>   * @} // endgoup LLVMCOPTREMARKS
>   */
>  
> 
> Added: llvm/trunk/tools/opt-remarks/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt-remarks/CMakeLists.txt?rev=346127&view=auto
> ==============================================================================
> --- llvm/trunk/tools/opt-remarks/CMakeLists.txt (added)
> +++ llvm/trunk/tools/opt-remarks/CMakeLists.txt Mon Nov  5 03:57:44 2018
> @@ -0,0 +1,22 @@
> +set(LLVM_LINK_COMPONENTS
> +  OptRemarks
> +  )
> +
> +set(SOURCES
> +  liboptremarks.cpp
> +  )
> +
> +set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/OptRemarks.exports)
> +
> +add_llvm_library(OptRemarks SHARED ${SOURCES})
> +
> +install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/OptRemarks.h
> +  DESTINATION include/llvm-c
> +  COMPONENT OptRemarks)
> +
> +if (APPLE)
> +  set(OPTREMARKS_VERSION ${LLVM_VERSION_MAJOR})
> +  set_property(TARGET OptRemarks APPEND_STRING PROPERTY
> +              LINK_FLAGS
> +              " -compatibility_version 1 -current_version ${OPTREMARKS_VERSION}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
> +endif()
> 
> Added: llvm/trunk/tools/opt-remarks/OptRemarks.exports
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt-remarks/OptRemarks.exports?rev=346127&view=auto
> ==============================================================================
> --- llvm/trunk/tools/opt-remarks/OptRemarks.exports (added)
> +++ llvm/trunk/tools/opt-remarks/OptRemarks.exports Mon Nov  5 03:57:44 2018
> @@ -0,0 +1,6 @@
> +LLVMOptRemarkParserCreate
> +LLVMOptRemarkParserGetNext
> +LLVMOptRemarkParserHasError
> +LLVMOptRemarkParserGetErrorMessage
> +LLVMOptRemarkParserDispose
> +LLVMOptRemarkVersion
> 
> Added: llvm/trunk/tools/opt-remarks/liboptremarks.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt-remarks/liboptremarks.cpp?rev=346127&view=auto
> ==============================================================================
> --- llvm/trunk/tools/opt-remarks/liboptremarks.cpp (added)
> +++ llvm/trunk/tools/opt-remarks/liboptremarks.cpp Mon Nov  5 03:57:44 2018
> @@ -0,0 +1,18 @@
> +//===-liboptremarks.cpp - LLVM Opt-Remarks Shared Library -----------------===//
> +//
> +//                     The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
> +//===----------------------------------------------------------------------===//
> +//
> +// Provide a library to work with optimization remarks.
> +//
> +//===----------------------------------------------------------------------===//
> +
> +#include "llvm-c/OptRemarks.h"
> +
> +extern uint32_t LLVMOptRemarkVersion(void) {
> +  return OPT_REMARKS_API_VERSION;
> +}
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 



More information about the llvm-commits mailing list