blob: 7850b5d6d27ef6b1e9ca93d097ebc961fccfea36 [file] [log] [blame]
Nick Kledzik77595fc2008-02-26 20:26:43 +00001//===-LTOCodeGenerator.cpp - LLVM Link Time Optimizer ---------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the Link Time Optimization library. This library is
11// intended to be used by linker to optimize code at link time.
12//
13//===----------------------------------------------------------------------===//
14
Nick Kledzikef194ed2008-02-27 22:25:36 +000015#include "LTOModule.h"
16#include "LTOCodeGenerator.h"
17
Nick Kledzik77595fc2008-02-26 20:26:43 +000018#include "llvm/Constants.h"
19#include "llvm/DerivedTypes.h"
Nick Lewycky8189d402009-06-17 06:52:10 +000020#include "llvm/Linker.h"
Owen Anderson0e7a5462009-07-02 00:31:14 +000021#include "llvm/LLVMContext.h"
Nick Lewycky8189d402009-06-17 06:52:10 +000022#include "llvm/Module.h"
Nick Lewycky8189d402009-06-17 06:52:10 +000023#include "llvm/PassManager.h"
24#include "llvm/ADT/StringExtras.h"
Viktor Kutuzov51cdac02009-11-17 18:48:27 +000025#include "llvm/ADT/Triple.h"
Nick Lewycky8189d402009-06-17 06:52:10 +000026#include "llvm/Analysis/Passes.h"
Nick Kledzik77595fc2008-02-26 20:26:43 +000027#include "llvm/Bitcode/ReaderWriter.h"
Chris Lattner5ef31a02010-03-12 18:44:54 +000028#include "llvm/MC/MCAsmInfo.h"
29#include "llvm/MC/MCContext.h"
30#include "llvm/Target/Mangler.h"
31#include "llvm/Target/SubtargetFeature.h"
32#include "llvm/Target/TargetOptions.h"
33#include "llvm/Target/TargetData.h"
34#include "llvm/Target/TargetMachine.h"
35#include "llvm/Target/TargetRegistry.h"
36#include "llvm/Target/TargetSelect.h"
Nick Kledzik920ae982008-07-08 21:14:10 +000037#include "llvm/Support/CommandLine.h"
David Greene71847812009-07-14 20:18:05 +000038#include "llvm/Support/FormattedStream.h"
Nick Kledzik77595fc2008-02-26 20:26:43 +000039#include "llvm/Support/MemoryBuffer.h"
Daniel Dunbar006a0342009-06-03 21:06:14 +000040#include "llvm/Support/StandardPasses.h"
41#include "llvm/Support/SystemUtils.h"
Daniel Dunbar3c2d4bf2009-08-03 04:03:51 +000042#include "llvm/System/Host.h"
Chris Lattnerb683ea42009-08-23 21:36:09 +000043#include "llvm/System/Program.h"
Nick Kledzik77595fc2008-02-26 20:26:43 +000044#include "llvm/System/Signals.h"
Nick Kledzik77595fc2008-02-26 20:26:43 +000045#include "llvm/Config/config.h"
Nick Lewycky8189d402009-06-17 06:52:10 +000046#include <cstdlib>
Nick Kledzik77595fc2008-02-26 20:26:43 +000047#include <unistd.h>
Nick Kledzik77595fc2008-02-26 20:26:43 +000048#include <fcntl.h>
49
50
51using namespace llvm;
52
Nick Kledzik920ae982008-07-08 21:14:10 +000053static cl::opt<bool> DisableInline("disable-inlining",
54 cl::desc("Do not run the inliner pass"));
Nick Kledzik77595fc2008-02-26 20:26:43 +000055
56
57const char* LTOCodeGenerator::getVersionString()
58{
59#ifdef LLVM_VERSION_INFO
60 return PACKAGE_NAME " version " PACKAGE_VERSION ", " LLVM_VERSION_INFO;
61#else
62 return PACKAGE_NAME " version " PACKAGE_VERSION;
63#endif
64}
65
66
Owen Anderson0e7a5462009-07-02 00:31:14 +000067LTOCodeGenerator::LTOCodeGenerator()
68 : _context(getGlobalContext()),
Owen Anderson8b477ed2009-07-01 16:58:40 +000069 _linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL),
Nick Kledzik77595fc2008-02-26 20:26:43 +000070 _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false),
Nick Kledzikef194ed2008-02-27 22:25:36 +000071 _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
Nick Lewycky3e4c41a2009-08-03 07:16:42 +000072 _nativeObjectFile(NULL), _assemblerPath(NULL)
Nick Kledzik77595fc2008-02-26 20:26:43 +000073{
Nick Lewyckyd42b58b2009-07-26 22:16:39 +000074 InitializeAllTargets();
75 InitializeAllAsmPrinters();
Nick Kledzik77595fc2008-02-26 20:26:43 +000076}
77
78LTOCodeGenerator::~LTOCodeGenerator()
79{
Nick Kledzikef194ed2008-02-27 22:25:36 +000080 delete _target;
81 delete _nativeObjectFile;
Nick Kledzik77595fc2008-02-26 20:26:43 +000082}
83
84
85
86bool LTOCodeGenerator::addModule(LTOModule* mod, std::string& errMsg)
87{
88 return _linker.LinkInModule(mod->getLLVVMModule(), &errMsg);
89}
90
91
92bool LTOCodeGenerator::setDebugInfo(lto_debug_model debug, std::string& errMsg)
93{
94 switch (debug) {
95 case LTO_DEBUG_MODEL_NONE:
96 _emitDwarfDebugInfo = false;
97 return false;
98
99 case LTO_DEBUG_MODEL_DWARF:
100 _emitDwarfDebugInfo = true;
101 return false;
102 }
103 errMsg = "unknown debug format";
104 return true;
105}
106
107
108bool LTOCodeGenerator::setCodePICModel(lto_codegen_model model,
Evan Cheng855a1682009-06-26 06:57:16 +0000109 std::string& errMsg)
Nick Kledzik77595fc2008-02-26 20:26:43 +0000110{
111 switch (model) {
112 case LTO_CODEGEN_PIC_MODEL_STATIC:
113 case LTO_CODEGEN_PIC_MODEL_DYNAMIC:
114 case LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC:
115 _codeModel = model;
116 return false;
117 }
118 errMsg = "unknown pic model";
119 return true;
120}
121
Nick Kledzikcbad5862009-06-04 00:28:45 +0000122void LTOCodeGenerator::setAssemblerPath(const char* path)
123{
124 if ( _assemblerPath )
125 delete _assemblerPath;
126 _assemblerPath = new sys::Path(path);
127}
128
Rafael Espindola98197e52010-08-10 18:55:09 +0000129void LTOCodeGenerator::setAssemblerArgs(const char** args, int nargs)
130{
131 for (int i = 0; i < nargs; ++i) {
132 const char *arg = args[i];
133 _assemblerArgs.push_back(arg);
134 }
135}
136
Nick Kledzik77595fc2008-02-26 20:26:43 +0000137void LTOCodeGenerator::addMustPreserveSymbol(const char* sym)
138{
139 _mustPreserveSymbols[sym] = 1;
140}
141
142
Chris Lattnerb515d752009-08-23 07:49:08 +0000143bool LTOCodeGenerator::writeMergedModules(const char *path,
144 std::string &errMsg) {
145 if (determineTarget(errMsg))
146 return true;
Nick Kledzik77595fc2008-02-26 20:26:43 +0000147
Chris Lattnerb515d752009-08-23 07:49:08 +0000148 // mark which symbols can not be internalized
149 applyScopeRestrictions();
Nick Kledzik77595fc2008-02-26 20:26:43 +0000150
Chris Lattnerb515d752009-08-23 07:49:08 +0000151 // create output file
152 std::string ErrInfo;
153 raw_fd_ostream Out(path, ErrInfo,
Dan Gohmanbaa26392009-08-25 15:34:52 +0000154 raw_fd_ostream::F_Binary);
Chris Lattnerb515d752009-08-23 07:49:08 +0000155 if (!ErrInfo.empty()) {
156 errMsg = "could not open bitcode file for writing: ";
157 errMsg += path;
158 return true;
159 }
Nick Kledzik77595fc2008-02-26 20:26:43 +0000160
Chris Lattnerb515d752009-08-23 07:49:08 +0000161 // write bitcode to it
162 WriteBitcodeToFile(_linker.getModule(), Out);
Dan Gohman4b7416b2010-05-27 20:19:47 +0000163 Out.close();
164
Chris Lattnerb515d752009-08-23 07:49:08 +0000165 if (Out.has_error()) {
166 errMsg = "could not write bitcode file: ";
167 errMsg += path;
Dan Gohman4b7416b2010-05-27 20:19:47 +0000168 Out.clear_error();
Chris Lattnerb515d752009-08-23 07:49:08 +0000169 return true;
170 }
171
172 return false;
Nick Kledzik77595fc2008-02-26 20:26:43 +0000173}
174
175
Nick Kledzikef194ed2008-02-27 22:25:36 +0000176const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg)
Nick Kledzik77595fc2008-02-26 20:26:43 +0000177{
Nick Kledzikef194ed2008-02-27 22:25:36 +0000178 // make unique temp .s file to put generated assembly code
Nick Kledzik77595fc2008-02-26 20:26:43 +0000179 sys::Path uniqueAsmPath("lto-llvm.s");
180 if ( uniqueAsmPath.createTemporaryFileOnDisk(true, &errMsg) )
181 return NULL;
182 sys::RemoveFileOnSignal(uniqueAsmPath);
183
184 // generate assembly code
Owen Andersoncb371882008-08-21 00:14:44 +0000185 bool genResult = false;
186 {
Dan Gohmanbaa26392009-08-25 15:34:52 +0000187 raw_fd_ostream asmFD(uniqueAsmPath.c_str(), errMsg);
David Greene71847812009-07-14 20:18:05 +0000188 formatted_raw_ostream asmFile(asmFD);
Dan Gohmaned3e8b42008-08-21 15:33:45 +0000189 if (!errMsg.empty())
190 return NULL;
Owen Andersoncb371882008-08-21 00:14:44 +0000191 genResult = this->generateAssemblyCode(asmFile, errMsg);
192 }
Nick Kledzik77595fc2008-02-26 20:26:43 +0000193 if ( genResult ) {
Dan Gohmand27047f2010-05-27 20:51:54 +0000194 uniqueAsmPath.eraseFromDisk();
Nick Kledzik77595fc2008-02-26 20:26:43 +0000195 return NULL;
196 }
197
Nick Kledzikef194ed2008-02-27 22:25:36 +0000198 // make unique temp .o file to put generated object file
Nick Kledzik77595fc2008-02-26 20:26:43 +0000199 sys::PathWithStatus uniqueObjPath("lto-llvm.o");
200 if ( uniqueObjPath.createTemporaryFileOnDisk(true, &errMsg) ) {
Dan Gohmand27047f2010-05-27 20:51:54 +0000201 uniqueAsmPath.eraseFromDisk();
Nick Kledzik77595fc2008-02-26 20:26:43 +0000202 return NULL;
203 }
204 sys::RemoveFileOnSignal(uniqueObjPath);
205
206 // assemble the assembly code
Chris Lattner74382b72009-08-23 22:45:37 +0000207 const std::string& uniqueObjStr = uniqueObjPath.str();
208 bool asmResult = this->assemble(uniqueAsmPath.str(), uniqueObjStr, errMsg);
Nick Kledzik77595fc2008-02-26 20:26:43 +0000209 if ( !asmResult ) {
Nick Kledzikef194ed2008-02-27 22:25:36 +0000210 // remove old buffer if compile() called twice
211 delete _nativeObjectFile;
212
Nick Kledzik77595fc2008-02-26 20:26:43 +0000213 // read .o file into memory buffer
Chris Lattner038112a2008-04-01 18:04:03 +0000214 _nativeObjectFile = MemoryBuffer::getFile(uniqueObjStr.c_str(),&errMsg);
Nick Kledzik77595fc2008-02-26 20:26:43 +0000215 }
Nick Kledzikef194ed2008-02-27 22:25:36 +0000216
217 // remove temp files
Nick Kledzik77595fc2008-02-26 20:26:43 +0000218 uniqueAsmPath.eraseFromDisk();
219 uniqueObjPath.eraseFromDisk();
Nick Kledzikef194ed2008-02-27 22:25:36 +0000220
221 // return buffer, unless error
222 if ( _nativeObjectFile == NULL )
223 return NULL;
224 *length = _nativeObjectFile->getBufferSize();
225 return _nativeObjectFile->getBufferStart();
Nick Kledzik77595fc2008-02-26 20:26:43 +0000226}
227
228
229bool LTOCodeGenerator::assemble(const std::string& asmPath,
230 const std::string& objPath, std::string& errMsg)
231{
Nick Kledzikcbad5862009-06-04 00:28:45 +0000232 sys::Path tool;
233 bool needsCompilerOptions = true;
234 if ( _assemblerPath ) {
235 tool = *_assemblerPath;
236 needsCompilerOptions = false;
Nick Lewycky195bea32009-04-30 15:24:09 +0000237 } else {
238 // find compiler driver
Nick Kledzikcbad5862009-06-04 00:28:45 +0000239 tool = sys::Program::FindProgramByName("gcc");
240 if ( tool.isEmpty() ) {
Nick Lewycky195bea32009-04-30 15:24:09 +0000241 errMsg = "can't locate gcc";
242 return true;
243 }
Nick Kledzik77595fc2008-02-26 20:26:43 +0000244 }
245
246 // build argument list
247 std::vector<const char*> args;
Viktor Kutuzov51cdac02009-11-17 18:48:27 +0000248 llvm::Triple targetTriple(_linker.getModule()->getTargetTriple());
249 const char *arch = targetTriple.getArchNameForAssembler();
250
Nick Kledzikcbad5862009-06-04 00:28:45 +0000251 args.push_back(tool.c_str());
Viktor Kutuzov51cdac02009-11-17 18:48:27 +0000252
253 if (targetTriple.getOS() == Triple::Darwin) {
Nick Kledzikd8b47112009-06-04 19:14:08 +0000254 // darwin specific command line options
Viktor Kutuzov51cdac02009-11-17 18:48:27 +0000255 if (arch != NULL) {
Nick Kledzik77595fc2008-02-26 20:26:43 +0000256 args.push_back("-arch");
Viktor Kutuzov51cdac02009-11-17 18:48:27 +0000257 args.push_back(arch);
Bob Wilson75d6ffd2009-06-22 18:01:28 +0000258 }
Nick Kledzikd8b47112009-06-04 19:14:08 +0000259 // add -static to assembler command line when code model requires
Chris Lattner5ef31a02010-03-12 18:44:54 +0000260 if ( (_assemblerPath != NULL) &&
261 (_codeModel == LTO_CODEGEN_PIC_MODEL_STATIC) )
Nick Kledzikd8b47112009-06-04 19:14:08 +0000262 args.push_back("-static");
Nick Kledzik77595fc2008-02-26 20:26:43 +0000263 }
Nick Kledzikcbad5862009-06-04 00:28:45 +0000264 if ( needsCompilerOptions ) {
265 args.push_back("-c");
266 args.push_back("-x");
267 args.push_back("assembler");
Rafael Espindola98197e52010-08-10 18:55:09 +0000268 } else {
269 for (std::vector<std::string>::iterator I = _assemblerArgs.begin(),
270 E = _assemblerArgs.end(); I != E; ++I) {
271 args.push_back(I->c_str());
272 }
Nick Kledzikcbad5862009-06-04 00:28:45 +0000273 }
Nick Kledzik77595fc2008-02-26 20:26:43 +0000274 args.push_back("-o");
275 args.push_back(objPath.c_str());
276 args.push_back(asmPath.c_str());
277 args.push_back(0);
278
279 // invoke assembler
Nick Kledzikcbad5862009-06-04 00:28:45 +0000280 if ( sys::Program::ExecuteAndWait(tool, &args[0], 0, 0, 0, 0, &errMsg) ) {
Nick Kledzik77595fc2008-02-26 20:26:43 +0000281 errMsg = "error in assembly";
282 return true;
283 }
284 return false; // success
285}
286
287
288
289bool LTOCodeGenerator::determineTarget(std::string& errMsg)
290{
291 if ( _target == NULL ) {
Daniel Dunbar3c2d4bf2009-08-03 04:03:51 +0000292 std::string Triple = _linker.getModule()->getTargetTriple();
293 if (Triple.empty())
294 Triple = sys::getHostTriple();
295
Nick Kledzik77595fc2008-02-26 20:26:43 +0000296 // create target machine from info for merged modules
Daniel Dunbar4bd03ab2009-08-03 04:20:57 +0000297 const Target *march = TargetRegistry::lookupTarget(Triple, errMsg);
Nick Kledzik77595fc2008-02-26 20:26:43 +0000298 if ( march == NULL )
299 return true;
Bill Wendling604a8182008-06-18 06:35:30 +0000300
Nick Kledzikf5a1c35f12009-06-03 22:52:12 +0000301 // The relocation model is actually a static member of TargetMachine
302 // and needs to be set before the TargetMachine is instantiated.
303 switch( _codeModel ) {
304 case LTO_CODEGEN_PIC_MODEL_STATIC:
305 TargetMachine::setRelocationModel(Reloc::Static);
306 break;
307 case LTO_CODEGEN_PIC_MODEL_DYNAMIC:
308 TargetMachine::setRelocationModel(Reloc::PIC_);
309 break;
310 case LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC:
311 TargetMachine::setRelocationModel(Reloc::DynamicNoPIC);
312 break;
313 }
314
Bill Wendling604a8182008-06-18 06:35:30 +0000315 // construct LTModule, hand over ownership of module and target
Bill Wendling81043ee2010-05-11 00:30:02 +0000316 SubtargetFeatures Features;
317 Features.getDefaultSubtargetFeatures("" /* cpu */, llvm::Triple(Triple));
318 std::string FeatureStr = Features.getString();
Viktor Kutuzov308f6632009-11-25 22:44:18 +0000319 _target = march->createTargetMachine(Triple, FeatureStr);
Nick Kledzik77595fc2008-02-26 20:26:43 +0000320 }
321 return false;
322}
323
Chris Lattner5ef31a02010-03-12 18:44:54 +0000324void LTOCodeGenerator::applyScopeRestrictions() {
325 if (_scopeRestrictionsDone) return;
326 Module *mergedModule = _linker.getModule();
Nick Kledzik77595fc2008-02-26 20:26:43 +0000327
Chris Lattner5ef31a02010-03-12 18:44:54 +0000328 // Start off with a verification pass.
329 PassManager passes;
330 passes.add(createVerifierPass());
Nick Kledzik77595fc2008-02-26 20:26:43 +0000331
Chris Lattner5ef31a02010-03-12 18:44:54 +0000332 // mark which symbols can not be internalized
333 if (!_mustPreserveSymbols.empty()) {
334 MCContext Context(*_target->getMCAsmInfo());
Chris Lattnerb87c3052010-03-12 20:47:28 +0000335 Mangler mangler(Context, *_target->getTargetData());
Chris Lattner5ef31a02010-03-12 18:44:54 +0000336 std::vector<const char*> mustPreserveList;
337 for (Module::iterator f = mergedModule->begin(),
338 e = mergedModule->end(); f != e; ++f) {
339 if (!f->isDeclaration() &&
340 _mustPreserveSymbols.count(mangler.getNameWithPrefix(f)))
341 mustPreserveList.push_back(::strdup(f->getNameStr().c_str()));
Nick Kledzik77595fc2008-02-26 20:26:43 +0000342 }
Chris Lattner5ef31a02010-03-12 18:44:54 +0000343 for (Module::global_iterator v = mergedModule->global_begin(),
344 e = mergedModule->global_end(); v != e; ++v) {
Bill Wendlingc3d0e0c2010-04-27 00:55:25 +0000345 if (!v->isDeclaration() &&
Chris Lattner5ef31a02010-03-12 18:44:54 +0000346 _mustPreserveSymbols.count(mangler.getNameWithPrefix(v)))
347 mustPreserveList.push_back(::strdup(v->getNameStr().c_str()));
348 }
349 passes.add(createInternalizePass(mustPreserveList));
350 }
351
352 // apply scope restrictions
353 passes.run(*mergedModule);
354
355 _scopeRestrictionsDone = true;
Nick Kledzik77595fc2008-02-26 20:26:43 +0000356}
357
Nick Kledzik77595fc2008-02-26 20:26:43 +0000358/// Optimize merged modules using various IPO passes
David Greene71847812009-07-14 20:18:05 +0000359bool LTOCodeGenerator::generateAssemblyCode(formatted_raw_ostream& out,
Owen Andersoncb371882008-08-21 00:14:44 +0000360 std::string& errMsg)
Nick Kledzik77595fc2008-02-26 20:26:43 +0000361{
Nick Lewyckyd42b58b2009-07-26 22:16:39 +0000362 if ( this->determineTarget(errMsg) )
Nick Kledzik77595fc2008-02-26 20:26:43 +0000363 return true;
364
365 // mark which symbols can not be internalized
366 this->applyScopeRestrictions();
367
368 Module* mergedModule = _linker.getModule();
369
Nick Kledzik920ae982008-07-08 21:14:10 +0000370 // if options were requested, set them
371 if ( !_codegenOptions.empty() )
372 cl::ParseCommandLineOptions(_codegenOptions.size(),
Dan Gohman43bc70e2010-04-17 17:44:03 +0000373 const_cast<char **>(&_codegenOptions[0]));
Devang Patela93ae712008-07-03 22:53:14 +0000374
Nick Kledzik77595fc2008-02-26 20:26:43 +0000375 // Instantiate the pass manager to organize the passes.
376 PassManager passes;
377
378 // Start off with a verification pass.
379 passes.add(createVerifierPass());
380
381 // Add an appropriate TargetData instance for this module...
382 passes.add(new TargetData(*_target->getTargetData()));
383
Daniel Dunbar006a0342009-06-03 21:06:14 +0000384 createStandardLTOPasses(&passes, /*Internalize=*/ false, !DisableInline,
Daniel Dunbar006a0342009-06-03 21:06:14 +0000385 /*VerifyEach=*/ false);
Nick Kledzik77595fc2008-02-26 20:26:43 +0000386
387 // Make sure everything is still good.
388 passes.add(createVerifierPass());
389
Jeffrey Yasskinf0356fe2010-01-27 20:34:15 +0000390 FunctionPassManager* codeGenPasses = new FunctionPassManager(mergedModule);
Nick Kledzik77595fc2008-02-26 20:26:43 +0000391
392 codeGenPasses->add(new TargetData(*_target->getTargetData()));
393
Chris Lattner5669e302010-02-03 05:55:08 +0000394 if (_target->addPassesToEmitFile(*codeGenPasses, out,
395 TargetMachine::CGFT_AssemblyFile,
396 CodeGenOpt::Aggressive)) {
397 errMsg = "target file type not supported";
398 return true;
Nick Kledzik77595fc2008-02-26 20:26:43 +0000399 }
400
Nick Kledzik77595fc2008-02-26 20:26:43 +0000401 // Run our queue of passes all at once now, efficiently.
402 passes.run(*mergedModule);
403
404 // Run the code generator, and write assembly file
405 codeGenPasses->doInitialization();
Nick Kledzik77595fc2008-02-26 20:26:43 +0000406
Bill Wendling604a8182008-06-18 06:35:30 +0000407 for (Module::iterator
408 it = mergedModule->begin(), e = mergedModule->end(); it != e; ++it)
409 if (!it->isDeclaration())
410 codeGenPasses->run(*it);
411
412 codeGenPasses->doFinalization();
Nick Lewyckyd42b58b2009-07-26 22:16:39 +0000413
Nick Kledzik77595fc2008-02-26 20:26:43 +0000414 return false; // success
415}
416
417
Nick Kledzik920ae982008-07-08 21:14:10 +0000418/// Optimize merged modules using various IPO passes
419void LTOCodeGenerator::setCodeGenDebugOptions(const char* options)
420{
Benjamin Kramerd4f19592010-01-11 18:03:24 +0000421 for (std::pair<StringRef, StringRef> o = getToken(options);
422 !o.first.empty(); o = getToken(o.second)) {
Nick Kledzik920ae982008-07-08 21:14:10 +0000423 // ParseCommandLineOptions() expects argv[0] to be program name.
424 // Lazily add that.
425 if ( _codegenOptions.empty() )
426 _codegenOptions.push_back("libLTO");
Benjamin Kramerd4f19592010-01-11 18:03:24 +0000427 _codegenOptions.push_back(strdup(o.first.str().c_str()));
Nick Kledzik920ae982008-07-08 21:14:10 +0000428 }
429}