]> gcc.gnu.org Git - gcc.git/blame - gcc/pass_manager.h
New syntax for -fsanitize-recover.
[gcc.git] / gcc / pass_manager.h
CommitLineData
315f8c0e 1/* pass_manager.h - The pipeline of optimization passes
23a5b65a 2 Copyright (C) 2013-2014 Free Software Foundation, Inc.
315f8c0e
DM
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef GCC_PASS_MANAGER_H
21#define GCC_PASS_MANAGER_H
22
23class opt_pass;
24struct register_pass_info;
25
26/* Define a list of pass lists so that both passes.c and plugins can easily
27 find all the pass lists. */
28#define GCC_PASS_LISTS \
29 DEF_PASS_LIST (all_lowering_passes) \
30 DEF_PASS_LIST (all_small_ipa_passes) \
31 DEF_PASS_LIST (all_regular_ipa_passes) \
315f8c0e
DM
32 DEF_PASS_LIST (all_passes)
33
34#define DEF_PASS_LIST(LIST) PASS_LIST_NO_##LIST,
35enum pass_list
36{
37 GCC_PASS_LISTS
38 PASS_LIST_NUM
39};
40#undef DEF_PASS_LIST
41
42namespace gcc {
43
44class context;
45
6cd4d135 46class pass_manager
315f8c0e
DM
47{
48public:
6a389ed5
DM
49 void *operator new (size_t sz);
50
c3284718 51 pass_manager (context *ctxt);
315f8c0e
DM
52
53 void register_pass (struct register_pass_info *pass_info);
6a5ac314 54 void register_one_dump_file (opt_pass *pass);
315f8c0e
DM
55
56 opt_pass *get_pass_for_id (int id) const;
57
58 void dump_passes () const;
59
60 void dump_profile_report () const;
61
f7695dbf
DM
62 void finish_optimization_passes ();
63
64 /* Access to specific passes, so that the majority can be private. */
65 void execute_early_local_passes ();
66 unsigned int execute_pass_mode_switching ();
67
05555c4a
DM
68 /* Various passes are manually cloned by epiphany. */
69 opt_pass *get_pass_split_all_insns () const {
70 return pass_split_all_insns_1;
71 }
72 opt_pass *get_pass_mode_switching () const {
73 return pass_mode_switching_1;
74 }
75 opt_pass *get_pass_peephole2 () const { return pass_peephole2_1; }
103ff0d6 76 opt_pass *get_pass_profile () const { return pass_profile_1; }
05555c4a 77
315f8c0e
DM
78public:
79 /* The root of the compilation pass tree, once constructed. */
80 opt_pass *all_passes;
81 opt_pass *all_small_ipa_passes;
82 opt_pass *all_lowering_passes;
83 opt_pass *all_regular_ipa_passes;
315f8c0e
DM
84 opt_pass *all_late_ipa_passes;
85
86 /* A map from static pass id to optimization pass. */
87 opt_pass **passes_by_id;
88 int passes_by_id_size;
89
90 opt_pass **pass_lists[PASS_LIST_NUM];
91
92private:
93 void set_pass_for_id (int id, opt_pass *pass);
a23c217d 94 void register_dump_files (opt_pass *pass);
315f8c0e
DM
95
96private:
65d3284b 97 context *m_ctxt;
315f8c0e 98
f7695dbf
DM
99 /* References to all of the individual passes.
100 These fields are generated via macro expansion.
101
102 For example:
103 NEXT_PASS (pass_build_cfg, 1);
104 within pass-instances.def means that there is a field:
105 opt_pass *pass_build_cfg_1;
106
107 Similarly, the various:
108 NEXT_PASS (pass_copy_prop, 1);
109 ...
110 NEXT_PASS (pass_copy_prop, 8);
111 in pass-instances.def lead to fields:
112 opt_pass *pass_copy_prop_1;
113 ...
114 opt_pass *pass_copy_prop_8; */
115
116#define INSERT_PASSES_AFTER(PASS)
117#define PUSH_INSERT_PASSES_WITHIN(PASS)
118#define POP_INSERT_PASSES()
119#define NEXT_PASS(PASS, NUM) opt_pass *PASS ## _ ## NUM
120#define TERMINATE_PASS_LIST()
121
122#include "pass-instances.def"
123
124#undef INSERT_PASSES_AFTER
125#undef PUSH_INSERT_PASSES_WITHIN
126#undef POP_INSERT_PASSES
127#undef NEXT_PASS
128#undef TERMINATE_PASS_LIST
129
315f8c0e
DM
130}; // class pass_manager
131
132} // namespace gcc
133
134#endif /* ! GCC_PASS_MANAGER_H */
6cd4d135 135
This page took 0.680451 seconds and 5 git commands to generate.