<html lang="en"> <head> <title>Pass manager - GNU Compiler Collection (GCC) Internals</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="GNU Compiler Collection (GCC) Internals"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Passes.html#Passes" title="Passes"> <link rel="prev" href="Gimplification-pass.html#Gimplification-pass" title="Gimplification pass"> <link rel="next" href="Tree-SSA-passes.html#Tree-SSA-passes" title="Tree SSA passes"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- Copyright (C) 1988-2015 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being ``Funding Free Software'', the Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled ``GNU Free Documentation License''. (a) The FSF's Front-Cover Text is: A GNU Manual (b) The FSF's Back-Cover Text is: You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.--> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Pass-manager"></a> <p> Next: <a rel="next" accesskey="n" href="Tree-SSA-passes.html#Tree-SSA-passes">Tree SSA passes</a>, Previous: <a rel="previous" accesskey="p" href="Gimplification-pass.html#Gimplification-pass">Gimplification pass</a>, Up: <a rel="up" accesskey="u" href="Passes.html#Passes">Passes</a> <hr> </div> <h3 class="section">9.4 Pass manager</h3> <p>The pass manager is located in <samp><span class="file">passes.c</span></samp>, <samp><span class="file">tree-optimize.c</span></samp> and <samp><span class="file">tree-pass.h</span></samp>. It processes passes as described in <samp><span class="file">passes.def</span></samp>. Its job is to run all of the individual passes in the correct order, and take care of standard bookkeeping that applies to every pass. <p>The theory of operation is that each pass defines a structure that represents everything we need to know about that pass—when it should be run, how it should be run, what intermediate language form or on-the-side data structures it needs. We register the pass to be run in some particular order, and the pass manager arranges for everything to happen in the correct order. <p>The actuality doesn't completely live up to the theory at present. Command-line switches and <code>timevar_id_t</code> enumerations must still be defined elsewhere. The pass manager validates constraints but does not attempt to (re-)generate data structures or lower intermediate language form based on the requirements of the next pass. Nevertheless, what is present is useful, and a far sight better than nothing at all. <p>Each pass should have a unique name. Each pass may have its own dump file (for GCC debugging purposes). Passes with a name starting with a star do not dump anything. Sometimes passes are supposed to share a dump file / option name. To still give these unique names, you can use a prefix that is delimited by a space from the part that is used for the dump file / option name. E.g. When the pass name is "ud dce", the name used for dump file/options is "dce". <p>TODO: describe the global variables set up by the pass manager, and a brief description of how a new pass should use it. I need to look at what info RTL passes use first<small class="enddots">...</small> </body></html>