[llvm-commits] [llvm] r103714 - /llvm/trunk/tools/gold/gold-plugin.cpp
Rafael Espindola
rafael.espindola at gmail.com
Thu May 13 06:39:31 PDT 2010
Author: rafael
Date: Thu May 13 08:39:31 2010
New Revision: 103714
URL: http://llvm.org/viewvc/llvm-project?rev=103714&view=rev
Log:
Add an also-emit-llvm option to the gold plugin.
Modified:
llvm/trunk/tools/gold/gold-plugin.cpp
Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=103714&r1=103713&r2=103714&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Thu May 13 08:39:31 2010
@@ -59,6 +59,7 @@
namespace options {
static bool generate_api_file = false;
+ static std::string bc_path;
static const char *as_path = NULL;
// Additional options to pass into the code generator.
// Note: This array will contain all plugin options which are not claimed
@@ -81,6 +82,14 @@
} else {
as_path = strdup(opt + 3);
}
+ } else if(llvm::StringRef(opt).startswith("also-emit-llvm=")) {
+ const char *path = opt + strlen("also-emit-llvm=");
+ if (bc_path != "") {
+ (*message)(LDPL_WARNING, "Path to the output IL file specified twice. "
+ "Discarding %s", opt);
+ } else {
+ bc_path = path;
+ }
} else {
// Save this option to pass to the code generator.
extra.push_back(std::string(opt));
@@ -374,6 +383,11 @@
}
}
+ if (options::bc_path != "") {
+ bool err = lto_codegen_write_merged_modules(cg, options::bc_path.c_str());
+ if (err)
+ (*message)(LDPL_FATAL, "Failed to write the output file.");
+ }
size_t bufsize = 0;
const char *buffer = static_cast<const char *>(lto_codegen_compile(cg,
&bufsize));
More information about the llvm-commits
mailing list