mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-13 17:38:39 +00:00
Add an also-emit-llvm option to the gold plugin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103714 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
49ed921190
commit
62bacd69c2
@ -59,6 +59,7 @@ namespace {
|
|||||||
|
|
||||||
namespace options {
|
namespace options {
|
||||||
static bool generate_api_file = false;
|
static bool generate_api_file = false;
|
||||||
|
static std::string bc_path;
|
||||||
static const char *as_path = NULL;
|
static const char *as_path = NULL;
|
||||||
// Additional options to pass into the code generator.
|
// Additional options to pass into the code generator.
|
||||||
// Note: This array will contain all plugin options which are not claimed
|
// Note: This array will contain all plugin options which are not claimed
|
||||||
@ -81,6 +82,14 @@ namespace options {
|
|||||||
} else {
|
} else {
|
||||||
as_path = strdup(opt + 3);
|
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 {
|
} else {
|
||||||
// Save this option to pass to the code generator.
|
// Save this option to pass to the code generator.
|
||||||
extra.push_back(std::string(opt));
|
extra.push_back(std::string(opt));
|
||||||
@ -374,6 +383,11 @@ static ld_plugin_status all_symbols_read_hook(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
size_t bufsize = 0;
|
||||||
const char *buffer = static_cast<const char *>(lto_codegen_compile(cg,
|
const char *buffer = static_cast<const char *>(lto_codegen_compile(cg,
|
||||||
&bufsize));
|
&bufsize));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user