Skip to content

[docs] Try to make it easier to find info about new PM vs legacy PM #80834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions llvm/docs/UserGuides.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,14 @@ LLVM Builds and Distributions
Optimizations
-------------

:doc:`WritingAnLLVMPass`
Information on how to write LLVM transformations and analyses.

:doc:`WritingAnLLVMNewPMPass`
Information on how to write LLVM transformations under the new pass
manager.

:doc:`WritingAnLLVMPass`
Information on how to write LLVM transformations and analyses under the
legacy pass manager.

:doc:`Passes`
A list of optimizations and analyses implemented in LLVM.

Expand Down
10 changes: 5 additions & 5 deletions llvm/docs/WritingAnLLVMNewPMPass.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ Writing an LLVM Pass
Introduction --- What is a pass?
================================

.. warning::
This document deals with the new pass manager. LLVM uses the legacy pass
manager for the codegen pipeline. For more details, see
:doc:`WritingAnLLVMPass` and :doc:`NewPassManager`.

The LLVM pass framework is an important part of the LLVM system, because LLVM
passes are where most of the interesting parts of the compiler exist. Passes
perform the transformations and optimizations that make up the compiler, they
Expand All @@ -29,11 +34,6 @@ We start by showing you how to construct a pass, from setting up the build,
creating the pass, to executing and testing it. Looking at existing passes is
always a great way to learn details.

.. warning::
This document deals with the new pass manager. LLVM uses the legacy pass
manager for the codegen pipeline. For more details, see
:doc:`WritingAnLLVMPass` and :doc:`NewPassManager`.

Quick Start --- Writing hello world
===================================

Expand Down
27 changes: 17 additions & 10 deletions llvm/docs/WritingAnLLVMPass.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
====================
Writing an LLVM Pass
====================
========================================
Writing an LLVM Pass (legacy PM version)
========================================

.. program:: opt

Expand All @@ -10,6 +10,13 @@ Writing an LLVM Pass
Introduction --- What is a pass?
================================

.. warning::
This document deals with the legacy pass manager. LLVM uses the new pass
manager for the optimization pipeline (the codegen pipeline
still uses the legacy pass manager), which has its own way of defining
passes. For more details, see :doc:`WritingAnLLVMNewPMPass` and
:doc:`NewPassManager`.

The LLVM Pass Framework is an important part of the LLVM system, because LLVM
passes are where most of the interesting parts of the compiler exist. Passes
perform the transformations and optimizations that make up the compiler, they
Expand All @@ -34,13 +41,6 @@ We start by showing you how to construct a pass, everything from setting up the
code, to compiling, loading, and executing it. After the basics are down, more
advanced features are discussed.

.. warning::
This document deals with the legacy pass manager. LLVM uses the new pass
manager for the optimization pipeline (the codegen pipeline
still uses the legacy pass manager), which has its own way of defining
passes. For more details, see :doc:`WritingAnLLVMNewPMPass` and
:doc:`NewPassManager`.

Quick Start --- Writing hello world
===================================

Expand Down Expand Up @@ -224,6 +224,13 @@ can have them) to be useful.
Running a pass with ``opt``
---------------------------

.. warning::
This document deals with the legacy pass manager. The :program:`opt` tool no
longer supports running legacy passes (except for certain hardcoded backend
passes and when using bugpoint). So the examples below for loading and
running legacy passes using :program:`opt` are deprecated and no longer
guaranteed to work.

Now that you have a brand new shiny shared object file, we can use the
:program:`opt` command to run an LLVM program through your pass. Because you
registered your pass with ``RegisterPass``, you will be able to use the
Expand Down