Skip to content

Commit 000c5d9

Browse files
committed
[docs][passes] Update documentation of Analysis and Transform Passes
- Added a warning about the pass list being incomplete (and hint about "opt -print-passes" listing known passes). - Replaced legacy PM example involving "opt -analyze" with a proper example using -passes option. - print-function and print-module does not exist with those names in the new PM. Since the document has been updated to reflect the new PM names earlier, those names were changed into referring to function(print) and module(print) instead. - Resolved some FIXME:s around strip* passes.
1 parent f89fe08 commit 000c5d9

File tree

1 file changed

+18
-42
lines changed

1 file changed

+18
-42
lines changed

llvm/docs/Passes.rst

Lines changed: 18 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ LLVM's Analysis and Transform Passes
77

88
Introduction
99
============
10+
.. warning:: This document is not updated frequently, and the list of passes
11+
is most likely incomplete. It is possible to list passes known by the opt
12+
tool using ``opt -print-passes``.
1013

1114
This document serves as a high level summary of the optimization features that
1215
LLVM provides. Optimizations are implemented as Passes that traverse some
@@ -193,14 +196,15 @@ memory operations it depends on. It builds on alias analysis information, and
193196
tries to provide a lazy, caching interface to a common kind of alias
194197
information query.
195198

196-
``module-debuginfo``: Decodes module-level debug info
197-
-----------------------------------------------------
199+
``print<module-debuginfo>``: Decodes module-level debug info
200+
------------------------------------------------------------
198201

199202
This pass decodes the debug info metadata in a module and prints in a
200203
(sufficiently-prepared-) human-readable form.
201204

202-
For example, run this pass from ``opt`` along with the ``-analyze`` option, and
203-
it'll print to standard output.
205+
For example, run this pass from ``opt`` along with the
206+
``-passes='print<module-debuginfo>'`` option, and it'll print to standard
207+
output.
204208

205209
``postdomtree``: Post-Dominator Tree Construction
206210
-------------------------------------------------
@@ -228,18 +232,18 @@ standard error in a human-readable form.
228232
``print-cfg-sccs``: Print SCCs of each function CFG
229233
---------------------------------------------------
230234

231-
This pass, only available in ``opt``, printsthe SCCs of each function CFG to
235+
This pass, only available in ``opt``, prints the SCCs of each function CFG to
232236
standard error in a human-readable fom.
233237

234-
``print-function``: Print function to stderr
235-
--------------------------------------------
238+
``function(print)``: Print function to stderr
239+
---------------------------------------------
236240

237241
The ``PrintFunctionPass`` class is designed to be pipelined with other
238242
``FunctionPasses``, and prints out the functions of the module as they are
239243
processed.
240244

241-
``print-module``: Print module to stderr
242-
----------------------------------------
245+
``module(print)``: Print module to stderr
246+
-----------------------------------------
243247

244248
This pass simply prints out the entire module when it is executed.
245249

@@ -924,17 +928,8 @@ code size or making it harder to reverse engineer code.
924928
``strip-dead-debug-info``: Strip debug info for unused symbols
925929
--------------------------------------------------------------
926930

927-
.. FIXME: this description is the same as for -strip
928-
929-
performs code stripping. this transformation can delete:
930-
931-
* names for virtual registers
932-
* symbols for internal globals and functions
933-
* debug information
934-
935-
note that this transformation makes code much less readable, so it should only
936-
be used in situations where the strip utility would be used, such as reducing
937-
code size or making it harder to reverse engineer code.
931+
Performs code stripping. Similar to strip, but only strips debug info for
932+
unused symbols.
938933

939934
``strip-dead-prototypes``: Strip Unused Function Prototypes
940935
-----------------------------------------------------------
@@ -947,32 +942,13 @@ functions).
947942
``strip-debug-declare``: Strip all ``llvm.dbg.declare`` intrinsics
948943
------------------------------------------------------------------
949944

950-
.. FIXME: this description is the same as for -strip
951-
952-
This pass implements code stripping. Specifically, it can delete:
953-
954-
#. names for virtual registers
955-
#. symbols for internal globals and functions
956-
#. debug information
957-
958-
Note that this transformation makes code much less readable, so it should only
959-
be used in situations where the 'strip' utility would be used, such as reducing
960-
code size or making it harder to reverse engineer code.
945+
Performs code stripping. Similar to strip, but only strips
946+
``llvm.dbg.declare`` intrinsics.
961947

962948
``strip-nondebug``: Strip all symbols, except dbg symbols, from a module
963949
------------------------------------------------------------------------
964950

965-
.. FIXME: this description is the same as for -strip
966-
967-
This pass implements code stripping. Specifically, it can delete:
968-
969-
#. names for virtual registers
970-
#. symbols for internal globals and functions
971-
#. debug information
972-
973-
Note that this transformation makes code much less readable, so it should only
974-
be used in situations where the 'strip' utility would be used, such as reducing
975-
code size or making it harder to reverse engineer code.
951+
Performs code stripping. Similar to strip, but dbg info is preserved.
976952

977953
``tailcallelim``: Tail Call Elimination
978954
---------------------------------------

0 commit comments

Comments
 (0)