OSDN Git Service

* interface.c: Fix a comment typo.
[pf3gnuchains/gcc-fork.git] / gcc / tree-pass.h
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>
4
5 This file is part of GCC.
6
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.
11
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.
16
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.  */
21
22
23 #ifndef GCC_TREE_PASS_H
24 #define GCC_TREE_PASS_H 1
25
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;
30
31 /* Return the dump_file_info for the given phase.  */
32 extern struct dump_file_info *get_dump_file_info (enum tree_dump_index);
33
34 /* Describe one pass.  */
35 struct tree_opt_pass
36 {
37   /* Terse name of the pass used as a fragment of the dump file name.  */
38   const char *name;
39
40   /* If non-null, this pass and all sub-passes are executed only if
41      the function returns true.  */
42   bool (*gate) (void);
43
44   /* This is the code to run.  If null, then there should be sub-passes
45      otherwise this pass does nothing.  */
46   void (*execute) (void);
47
48   /* A list of sub-passes to run, dependent on gate predicate.  */
49   struct tree_opt_pass *sub;
50
51   /* Next in the list of passes to run, independent of gate predicate.  */
52   struct tree_opt_pass *next;
53
54   /* Static pass number, used as a fragment of the dump file name.  */
55   int static_pass_number;
56
57   /* The timevar id associated with this pass.  */
58   /* ??? Ideally would be dynamically assigned.  */
59   unsigned int tv_id;
60
61   /* Sets of properties input and output from this pass.  */
62   unsigned int properties_required;
63   unsigned int properties_provided;
64   unsigned int properties_destroyed;
65
66   /* Flags indicating common sets things to do before and after.  */
67   unsigned int todo_flags_start;
68   unsigned int todo_flags_finish;
69
70   /* Letter for RTL dumps.  */
71   char letter;
72 };
73
74 /* Define a tree dump switch.  */
75 struct dump_file_info
76 {
77   const char *suffix;           /* suffix to give output file.  */
78   const char *swtch;            /* command line switch */
79   const char *glob;             /* command line glob  */
80   int flags;                    /* user flags */
81   int state;                    /* state of play */
82   int num;                      /* dump file number */
83   int letter;                   /* enabling letter for RTL dumps */
84 };
85
86 /* Pass properties.  */
87 #define PROP_gimple_any         (1 << 0)        /* entire gimple grammar */
88 #define PROP_gimple_lcf         (1 << 1)        /* lowered control flow */
89 #define PROP_gimple_leh         (1 << 2)        /* lowered eh */
90 #define PROP_cfg                (1 << 3)
91 #define PROP_referenced_vars    (1 << 4)
92 #define PROP_pta                (1 << 5)
93 #define PROP_ssa                (1 << 6)
94 #define PROP_no_crit_edges      (1 << 7)
95 #define PROP_rtl                (1 << 8)
96 #define PROP_alias              (1 << 9)
97
98 #define PROP_trees \
99   (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh)
100
101 /* To-do flags.  */
102 #define TODO_dump_func                  (1 << 0)
103 #define TODO_ggc_collect                (1 << 1)
104 #define TODO_verify_ssa                 (1 << 2) 
105 #define TODO_verify_flow                (1 << 3)
106 #define TODO_verify_stmts               (1 << 4)
107 #define TODO_cleanup_cfg                (1 << 5)
108 #define TODO_verify_loops               (1 << 6)
109
110 /* To-do flags for calls to update_ssa.  */
111
112 /* Update the SSA form inserting PHI nodes for newly exposed symbols
113    and virtual names marked for updating.  When updating real names,
114    only insert PHI nodes for a real name O_j in blocks reached by all
115    the new and old definitions for O_j.  If the iterated dominance
116    frontier for O_j is not pruned, we may end up inserting PHI nodes
117    in blocks that have one or more edges with no incoming definition
118    for O_j.  This would lead to uninitialized warnings for O_j's
119    symbol.  */
120 #define TODO_update_ssa                 (1 << 7)
121
122 /* Update the SSA form without inserting any new PHI nodes at all.
123    This is used by passes that have either inserted all the PHI nodes
124    themselves or passes that need only to patch use-def and def-def
125    chains for virtuals (e.g., DCE).  */
126 #define TODO_update_ssa_no_phi          (1 << 8)
127
128 /* Insert PHI nodes everywhere they are needed.  No prunning of the
129    IDF is done.  This is used by passes that need the PHI nodes for
130    O_j even if it means that some arguments will come from the default
131    definition of O_j's symbol (e.g., pass_linear_transform).
132    
133    WARNING: If you need to use this flag, chances are that your pass
134    may be doing something wrong.  Inserting PHI nodes for an old name
135    where not all edges carry a new replacement may lead to silent
136    codegen errors or spurious uninitialized warnings.  */
137 #define TODO_update_ssa_full_phi        (1 << 9)
138
139 /* Passes that update the SSA form on their own may want to delegate
140    the updating of virtual names to the generic updater.  Since FUD
141    chains are easier to maintain, this simplifies the work they need
142    to do.  NOTE: If this flag is used, any OLD->NEW mappings for real
143    names are explicitly destroyed and only the symbols marked for
144    renaming are processed.  */
145 #define TODO_update_ssa_only_virtuals   (1 << 10)
146
147 #define TODO_update_ssa_any             \
148     (TODO_update_ssa                    \
149      | TODO_update_ssa_no_phi           \
150      | TODO_update_ssa_full_phi         \
151      | TODO_update_ssa_only_virtuals)
152
153 #define TODO_verify_all \
154   (TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts)
155
156 extern struct tree_opt_pass pass_mudflap_1;
157 extern struct tree_opt_pass pass_mudflap_2;
158 extern struct tree_opt_pass pass_remove_useless_stmts;
159 extern struct tree_opt_pass pass_lower_cf;
160 extern struct tree_opt_pass pass_lower_eh;
161 extern struct tree_opt_pass pass_build_cfg;
162 extern struct tree_opt_pass pass_tree_profile;
163 extern struct tree_opt_pass pass_referenced_vars;
164 extern struct tree_opt_pass pass_sra;
165 extern struct tree_opt_pass pass_tail_recursion;
166 extern struct tree_opt_pass pass_tail_calls;
167 extern struct tree_opt_pass pass_loop;
168 extern struct tree_opt_pass pass_loop_init;
169 extern struct tree_opt_pass pass_lim;
170 extern struct tree_opt_pass pass_unswitch;
171 extern struct tree_opt_pass pass_iv_canon;
172 extern struct tree_opt_pass pass_record_bounds;
173 extern struct tree_opt_pass pass_if_conversion;
174 extern struct tree_opt_pass pass_vectorize;
175 extern struct tree_opt_pass pass_complete_unroll;
176 extern struct tree_opt_pass pass_iv_optimize;
177 extern struct tree_opt_pass pass_loop_done;
178 extern struct tree_opt_pass pass_ch;
179 extern struct tree_opt_pass pass_ccp;
180 extern struct tree_opt_pass pass_build_ssa;
181 extern struct tree_opt_pass pass_del_ssa;
182 extern struct tree_opt_pass pass_dominator;
183 extern struct tree_opt_pass pass_dce;
184 extern struct tree_opt_pass pass_cd_dce;
185 extern struct tree_opt_pass pass_merge_phi;
186 extern struct tree_opt_pass pass_may_alias;
187 extern struct tree_opt_pass pass_split_crit_edges;
188 extern struct tree_opt_pass pass_pre;
189 extern struct tree_opt_pass pass_profile;
190 extern struct tree_opt_pass pass_pre_expand;
191 extern struct tree_opt_pass pass_lower_vector_ssa;
192 extern struct tree_opt_pass pass_fold_builtins;
193 extern struct tree_opt_pass pass_stdarg;
194 extern struct tree_opt_pass pass_early_warn_uninitialized;
195 extern struct tree_opt_pass pass_late_warn_uninitialized;
196 extern struct tree_opt_pass pass_warn_function_return;
197 extern struct tree_opt_pass pass_phiopt;
198 extern struct tree_opt_pass pass_forwprop;
199 extern struct tree_opt_pass pass_redundant_phi;
200 extern struct tree_opt_pass pass_dse;
201 extern struct tree_opt_pass pass_nrv;
202 extern struct tree_opt_pass pass_remove_useless_vars;
203 extern struct tree_opt_pass pass_mark_used_blocks;
204 extern struct tree_opt_pass pass_rename_ssa_copies;
205 extern struct tree_opt_pass pass_expand;
206 extern struct tree_opt_pass pass_rest_of_compilation;
207 extern struct tree_opt_pass pass_sink_code;
208 extern struct tree_opt_pass pass_fre;
209 extern struct tree_opt_pass pass_linear_transform;
210 extern struct tree_opt_pass pass_copy_prop;
211 extern struct tree_opt_pass pass_store_ccp;
212 extern struct tree_opt_pass pass_store_copy_prop;
213 extern struct tree_opt_pass pass_vrp;
214 extern struct tree_opt_pass pass_create_structure_vars;
215
216 #endif /* GCC_TREE_PASS_H */