blob: 188aca7977607f1ab02b54521d4d5f950979e9fc [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"
Nick Kledzik77595fc2008-02-26 20:26:43 +000017#include "llvm/Constants.h"
18#include "llvm/DerivedTypes.h"
Nick Lewycky8189d402009-06-17 06:52:10 +000019#include "llvm/Linker.h"
Owen Anderson0e7a5462009-07-02 00:31:14 +000020#include "llvm/LLVMContext.h"
Nick Lewycky8189d402009-06-17 06:52:10 +000021#include "llvm/Module.h"
Nick Lewycky8189d402009-06-17 06:52:10 +000022#include "llvm/PassManager.h"
23#include "llvm/ADT/StringExtras.h"
Viktor Kutuzov51cdac02009-11-17 18:48:27 +000024#include "llvm/ADT/Triple.h"
Nick Lewycky8189d402009-06-17 06:52:10 +000025#include "llvm/Analysis/Passes.h"
Nick Kledzik77595fc2008-02-26 20:26:43 +000026#include "llvm/Bitcode/ReaderWriter.h"
Chris Lattner5ef31a02010-03-12 18:44:54 +000027#include "llvm/MC/MCAsmInfo.h"
28#include "llvm/MC/MCContext.h"
Evan Chengab8be962011-06-29 01:14:12 +000029#include "llvm/MC/SubtargetFeature.h"
Chris Lattner5ef31a02010-03-12 18:44:54 +000030#include "llvm/Target/Mangler.h"
Chris Lattner5ef31a02010-03-12 18:44:54 +000031#include "llvm/Target/TargetOptions.h"
32#include "llvm/Target/TargetData.h"
33#include "llvm/Target/TargetMachine.h"
Evan Cheng0e6a0522011-07-18 20:57:22 +000034#include "llvm/Target/TargetRegisterInfo.h"
Chris Lattner5ef31a02010-03-12 18:44:54 +000035#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"
Chris Lattner817a01f2011-05-22 00:20:07 +000040#include "llvm/Support/PassManagerBuilder.h"
Daniel Dunbar006a0342009-06-03 21:06:14 +000041#include "llvm/Support/SystemUtils.h"
Dan Gohman9f36c4e2010-10-07 20:48:46 +000042#include "llvm/Support/ToolOutputFile.h"
Michael J. Spencer3cc52ea2010-11-29 18:47:54 +000043#include "llvm/Support/Host.h"
44#include "llvm/Support/Program.h"
45#include "llvm/Support/Signals.h"
Michael J. Spencerf2f516f2010-12-09 18:06:07 +000046#include "llvm/Support/system_error.h"
Nick Kledzik77595fc2008-02-26 20:26:43 +000047#include "llvm/Config/config.h"
Nick Lewycky8189d402009-06-17 06:52:10 +000048#include <cstdlib>
Nick Kledzik77595fc2008-02-26 20:26:43 +000049#include <unistd.h>
Nick Kledzik77595fc2008-02-26 20:26:43 +000050#include <fcntl.h>
51
52
53using namespace llvm;
54
Nick Kledzik920ae982008-07-08 21:14:10 +000055static cl::opt<bool> DisableInline("disable-inlining",
56 cl::desc("Do not run the inliner pass"));
Nick Kledzik77595fc2008-02-26 20:26:43 +000057
58
59const char* LTOCodeGenerator::getVersionString()
60{
61#ifdef LLVM_VERSION_INFO
62 return PACKAGE_NAME " version " PACKAGE_VERSION ", " LLVM_VERSION_INFO;
63#else
64 return PACKAGE_NAME " version " PACKAGE_VERSION;
65#endif
66}
67
68
Owen Anderson0e7a5462009-07-02 00:31:14 +000069LTOCodeGenerator::LTOCodeGenerator()
70 : _context(getGlobalContext()),
Owen Anderson8b477ed2009-07-01 16:58:40 +000071 _linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL),
Nick Kledzik77595fc2008-02-26 20:26:43 +000072 _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false),
Nick Kledzikef194ed2008-02-27 22:25:36 +000073 _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
Rafael Espindolae9efea12011-02-24 21:04:06 +000074 _nativeObjectFile(NULL)
Nick Kledzik77595fc2008-02-26 20:26:43 +000075{
Nick Lewyckyd42b58b2009-07-26 22:16:39 +000076 InitializeAllTargets();
Evan Chenge78085a2011-07-22 21:58:54 +000077 InitializeAllTargetMCs();
Nick Lewyckyd42b58b2009-07-26 22:16:39 +000078 InitializeAllAsmPrinters();
Nick Kledzik77595fc2008-02-26 20:26:43 +000079}
80
81LTOCodeGenerator::~LTOCodeGenerator()
82{
Nick Kledzikef194ed2008-02-27 22:25:36 +000083 delete _target;
84 delete _nativeObjectFile;
Nick Kledzik77595fc2008-02-26 20:26:43 +000085}
86
87
88
89bool LTOCodeGenerator::addModule(LTOModule* mod, std::string& errMsg)
90{
Rafael Espindolaf19d7a72011-03-18 19:51:00 +000091
92 if(mod->getLLVVMModule()->MaterializeAllPermanently(&errMsg))
93 return true;
94
Rafael Espindola38c4e532011-03-02 04:14:42 +000095 bool ret = _linker.LinkInModule(mod->getLLVVMModule(), &errMsg);
96
97 const std::vector<const char*> &undefs = mod->getAsmUndefinedRefs();
98 for (int i = 0, e = undefs.size(); i != e; ++i)
99 _asmUndefinedRefs[undefs[i]] = 1;
100
101 return ret;
Nick Kledzik77595fc2008-02-26 20:26:43 +0000102}
103
104
105bool LTOCodeGenerator::setDebugInfo(lto_debug_model debug, std::string& errMsg)
106{
107 switch (debug) {
108 case LTO_DEBUG_MODEL_NONE:
109 _emitDwarfDebugInfo = false;
110 return false;
111
112 case LTO_DEBUG_MODEL_DWARF:
113 _emitDwarfDebugInfo = true;
114 return false;
115 }
116 errMsg = "unknown debug format";
117 return true;
118}
119
120
121bool LTOCodeGenerator::setCodePICModel(lto_codegen_model model,
Evan Cheng855a1682009-06-26 06:57:16 +0000122 std::string& errMsg)
Nick Kledzik77595fc2008-02-26 20:26:43 +0000123{
124 switch (model) {
125 case LTO_CODEGEN_PIC_MODEL_STATIC:
126 case LTO_CODEGEN_PIC_MODEL_DYNAMIC:
127 case LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC:
128 _codeModel = model;
129 return false;
130 }
131 errMsg = "unknown pic model";
132 return true;
133}
134
Rafael Espindola2d643ef2010-08-11 00:15:13 +0000135void LTOCodeGenerator::setCpu(const char* mCpu)
136{
137 _mCpu = mCpu;
138}
139
Nick Kledzik77595fc2008-02-26 20:26:43 +0000140void LTOCodeGenerator::addMustPreserveSymbol(const char* sym)
141{
142 _mustPreserveSymbols[sym] = 1;
143}
144
145
Chris Lattnerb515d752009-08-23 07:49:08 +0000146bool LTOCodeGenerator::writeMergedModules(const char *path,
147 std::string &errMsg) {
148 if (determineTarget(errMsg))
149 return true;
Nick Kledzik77595fc2008-02-26 20:26:43 +0000150
Chris Lattnerb515d752009-08-23 07:49:08 +0000151 // mark which symbols can not be internalized
152 applyScopeRestrictions();
Nick Kledzik77595fc2008-02-26 20:26:43 +0000153
Chris Lattnerb515d752009-08-23 07:49:08 +0000154 // create output file
155 std::string ErrInfo;
Dan Gohmanf2914012010-08-20 16:59:15 +0000156 tool_output_file Out(path, ErrInfo,
157 raw_fd_ostream::F_Binary);
Chris Lattnerb515d752009-08-23 07:49:08 +0000158 if (!ErrInfo.empty()) {
159 errMsg = "could not open bitcode file for writing: ";
160 errMsg += path;
161 return true;
162 }
Nick Kledzik77595fc2008-02-26 20:26:43 +0000163
Chris Lattnerb515d752009-08-23 07:49:08 +0000164 // write bitcode to it
Dan Gohmand4c45432010-09-01 14:20:41 +0000165 WriteBitcodeToFile(_linker.getModule(), Out.os());
166 Out.os().close();
Dan Gohman4b7416b2010-05-27 20:19:47 +0000167
Dan Gohmand4c45432010-09-01 14:20:41 +0000168 if (Out.os().has_error()) {
Chris Lattnerb515d752009-08-23 07:49:08 +0000169 errMsg = "could not write bitcode file: ";
170 errMsg += path;
Dan Gohmand4c45432010-09-01 14:20:41 +0000171 Out.os().clear_error();
Chris Lattnerb515d752009-08-23 07:49:08 +0000172 return true;
173 }
174
Dan Gohmanf2914012010-08-20 16:59:15 +0000175 Out.keep();
Chris Lattnerb515d752009-08-23 07:49:08 +0000176 return false;
Nick Kledzik77595fc2008-02-26 20:26:43 +0000177}
178
179
Rafael Espindola6421a882011-03-22 20:57:13 +0000180bool LTOCodeGenerator::compile_to_file(const char** name, std::string& errMsg)
181{
182 // make unique temp .o file to put generated object file
183 sys::PathWithStatus uniqueObjPath("lto-llvm.o");
184 if ( uniqueObjPath.createTemporaryFileOnDisk(false, &errMsg) ) {
185 uniqueObjPath.eraseFromDisk();
186 return true;
187 }
188 sys::RemoveFileOnSignal(uniqueObjPath);
189
190 // generate object file
191 bool genResult = false;
192 tool_output_file objFile(uniqueObjPath.c_str(), errMsg);
193 if (!errMsg.empty())
194 return NULL;
195 genResult = this->generateObjectFile(objFile.os(), errMsg);
196 objFile.os().close();
197 if (objFile.os().has_error()) {
198 objFile.os().clear_error();
199 return true;
200 }
201 objFile.keep();
202 if ( genResult ) {
203 uniqueObjPath.eraseFromDisk();
204 return true;
205 }
206
207 _nativeObjectPath = uniqueObjPath.str();
208 *name = _nativeObjectPath.c_str();
209 return false;
210}
211
Nick Kledzikef194ed2008-02-27 22:25:36 +0000212const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg)
Nick Kledzik77595fc2008-02-26 20:26:43 +0000213{
Rafael Espindola6421a882011-03-22 20:57:13 +0000214 const char *name;
215 if (compile_to_file(&name, errMsg))
216 return NULL;
Nick Kledzik77595fc2008-02-26 20:26:43 +0000217
Rafael Espindola6421a882011-03-22 20:57:13 +0000218 // remove old buffer if compile() called twice
219 delete _nativeObjectFile;
Nick Kledzikef194ed2008-02-27 22:25:36 +0000220
Rafael Espindola6421a882011-03-22 20:57:13 +0000221 // read .o file into memory buffer
222 OwningPtr<MemoryBuffer> BuffPtr;
223 if (error_code ec = MemoryBuffer::getFile(name, BuffPtr, -1, false)) {
224 errMsg = ec.message();
225 return NULL;
226 }
227 _nativeObjectFile = BuffPtr.take();
Rafael Espindolae9efea12011-02-24 21:04:06 +0000228
Rafael Espindola6421a882011-03-22 20:57:13 +0000229 // remove temp files
230 sys::Path(_nativeObjectPath).eraseFromDisk();
Rafael Espindolae9efea12011-02-24 21:04:06 +0000231
Rafael Espindola6421a882011-03-22 20:57:13 +0000232 // return buffer, unless error
233 if ( _nativeObjectFile == NULL )
234 return NULL;
235 *length = _nativeObjectFile->getBufferSize();
236 return _nativeObjectFile->getBufferStart();
Nick Kledzik77595fc2008-02-26 20:26:43 +0000237}
238
Nick Kledzik77595fc2008-02-26 20:26:43 +0000239bool LTOCodeGenerator::determineTarget(std::string& errMsg)
240{
241 if ( _target == NULL ) {
Daniel Dunbar3c2d4bf2009-08-03 04:03:51 +0000242 std::string Triple = _linker.getModule()->getTargetTriple();
243 if (Triple.empty())
244 Triple = sys::getHostTriple();
245
Nick Kledzik77595fc2008-02-26 20:26:43 +0000246 // create target machine from info for merged modules
Daniel Dunbar4bd03ab2009-08-03 04:20:57 +0000247 const Target *march = TargetRegistry::lookupTarget(Triple, errMsg);
Nick Kledzik77595fc2008-02-26 20:26:43 +0000248 if ( march == NULL )
249 return true;
Bill Wendling604a8182008-06-18 06:35:30 +0000250
Nick Kledzikf5a1c35f12009-06-03 22:52:12 +0000251 // The relocation model is actually a static member of TargetMachine
252 // and needs to be set before the TargetMachine is instantiated.
Evan Cheng43966132011-07-19 06:37:02 +0000253 Reloc::Model RelocModel = Reloc::Default;
Nick Kledzikf5a1c35f12009-06-03 22:52:12 +0000254 switch( _codeModel ) {
255 case LTO_CODEGEN_PIC_MODEL_STATIC:
Evan Cheng43966132011-07-19 06:37:02 +0000256 RelocModel = Reloc::Static;
Nick Kledzikf5a1c35f12009-06-03 22:52:12 +0000257 break;
258 case LTO_CODEGEN_PIC_MODEL_DYNAMIC:
Evan Cheng43966132011-07-19 06:37:02 +0000259 RelocModel = Reloc::PIC_;
Nick Kledzikf5a1c35f12009-06-03 22:52:12 +0000260 break;
261 case LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC:
Evan Cheng43966132011-07-19 06:37:02 +0000262 RelocModel = Reloc::DynamicNoPIC;
Nick Kledzikf5a1c35f12009-06-03 22:52:12 +0000263 break;
264 }
265
Bill Wendling604a8182008-06-18 06:35:30 +0000266 // construct LTModule, hand over ownership of module and target
Bill Wendling81043ee2010-05-11 00:30:02 +0000267 SubtargetFeatures Features;
Evan Cheng276365d2011-06-30 01:53:36 +0000268 Features.getDefaultSubtargetFeatures(llvm::Triple(Triple));
Bill Wendling81043ee2010-05-11 00:30:02 +0000269 std::string FeatureStr = Features.getString();
Evan Cheng43966132011-07-19 06:37:02 +0000270 _target = march->createTargetMachine(Triple, _mCpu, FeatureStr,
271 RelocModel);
Nick Kledzik77595fc2008-02-26 20:26:43 +0000272 }
273 return false;
274}
275
Rafael Espindola38c4e532011-03-02 04:14:42 +0000276void LTOCodeGenerator::applyRestriction(GlobalValue &GV,
277 std::vector<const char*> &mustPreserveList,
278 SmallPtrSet<GlobalValue*, 8> &asmUsed,
279 Mangler &mangler) {
280 SmallString<64> Buffer;
281 mangler.getNameWithPrefix(Buffer, &GV, false);
282
283 if (GV.isDeclaration())
284 return;
285 if (_mustPreserveSymbols.count(Buffer))
286 mustPreserveList.push_back(GV.getName().data());
287 if (_asmUndefinedRefs.count(Buffer))
288 asmUsed.insert(&GV);
289}
290
291static void findUsedValues(GlobalVariable *LLVMUsed,
292 SmallPtrSet<GlobalValue*, 8> &UsedValues) {
293 if (LLVMUsed == 0) return;
294
295 ConstantArray *Inits = dyn_cast<ConstantArray>(LLVMUsed->getInitializer());
296 if (Inits == 0) return;
297
298 for (unsigned i = 0, e = Inits->getNumOperands(); i != e; ++i)
299 if (GlobalValue *GV =
300 dyn_cast<GlobalValue>(Inits->getOperand(i)->stripPointerCasts()))
301 UsedValues.insert(GV);
302}
303
Chris Lattner5ef31a02010-03-12 18:44:54 +0000304void LTOCodeGenerator::applyScopeRestrictions() {
305 if (_scopeRestrictionsDone) return;
306 Module *mergedModule = _linker.getModule();
Nick Kledzik77595fc2008-02-26 20:26:43 +0000307
Chris Lattner5ef31a02010-03-12 18:44:54 +0000308 // Start off with a verification pass.
309 PassManager passes;
310 passes.add(createVerifierPass());
Nick Kledzik77595fc2008-02-26 20:26:43 +0000311
Chris Lattner5ef31a02010-03-12 18:44:54 +0000312 // mark which symbols can not be internalized
Evan Cheng203576a2011-07-20 19:50:42 +0000313 MCContext Context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(), NULL);
Rafael Espindola38c4e532011-03-02 04:14:42 +0000314 Mangler mangler(Context, *_target->getTargetData());
315 std::vector<const char*> mustPreserveList;
316 SmallPtrSet<GlobalValue*, 8> asmUsed;
317
318 for (Module::iterator f = mergedModule->begin(),
319 e = mergedModule->end(); f != e; ++f)
320 applyRestriction(*f, mustPreserveList, asmUsed, mangler);
321 for (Module::global_iterator v = mergedModule->global_begin(),
322 e = mergedModule->global_end(); v != e; ++v)
323 applyRestriction(*v, mustPreserveList, asmUsed, mangler);
324 for (Module::alias_iterator a = mergedModule->alias_begin(),
325 e = mergedModule->alias_end(); a != e; ++a)
326 applyRestriction(*a, mustPreserveList, asmUsed, mangler);
327
328 GlobalVariable *LLVMCompilerUsed =
329 mergedModule->getGlobalVariable("llvm.compiler.used");
330 findUsedValues(LLVMCompilerUsed, asmUsed);
331 if (LLVMCompilerUsed)
332 LLVMCompilerUsed->eraseFromParent();
333
Chris Lattnerdb125cf2011-07-18 04:54:35 +0000334 llvm::Type *i8PTy = llvm::Type::getInt8PtrTy(_context);
Rafael Espindola38c4e532011-03-02 04:14:42 +0000335 std::vector<Constant*> asmUsed2;
336 for (SmallPtrSet<GlobalValue*, 16>::const_iterator i = asmUsed.begin(),
337 e = asmUsed.end(); i !=e; ++i) {
338 GlobalValue *GV = *i;
339 Constant *c = ConstantExpr::getBitCast(GV, i8PTy);
340 asmUsed2.push_back(c);
Chris Lattner5ef31a02010-03-12 18:44:54 +0000341 }
Rafael Espindola38c4e532011-03-02 04:14:42 +0000342
343 llvm::ArrayType *ATy = llvm::ArrayType::get(i8PTy, asmUsed2.size());
344 LLVMCompilerUsed =
345 new llvm::GlobalVariable(*mergedModule, ATy, false,
346 llvm::GlobalValue::AppendingLinkage,
347 llvm::ConstantArray::get(ATy, asmUsed2),
348 "llvm.compiler.used");
349
350 LLVMCompilerUsed->setSection("llvm.metadata");
351
352 passes.add(createInternalizePass(mustPreserveList));
353
Chris Lattner5ef31a02010-03-12 18:44:54 +0000354 // apply scope restrictions
355 passes.run(*mergedModule);
356
357 _scopeRestrictionsDone = true;
Nick Kledzik77595fc2008-02-26 20:26:43 +0000358}
359
Nick Kledzik77595fc2008-02-26 20:26:43 +0000360/// Optimize merged modules using various IPO passes
Chris Lattner817a01f2011-05-22 00:20:07 +0000361bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
362 std::string &errMsg) {
Nick Lewyckyd42b58b2009-07-26 22:16:39 +0000363 if ( this->determineTarget(errMsg) )
Nick Kledzik77595fc2008-02-26 20:26:43 +0000364 return true;
365
366 // mark which symbols can not be internalized
367 this->applyScopeRestrictions();
368
369 Module* mergedModule = _linker.getModule();
370
Nick Kledzik920ae982008-07-08 21:14:10 +0000371 // if options were requested, set them
372 if ( !_codegenOptions.empty() )
373 cl::ParseCommandLineOptions(_codegenOptions.size(),
Dan Gohman43bc70e2010-04-17 17:44:03 +0000374 const_cast<char **>(&_codegenOptions[0]));
Devang Patela93ae712008-07-03 22:53:14 +0000375
Nick Kledzik77595fc2008-02-26 20:26:43 +0000376 // Instantiate the pass manager to organize the passes.
377 PassManager passes;
378
379 // Start off with a verification pass.
380 passes.add(createVerifierPass());
381
382 // Add an appropriate TargetData instance for this module...
383 passes.add(new TargetData(*_target->getTargetData()));
384
Chris Lattner817a01f2011-05-22 00:20:07 +0000385 PassManagerBuilder().populateLTOPassManager(passes, /*Internalize=*/ false,
386 !DisableInline);
Nick Kledzik77595fc2008-02-26 20:26:43 +0000387
388 // Make sure everything is still good.
389 passes.add(createVerifierPass());
390
Chris Lattner817a01f2011-05-22 00:20:07 +0000391 FunctionPassManager *codeGenPasses = new FunctionPassManager(mergedModule);
Nick Kledzik77595fc2008-02-26 20:26:43 +0000392
393 codeGenPasses->add(new TargetData(*_target->getTargetData()));
394
Dan Gohmand4c45432010-09-01 14:20:41 +0000395 formatted_raw_ostream Out(out);
396
397 if (_target->addPassesToEmitFile(*codeGenPasses, Out,
Rafael Espindolae9efea12011-02-24 21:04:06 +0000398 TargetMachine::CGFT_ObjectFile,
Chris Lattner5669e302010-02-03 05:55:08 +0000399 CodeGenOpt::Aggressive)) {
400 errMsg = "target file type not supported";
401 return true;
Nick Kledzik77595fc2008-02-26 20:26:43 +0000402 }
403
Nick Kledzik77595fc2008-02-26 20:26:43 +0000404 // Run our queue of passes all at once now, efficiently.
405 passes.run(*mergedModule);
406
407 // Run the code generator, and write assembly file
408 codeGenPasses->doInitialization();
Nick Kledzik77595fc2008-02-26 20:26:43 +0000409
Bill Wendling604a8182008-06-18 06:35:30 +0000410 for (Module::iterator
411 it = mergedModule->begin(), e = mergedModule->end(); it != e; ++it)
412 if (!it->isDeclaration())
413 codeGenPasses->run(*it);
414
415 codeGenPasses->doFinalization();
Rafael Espindolacd6c93e2011-02-20 16:27:25 +0000416 delete codeGenPasses;
Nick Lewyckyd42b58b2009-07-26 22:16:39 +0000417
Nick Kledzik77595fc2008-02-26 20:26:43 +0000418 return false; // success
419}
420
421
Nick Kledzik920ae982008-07-08 21:14:10 +0000422/// Optimize merged modules using various IPO passes
423void LTOCodeGenerator::setCodeGenDebugOptions(const char* options)
424{
Benjamin Kramerd4f19592010-01-11 18:03:24 +0000425 for (std::pair<StringRef, StringRef> o = getToken(options);
426 !o.first.empty(); o = getToken(o.second)) {
Nick Kledzik920ae982008-07-08 21:14:10 +0000427 // ParseCommandLineOptions() expects argv[0] to be program name.
428 // Lazily add that.
429 if ( _codegenOptions.empty() )
430 _codegenOptions.push_back("libLTO");
Benjamin Kramerd4f19592010-01-11 18:03:24 +0000431 _codegenOptions.push_back(strdup(o.first.str().c_str()));
Nick Kledzik920ae982008-07-08 21:14:10 +0000432 }
433}