diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
commit | 71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch) | |
tree | 5343938942df402b49ec7300a1c25a2d4ccd5821 /tools/lto/lto.cpp | |
parent | 31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff) |
Diffstat (limited to 'tools/lto/lto.cpp')
-rw-r--r-- | tools/lto/lto.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index a1dd4ebbccba..1b218a64cbf5 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -44,9 +44,13 @@ static cl::opt<bool> DisableGVNLoadPRE("disable-gvn-loadpre", cl::init(false), cl::desc("Do not run the GVN load PRE pass")); -static cl::opt<bool> -DisableLTOVectorization("disable-lto-vectorization", cl::init(false), - cl::desc("Do not run loop or slp vectorization during LTO")); +static cl::opt<bool> DisableLTOVectorization( + "disable-lto-vectorization", cl::init(false), + cl::desc("Do not run loop or slp vectorization during LTO")); + +static cl::opt<bool> EnableFreestanding( + "lto-freestanding", cl::init(false), + cl::desc("Enable Freestanding (disable builtins / TLI) during LTO")); #ifdef NDEBUG static bool VerifyByDefault = false; @@ -159,6 +163,7 @@ static void lto_add_attrs(lto_code_gen_t cg) { if (OptLevel < '0' || OptLevel > '3') report_fatal_error("Optimization level must be between 0 and 3"); CG->setOptLevel(OptLevel - '0'); + CG->setFreestanding(EnableFreestanding); } extern const char* lto_get_version() { @@ -267,7 +272,7 @@ lto_module_t lto_module_create_in_local_context(const void *mem, size_t length, lto_initialize(); llvm::TargetOptions Options = InitTargetOptionsFromCodeGenFlags(); - // Create a local context. Ownership will be transfered to LTOModule. + // Create a local context. Ownership will be transferred to LTOModule. std::unique_ptr<LLVMContext> Context = llvm::make_unique<LLVMContext>(); Context->setDiagnosticHandler(diagnosticHandler, nullptr, true); @@ -464,6 +469,7 @@ thinlto_code_gen_t thinlto_create_codegen(void) { lto_initialize(); ThinLTOCodeGenerator *CodeGen = new ThinLTOCodeGenerator(); CodeGen->setTargetOptions(InitTargetOptionsFromCodeGenFlags()); + CodeGen->setFreestanding(EnableFreestanding); if (OptLevel.getNumOccurrences()) { if (OptLevel < '0' || OptLevel > '3') |