builtins.c (expand_builtin_atomic_compare_exchange): Pass old value operand as MEM...
[platform/upstream/gcc.git] / gcc / tree-pass.h
1 /* Definitions for describing one tree-ssa optimization pass.
2    Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
3    Free Software Foundation, Inc.
4    Contributed by Richard Henderson <rth@redhat.com>
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22
23 #ifndef GCC_TREE_PASS_H
24 #define GCC_TREE_PASS_H 1
25
26 #include "timevar.h"
27 #include "dumpfile.h"
28
29 /* Optimization pass type.  */
30 enum opt_pass_type
31 {
32   GIMPLE_PASS,
33   RTL_PASS,
34   SIMPLE_IPA_PASS,
35   IPA_PASS
36 };
37
38 /* Describe one pass; this is the common part shared across different pass
39    types.  */
40 struct opt_pass
41 {
42   /* Optimization pass type.  */
43   enum opt_pass_type type;
44
45   /* Terse name of the pass used as a fragment of the dump file
46      name.  If the name starts with a star, no dump happens. */
47   const char *name;
48
49   /* If non-null, this pass and all sub-passes are executed only if
50      the function returns true.  */
51   bool (*gate) (void);
52
53   /* This is the code to run.  If null, then there should be sub-passes
54      otherwise this pass does nothing.  The return value contains
55      TODOs to execute in addition to those in TODO_flags_finish.   */
56   unsigned int (*execute) (void);
57
58   /* A list of sub-passes to run, dependent on gate predicate.  */
59   struct opt_pass *sub;
60
61   /* Next in the list of passes to run, independent of gate predicate.  */
62   struct opt_pass *next;
63
64   /* Static pass number, used as a fragment of the dump file name.  */
65   int static_pass_number;
66
67   /* The timevar id associated with this pass.  */
68   /* ??? Ideally would be dynamically assigned.  */
69   timevar_id_t tv_id;
70
71   /* Sets of properties input and output from this pass.  */
72   unsigned int properties_required;
73   unsigned int properties_provided;
74   unsigned int properties_destroyed;
75
76   /* Flags indicating common sets things to do before and after.  */
77   unsigned int todo_flags_start;
78   unsigned int todo_flags_finish;
79 };
80
81 /* Description of GIMPLE pass.  */
82 struct gimple_opt_pass
83 {
84   struct opt_pass pass;
85 };
86
87 /* Description of RTL pass.  */
88 struct rtl_opt_pass
89 {
90   struct opt_pass pass;
91 };
92
93 struct varpool_node;
94 struct cgraph_node;
95 struct cgraph_node_set_def;
96 struct varpool_node_set_def;
97
98 /* Description of IPA pass with generate summary, write, execute, read and
99    transform stages.  */
100 struct ipa_opt_pass_d
101 {
102   struct opt_pass pass;
103
104   /* IPA passes can analyze function body and variable initializers
105       using this hook and produce summary.  */
106   void (*generate_summary) (void);
107
108   /* This hook is used to serialize IPA summaries on disk.  */
109   void (*write_summary) (struct cgraph_node_set_def *,
110                          struct varpool_node_set_def *);
111
112   /* This hook is used to deserialize IPA summaries from disk.  */
113   void (*read_summary) (void);
114
115   /* This hook is used to serialize IPA optimization summaries on disk.  */
116   void (*write_optimization_summary) (struct cgraph_node_set_def *,
117                                       struct varpool_node_set_def *);
118
119   /* This hook is used to deserialize IPA summaries from disk.  */
120   void (*read_optimization_summary) (void);
121
122   /* Hook to convert gimple stmt uids into true gimple statements.  The second
123      parameter is an array of statements indexed by their uid. */
124   void (*stmt_fixup) (struct cgraph_node *, gimple *);
125
126   /* Results of interprocedural propagation of an IPA pass is applied to
127      function body via this hook.  */
128   unsigned int function_transform_todo_flags_start;
129   unsigned int (*function_transform) (struct cgraph_node *);
130   void (*variable_transform) (struct varpool_node *);
131 };
132
133 /* Description of simple IPA pass.  Simple IPA passes have just one execute
134    hook.  */
135 struct simple_ipa_opt_pass
136 {
137   struct opt_pass pass;
138 };
139
140 /* Pass properties.  */
141 #define PROP_gimple_any         (1 << 0)        /* entire gimple grammar */
142 #define PROP_gimple_lcf         (1 << 1)        /* lowered control flow */
143 #define PROP_gimple_leh         (1 << 2)        /* lowered eh */
144 #define PROP_cfg                (1 << 3)
145 #define PROP_ssa                (1 << 5)
146 #define PROP_no_crit_edges      (1 << 6)
147 #define PROP_rtl                (1 << 7)
148 #define PROP_gimple_lomp        (1 << 8)        /* lowered OpenMP directives */
149 #define PROP_cfglayout          (1 << 9)        /* cfglayout mode on RTL */
150 #define PROP_gimple_lcx         (1 << 10)       /* lowered complex */
151 #define PROP_loops              (1 << 11)       /* preserve loop structures */
152
153 #define PROP_trees \
154   (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp)
155
156 /* To-do flags.  */
157 #define TODO_ggc_collect                (1 << 1)
158 #define TODO_verify_ssa                 (1 << 2)
159 #define TODO_verify_flow                (1 << 3)
160 #define TODO_verify_stmts               (1 << 4)
161 #define TODO_cleanup_cfg                (1 << 5)
162 #define TODO_dump_symtab                (1 << 7)
163 #define TODO_remove_functions           (1 << 8)
164 #define TODO_rebuild_frequencies        (1 << 9)
165 #define TODO_verify_rtl_sharing         (1 << 10)
166
167 /* To-do flags for calls to update_ssa.  */
168
169 /* Update the SSA form inserting PHI nodes for newly exposed symbols
170    and virtual names marked for updating.  When updating real names,
171    only insert PHI nodes for a real name O_j in blocks reached by all
172    the new and old definitions for O_j.  If the iterated dominance
173    frontier for O_j is not pruned, we may end up inserting PHI nodes
174    in blocks that have one or more edges with no incoming definition
175    for O_j.  This would lead to uninitialized warnings for O_j's
176    symbol.  */
177 #define TODO_update_ssa                 (1 << 11)
178
179 /* Update the SSA form without inserting any new PHI nodes at all.
180    This is used by passes that have either inserted all the PHI nodes
181    themselves or passes that need only to patch use-def and def-def
182    chains for virtuals (e.g., DCE).  */
183 #define TODO_update_ssa_no_phi          (1 << 12)
184
185 /* Insert PHI nodes everywhere they are needed.  No pruning of the
186    IDF is done.  This is used by passes that need the PHI nodes for
187    O_j even if it means that some arguments will come from the default
188    definition of O_j's symbol.
189
190    WARNING: If you need to use this flag, chances are that your pass
191    may be doing something wrong.  Inserting PHI nodes for an old name
192    where not all edges carry a new replacement may lead to silent
193    codegen errors or spurious uninitialized warnings.  */
194 #define TODO_update_ssa_full_phi        (1 << 13)
195
196 /* Passes that update the SSA form on their own may want to delegate
197    the updating of virtual names to the generic updater.  Since FUD
198    chains are easier to maintain, this simplifies the work they need
199    to do.  NOTE: If this flag is used, any OLD->NEW mappings for real
200    names are explicitly destroyed and only the symbols marked for
201    renaming are processed.  */
202 #define TODO_update_ssa_only_virtuals   (1 << 14)
203
204 /* Some passes leave unused local variables that can be removed from
205    cfun->local_decls.  This reduces the size of dump files
206    and the memory footprint for VAR_DECLs.  */
207 #define TODO_remove_unused_locals       (1 << 15)
208
209 /* Call df_finish at the end of the pass.  This is done after all of
210    the dumpers have been allowed to run so that they have access to
211    the instance before it is destroyed.  */
212 #define TODO_df_finish                  (1 << 17)
213
214 /* Call df_verify at the end of the pass if checking is enabled.  */
215 #define TODO_df_verify                  (1 << 18)
216
217 /* Internally used for the first instance of a pass.  */
218 #define TODO_mark_first_instance        (1 << 19)
219
220 /* Rebuild aliasing info.  */
221 #define TODO_rebuild_alias              (1 << 20)
222
223 /* Rebuild the addressable-vars bitmap and do register promotion.  */
224 #define TODO_update_address_taken       (1 << 21)
225
226 /* Rebuild the callgraph edges.  */
227 #define TODO_rebuild_cgraph_edges       (1 << 22)
228
229 /* Internally used in execute_function_todo().  */
230 #define TODO_update_ssa_any             \
231     (TODO_update_ssa                    \
232      | TODO_update_ssa_no_phi           \
233      | TODO_update_ssa_full_phi         \
234      | TODO_update_ssa_only_virtuals)
235
236 #define TODO_verify_all \
237   (TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts)
238
239
240 /* Register pass info. */
241
242 enum pass_positioning_ops
243 {
244   PASS_POS_INSERT_AFTER,  /* Insert after the reference pass.  */
245   PASS_POS_INSERT_BEFORE, /* Insert before the reference pass.  */
246   PASS_POS_REPLACE        /* Replace the reference pass.  */
247 };
248
249 struct register_pass_info
250 {
251   struct opt_pass *pass;            /* New pass to register.  */
252   const char *reference_pass_name;  /* Name of the reference pass for hooking
253                                        up the new pass.  */
254   int ref_pass_instance_number;     /* Insert the pass at the specified
255                                        instance number of the reference pass.
256                                        Do it for every instance if it is 0.  */
257   enum pass_positioning_ops pos_op; /* how to insert the new pass.  */
258 };
259
260 extern struct gimple_opt_pass pass_mudflap_1;
261 extern struct gimple_opt_pass pass_mudflap_2;
262 extern struct gimple_opt_pass pass_lower_cf;
263 extern struct gimple_opt_pass pass_refactor_eh;
264 extern struct gimple_opt_pass pass_lower_eh;
265 extern struct gimple_opt_pass pass_lower_eh_dispatch;
266 extern struct gimple_opt_pass pass_lower_resx;
267 extern struct gimple_opt_pass pass_build_cfg;
268 extern struct gimple_opt_pass pass_early_tree_profile;
269 extern struct gimple_opt_pass pass_cleanup_eh;
270 extern struct gimple_opt_pass pass_sra;
271 extern struct gimple_opt_pass pass_sra_early;
272 extern struct gimple_opt_pass pass_early_ipa_sra;
273 extern struct gimple_opt_pass pass_tail_recursion;
274 extern struct gimple_opt_pass pass_tail_calls;
275 extern struct gimple_opt_pass pass_tree_loop;
276 extern struct gimple_opt_pass pass_tree_loop_init;
277 extern struct gimple_opt_pass pass_lim;
278 extern struct gimple_opt_pass pass_tree_unswitch;
279 extern struct gimple_opt_pass pass_predcom;
280 extern struct gimple_opt_pass pass_iv_canon;
281 extern struct gimple_opt_pass pass_scev_cprop;
282 extern struct gimple_opt_pass pass_empty_loop;
283 extern struct gimple_opt_pass pass_record_bounds;
284 extern struct gimple_opt_pass pass_graphite;
285 extern struct gimple_opt_pass pass_graphite_transforms;
286 extern struct gimple_opt_pass pass_if_conversion;
287 extern struct gimple_opt_pass pass_loop_distribution;
288 extern struct gimple_opt_pass pass_vectorize;
289 extern struct gimple_opt_pass pass_slp_vectorize;
290 extern struct gimple_opt_pass pass_complete_unroll;
291 extern struct gimple_opt_pass pass_complete_unrolli;
292 extern struct gimple_opt_pass pass_parallelize_loops;
293 extern struct gimple_opt_pass pass_loop_prefetch;
294 extern struct gimple_opt_pass pass_iv_optimize;
295 extern struct gimple_opt_pass pass_tree_loop_done;
296 extern struct gimple_opt_pass pass_ch;
297 extern struct gimple_opt_pass pass_ccp;
298 extern struct gimple_opt_pass pass_phi_only_cprop;
299 extern struct gimple_opt_pass pass_build_ssa;
300 extern struct gimple_opt_pass pass_build_alias;
301 extern struct gimple_opt_pass pass_build_ealias;
302 extern struct gimple_opt_pass pass_dominator;
303 extern struct gimple_opt_pass pass_dce;
304 extern struct gimple_opt_pass pass_dce_loop;
305 extern struct gimple_opt_pass pass_cd_dce;
306 extern struct gimple_opt_pass pass_call_cdce;
307 extern struct gimple_opt_pass pass_merge_phi;
308 extern struct gimple_opt_pass pass_split_crit_edges;
309 extern struct gimple_opt_pass pass_pre;
310 extern unsigned int tail_merge_optimize (unsigned int);
311 extern struct gimple_opt_pass pass_profile;
312 extern struct gimple_opt_pass pass_strip_predict_hints;
313 extern struct gimple_opt_pass pass_lower_complex_O0;
314 extern struct gimple_opt_pass pass_lower_complex;
315 extern struct gimple_opt_pass pass_lower_vector;
316 extern struct gimple_opt_pass pass_lower_vector_ssa;
317 extern struct gimple_opt_pass pass_lower_omp;
318 extern struct gimple_opt_pass pass_diagnose_omp_blocks;
319 extern struct gimple_opt_pass pass_expand_omp;
320 extern struct gimple_opt_pass pass_expand_omp_ssa;
321 extern struct gimple_opt_pass pass_object_sizes;
322 extern struct gimple_opt_pass pass_strlen;
323 extern struct gimple_opt_pass pass_fold_builtins;
324 extern struct gimple_opt_pass pass_stdarg;
325 extern struct gimple_opt_pass pass_early_warn_uninitialized;
326 extern struct gimple_opt_pass pass_late_warn_uninitialized;
327 extern struct gimple_opt_pass pass_cse_reciprocals;
328 extern struct gimple_opt_pass pass_cse_sincos;
329 extern struct gimple_opt_pass pass_optimize_bswap;
330 extern struct gimple_opt_pass pass_optimize_widening_mul;
331 extern struct gimple_opt_pass pass_warn_function_return;
332 extern struct gimple_opt_pass pass_warn_function_noreturn;
333 extern struct gimple_opt_pass pass_cselim;
334 extern struct gimple_opt_pass pass_phiopt;
335 extern struct gimple_opt_pass pass_forwprop;
336 extern struct gimple_opt_pass pass_phiprop;
337 extern struct gimple_opt_pass pass_tree_ifcombine;
338 extern struct gimple_opt_pass pass_dse;
339 extern struct gimple_opt_pass pass_nrv;
340 extern struct gimple_opt_pass pass_rename_ssa_copies;
341 extern struct gimple_opt_pass pass_sink_code;
342 extern struct gimple_opt_pass pass_fre;
343 extern struct gimple_opt_pass pass_check_data_deps;
344 extern struct gimple_opt_pass pass_copy_prop;
345 extern struct gimple_opt_pass pass_vrp;
346 extern struct gimple_opt_pass pass_uncprop;
347 extern struct gimple_opt_pass pass_return_slot;
348 extern struct gimple_opt_pass pass_reassoc;
349 extern struct gimple_opt_pass pass_rebuild_cgraph_edges;
350 extern struct gimple_opt_pass pass_remove_cgraph_callee_edges;
351 extern struct gimple_opt_pass pass_build_cgraph_edges;
352 extern struct gimple_opt_pass pass_local_pure_const;
353 extern struct gimple_opt_pass pass_tracer;
354 extern struct gimple_opt_pass pass_warn_unused_result;
355 extern struct gimple_opt_pass pass_diagnose_tm_blocks;
356 extern struct gimple_opt_pass pass_lower_tm;
357 extern struct gimple_opt_pass pass_tm_init;
358 extern struct gimple_opt_pass pass_tm_mark;
359 extern struct gimple_opt_pass pass_tm_memopt;
360 extern struct gimple_opt_pass pass_tm_edges;
361 extern struct gimple_opt_pass pass_split_functions;
362 extern struct gimple_opt_pass pass_feedback_split_functions;
363 extern struct gimple_opt_pass pass_strength_reduction;
364
365 /* IPA Passes */
366 extern struct simple_ipa_opt_pass pass_ipa_lower_emutls;
367 extern struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility;
368 extern struct simple_ipa_opt_pass pass_ipa_tree_profile;
369
370 extern struct simple_ipa_opt_pass pass_early_local_passes;
371
372 extern struct ipa_opt_pass_d pass_ipa_whole_program_visibility;
373 extern struct ipa_opt_pass_d pass_ipa_lto_gimple_out;
374 extern struct simple_ipa_opt_pass pass_ipa_increase_alignment;
375 extern struct simple_ipa_opt_pass pass_ipa_matrix_reorg;
376 extern struct ipa_opt_pass_d pass_ipa_inline;
377 extern struct simple_ipa_opt_pass pass_ipa_free_lang_data;
378 extern struct simple_ipa_opt_pass pass_ipa_free_inline_summary;
379 extern struct ipa_opt_pass_d pass_ipa_cp;
380 extern struct ipa_opt_pass_d pass_ipa_reference;
381 extern struct ipa_opt_pass_d pass_ipa_pure_const;
382 extern struct simple_ipa_opt_pass pass_ipa_pta;
383 extern struct ipa_opt_pass_d pass_ipa_lto_wpa_fixup;
384 extern struct ipa_opt_pass_d pass_ipa_lto_finish_out;
385 extern struct simple_ipa_opt_pass pass_ipa_tm;
386 extern struct ipa_opt_pass_d pass_ipa_profile;
387 extern struct ipa_opt_pass_d pass_ipa_cdtor_merge;
388
389 extern struct gimple_opt_pass pass_cleanup_cfg_post_optimizing;
390 extern struct gimple_opt_pass pass_init_datastructures;
391 extern struct gimple_opt_pass pass_fixup_cfg;
392
393 extern struct rtl_opt_pass pass_expand;
394 extern struct rtl_opt_pass pass_instantiate_virtual_regs;
395 extern struct rtl_opt_pass pass_rtl_fwprop;
396 extern struct rtl_opt_pass pass_rtl_fwprop_addr;
397 extern struct rtl_opt_pass pass_jump;
398 extern struct rtl_opt_pass pass_jump2;
399 extern struct rtl_opt_pass pass_lower_subreg;
400 extern struct rtl_opt_pass pass_cse;
401 extern struct rtl_opt_pass pass_fast_rtl_dce;
402 extern struct rtl_opt_pass pass_ud_rtl_dce;
403 extern struct rtl_opt_pass pass_rtl_dce;
404 extern struct rtl_opt_pass pass_rtl_dse1;
405 extern struct rtl_opt_pass pass_rtl_dse2;
406 extern struct rtl_opt_pass pass_rtl_dse3;
407 extern struct rtl_opt_pass pass_rtl_cprop;
408 extern struct rtl_opt_pass pass_rtl_pre;
409 extern struct rtl_opt_pass pass_rtl_hoist;
410 extern struct rtl_opt_pass pass_rtl_store_motion;
411 extern struct rtl_opt_pass pass_cse_after_global_opts;
412 extern struct rtl_opt_pass pass_rtl_ifcvt;
413
414 extern struct rtl_opt_pass pass_into_cfg_layout_mode;
415 extern struct rtl_opt_pass pass_outof_cfg_layout_mode;
416
417 extern struct rtl_opt_pass pass_loop2;
418 extern struct rtl_opt_pass pass_rtl_loop_init;
419 extern struct rtl_opt_pass pass_rtl_move_loop_invariants;
420 extern struct rtl_opt_pass pass_rtl_unswitch;
421 extern struct rtl_opt_pass pass_rtl_unroll_and_peel_loops;
422 extern struct rtl_opt_pass pass_rtl_doloop;
423 extern struct rtl_opt_pass pass_rtl_loop_done;
424
425 extern struct rtl_opt_pass pass_web;
426 extern struct rtl_opt_pass pass_cse2;
427 extern struct rtl_opt_pass pass_df_initialize_opt;
428 extern struct rtl_opt_pass pass_df_initialize_no_opt;
429 extern struct rtl_opt_pass pass_reginfo_init;
430 extern struct rtl_opt_pass pass_inc_dec;
431 extern struct rtl_opt_pass pass_stack_ptr_mod;
432 extern struct rtl_opt_pass pass_initialize_regs;
433 extern struct rtl_opt_pass pass_combine;
434 extern struct rtl_opt_pass pass_if_after_combine;
435 extern struct rtl_opt_pass pass_ree;
436 extern struct rtl_opt_pass pass_partition_blocks;
437 extern struct rtl_opt_pass pass_match_asm_constraints;
438 extern struct rtl_opt_pass pass_regmove;
439 extern struct rtl_opt_pass pass_split_all_insns;
440 extern struct rtl_opt_pass pass_fast_rtl_byte_dce;
441 extern struct rtl_opt_pass pass_lower_subreg2;
442 extern struct rtl_opt_pass pass_mode_switching;
443 extern struct rtl_opt_pass pass_sms;
444 extern struct rtl_opt_pass pass_sched;
445 extern struct rtl_opt_pass pass_ira;
446 extern struct rtl_opt_pass pass_reload;
447 extern struct rtl_opt_pass pass_clean_state;
448 extern struct rtl_opt_pass pass_branch_prob;
449 extern struct rtl_opt_pass pass_value_profile_transformations;
450 extern struct rtl_opt_pass pass_postreload_cse;
451 extern struct rtl_opt_pass pass_gcse2;
452 extern struct rtl_opt_pass pass_split_after_reload;
453 extern struct rtl_opt_pass pass_branch_target_load_optimize1;
454 extern struct rtl_opt_pass pass_thread_prologue_and_epilogue;
455 extern struct rtl_opt_pass pass_stack_adjustments;
456 extern struct rtl_opt_pass pass_peephole2;
457 extern struct rtl_opt_pass pass_if_after_reload;
458 extern struct rtl_opt_pass pass_regrename;
459 extern struct rtl_opt_pass pass_cprop_hardreg;
460 extern struct rtl_opt_pass pass_reorder_blocks;
461 extern struct rtl_opt_pass pass_branch_target_load_optimize2;
462 extern struct rtl_opt_pass pass_leaf_regs;
463 extern struct rtl_opt_pass pass_split_before_sched2;
464 extern struct rtl_opt_pass pass_compare_elim_after_reload;
465 extern struct rtl_opt_pass pass_sched2;
466 extern struct rtl_opt_pass pass_stack_regs;
467 extern struct rtl_opt_pass pass_stack_regs_run;
468 extern struct rtl_opt_pass pass_df_finish;
469 extern struct rtl_opt_pass pass_compute_alignments;
470 extern struct rtl_opt_pass pass_duplicate_computed_gotos;
471 extern struct rtl_opt_pass pass_variable_tracking;
472 extern struct rtl_opt_pass pass_free_cfg;
473 extern struct rtl_opt_pass pass_machine_reorg;
474 extern struct rtl_opt_pass pass_cleanup_barriers;
475 extern struct rtl_opt_pass pass_delay_slots;
476 extern struct rtl_opt_pass pass_split_for_shorten_branches;
477 extern struct rtl_opt_pass pass_split_before_regstack;
478 extern struct rtl_opt_pass pass_convert_to_eh_region_ranges;
479 extern struct rtl_opt_pass pass_shorten_branches;
480 extern struct rtl_opt_pass pass_set_nothrow_function_flags;
481 extern struct rtl_opt_pass pass_dwarf2_frame;
482 extern struct rtl_opt_pass pass_final;
483 extern struct rtl_opt_pass pass_rtl_seqabstr;
484 extern struct gimple_opt_pass pass_release_ssa_names;
485 extern struct gimple_opt_pass pass_early_inline;
486 extern struct gimple_opt_pass pass_inline_parameters;
487 extern struct gimple_opt_pass pass_update_address_taken;
488 extern struct gimple_opt_pass pass_convert_switch;
489
490 /* The root of the compilation pass tree, once constructed.  */
491 extern struct opt_pass *all_passes, *all_small_ipa_passes, *all_lowering_passes,
492                        *all_regular_ipa_passes, *all_lto_gen_passes, *all_late_ipa_passes;
493
494 /* Define a list of pass lists so that both passes.c and plugins can easily
495    find all the pass lists.  */
496 #define GCC_PASS_LISTS \
497   DEF_PASS_LIST (all_lowering_passes) \
498   DEF_PASS_LIST (all_small_ipa_passes) \
499   DEF_PASS_LIST (all_regular_ipa_passes) \
500   DEF_PASS_LIST (all_lto_gen_passes) \
501   DEF_PASS_LIST (all_passes)
502
503 #define DEF_PASS_LIST(LIST) PASS_LIST_NO_##LIST,
504 enum
505 {
506   GCC_PASS_LISTS
507   PASS_LIST_NUM
508 };
509 #undef DEF_PASS_LIST
510
511 /* This is used by plugins, and should also be used in
512    passes.c:register_pass.  */
513 extern struct opt_pass **gcc_pass_lists[];
514
515 /* Current optimization pass.  */
516 extern struct opt_pass *current_pass;
517
518 extern struct opt_pass * get_pass_for_id (int);
519 extern bool execute_one_pass (struct opt_pass *);
520 extern void execute_pass_list (struct opt_pass *);
521 extern void execute_ipa_pass_list (struct opt_pass *);
522 extern void execute_ipa_summary_passes (struct ipa_opt_pass_d *);
523 extern void execute_all_ipa_transforms (void);
524 extern void execute_all_ipa_stmt_fixups (struct cgraph_node *, gimple *);
525 extern bool pass_init_dump_file (struct opt_pass *);
526 extern void pass_fini_dump_file (struct opt_pass *);
527
528 extern const char *get_current_pass_name (void);
529 extern void print_current_pass (FILE *);
530 extern void debug_pass (void);
531 extern void ipa_write_summaries (void);
532 extern void ipa_write_optimization_summaries (struct cgraph_node_set_def *,
533                                               struct varpool_node_set_def *);
534 extern void ipa_read_summaries (void);
535 extern void ipa_read_optimization_summaries (void);
536 extern void register_one_dump_file (struct opt_pass *);
537 extern bool function_called_by_processed_nodes_p (void);
538 extern void register_pass (struct register_pass_info *);
539
540 /* Set to true if the pass is called the first time during compilation of the
541    current function.  Note that using this information in the optimization
542    passes is considered not to be clean, and it should be avoided if possible.
543    This flag is currently used to prevent loops from being peeled repeatedly
544    in jump threading; it will be removed once we preserve loop structures
545    throughout the compilation -- we will be able to mark the affected loops
546    directly in jump threading, and avoid peeling them next time.  */
547 extern bool first_pass_instance;
548
549 /* Declare for plugins.  */
550 extern void do_per_function_toporder (void (*) (void *), void *);
551
552 extern void disable_pass (const char *);
553 extern void enable_pass (const char *);
554 extern void dump_passes (void);
555
556 #endif /* GCC_TREE_PASS_H */