llvm.org GIT mirror llvm / ab53bc7
Cleanup whitespace and trim some of the #includes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153807 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
4 changed file(s) with 54 addition(s) and 60 deletion(s). Raw diff Collapse all Expand all
1111 //
1212 //===----------------------------------------------------------------------===//
1313
14 #include "LTOCodeGenerator.h"
1415 #include "LTOModule.h"
15 #include "LTOCodeGenerator.h"
1616 #include "llvm/Constants.h"
1717 #include "llvm/DerivedTypes.h"
1818 #include "llvm/Linker.h"
33 //
44 // This file is distributed under the University of Illinois Open Source
55 // License. See LICENSE.TXT for details.
6 //
6 //
77 //===----------------------------------------------------------------------===//
88 //
9 // This file declares the LTOCodeGenerator class.
9 // This file declares the LTOCodeGenerator class.
1010 //
1111 //===----------------------------------------------------------------------===//
12
1312
1413 #ifndef LTO_CODE_GENERATOR_H
1514 #define LTO_CODE_GENERATOR_H
1615
1716 #include "llvm/Linker.h"
18 #include "llvm/LLVMContext.h"
1917 #include "llvm/ADT/StringMap.h"
20 #include "llvm/ADT/SmallVector.h"
2118 #include "llvm/ADT/SmallPtrSet.h"
22
19 #include "llvm-c/lto.h"
2320 #include
2421
22 namespace llvm {
23 class LLVMContext;
24 class GlobalValue;
25 class Mangler;
26 class MemoryBuffer;
27 class TargetMachine;
28 class raw_ostream;
29 }
2530
26 //
27 // C++ class which implements the opaque lto_code_gen_t
28 //
31 //===----------------------------------------------------------------------===//
32 /// LTOCodeGenerator - C++ class which implements the opaque lto_code_gen_t
33 /// type.
34 ///
35 struct LTOCodeGenerator {
36 static const char *getVersionString();
2937
30 struct LTOCodeGenerator {
31 static const char* getVersionString();
32
33 LTOCodeGenerator();
34 ~LTOCodeGenerator();
35
36 bool addModule(struct LTOModule*, std::string& errMsg);
37 bool setDebugInfo(lto_debug_model, std::string& errMsg);
38 bool setCodePICModel(lto_codegen_model, std::string& errMsg);
39 void setCpu(const char *cpu);
40 void addMustPreserveSymbol(const char* sym);
41 bool writeMergedModules(const char* path,
42 std::string& errMsg);
43 bool compile_to_file(const char** name, std::string& errMsg);
44 const void* compile(size_t* length, std::string& errMsg);
45 void setCodeGenDebugOptions(const char *opts);
38 LTOCodeGenerator();
39 ~LTOCodeGenerator();
40
41 bool addModule(struct LTOModule*, std::string &errMsg);
42 bool setDebugInfo(lto_debug_model, std::string &errMsg);
43 bool setCodePICModel(lto_codegen_model, std::string &errMsg);
44 void setCpu(const char *cpu);
45 void addMustPreserveSymbol(const char *sym);
46 bool writeMergedModules(const char *path, std::string &errMsg);
47 bool compile_to_file(const char **name, std::string &errMsg);
48 const void *compile(size_t *length, std::string &errMsg);
49 void setCodeGenDebugOptions(const char *opts);
50
4651 private:
47 bool generateObjectFile(llvm::raw_ostream& out,
48 std::string& errMsg);
49 void applyScopeRestrictions();
50 void applyRestriction(llvm::GlobalValue &GV,
51 std::vector &mustPreserveList,
52 bool generateObjectFile(llvm::raw_ostream &out, std::string &errMsg);
53 void applyScopeRestrictions();
54 void applyRestriction(llvm::GlobalValue &GV,
55 std::vector &mustPreserveList,
5256 llvm::SmallPtrSet &asmUsed,
53 llvm::Mangler &mangler);
54 bool determineTarget(std::string& errMsg);
55
56 typedef llvm::StringMap StringSet;
57 llvm::Mangler &mangler);
58 bool determineTarget(std::string &errMsg);
5759
58 llvm::LLVMContext& _context;
59 llvm::Linker _linker;
60 llvm::TargetMachine* _target;
61 bool _emitDwarfDebugInfo;
62 bool _scopeRestrictionsDone;
63 lto_codegen_model _codeModel;
64 StringSet _mustPreserveSymbols;
65 StringSet _asmUndefinedRefs;
66 llvm::MemoryBuffer* _nativeObjectFile;
67 std::vector _codegenOptions;
68 std::string _mCpu;
69 std::string _nativeObjectPath;
60 typedef llvm::StringMap StringSet;
61
62 llvm::LLVMContext& _context;
63 llvm::Linker _linker;
64 llvm::TargetMachine* _target;
65 bool _emitDwarfDebugInfo;
66 bool _scopeRestrictionsDone;
67 lto_codegen_model _codeModel;
68 StringSet _mustPreserveSymbols;
69 StringSet _asmUndefinedRefs;
70 llvm::MemoryBuffer* _nativeObjectFile;
71 std::vector _codegenOptions;
72 std::string _mCpu;
73 std::string _nativeObjectPath;
7074 };
7175
7276 #endif // LTO_CODE_GENERATOR_H
73
1616 #include "llvm/LLVMContext.h"
1717 #include "llvm/Module.h"
1818 #include "llvm/Bitcode/ReaderWriter.h"
19 #include "llvm/MC/MCAsmInfo.h"
2019 #include "llvm/MC/MCExpr.h"
2120 #include "llvm/MC/MCInst.h"
2221 #include "llvm/MC/MCStreamer.h"
2524 #include "llvm/MC/MCTargetAsmParser.h"
2625 #include "llvm/MC/SubtargetFeature.h"
2726 #include "llvm/MC/MCParser/MCAsmParser.h"
28 #include "llvm/Target/TargetMachine.h"
2927 #include "llvm/Target/TargetRegisterInfo.h"
3028 #include "llvm/Support/Host.h"
31 #include "llvm/Support/MathExtras.h"
3229 #include "llvm/Support/MemoryBuffer.h"
3330 #include "llvm/Support/Path.h"
34 #include "llvm/Support/Process.h"
3531 #include "llvm/Support/SourceMgr.h"
36 #include "llvm/Support/SystemUtils.h"
3732 #include "llvm/Support/TargetRegistry.h"
3833 #include "llvm/Support/TargetSelect.h"
3934 #include "llvm/Support/system_error.h"
4035 #include "llvm/ADT/OwningPtr.h"
4136 #include "llvm/ADT/Triple.h"
42
4337 using namespace llvm;
4438
4539 LTOModule::LTOModule(llvm::Module *m, llvm::TargetMachine *t)
1919 #include "llvm/Target/TargetMachine.h"
2020 #include "llvm/ADT/OwningPtr.h"
2121 #include "llvm/ADT/StringMap.h"
22
2322 #include "llvm-c/lto.h"
24
2523 #include
2624 #include
27
2825
2926 // Forward references to llvm classes.
3027 namespace llvm {
3431 class Value;
3532 }
3633
37 //
38 // C++ class which implements the opaque lto_module_t type.
39 //
34 //===----------------------------------------------------------------------===//
35 /// LTOModule - C++ class which implements the opaque lto_module_t type.
36 ///
4037 struct LTOModule {
4138 private:
4239 typedef llvm::StringMap StringSet;