| 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 // Alternative methods of adding modules, which delay merging modules until |
| 46 // all modules are available. |
| 47 bool gatherModuleForLinking(struct LTOModule*); |
| 48 bool linkGatheredModulesAndDispose(std::string &errMsg); |
| 49 // @LOCALMOD-END |
| 43 bool setDebugInfo(lto_debug_model, std::string &errMsg); | 50 bool setDebugInfo(lto_debug_model, std::string &errMsg); |
| 44 bool setCodePICModel(lto_codegen_model, std::string &errMsg); | 51 bool setCodePICModel(lto_codegen_model, std::string &errMsg); |
| 45 | 52 |
| 46 void setCpu(const char* mCpu) { _mCpu = mCpu; } | 53 void setCpu(const char* mCpu) { _mCpu = mCpu; } |
| 47 | 54 |
| 48 void addMustPreserveSymbol(const char* sym) { | 55 void addMustPreserveSymbol(const char* sym) { |
| 49 _mustPreserveSymbols[sym] = 1; | 56 _mustPreserveSymbols[sym] = 1; |
| 50 } | 57 } |
| 51 | 58 |
| 52 bool writeMergedModules(const char *path, std::string &errMsg); | 59 bool writeMergedModules(const char *path, std::string &errMsg); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 80 llvm::TargetMachine* _target; | 87 llvm::TargetMachine* _target; |
| 81 bool _emitDwarfDebugInfo; | 88 bool _emitDwarfDebugInfo; |
| 82 bool _scopeRestrictionsDone; | 89 bool _scopeRestrictionsDone; |
| 83 lto_codegen_model _codeModel; | 90 lto_codegen_model _codeModel; |
| 84 StringSet _mustPreserveSymbols; | 91 StringSet _mustPreserveSymbols; |
| 85 StringSet _asmUndefinedRefs; | 92 StringSet _asmUndefinedRefs; |
| 86 llvm::MemoryBuffer* _nativeObjectFile; | 93 llvm::MemoryBuffer* _nativeObjectFile; |
| 87 std::vector<char*> _codegenOptions; | 94 std::vector<char*> _codegenOptions; |
| 88 std::string _mCpu; | 95 std::string _mCpu; |
| 89 std::string _nativeObjectPath; | 96 std::string _nativeObjectPath; |
| 97 |
| 98 // @LOCALMOD |
| 99 std::vector<LTOModule*> _gatheredModules; |
| 90 }; | 100 }; |
| 91 | 101 |
| 92 #endif // LTO_CODE_GENERATOR_H | 102 #endif // LTO_CODE_GENERATOR_H |
| OLD | NEW |