This is an archive of the discontinued LLVM Phabricator instance.

TableGen: Add a --write-if-changed flag to tablegen directly instead of doing it in cmake.
ClosedPublic

Authored by thakis on Apr 20 2018, 12:58 PM.

Details

Reviewers
rnk
Summary

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

Diff Detail

Event Timeline

thakis created this revision.Apr 20 2018, 12:58 PM
thakis added inline comments.Apr 20 2018, 12:59 PM
lib/TableGen/Main.cpp
113

Not sure if we should even have a --write-if-changed flag instead of doing this unconditionally, since we always pass the flag.

rnk accepted this revision.Apr 23 2018, 5:50 PM
rnk added inline comments.
lib/TableGen/Main.cpp
110–112

A variable name like ExistingOrError might be better here, and we could probably write it like:

bool OutputChanged = true;
if (auto ExistingOrErr = MemoryBuffer::getFile(OutputFilename))
  OutputChanged = std::move(ExistingOrErr)->getBuffer() != Out.str();
113

I'm in favor of removing the option and doing this unconditionally.

This revision is now accepted and ready to land.Apr 23 2018, 5:50 PM
thakis closed this revision.Apr 24 2018, 10:32 AM
thakis marked 3 inline comments as done.

Thanks, landed with comment addressed and without a flag in r330742.