2 * Copyright (C) 1995-2009 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 #ifndef FIRM_IR_PASS_T_H
20 #define FIRM_IR_PASS_T_H
24 * @brief Manager for optimization passes. Private Header
25 * @author Michael Beck
28 #include "firm_types.h"
29 #include "firm_common.h"
34 * Pass function on an ir_graph.
36 typedef int (*RUN_ON_IRG_FUNC)(ir_graph *irg, void *ctx);
39 * Dump function on an ir_graph.
41 typedef void (*DUMP_ON_IRG_FUNC)(ir_graph *irg, void *ctx, unsigned idx);
44 * Pass function on an ir_prog.
46 typedef int (*RUN_ON_IRPROG_FUNC)(ir_prog *prog, void *ctx);
49 * Dump function on an ir_prog.
51 typedef void (*DUMP_ON_IRPROG_FUNC)(ir_prog *irg, void *ctx, unsigned idx);
54 * Init/Term function on an pass.
56 typedef void (*INIT_TERM_FUNC)(void *ctx);
61 struct ir_graph_pass_t {
65 /** This function is run on every graph on an ir_prog. */
66 RUN_ON_IRG_FUNC run_on_irg;
67 RUN_ON_IRG_FUNC verify_irg;
68 DUMP_ON_IRG_FUNC dump_irg;
69 /** This function is called if this pass is added. */
70 INIT_TERM_FUNC add_to_mgr;
71 /** This function is called if this pass is removed. */
72 INIT_TERM_FUNC rem_from_mgr;
74 /** context parameter for this pass */
77 /** The name of the pass. */
80 /** Links all passes. */
83 unsigned verify:1; /**< Set if this pass should be verified. */
84 unsigned dump:1; /**< Set if this pass should be dumped. */
90 struct ir_prog_pass_t {
94 /** This function is on an ir_prog. */
95 RUN_ON_IRPROG_FUNC run_on_irprog;
96 RUN_ON_IRPROG_FUNC verify_irprog;
97 DUMP_ON_IRPROG_FUNC dump_irprog;
98 /** This function is called if this pass is added. */
99 INIT_TERM_FUNC add_to_mgr;
100 /** This function is called if this pass is removed. */
101 INIT_TERM_FUNC rem_from_mgr;
103 /** context parameter for this pass */
106 /** The name of the pass. */
109 /** Links all passes */
112 unsigned verify:1; /**< Set if this pass should be verified. */
113 unsigned dump:1; /**< Set if this pass should be dumped. */
117 * A graph pass manager.
119 struct ir_graph_pass_manager_t {
120 firm_kind kind; /**< The firm kind. */
121 list_head passes; /**< The list of passes. */
122 unsigned n_passes; /**< Number of added passes. */
123 const char *name; /**< the name of the manager. */
124 unsigned run_idx; /**< The run number for the first pass of this manager. */
125 unsigned verify_all:1; /**< Set if every pass should be verified. */
126 unsigned dump_all:1; /**< Set if every pass should be dumped. */
130 * A irprog pass manager.
132 struct ir_prog_pass_manager_t {
133 firm_kind kind; /**< The firm kind. */
134 list_head passes; /**< The list of passes. */
135 unsigned n_passes; /**< Number of added passes. */
136 const char *name; /**< the name of the manager. */
137 unsigned run_idx; /**< The run number for the first pass of this manager. */
138 unsigned verify_all:1; /**< Set if every pass should be verified. */
139 unsigned dump_all:1; /**< Set if every pass should be dumped. */