[llvm] r211322 - Set gold plugin options in a sane order.
Rafael Espindola
rafael.espindola at gmail.com
Thu Jun 19 15:54:48 PDT 2014
Author: rafael
Date: Thu Jun 19 17:54:47 2014
New Revision: 211322
URL: http://llvm.org/viewvc/llvm-project?rev=211322&view=rev
Log:
Set gold plugin options in a sane order.
This fixes the processing of --plugin-opt=-jump-table-type=arity.
Nice properties:
* We call InitTargetOptionsFromCodeGenFlags once.
* We call parseCodeGenDebugOptions once.
* It works :-)
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=211322&r1=211321&r2=211322&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Thu Jun 19 17:54:47 2014
@@ -248,9 +248,7 @@ ld_plugin_status onload(ld_plugin_tv *tv
InitializeAllAsmParsers();
InitializeAllAsmPrinters();
InitializeAllDisassemblers();
- TargetOpts = InitTargetOptionsFromCodeGenFlags();
CodeGen = new LTOCodeGenerator();
- CodeGen->setTargetOptions(TargetOpts);
if (MAttrs.size()) {
std::string Attrs;
for (unsigned I = 0; I < MAttrs.size(); ++I) {
@@ -261,6 +259,18 @@ ld_plugin_status onload(ld_plugin_tv *tv
CodeGen->setAttr(Attrs.c_str());
}
+ // Pass through extra options to the code generator.
+ if (!options::extra.empty()) {
+ for (std::vector<std::string>::iterator it = options::extra.begin();
+ it != options::extra.end(); ++it) {
+ CodeGen->setCodeGenDebugOptions((*it).c_str());
+ }
+ }
+
+ CodeGen->parseCodeGenDebugOptions();
+ TargetOpts = InitTargetOptionsFromCodeGenFlags();
+ CodeGen->setTargetOptions(TargetOpts);
+
return LDPS_OK;
}
@@ -444,14 +454,6 @@ static ld_plugin_status all_symbols_read
if (!options::mcpu.empty())
CodeGen->setCpu(options::mcpu.c_str());
- // Pass through extra options to the code generator.
- if (!options::extra.empty()) {
- for (std::vector<std::string>::iterator it = options::extra.begin();
- it != options::extra.end(); ++it) {
- CodeGen->setCodeGenDebugOptions((*it).c_str());
- }
- }
-
if (options::generate_bc_file != options::BC_NO) {
std::string path;
if (options::generate_bc_file == options::BC_ONLY)
@@ -460,7 +462,6 @@ static ld_plugin_status all_symbols_read
path = options::bc_path;
else
path = output_name + ".bc";
- CodeGen->parseCodeGenDebugOptions();
std::string Error;
if (!CodeGen->writeMergedModules(path.c_str(), Error))
(*message)(LDPL_FATAL, "Failed to write the output file.");
@@ -473,7 +474,6 @@ static ld_plugin_status all_symbols_read
std::string ObjPath;
{
const char *Temp;
- CodeGen->parseCodeGenDebugOptions();
std::string Error;
if (!CodeGen->compile_to_file(&Temp, /*DisableOpt*/ false, /*DisableInline*/
false, /*DisableGVNLoadPRE*/ false, Error))
More information about the llvm-commits
mailing list