LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LTOCodeGenerator.cpp
Go to the documentation of this file.
1 //===-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 
16 #include "llvm/LTO/LTOModule.h"
17 #include "llvm/ADT/StringExtras.h"
18 #include "llvm/Analysis/Passes.h"
19 #include "llvm/Analysis/Verifier.h"
22 #include "llvm/Config/config.h"
23 #include "llvm/IR/Constants.h"
24 #include "llvm/IR/DataLayout.h"
25 #include "llvm/IR/DerivedTypes.h"
26 #include "llvm/IR/LLVMContext.h"
27 #include "llvm/IR/Module.h"
28 #include "llvm/InitializePasses.h"
29 #include "llvm/Linker.h"
30 #include "llvm/MC/MCAsmInfo.h"
31 #include "llvm/MC/MCContext.h"
33 #include "llvm/PassManager.h"
37 #include "llvm/Support/Host.h"
39 #include "llvm/Support/Signals.h"
48 #include "llvm/Target/Mangler.h"
49 #include "llvm/Transforms/IPO.h"
52 using namespace llvm;
53 
55 #ifdef LLVM_VERSION_INFO
56  return PACKAGE_NAME " version " PACKAGE_VERSION ", " LLVM_VERSION_INFO;
57 #else
58  return PACKAGE_NAME " version " PACKAGE_VERSION;
59 #endif
60 }
61 
63  : Context(getGlobalContext()), Linker(new Module("ld-temp.o", Context)),
64  TargetMach(NULL), EmitDwarfDebugInfo(false), ScopeRestrictionsDone(false),
65  CodeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC), NativeObjectFile(NULL) {
66  initializeLTOPasses();
67 }
68 
70  delete TargetMach;
71  delete NativeObjectFile;
72  TargetMach = NULL;
73  NativeObjectFile = NULL;
74 
76 
77  for (std::vector<char *>::iterator I = CodegenOptions.begin(),
78  E = CodegenOptions.end();
79  I != E; ++I)
80  free(*I);
81 }
82 
83 // Initialize LTO passes. Please keep this funciton in sync with
84 // PassManagerBuilder::populateLTOPassManager(), and make sure all LTO
85 // passes are initialized.
86 //
87 void LTOCodeGenerator::initializeLTOPasses() {
88  PassRegistry &R = *PassRegistry::getPassRegistry();
89 
111 }
112 
113 bool LTOCodeGenerator::addModule(LTOModule* mod, std::string& errMsg) {
114  bool ret = Linker.linkInModule(mod->getLLVVMModule(), &errMsg);
115 
116  const std::vector<const char*> &undefs = mod->getAsmUndefinedRefs();
117  for (int i = 0, e = undefs.size(); i != e; ++i)
118  AsmUndefinedRefs[undefs[i]] = 1;
119 
120  return !ret;
121 }
122 
125  Options.NoFramePointerElim = options.NoFramePointerElim;
126  Options.AllowFPOpFusion = options.AllowFPOpFusion;
127  Options.UnsafeFPMath = options.UnsafeFPMath;
128  Options.NoInfsFPMath = options.NoInfsFPMath;
129  Options.NoNaNsFPMath = options.NoNaNsFPMath;
132  Options.UseSoftFloat = options.UseSoftFloat;
133  Options.FloatABIType = options.FloatABIType;
134  Options.NoZerosInBSS = options.NoZerosInBSS;
136  Options.DisableTailCalls = options.DisableTailCalls;
138  Options.TrapFuncName = options.TrapFuncName;
141  Options.UseInitArray = options.UseInitArray;
142 }
143 
145  switch (debug) {
147  EmitDwarfDebugInfo = false;
148  return;
149 
151  EmitDwarfDebugInfo = true;
152  return;
153  }
154  llvm_unreachable("Unknown debug format!");
155 }
156 
158  switch (model) {
162  CodeModel = model;
163  return;
164  }
165  llvm_unreachable("Unknown PIC model!");
166 }
167 
169  std::string &errMsg) {
170  if (!determineTarget(errMsg))
171  return false;
172 
173  // mark which symbols can not be internalized
174  applyScopeRestrictions();
175 
176  // create output file
177  std::string ErrInfo;
178  tool_output_file Out(path, ErrInfo, sys::fs::F_Binary);
179  if (!ErrInfo.empty()) {
180  errMsg = "could not open bitcode file for writing: ";
181  errMsg += path;
182  return false;
183  }
184 
185  // write bitcode to it
187  Out.os().close();
188 
189  if (Out.os().has_error()) {
190  errMsg = "could not write bitcode file: ";
191  errMsg += path;
192  Out.os().clear_error();
193  return false;
194  }
195 
196  Out.keep();
197  return true;
198 }
199 
200 bool LTOCodeGenerator::compile_to_file(const char** name,
201  bool disableOpt,
202  bool disableInline,
203  bool disableGVNLoadPRE,
204  std::string& errMsg) {
205  // make unique temp .o file to put generated object file
206  SmallString<128> Filename;
207  int FD;
208  error_code EC = sys::fs::createTemporaryFile("lto-llvm", "o", FD, Filename);
209  if (EC) {
210  errMsg = EC.message();
211  return false;
212  }
213 
214  // generate object file
215  tool_output_file objFile(Filename.c_str(), FD);
216 
217  bool genResult = generateObjectFile(objFile.os(), disableOpt, disableInline,
218  disableGVNLoadPRE, errMsg);
219  objFile.os().close();
220  if (objFile.os().has_error()) {
221  objFile.os().clear_error();
222  sys::fs::remove(Twine(Filename));
223  return false;
224  }
225 
226  objFile.keep();
227  if (!genResult) {
228  sys::fs::remove(Twine(Filename));
229  return false;
230  }
231 
232  NativeObjectPath = Filename.c_str();
233  *name = NativeObjectPath.c_str();
234  return true;
235 }
236 
237 const void* LTOCodeGenerator::compile(size_t* length,
238  bool disableOpt,
239  bool disableInline,
240  bool disableGVNLoadPRE,
241  std::string& errMsg) {
242  const char *name;
243  if (!compile_to_file(&name, disableOpt, disableInline, disableGVNLoadPRE,
244  errMsg))
245  return NULL;
246 
247  // remove old buffer if compile() called twice
248  delete NativeObjectFile;
249 
250  // read .o file into memory buffer
251  OwningPtr<MemoryBuffer> BuffPtr;
252  if (error_code ec = MemoryBuffer::getFile(name, BuffPtr, -1, false)) {
253  errMsg = ec.message();
254  sys::fs::remove(NativeObjectPath);
255  return NULL;
256  }
257  NativeObjectFile = BuffPtr.take();
258 
259  // remove temp files
260  sys::fs::remove(NativeObjectPath);
261 
262  // return buffer, unless error
263  if (NativeObjectFile == NULL)
264  return NULL;
265  *length = NativeObjectFile->getBufferSize();
266  return NativeObjectFile->getBufferStart();
267 }
268 
269 bool LTOCodeGenerator::determineTarget(std::string &errMsg) {
270  if (TargetMach != NULL)
271  return true;
272 
273  std::string TripleStr = Linker.getModule()->getTargetTriple();
274  if (TripleStr.empty())
275  TripleStr = sys::getDefaultTargetTriple();
276  llvm::Triple Triple(TripleStr);
277 
278  // create target machine from info for merged modules
279  const Target *march = TargetRegistry::lookupTarget(TripleStr, errMsg);
280  if (march == NULL)
281  return false;
282 
283  // The relocation model is actually a static member of TargetMachine and
284  // needs to be set before the TargetMachine is instantiated.
286  switch (CodeModel) {
288  RelocModel = Reloc::Static;
289  break;
291  RelocModel = Reloc::PIC_;
292  break;
294  RelocModel = Reloc::DynamicNoPIC;
295  break;
296  }
297 
298  // construct LTOModule, hand over ownership of module and target
299  SubtargetFeatures Features;
301  std::string FeatureStr = Features.getString();
302  // Set a default CPU for Darwin triples.
303  if (MCpu.empty() && Triple.isOSDarwin()) {
305  MCpu = "core2";
306  else if (Triple.getArch() == llvm::Triple::x86)
307  MCpu = "yonah";
308  }
309 
310  TargetMach = march->createTargetMachine(TripleStr, MCpu, FeatureStr, Options,
311  RelocModel, CodeModel::Default,
313  return true;
314 }
315 
316 void LTOCodeGenerator::
317 applyRestriction(GlobalValue &GV,
318  const ArrayRef<StringRef> &Libcalls,
319  std::vector<const char*> &MustPreserveList,
321  Mangler &Mangler) {
322  SmallString<64> Buffer;
323  Mangler.getNameWithPrefix(Buffer, &GV, false);
324 
325  if (GV.isDeclaration())
326  return;
327  if (MustPreserveSymbols.count(Buffer))
328  MustPreserveList.push_back(GV.getName().data());
329  if (AsmUndefinedRefs.count(Buffer))
330  AsmUsed.insert(&GV);
331 
332  // Conservatively append user-supplied runtime library functions to
333  // llvm.compiler.used. These could be internalized and deleted by
334  // optimizations like -globalopt, causing problems when later optimizations
335  // add new library calls (e.g., llvm.memset => memset and printf => puts).
336  // Leave it to the linker to remove any dead code (e.g. with -dead_strip).
337  if (isa<Function>(GV) &&
338  std::binary_search(Libcalls.begin(), Libcalls.end(), GV.getName()))
339  AsmUsed.insert(&GV);
340 }
341 
342 static void findUsedValues(GlobalVariable *LLVMUsed,
343  SmallPtrSet<GlobalValue*, 8> &UsedValues) {
344  if (LLVMUsed == 0) return;
345 
346  ConstantArray *Inits = cast<ConstantArray>(LLVMUsed->getInitializer());
347  for (unsigned i = 0, e = Inits->getNumOperands(); i != e; ++i)
348  if (GlobalValue *GV =
349  dyn_cast<GlobalValue>(Inits->getOperand(i)->stripPointerCasts()))
350  UsedValues.insert(GV);
351 }
352 
353 static void accumulateAndSortLibcalls(std::vector<StringRef> &Libcalls,
354  const TargetLibraryInfo& TLI,
355  const TargetLowering *Lowering)
356 {
357  // TargetLibraryInfo has info on C runtime library calls on the current
358  // target.
359  for (unsigned I = 0, E = static_cast<unsigned>(LibFunc::NumLibFuncs);
360  I != E; ++I) {
361  LibFunc::Func F = static_cast<LibFunc::Func>(I);
362  if (TLI.has(F))
363  Libcalls.push_back(TLI.getName(F));
364  }
365 
366  // TargetLowering has info on library calls that CodeGen expects to be
367  // available, both from the C runtime and compiler-rt.
368  if (Lowering)
369  for (unsigned I = 0, E = static_cast<unsigned>(RTLIB::UNKNOWN_LIBCALL);
370  I != E; ++I)
371  if (const char *Name
372  = Lowering->getLibcallName(static_cast<RTLIB::Libcall>(I)))
373  Libcalls.push_back(Name);
374 
375  array_pod_sort(Libcalls.begin(), Libcalls.end());
376  Libcalls.erase(std::unique(Libcalls.begin(), Libcalls.end()),
377  Libcalls.end());
378 }
379 
380 void LTOCodeGenerator::applyScopeRestrictions() {
381  if (ScopeRestrictionsDone)
382  return;
383  Module *mergedModule = Linker.getModule();
384 
385  // Start off with a verification pass.
386  PassManager passes;
387  passes.add(createVerifierPass());
388 
389  // mark which symbols can not be internalized
390  Mangler Mangler(TargetMach);
391  std::vector<const char*> MustPreserveList;
393  std::vector<StringRef> Libcalls;
394  TargetLibraryInfo TLI(Triple(TargetMach->getTargetTriple()));
395  accumulateAndSortLibcalls(Libcalls, TLI, TargetMach->getTargetLowering());
396 
397  for (Module::iterator f = mergedModule->begin(),
398  e = mergedModule->end(); f != e; ++f)
399  applyRestriction(*f, Libcalls, MustPreserveList, AsmUsed, Mangler);
400  for (Module::global_iterator v = mergedModule->global_begin(),
401  e = mergedModule->global_end(); v != e; ++v)
402  applyRestriction(*v, Libcalls, MustPreserveList, AsmUsed, Mangler);
403  for (Module::alias_iterator a = mergedModule->alias_begin(),
404  e = mergedModule->alias_end(); a != e; ++a)
405  applyRestriction(*a, Libcalls, MustPreserveList, AsmUsed, Mangler);
406 
407  GlobalVariable *LLVMCompilerUsed =
408  mergedModule->getGlobalVariable("llvm.compiler.used");
409  findUsedValues(LLVMCompilerUsed, AsmUsed);
410  if (LLVMCompilerUsed)
411  LLVMCompilerUsed->eraseFromParent();
412 
413  if (!AsmUsed.empty()) {
414  llvm::Type *i8PTy = llvm::Type::getInt8PtrTy(Context);
415  std::vector<Constant*> asmUsed2;
417  e = AsmUsed.end(); i !=e; ++i) {
418  GlobalValue *GV = *i;
419  Constant *c = ConstantExpr::getBitCast(GV, i8PTy);
420  asmUsed2.push_back(c);
421  }
422 
423  llvm::ArrayType *ATy = llvm::ArrayType::get(i8PTy, asmUsed2.size());
424  LLVMCompilerUsed =
425  new llvm::GlobalVariable(*mergedModule, ATy, false,
427  llvm::ConstantArray::get(ATy, asmUsed2),
428  "llvm.compiler.used");
429 
430  LLVMCompilerUsed->setSection("llvm.metadata");
431  }
432 
433  passes.add(createInternalizePass(MustPreserveList));
434 
435  // apply scope restrictions
436  passes.run(*mergedModule);
437 
438  ScopeRestrictionsDone = true;
439 }
440 
441 /// Optimize merged modules using various IPO passes
442 bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
443  bool DisableOpt,
444  bool DisableInline,
445  bool DisableGVNLoadPRE,
446  std::string &errMsg) {
447  if (!this->determineTarget(errMsg))
448  return false;
449 
450  Module *mergedModule = Linker.getModule();
451 
452  // Mark which symbols can not be internalized
453  this->applyScopeRestrictions();
454 
455  // Instantiate the pass manager to organize the passes.
456  PassManager passes;
457 
458  // Start off with a verification pass.
459  passes.add(createVerifierPass());
460 
461  // Add an appropriate DataLayout instance for this module...
462  passes.add(new DataLayout(*TargetMach->getDataLayout()));
463  TargetMach->addAnalysisPasses(passes);
464 
465  // Enabling internalize here would use its AllButMain variant. It
466  // keeps only main if it exists and does nothing for libraries. Instead
467  // we create the pass ourselves with the symbol list provided by the linker.
468  if (!DisableOpt)
470  /*Internalize=*/false,
471  !DisableInline,
472  DisableGVNLoadPRE);
473 
474  // Make sure everything is still good.
475  passes.add(createVerifierPass());
476 
477  PassManager codeGenPasses;
478 
479  codeGenPasses.add(new DataLayout(*TargetMach->getDataLayout()));
480  TargetMach->addAnalysisPasses(codeGenPasses);
481 
482  formatted_raw_ostream Out(out);
483 
484  // If the bitcode files contain ARC code and were compiled with optimization,
485  // the ObjCARCContractPass must be run, so do it unconditionally here.
486  codeGenPasses.add(createObjCARCContractPass());
487 
488  if (TargetMach->addPassesToEmitFile(codeGenPasses, Out,
489  TargetMachine::CGFT_ObjectFile)) {
490  errMsg = "target file type not supported";
491  return false;
492  }
493 
494  // Run our queue of passes all at once now, efficiently.
495  passes.run(*mergedModule);
496 
497  // Run the code generator, and write assembly file
498  codeGenPasses.run(*mergedModule);
499 
500  return true;
501 }
502 
503 /// setCodeGenDebugOptions - Set codegen debugging options to aid in debugging
504 /// LTO problems.
505 void LTOCodeGenerator::setCodeGenDebugOptions(const char *options) {
506  for (std::pair<StringRef, StringRef> o = getToken(options);
507  !o.first.empty(); o = getToken(o.second)) {
508  // ParseCommandLineOptions() expects argv[0] to be program name. Lazily add
509  // that.
510  if (CodegenOptions.empty())
511  CodegenOptions.push_back(strdup("libLLVMLTO"));
512  CodegenOptions.push_back(strdup(o.first.str().c_str()));
513  }
514 }
515 
517  // if options were requested, set them
518  if (!CodegenOptions.empty())
519  cl::ParseCommandLineOptions(CodegenOptions.size(),
520  const_cast<char **>(&CodegenOptions[0]));
521 }
void initializeFunctionAttrsPass(PassRegistry &)
static void accumulateAndSortLibcalls(std::vector< StringRef > &Libcalls, const TargetLibraryInfo &TLI, const TargetLowering *Lowering)
virtual const TargetLowering * getTargetLowering() const
void initializeInstCombinerPass(PassRegistry &)
void setTargetOptions(llvm::TargetOptions options)
Special purpose, only applies to global arrays.
Definition: GlobalValue.h:40
int remove(const char *path);
const char * getBufferStart() const
Definition: MemoryBuffer.h:51
void getDefaultSubtargetFeatures(const Triple &Triple)
Adds the default features for the specified target triple.
static void findUsedValues(GlobalVariable *LLVMUsed, SmallPtrSet< GlobalValue *, 8 > &UsedValues)
std::string TrapFuncName
The main container class for the LLVM Intermediate Representation.
Definition: Module.h:112
void deleteModule()
void initializeSimpleInlinerPass(PassRegistry &)
void initializeJumpThreadingPass(PassRegistry &)
unsigned getNumOperands() const
Definition: User.h:108
iterator end() const
Definition: ArrayRef.h:98
void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, bool isImplicitlyPrivate, bool UseGlobalPrefix=true)
Definition: Mangler.cpp:90
std::string getDefaultTargetTriple()
void initializeInternalizePassPass(PassRegistry &)
bool writeMergedModules(const char *path, std::string &errMsg)
bool insert(PtrType Ptr)
Definition: SmallPtrSet.h:253
raw_fd_ostream & os()
os - Return the contained raw_fd_ostream.
F(f)
const Constant * getInitializer() const
llvm::Module * getLLVVMModule()
getLLVVMModule - Return the Module.
Definition: LTOModule.h:131
const std::string & getTargetTriple() const
Definition: Module.h:237
const GlobalVariable * getGlobalVariable(StringRef Name, bool AllowInternal=false) const
Definition: Module.h:355
void initializeSROA_DTPass(PassRegistry &)
StringRef getName() const
Definition: Value.cpp:167
void initializePruneEHPass(PassRegistry &)
bool has_error() const
Definition: raw_ostream.h:390
std::pair< StringRef, StringRef > getToken(StringRef Source, StringRef Delimiters=" \t\n\v\f\r")
bool has(LibFunc::Func F) const
static cl::opt< bool > Aggressive("aggressive-ext-opt", cl::Hidden, cl::desc("Aggressive extension optimization"))
#define llvm_unreachable(msg)
void initializeArgPromotionPass(PassRegistry &)
void initializeGlobalOptPass(PassRegistry &)
size_type count(StringRef Key) const
Definition: StringMap.h:316
#define false
Definition: ConvertUTF.c:64
global_iterator global_begin()
Definition: Module.h:521
void setCodeGenDebugOptions(const char *opts)
const char * data() const
Definition: StringRef.h:107
void populateLTOPassManager(PassManagerBase &PM, bool Internalize, bool RunInliner, bool DisableGVNLoadPRE=false)
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:172
void initializeGlobalsModRefPass(PassRegistry &)
lto_debug_model
Definition: lto.h:65
void setDebugInfo(lto_debug_model)
unsigned NoFramePointerElim
Definition: TargetOptions.h:65
void array_pod_sort(IteratorTy Start, IteratorTy End)
Definition: STLExtras.h:289
FPOpFusion::FPOpFusionMode AllowFPOpFusion
cl::opt< Reloc::Model > RelocModel("relocation-model", cl::desc("Choose relocation model"), cl::init(Reloc::Default), cl::values(clEnumValN(Reloc::Default,"default","Target default relocation model"), clEnumValN(Reloc::Static,"static","Non-relocatable code"), clEnumValN(Reloc::PIC_,"pic","Fully relocatable, position independent code"), clEnumValN(Reloc::DynamicNoPIC,"dynamic-no-pic","Relocatable external references, non-relocatable code"), clEnumValEnd))
alias_iterator alias_end()
Definition: Module.h:544
void ParseCommandLineOptions(int argc, const char *const *argv, const char *Overview=0)
virtual bool addPassesToEmitFile(PassManagerBase &, formatted_raw_ostream &, CodeGenFileType, bool=true, AnalysisID=0, AnalysisID=0)
LLVM Constant Representation.
Definition: Constant.h:41
Pass * createObjCARCContractPass()
static Constant * get(ArrayType *T, ArrayRef< Constant * > V)
Definition: Constants.cpp:745
void free(void *ptr);
virtual void eraseFromParent()
Definition: Globals.cpp:142
bool compile_to_file(const char **name, bool disableOpt, bool disableInline, bool disableGVNLoadPRE, std::string &errMsg)
const std::vector< const char * > & getAsmUndefinedRefs()
getAsmUndefinedRefs -
Definition: LTOModule.h:134
iterator begin() const
Definition: ArrayRef.h:97
unsigned GuaranteedTailCallOpt
Value * getOperand(unsigned i) const
Definition: User.h:88
const void * compile(size_t *length, bool disableOpt, bool disableInline, bool disableGVNLoadPRE, std::string &errMsg)
void initializeIPSCCPPass(PassRegistry &)
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
Definition: SmallPtrSet.h:74
void initializeLICMPass(PassRegistry &)
std::string getString() const
Features string accessors.
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:284
error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix, int &ResultFD, SmallVectorImpl< char > &ResultPath)
Create a file in the system temporary directory.
Definition: Path.cpp:678
char *strdup(const char *s1);
virtual void addAnalysisPasses(PassManagerBase &)
Register analysis passes for this target with a pass manager.
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X or iOS).
Definition: Triple.h:313
global_iterator global_end()
Definition: Module.h:523
TargetMachine * createTargetMachine(StringRef Triple, StringRef CPU, StringRef Features, const TargetOptions &Options, Reloc::Model RM=Reloc::Default, CodeModel::Model CM=CodeModel::Default, CodeGenOpt::Level OL=CodeGenOpt::Default) const
SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
Definition: SmallPtrSet.h:174
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
bool linkInModule(Module *Src, unsigned Mode, std::string *ErrorMsg)
Link Src into the composite. The source is destroyed if Mode is DestroySource and preserved if it is ...
void initializeSROA_SSAUpPass(PassRegistry &)
alias_iterator alias_begin()
Definition: Module.h:542
Value * stripPointerCasts()
Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value...
Definition: Value.cpp:385
unsigned StackAlignmentOverride
StackAlignmentOverride - Override default stack alignment for target.
lto_codegen_model
Definition: lto.h:70
void setCodePICModel(lto_codegen_model)
std::string message() const
#define debug(s)
void initializeDCEPass(PassRegistry &)
void initializeDAHPass(PassRegistry &)
void initializeSROAPass(PassRegistry &)
const StringRef getTargetTriple() const
size_t getBufferSize() const
Definition: MemoryBuffer.h:53
void initializeGlobalDCEPass(PassRegistry &)
iterator end()
Definition: Module.h:533
StringRef getName(LibFunc::Func F) const
bool isDeclaration() const
Definition: Globals.cpp:66
const char * c_str()
Definition: SmallString.h:273
virtual const DataLayout * getDataLayout() const
unsigned PositionIndependentExecutable
#define I(x, y, z)
Definition: MD5.cpp:54
iterator end() const
Definition: SmallPtrSet.h:279
iterator begin()
Definition: Module.h:531
static ArrayType * get(Type *ElementType, uint64_t NumElements)
Definition: Type.cpp:679
ModulePass * createInternalizePass(ArrayRef< const char * > ExportList)
void initializeConstantMergePass(PassRegistry &)
unsigned EnableSegmentedStacks
void initializeCFGSimplifyPassPass(PassRegistry &)
void initializeMemCpyOptPass(PassRegistry &)
Module * getModule() const
Definition: Linker.h:36
unsigned HonorSignDependentRoundingFPMathOption
iterator begin() const
Definition: SmallPtrSet.h:276
unsigned LessPreciseFPMADOption
Definition: TargetOptions.h:76
static const char * getVersionString()
LLVMContext & getGlobalContext()
Definition: LLVMContext.cpp:27
void WriteBitcodeToFile(const Module *M, raw_ostream &Out)
FunctionPass * createVerifierPass(VerifierFailureAction action=AbortProcessAction)
Create a verifier pass.
Definition: Verifier.cpp:2409
FloatABI::ABIType FloatABIType
bool addModule(struct LTOModule *, std::string &errMsg)
void initializeGVNPass(PassRegistry &)