[llvm] r235732 - [CMake] Fix for PR 23328: LLVM_OPTIMIZED_TABLEGEN broken

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 1 11:20:45 PDT 2016


Chris, excuse me to respond an older commit.

On Sat, Apr 25, 2015 at 2:17 AM Chris Bieneman <beanz at apple.com> wrote:

> Author: cbieneman
> Date: Fri Apr 24 12:09:20 2015
> New Revision: 235732
>
> URL: http://llvm.org/viewvc/llvm-project?rev=235732&view=rev
> Log:
> [CMake] Fix for PR 23328: LLVM_OPTIMIZED_TABLEGEN broken
>
> In CMake dependencies can be filenames or targets, and targets can't be
> filenames. The Ninja generator handles filename dependencies because it
> generates targets for every output file from a command. For example:
>
> add_custom_command(OUTPUT foo.txt COMMAND touch foo.txt)
>
> With the Ninja generator this generates a target foo.txt, but with the
> Makefile generator it doesn't. This is probably because Ninja explicitly
> requires these hard dependency ties, and Make just behaves oddly in general.
>
> To fix this we need to make the tablegen actions depend on a target rather
> than a filename.
>
> Modified:
>     llvm/trunk/cmake/modules/TableGen.cmake
>
> Modified: llvm/trunk/cmake/modules/TableGen.cmake
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=235732&r1=235731&r2=235732&view=diff
>
> ==============================================================================
> --- llvm/trunk/cmake/modules/TableGen.cmake (original)
> +++ llvm/trunk/cmake/modules/TableGen.cmake Fri Apr 24 12:09:20 2015
> @@ -32,7 +32,7 @@ function(tablegen project ofn)
>      # The file in LLVM_TARGET_DEFINITIONS may be not in the current
>      # directory and local_tds may not contain it, so we must
>      # explicitly list it here:
> -    DEPENDS ${${project}_TABLEGEN_EXE} ${local_tds} ${global_tds}
> +    DEPENDS ${${project}_TABLEGEN_TARGET} ${local_tds} ${global_tds}
>

I think it'd be wrong. Order-only dependency is generated in trunk.

  build include/llvm/IR/Intrinsics.gen.tmp: CUSTOM_COMMAND foo.td ...
  || utils/TableGen/LLVM-tablegen-host

I think it should be right with ${${project}_TABLEGEN_EXE}. Files (or
executable targets) may be described here.

     ${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
>      COMMENT "Building ${ofn}..."
>      )
> @@ -90,6 +90,7 @@ macro(add_tablegen target project)
>
>    # Effective tblgen executable to be used:
>    set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN} PARENT_SCOPE)
> +  set(${project}_TABLEGEN_TARGET ${${project}_TABLEGEN} PARENT_SCOPE)
>
>    if(LLVM_USE_HOST_TOOLS)
>      if( ${${project}_TABLEGEN} STREQUAL "${target}" )
> @@ -101,8 +102,8 @@ macro(add_tablegen target project)
>          DEPENDS CONFIGURE_LLVM_NATIVE ${target}
>          WORKING_DIRECTORY ${LLVM_NATIVE_BUILD}
>          COMMENT "Building native TableGen...")
> -      add_custom_target(${project}NativeTableGen DEPENDS
> ${${project}_TABLEGEN_EXE})
> -      add_dependencies(${project}NativeTableGen CONFIGURE_LLVM_NATIVE)
> +      add_custom_target(${project}-tablegen-host DEPENDS
> ${${project}_TABLEGEN_EXE})
> +      set(${project}_TABLEGEN_TARGET ${project}-tablegen-host
> PARENT_SCOPE)
>      endif()
>    endif()
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161101/3aefa8cd/attachment.html>


More information about the llvm-commits mailing list