summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-lto/llvm-lto.cpp6
-rw-r--r--llvm/tools/lto/lto.cpp12
2 files changed, 15 insertions, 3 deletions
diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp
index 475350c8ecf..2f005412a3b 100644
--- a/llvm/tools/llvm-lto/llvm-lto.cpp
+++ b/llvm/tools/llvm-lto/llvm-lto.cpp
@@ -63,6 +63,10 @@ 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"));
+
static cl::opt<bool> UseDiagnosticHandler(
"use-diagnostic-handler", cl::init(false),
cl::desc("Use a diagnostic handler to test the handler interface"));
@@ -433,6 +437,7 @@ public:
ThinGenerator.setCodePICModel(getRelocModel());
ThinGenerator.setTargetOptions(Options);
ThinGenerator.setCacheDir(ThinLTOCacheDir);
+ ThinGenerator.setFreestanding(EnableFreestanding);
// Add all the exported symbols to the table of symbols to preserve.
for (unsigned i = 0; i < ExportedSymbols.size(); ++i)
@@ -809,6 +814,7 @@ int main(int argc, char **argv) {
CodeGen.setDiagnosticHandler(handleDiagnostics, nullptr);
CodeGen.setCodePICModel(getRelocModel());
+ CodeGen.setFreestanding(EnableFreestanding);
CodeGen.setDebugInfo(LTO_DEBUG_MODEL_DWARF);
CodeGen.setTargetOptions(Options);
diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp
index a1dd4ebbccb..e28c7aaf526 100644
--- a/llvm/tools/lto/lto.cpp
+++ b/llvm/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() {
@@ -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')
OpenPOWER on IntegriCloud