[PATCH] D88342: [Docs][NewPM] Add note about required passes

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 21:45:51 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGda036b451470: [Docs][NewPM] Add note about required passes (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88342/new/

https://reviews.llvm.org/D88342

Files:
  llvm/docs/WritingAnLLVMNewPMPass.rst


Index: llvm/docs/WritingAnLLVMNewPMPass.rst
===================================================================
--- llvm/docs/WritingAnLLVMNewPMPass.rst
+++ llvm/docs/WritingAnLLVMNewPMPass.rst
@@ -207,3 +207,32 @@
 
   $ ninja -C build check-llvm
   # runs our new test alongside all other llvm lit tests
+
+FAQs
+====
+
+Required passes
+---------------
+
+A pass that defines a static ``isRequired()`` method that returns true is a required pass. For example:
+
+.. code-block:: c++
+
+  class HelloWorldPass : public PassInfoMixin<HelloWorldPass> {
+  public:
+    PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+
+    static bool isRequired() { return true; }
+  };
+
+A required pass is a pass that may not be skipped. An example of a required
+pass is ``AlwaysInlinerPass``, which must always be run to preserve
+``alwaysinline`` semantics. Pass managers are required since they may contain
+other required passes.
+
+An example of how a pass can be skipped is the ``optnone`` function
+attribute, which specifies that optimizations should not be run on the
+function. Required passes will still be run on ``optnone`` functions.
+
+For more implementation details, see
+``PassInstrumentation::runBeforePass()``.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88342.294881.patch
Type: text/x-patch
Size: 1237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200929/a51d6a6f/attachment.bin>


More information about the llvm-commits mailing list