summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen/Main.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2018-05-07 23:41:48 +0000
committerChandler Carruth <chandlerc@gmail.com>2018-05-07 23:41:48 +0000
commit029cea90fa4abe3beb1915094e47995d63fcb743 (patch)
treebf25a3b5a2ad3893d4516b480ab665809e639ed4 /llvm/lib/TableGen/Main.cpp
parente2953dcbf702ab909d4c0fa154a7469e27246640 (diff)
downloadbcm5719-llvm-029cea90fa4abe3beb1915094e47995d63fcb743.tar.gz
bcm5719-llvm-029cea90fa4abe3beb1915094e47995d63fcb743.zip
Revert r330742: Let TableGen write output only if it changed, instead of doing so in cmake.
This change causes us to re-run tablegen for every single target on every single build. This is much, much worse than the problem being fixed AFAICT. On my system, it makes a clean rebuild of `llc` with nothing changed go from .5s to over 8s. On systems with less parallelism, slower file systems, or high process startup overhead this will be even more extreme. The only way I see this could be a win is in clean builds where we churn the filesystem. But I think incremental rebuild is more important, and so if we want to re-instate this, it needs to be done in a way that doesn't trigger constant re-runs of tablegen. llvm-svn: 331702
Diffstat (limited to 'llvm/lib/TableGen/Main.cpp')
-rw-r--r--llvm/lib/TableGen/Main.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/llvm/lib/TableGen/Main.cpp b/llvm/lib/TableGen/Main.cpp
index bcd7dce95a8..3a070162608 100644
--- a/llvm/lib/TableGen/Main.cpp
+++ b/llvm/lib/TableGen/Main.cpp
@@ -96,21 +96,8 @@ int llvm::TableGenMain(char *argv0, TableGenMainFn *MainFn) {
if (Parser.ParseFile())
return 1;
- // Write output to memory.
- std::string OutString;
- raw_string_ostream Out(OutString);
- if (MainFn(Out, Records))
- return 1;
-
- // Only updates the real output file if there are any differences.
- // This prevents recompilation of all the files depending on it if there
- // aren't any.
- if (auto ExistingOrErr = MemoryBuffer::getFile(OutputFilename))
- if (std::move(ExistingOrErr.get())->getBuffer() == Out.str())
- return 0;
-
std::error_code EC;
- ToolOutputFile OutFile(OutputFilename, EC, sys::fs::F_Text);
+ ToolOutputFile Out(OutputFilename, EC, sys::fs::F_Text);
if (EC)
return reportError(argv0, "error opening " + OutputFilename + ":" +
EC.message() + "\n");
@@ -118,12 +105,14 @@ int llvm::TableGenMain(char *argv0, TableGenMainFn *MainFn) {
if (int Ret = createDependencyFile(Parser, argv0))
return Ret;
}
- OutFile.os() << Out.str();
+
+ if (MainFn(Out.os(), Records))
+ return 1;
if (ErrorsPrinted > 0)
return reportError(argv0, Twine(ErrorsPrinted) + " errors.\n");
// Declare success.
- OutFile.keep();
+ Out.keep();
return 0;
}
OpenPOWER on IntegriCloud