[CMake][NewPM] Move ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER into llvm/
This allows us to use its value everywhere, rather than just clang. Some
other places, like opt and lld, will use its value soon.
The #define for it is now in llvm-config.h.
Reviewed By: rnk, hans
Differential Revision: https://reviews.llvm.org/D92072
GitOrigin-RevId: a36bd4c90dcca82be9b64f65dbd22e921b6485ef
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8c539e8..f947b82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -242,9 +242,6 @@
set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL
"enable x86 relax relocations by default")
-set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER FALSE CACHE BOOL
- "Enable the experimental new pass manager by default.")
-
set(CLANG_SPAWN_CC1 OFF CACHE BOOL
"Whether clang should use a new process for the CC1 invocation")
diff --git a/include/clang/Config/config.h.cmake b/include/clang/Config/config.h.cmake
index 26e9d5c..a240862 100644
--- a/include/clang/Config/config.h.cmake
+++ b/include/clang/Config/config.h.cmake
@@ -75,9 +75,6 @@
/* enable x86 relax relocations by default */
#cmakedefine01 ENABLE_X86_RELAX_RELOCATIONS
-/* Enable the experimental new pass manager by default */
-#cmakedefine01 ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER
-
/* Enable each functionality of modules */
#cmakedefine01 CLANG_ENABLE_ARCMT
#cmakedefine01 CLANG_ENABLE_OBJC_REWRITER
diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
index 48d0e2d..6e37a31 100644
--- a/include/clang/Driver/Options.td
+++ b/include/clang/Driver/Options.td
@@ -1349,7 +1349,7 @@
def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group<f_clang_Group>,
Alias<fglobal_isel>;
defm experimental_new_pass_manager : BooleanMarshalledFFlag<"experimental-new-pass-manager", "CodeGenOpts.ExperimentalNewPassManager",
- "static_cast<unsigned>(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER)", "Enables an experimental new pass manager in LLVM.",
+ "static_cast<unsigned>(LLVM_ENABLE_NEW_PASS_MANAGER)", "Enables an experimental new pass manager in LLVM.",
"Disables an experimental new pass manager in LLVM.">, Group<f_clang_Group>, Flags<[CC1Option]>;
def fexperimental_strict_floating_point : Flag<["-"], "fexperimental-strict-floating-point">,
Group<f_clang_Group>, Flags<[CC1Option]>,
diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp
index d765b4c..034fab2 100644
--- a/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/lib/Driver/ToolChains/CommonArgs.cpp
@@ -37,6 +37,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/Config/llvm-config.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
@@ -597,7 +598,7 @@
// Need this flag to turn on new pass manager via Gold plugin.
if (Args.hasFlag(options::OPT_fexperimental_new_pass_manager,
options::OPT_fno_experimental_new_pass_manager,
- /* Default */ ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER)) {
+ /* Default */ LLVM_ENABLE_NEW_PASS_MANAGER)) {
CmdArgs.push_back("-plugin-opt=new-pass-manager");
}
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index f72e0fc..068c860 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -58,6 +58,7 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/Config/llvm-config.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/Linker/Linker.h"
#include "llvm/MC/MCTargetOptions.h"
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 2aff029..a913b35 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -15,7 +15,7 @@
CLANG_ENABLE_STATIC_ANALYZER
CLANG_SPAWN_CC1
ENABLE_BACKTRACES
- ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER
+ LLVM_ENABLE_NEW_PASS_MANAGER
LLVM_ENABLE_ZLIB
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
LLVM_ENABLE_PLUGINS
diff --git a/test/lit.site.cfg.py.in b/test/lit.site.cfg.py.in
index 9cbb6eb..eb01720 100644
--- a/test/lit.site.cfg.py.in
+++ b/test/lit.site.cfg.py.in
@@ -24,7 +24,7 @@
config.clang_examples = @CLANG_BUILD_EXAMPLES@
config.enable_shared = @ENABLE_SHARED@
config.enable_backtrace = @ENABLE_BACKTRACES@
-config.enable_experimental_new_pass_manager = @ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER@
+config.enable_experimental_new_pass_manager = @LLVM_ENABLE_NEW_PASS_MANAGER@
config.enable_threads = @LLVM_ENABLE_THREADS@
config.host_arch = "@HOST_ARCH@"
config.python_executable = "@Python3_EXECUTABLE@"