}
};
-// For use in NPM transition.
+// For use in NPM transition. Currently this contains most codegen-specific
+// passes. Remove passes from here when porting to the NPM.
// TODO: use a codegen version of PassRegistry.def/PassBuilder::is*Pass() once
// it exists.
-static bool IsCodegenPass(StringRef Pass) {
+static bool shouldPinPassToLegacyPM(StringRef Pass) {
std::vector<StringRef> PassNamePrefix = {
"x86-", "xcore-", "wasm-", "systemz-", "ppc-", "nvvm-", "nvptx-",
"mips-", "lanai-", "hexagon-", "bpf-", "avr-", "thumb2-", "arm-",
}
// For use in NPM transition.
-static bool CodegenPassSpecifiedInPassList() {
+static bool shouldForceLegacyPM() {
for (const auto &P : PassList) {
StringRef Arg = P->getPassArgument();
- if (IsCodegenPass(Arg))
+ if (shouldPinPassToLegacyPM(Arg))
return true;
}
return false;
// If `-enable-new-pm` is specified and there are no codegen passes, use NPM.
// e.g. `-enable-new-pm -sroa` will use NPM.
// but `-enable-new-pm -codegenprepare` will still revert to legacy PM.
- if ((EnableNewPassManager && !CodegenPassSpecifiedInPassList()) ||
+ if ((EnableNewPassManager && !shouldForceLegacyPM()) ||
PassPipeline.getNumOccurrences() > 0) {
if (AnalyzeOnly) {
errs() << "Cannot specify -analyze under new pass manager\n";