Let TableGen write output only if it changed, instead of doing so in cmake, attempt 2
authorNico Weber <nicolasweber@gmx.de>
Wed, 19 Dec 2018 13:35:53 +0000 (13:35 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 19 Dec 2018 13:35:53 +0000 (13:35 +0000)
commitf7cf1a1a7353dc5c578dfc85eb963e61a4d406cd
treeb68f7ad17c40e14c0235fb74d0750963bed31578
parent530108cb5cb5a0a2a632c3db1c1de61c09371973
Let TableGen write output only if it changed, instead of doing so in cmake, attempt 2

This relands r330742:
"""
Let TableGen write output only if it changed, instead of doing so in cmake.

Removes one subprocess and one temp file from the build for each tablegen
invocation.

No intended behavior change.
"""

In particular, if you see rebuilds after this change that you didn't see
before this change, that's unintended and it's fine to revert this change
again (but let me know).

r330742 got reverted because some people reported that llvm-tblgen ran on every
build after it.  This could happen if the depfile output got deleted without
deleting the main .inc output. To fix, make TableGen always write the depfile,
but keep writing the main .inc output only if it has changed. This matches what
we did in cmake before.

Differential Revision: https://reviews.llvm.org/D55842

llvm-svn: 349624
llvm/cmake/modules/TableGen.cmake
llvm/lib/TableGen/Main.cpp
llvm/utils/gn/secondary/llvm/utils/TableGen/tablegen.gni