pass machinemoduleinfo down into getSymbolForDwarfGlobalReference,
[llvm/avr.git] / tools / lto / LTOCodeGenerator.h
blob0ebec2ca8b0f5376d6e53ec19839d12bfada75eb
1 //===-LTOCodeGenerator.h - 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 declares the LTOCodeGenerator class.
12 //===----------------------------------------------------------------------===//
15 #ifndef LTO_CODE_GENERATOR_H
16 #define LTO_CODE_GENERATOR_H
18 #include "llvm/Linker.h"
19 #include "llvm/LLVMContext.h"
20 #include "llvm/ADT/StringMap.h"
21 #include "llvm/ADT/SmallVector.h"
23 #include <string>
27 // C++ class which implements the opaque lto_code_gen_t
30 class LTOCodeGenerator {
31 public:
32 static const char* getVersionString();
34 LTOCodeGenerator();
35 ~LTOCodeGenerator();
37 bool addModule(class LTOModule*, std::string& errMsg);
38 bool setDebugInfo(lto_debug_model, std::string& errMsg);
39 bool setCodePICModel(lto_codegen_model, std::string& errMsg);
40 void setAssemblerPath(const char* path);
41 void addMustPreserveSymbol(const char* sym);
42 bool writeMergedModules(const char* path,
43 std::string& errMsg);
44 const void* compile(size_t* length, std::string& errMsg);
45 void setCodeGenDebugOptions(const char *opts);
46 private:
47 bool generateAssemblyCode(llvm::formatted_raw_ostream& out,
48 std::string& errMsg);
49 bool assemble(const std::string& asmPath,
50 const std::string& objPath, std::string& errMsg);
51 void applyScopeRestrictions();
52 bool determineTarget(std::string& errMsg);
54 typedef llvm::StringMap<uint8_t> StringSet;
56 llvm::LLVMContext& _context;
57 llvm::Linker _linker;
58 llvm::TargetMachine* _target;
59 bool _emitDwarfDebugInfo;
60 bool _scopeRestrictionsDone;
61 lto_codegen_model _codeModel;
62 StringSet _mustPreserveSymbols;
63 llvm::MemoryBuffer* _nativeObjectFile;
64 std::vector<const char*> _codegenOptions;
65 llvm::sys::Path* _assemblerPath;
68 #endif // LTO_CODE_GENERATOR_H