(Hopefully) unbreak Apple-style builds.
[llvm/msp430.git] / tools / lto / LTOCodeGenerator.h
blob57398b0650037ac63ee900dbd9d93030b83596e9
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/ADT/StringMap.h"
20 #include "llvm/ADT/SmallVector.h"
22 #include <string>
26 // C++ class which implements the opaque lto_code_gen_t
29 class LTOCodeGenerator {
30 public:
31 static const char* getVersionString();
33 LTOCodeGenerator();
34 ~LTOCodeGenerator();
36 bool addModule(class LTOModule*, std::string& errMsg);
37 bool setDebugInfo(lto_debug_model, std::string& errMsg);
38 bool setCodePICModel(lto_codegen_model, std::string& errMsg);
39 void setGccPath(const char* path);
40 void addMustPreserveSymbol(const char* sym);
41 bool writeMergedModules(const char* path,
42 std::string& errMsg);
43 const void* compile(size_t* length, std::string& errMsg);
44 void setCodeGenDebugOptions(const char *opts);
45 private:
46 bool generateAssemblyCode(llvm::raw_ostream& out,
47 std::string& errMsg);
48 bool assemble(const std::string& asmPath,
49 const std::string& objPath, std::string& errMsg);
50 void applyScopeRestrictions();
51 bool determineTarget(std::string& errMsg);
53 typedef llvm::StringMap<uint8_t> StringSet;
55 llvm::Linker _linker;
56 llvm::TargetMachine* _target;
57 bool _emitDwarfDebugInfo;
58 bool _scopeRestrictionsDone;
59 lto_codegen_model _codeModel;
60 StringSet _mustPreserveSymbols;
61 llvm::MemoryBuffer* _nativeObjectFile;
62 std::vector<const char*> _codegenOptions;
63 llvm::sys::Path* _gccPath;
66 #endif // LTO_CODE_GENERATOR_H