summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-27 23:19:26 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-27 23:19:26 +0000
commit7832e0a2f05c07101f8b320220a1165b2e148e4d (patch)
treed730a9d1a741a06aa062ea258822e6dd9116d0bf /llvm
parente0bca755d8e8bd33f17e05ffb69b75339e042b3c (diff)
downloadbcm5719-llvm-7832e0a2f05c07101f8b320220a1165b2e148e4d.tar.gz
bcm5719-llvm-7832e0a2f05c07101f8b320220a1165b2e148e4d.zip
LTO: Simplify code generator initialization
Simplify `LTOCodeGenerator` initialization by initializing simple fields at their definition. llvm-svn: 235939
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/LTO/LTOCodeGenerator.h19
-rw-r--r--llvm/lib/LTO/LTOCodeGenerator.cpp17
2 files changed, 11 insertions, 25 deletions
diff --git a/llvm/include/llvm/LTO/LTOCodeGenerator.h b/llvm/include/llvm/LTO/LTOCodeGenerator.h
index ff3b71a1a0e..88156304344 100644
--- a/llvm/include/llvm/LTO/LTOCodeGenerator.h
+++ b/llvm/include/llvm/LTO/LTOCodeGenerator.h
@@ -155,15 +155,14 @@ private:
typedef StringMap<uint8_t> StringSet;
- void initialize();
void destroyMergedModule();
std::unique_ptr<LLVMContext> OwnedContext;
LLVMContext &Context;
Linker IRLinker;
- TargetMachine *TargetMach;
- bool EmitDwarfDebugInfo;
- bool ScopeRestrictionsDone;
- lto_codegen_model CodeModel;
+ TargetMachine *TargetMach = nullptr;
+ bool EmitDwarfDebugInfo = false;
+ bool ScopeRestrictionsDone = false;
+ lto_codegen_model CodeModel = LTO_CODEGEN_PIC_MODEL_DEFAULT;
StringSet MustPreserveSymbols;
StringSet AsmUndefinedRefs;
std::unique_ptr<MemoryBuffer> NativeObjectFile;
@@ -172,11 +171,11 @@ private:
std::string MAttr;
std::string NativeObjectPath;
TargetOptions Options;
- unsigned OptLevel;
- lto_diagnostic_handler_t DiagHandler;
- void *DiagContext;
- LTOModule *OwnedModule;
- bool ShouldInternalize;
+ unsigned OptLevel = 2;
+ lto_diagnostic_handler_t DiagHandler = nullptr;
+ void *DiagContext = nullptr;
+ LTOModule *OwnedModule = nullptr;
+ bool ShouldInternalize = true;
};
}
#endif
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp
index 16718d7ce64..6a19849e668 100644
--- a/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -65,25 +65,12 @@ const char* LTOCodeGenerator::getVersionString() {
LTOCodeGenerator::LTOCodeGenerator()
: Context(getGlobalContext()), IRLinker(new Module("ld-temp.o", Context)) {
- initialize();
+ initializeLTOPasses();
}
LTOCodeGenerator::LTOCodeGenerator(std::unique_ptr<LLVMContext> Context)
: OwnedContext(std::move(Context)), Context(*OwnedContext),
- IRLinker(new Module("ld-temp.o", *OwnedContext)), OptLevel(2) {
- initialize();
-}
-
-void LTOCodeGenerator::initialize() {
- TargetMach = nullptr;
- EmitDwarfDebugInfo = false;
- ScopeRestrictionsDone = false;
- CodeModel = LTO_CODEGEN_PIC_MODEL_DEFAULT;
- DiagHandler = nullptr;
- DiagContext = nullptr;
- OwnedModule = nullptr;
- ShouldInternalize = true;
-
+ IRLinker(new Module("ld-temp.o", *OwnedContext)) {
initializeLTOPasses();
}
OpenPOWER on IntegriCloud