OLD | NEW |
1 //===-LTOCodeGenerator.h - LLVM Link Time Optimizer -----------------------===// | 1 //===-LTOCodeGenerator.h - LLVM Link Time Optimizer -----------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file declares the LTOCodeGenerator class. | 10 // This file declares the LTOCodeGenerator class. |
11 // | 11 // |
12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
13 | 13 |
14 #ifndef LTO_CODE_GENERATOR_H | 14 #ifndef LTO_CODE_GENERATOR_H |
15 #define LTO_CODE_GENERATOR_H | 15 #define LTO_CODE_GENERATOR_H |
16 | 16 |
17 #include "llvm/Linker.h" | 17 #include "llvm/Linker.h" |
18 #include "llvm/ADT/StringMap.h" | 18 #include "llvm/ADT/StringMap.h" |
19 #include "llvm/ADT/SmallPtrSet.h" | 19 #include "llvm/ADT/SmallPtrSet.h" |
20 #include "llvm-c/lto.h" | 20 #include "llvm-c/lto.h" |
21 #include <string> | 21 #include <string> |
| 22 #include <vector> |
22 | 23 |
23 namespace llvm { | 24 namespace llvm { |
24 class LLVMContext; | 25 class LLVMContext; |
25 class GlobalValue; | 26 class GlobalValue; |
26 class Mangler; | 27 class Mangler; |
27 class MemoryBuffer; | 28 class MemoryBuffer; |
28 class TargetMachine; | 29 class TargetMachine; |
29 class raw_ostream; | 30 class raw_ostream; |
30 } | 31 } |
31 | 32 |
32 //===----------------------------------------------------------------------===// | 33 //===----------------------------------------------------------------------===// |
33 /// LTOCodeGenerator - C++ class which implements the opaque lto_code_gen_t | 34 /// LTOCodeGenerator - C++ class which implements the opaque lto_code_gen_t |
34 /// type. | 35 /// type. |
35 /// | 36 /// |
36 struct LTOCodeGenerator { | 37 struct LTOCodeGenerator { |
37 static const char *getVersionString(); | 38 static const char *getVersionString(); |
38 | 39 |
39 LTOCodeGenerator(); | 40 LTOCodeGenerator(); |
40 ~LTOCodeGenerator(); | 41 ~LTOCodeGenerator(); |
41 | 42 |
42 bool addModule(struct LTOModule*, std::string &errMsg); | 43 bool addModule(struct LTOModule*, std::string &errMsg); |
| 44 // @LOCALMOD-BEGIN |
| 45 bool gatherModule(struct LTOModule*); |
| 46 bool linkGatheredModulesAndDispose(std::string &errMsg); |
| 47 // @LOCALMOD-END |
43 bool setDebugInfo(lto_debug_model, std::string &errMsg); | 48 bool setDebugInfo(lto_debug_model, std::string &errMsg); |
44 bool setCodePICModel(lto_codegen_model, std::string &errMsg); | 49 bool setCodePICModel(lto_codegen_model, std::string &errMsg); |
45 | 50 |
46 void setCpu(const char* mCpu) { _mCpu = mCpu; } | 51 void setCpu(const char* mCpu) { _mCpu = mCpu; } |
47 | 52 |
48 void addMustPreserveSymbol(const char* sym) { | 53 void addMustPreserveSymbol(const char* sym) { |
49 _mustPreserveSymbols[sym] = 1; | 54 _mustPreserveSymbols[sym] = 1; |
50 } | 55 } |
51 | 56 |
52 bool writeMergedModules(const char *path, std::string &errMsg); | 57 bool writeMergedModules(const char *path, std::string &errMsg); |
(...skipping 27 matching lines...) Expand all Loading... |
80 llvm::TargetMachine* _target; | 85 llvm::TargetMachine* _target; |
81 bool _emitDwarfDebugInfo; | 86 bool _emitDwarfDebugInfo; |
82 bool _scopeRestrictionsDone; | 87 bool _scopeRestrictionsDone; |
83 lto_codegen_model _codeModel; | 88 lto_codegen_model _codeModel; |
84 StringSet _mustPreserveSymbols; | 89 StringSet _mustPreserveSymbols; |
85 StringSet _asmUndefinedRefs; | 90 StringSet _asmUndefinedRefs; |
86 llvm::MemoryBuffer* _nativeObjectFile; | 91 llvm::MemoryBuffer* _nativeObjectFile; |
87 std::vector<char*> _codegenOptions; | 92 std::vector<char*> _codegenOptions; |
88 std::string _mCpu; | 93 std::string _mCpu; |
89 std::string _nativeObjectPath; | 94 std::string _nativeObjectPath; |
| 95 |
| 96 // @LOCALMOD |
| 97 std::vector<LTOModule*> _gatheredModules; |
90 }; | 98 }; |
91 | 99 |
92 #endif // LTO_CODE_GENERATOR_H | 100 #endif // LTO_CODE_GENERATOR_H |
OLD | NEW |