Merge from the pain train
[official-gcc.git] / gcc / tree-pass.h
blobe63ad11c9bb5509e30f5132b0d404703f2060129
1 /* Definitions for describing one tree-ssa optimization pass.
2 Copyright (C) 2004, 2005 Free Software Foundation, Inc.
3 Contributed by Richard Henderson <rth@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
23 #ifndef GCC_TREE_PASS_H
24 #define GCC_TREE_PASS_H 1
26 /* Global variables used to communicate with passes. */
27 extern FILE *dump_file;
28 extern int dump_flags;
29 extern const char *dump_file_name;
31 extern struct bitmap_head_def *vars_to_rename;
33 /* Return the dump_file_info for the given phase. */
34 extern struct dump_file_info *get_dump_file_info (enum tree_dump_index);
36 /* Describe one pass. */
37 struct tree_opt_pass
39 /* Terse name of the pass used as a fragment of the dump file name. */
40 const char *name;
42 /* If non-null, this pass and all sub-passes are executed only if
43 the function returns true. */
44 bool (*gate) (void);
46 /* This is the code to run. If null, then there should be sub-passes
47 otherwise this pass does nothing. */
48 void (*execute) (void);
50 /* A list of sub-passes to run, dependent on gate predicate. */
51 struct tree_opt_pass *sub;
53 /* Next in the list of passes to run, independent of gate predicate. */
54 struct tree_opt_pass *next;
56 /* Static pass number, used as a fragment of the dump file name. */
57 int static_pass_number;
59 /* The timevar id associated with this pass. */
60 /* ??? Ideally would be dynamically assigned. */
61 unsigned int tv_id;
63 /* Sets of properties input and output from this pass. */
64 unsigned int properties_required;
65 unsigned int properties_provided;
66 unsigned int properties_destroyed;
68 /* Flags indicating common sets things to do before and after. */
69 unsigned int todo_flags_start;
70 unsigned int todo_flags_finish;
72 /* Letter for RTL dumps. */
73 char letter;
76 /* Define a tree dump switch. */
77 struct dump_file_info
79 const char *suffix; /* suffix to give output file. */
80 const char *swtch; /* command line switch */
81 const char *glob; /* command line glob */
82 int flags; /* user flags */
83 int state; /* state of play */
84 int num; /* dump file number */
85 int letter; /* enabling letter for RTL dumps */
88 /* Pass properties. */
89 #define PROP_gimple_any (1 << 0) /* entire gimple grammar */
90 #define PROP_gimple_lcf (1 << 1) /* lowered control flow */
91 #define PROP_gimple_leh (1 << 2) /* lowered eh */
92 #define PROP_cfg (1 << 3)
93 #define PROP_referenced_vars (1 << 4)
94 #define PROP_pta (1 << 5)
95 #define PROP_ssa (1 << 6)
96 #define PROP_no_crit_edges (1 << 7)
97 #define PROP_rtl (1 << 8)
98 #define PROP_alias (1 << 9)
100 #define PROP_trees \
101 (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh)
103 /* To-do flags. */
104 #define TODO_dump_func (1 << 0) /* pass doesn't dump itself */
105 #define TODO_rename_vars (1 << 1) /* rewrite new vars to ssa */
106 #define TODO_ggc_collect (1 << 2) /* run the collector */
107 #define TODO_verify_ssa (1 << 3)
108 #define TODO_verify_flow (1 << 4)
109 #define TODO_verify_stmts (1 << 5)
110 #define TODO_fix_def_def_chains (1 << 6) /* rewrite def-def chains */
111 #define TODO_cleanup_cfg (1 << 7) /* cleanup the cfg. */
113 #define TODO_verify_all \
114 (TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts)
117 extern struct tree_opt_pass pass_mudflap_1;
118 extern struct tree_opt_pass pass_mudflap_2;
119 extern struct tree_opt_pass pass_remove_useless_stmts;
120 extern struct tree_opt_pass pass_lower_cf;
121 extern struct tree_opt_pass pass_lower_eh;
122 extern struct tree_opt_pass pass_build_cfg;
123 extern struct tree_opt_pass pass_tree_profile;
124 extern struct tree_opt_pass pass_referenced_vars;
125 extern struct tree_opt_pass pass_sra;
126 extern struct tree_opt_pass pass_tail_recursion;
127 extern struct tree_opt_pass pass_tail_calls;
128 extern struct tree_opt_pass pass_loop;
129 extern struct tree_opt_pass pass_loop_init;
130 extern struct tree_opt_pass pass_lim;
131 extern struct tree_opt_pass pass_unswitch;
132 extern struct tree_opt_pass pass_iv_canon;
133 extern struct tree_opt_pass pass_record_bounds;
134 extern struct tree_opt_pass pass_if_conversion;
135 extern struct tree_opt_pass pass_vectorize;
136 extern struct tree_opt_pass pass_complete_unroll;
137 extern struct tree_opt_pass pass_iv_optimize;
138 extern struct tree_opt_pass pass_loop_done;
139 extern struct tree_opt_pass pass_ch;
140 extern struct tree_opt_pass pass_ccp;
141 extern struct tree_opt_pass pass_build_ssa;
142 extern struct tree_opt_pass pass_del_ssa;
143 extern struct tree_opt_pass pass_dominator;
144 extern struct tree_opt_pass pass_dce;
145 extern struct tree_opt_pass pass_cd_dce;
146 extern struct tree_opt_pass pass_merge_phi;
147 extern struct tree_opt_pass pass_may_alias;
148 extern struct tree_opt_pass pass_split_crit_edges;
149 extern struct tree_opt_pass pass_pre;
150 extern struct tree_opt_pass pass_profile;
151 extern struct tree_opt_pass pass_pre_expand;
152 extern struct tree_opt_pass pass_lower_vector_ssa;
153 extern struct tree_opt_pass pass_fold_builtins;
154 extern struct tree_opt_pass pass_early_warn_uninitialized;
155 extern struct tree_opt_pass pass_late_warn_uninitialized;
156 extern struct tree_opt_pass pass_warn_function_return;
157 extern struct tree_opt_pass pass_phiopt;
158 extern struct tree_opt_pass pass_forwprop;
159 extern struct tree_opt_pass pass_redundant_phi;
160 extern struct tree_opt_pass pass_dse;
161 extern struct tree_opt_pass pass_nrv;
162 extern struct tree_opt_pass pass_remove_useless_vars;
163 extern struct tree_opt_pass pass_mark_used_blocks;
164 extern struct tree_opt_pass pass_rename_ssa_copies;
165 extern struct tree_opt_pass pass_expand;
166 extern struct tree_opt_pass pass_rest_of_compilation;
167 extern struct tree_opt_pass pass_fre;
168 extern struct tree_opt_pass pass_linear_transform;
169 extern struct tree_opt_pass pass_create_structure_vars;
170 extern struct tree_opt_pass pass_build_pta;
171 extern struct tree_opt_pass pass_del_pta;
173 #endif /* GCC_TREE_PASS_H */