[PATCH] D92818: [NFC] Rename IsCodeGenPass to ShouldPinPassToLegacyPM

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 7 23:18:31 PST 2020


aeubanks created this revision.
aeubanks added reviewers: ychen, asbirlea.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Codegen-specific passes are being ported to the NPM. Rename for better
clarity and note that ported passes that fully work with the NPM should
be removed from these lists.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92818

Files:
  llvm/tools/opt/opt.cpp


Index: llvm/tools/opt/opt.cpp
===================================================================
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -457,10 +457,11 @@
   }
 };
 
-// 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-",
@@ -490,10 +491,10 @@
 }
 
 // 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;
@@ -722,7 +723,7 @@
   // 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";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92818.310093.patch
Type: text/x-patch
Size: 1579 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201208/58f3f81a/attachment.bin>


More information about the llvm-commits mailing list