Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: llvm/tools/gold/gold-plugin.cpp

Issue 10808021: Change LLVM bitcode linking to use tree reduction to scale better (Closed)
Patch Set: stuff Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « llvm/include/llvm-c/lto.h ('k') | llvm/tools/llc/llc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: llvm/tools/gold/gold-plugin.cpp
===================================================================
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -99,6 +99,7 @@
namespace options {
enum generate_bc { BC_NO, BC_ALSO, BC_ONLY };
static bool generate_api_file = false;
+ static bool gather_then_link = true; // @LOCALMOD
static generate_bc generate_bc_file = BC_NO;
static std::string bc_path;
static std::string obj_path;
@@ -128,6 +129,10 @@
triple = opt.substr(strlen("mtriple="));
} else if (opt.startswith("obj-path=")) {
obj_path = opt.substr(strlen("obj-path="));
+ // @LOCALMOD-BEGIN
+ } else if (opt == "no-gather-then-link") {
+ gather_then_link = false;
+ // @LOCALMOD-END
} else if (opt == "emit-llvm") {
generate_bc_file = BC_ONLY;
} else if (opt == "also-emit-llvm") {
@@ -461,14 +466,20 @@
DepLibs.push_back(soname);
}
} else {
- lto_codegen_add_module(code_gen, M);
+ if (options::gather_then_link) {
+ lto_codegen_gather_module_for_link(code_gen, M);
+ } else {
+ lto_codegen_add_module(code_gen, M);
+ }
cf.is_linked_in = true;
}
}
+
+ // With gather_then_link, the modules are disposed when linking.
+ if (!options::gather_then_link)
+ lto_module_dispose(M);
// @LOCALMOD-END
- lto_module_dispose(M);
-
return LDPS_OK;
}
@@ -480,6 +491,12 @@
std::ofstream api_file;
assert(code_gen);
+ // @LOCALMOD-BEGIN
+ if (options::gather_then_link) {
+ lto_codegen_link_gathered_modules_and_dispose(code_gen);
+ }
+ // @LOCALMOD-END
+
if (options::generate_api_file) {
api_file.open("apifile.txt", std::ofstream::out | std::ofstream::trunc);
if (!api_file.is_open()) {
« no previous file with comments | « llvm/include/llvm-c/lto.h ('k') | llvm/tools/llc/llc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698