annotate gcc/passes.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 351920fa3827
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Top level of GCC compilers (cc1, cc1plus, etc.)
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 1987-2020 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 /* This is the top level of cc1/c++.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 It parses command args, opens files, invokes the various passes
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 in the proper order, and counts the time used by each.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 Error messages and low-level interface to malloc also handled here. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 #include "config.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 #include "system.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 #include "coretypes.h"
111
kono
parents: 67
diff changeset
28 #include "backend.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 #include "target.h"
111
kono
parents: 67
diff changeset
30 #include "rtl.h"
kono
parents: 67
diff changeset
31 #include "tree.h"
kono
parents: 67
diff changeset
32 #include "gimple.h"
kono
parents: 67
diff changeset
33 #include "cfghooks.h"
kono
parents: 67
diff changeset
34 #include "df.h"
kono
parents: 67
diff changeset
35 #include "memmodel.h"
kono
parents: 67
diff changeset
36 #include "tm_p.h"
kono
parents: 67
diff changeset
37 #include "ssa.h"
kono
parents: 67
diff changeset
38 #include "emit-rtl.h"
kono
parents: 67
diff changeset
39 #include "cgraph.h"
kono
parents: 67
diff changeset
40 #include "lto-streamer.h"
kono
parents: 67
diff changeset
41 #include "fold-const.h"
kono
parents: 67
diff changeset
42 #include "varasm.h"
kono
parents: 67
diff changeset
43 #include "output.h"
kono
parents: 67
diff changeset
44 #include "graph.h"
kono
parents: 67
diff changeset
45 #include "debug.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 #include "cfgloop.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 #include "value-prof.h"
111
kono
parents: 67
diff changeset
48 #include "tree-cfg.h"
kono
parents: 67
diff changeset
49 #include "tree-ssa-loop-manip.h"
kono
parents: 67
diff changeset
50 #include "tree-into-ssa.h"
kono
parents: 67
diff changeset
51 #include "tree-dfa.h"
kono
parents: 67
diff changeset
52 #include "tree-ssa.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 #include "tree-pass.h"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
54 #include "plugin.h"
111
kono
parents: 67
diff changeset
55 #include "ipa-utils.h"
kono
parents: 67
diff changeset
56 #include "tree-pretty-print.h" /* for dump_function_header */
kono
parents: 67
diff changeset
57 #include "context.h"
kono
parents: 67
diff changeset
58 #include "pass_manager.h"
kono
parents: 67
diff changeset
59 #include "cfgrtl.h"
kono
parents: 67
diff changeset
60 #include "tree-ssa-live.h" /* For remove_unused_locals. */
kono
parents: 67
diff changeset
61 #include "tree-cfgcleanup.h"
kono
parents: 67
diff changeset
62 #include "insn-addr.h" /* for INSN_ADDRESSES_ALLOC. */
kono
parents: 67
diff changeset
63 #include "diagnostic-core.h" /* for fnotice */
kono
parents: 67
diff changeset
64 #include "stringpool.h"
kono
parents: 67
diff changeset
65 #include "attribs.h"
kono
parents: 67
diff changeset
66
kono
parents: 67
diff changeset
67 using namespace gcc;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 /* This is used for debugging. It allows the current pass to printed
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
70 from anywhere in compilation.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
71 The variable current_pass is also used for statistics and plugins. */
111
kono
parents: 67
diff changeset
72 opt_pass *current_pass;
kono
parents: 67
diff changeset
73
kono
parents: 67
diff changeset
74 /* Most passes are single-instance (within their context) and thus don't
kono
parents: 67
diff changeset
75 need to implement cloning, but passes that support multiple instances
kono
parents: 67
diff changeset
76 *must* provide their own implementation of the clone method.
kono
parents: 67
diff changeset
77
kono
parents: 67
diff changeset
78 Handle this by providing a default implemenation, but make it a fatal
kono
parents: 67
diff changeset
79 error to call it. */
kono
parents: 67
diff changeset
80
kono
parents: 67
diff changeset
81 opt_pass *
kono
parents: 67
diff changeset
82 opt_pass::clone ()
kono
parents: 67
diff changeset
83 {
kono
parents: 67
diff changeset
84 internal_error ("pass %s does not support cloning", name);
kono
parents: 67
diff changeset
85 }
kono
parents: 67
diff changeset
86
kono
parents: 67
diff changeset
87 void
kono
parents: 67
diff changeset
88 opt_pass::set_pass_param (unsigned int, bool)
kono
parents: 67
diff changeset
89 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
90 internal_error ("pass %s needs a %<set_pass_param%> implementation "
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
91 "to handle the extra argument in %<NEXT_PASS%>", name);
111
kono
parents: 67
diff changeset
92 }
kono
parents: 67
diff changeset
93
kono
parents: 67
diff changeset
94 bool
kono
parents: 67
diff changeset
95 opt_pass::gate (function *)
kono
parents: 67
diff changeset
96 {
kono
parents: 67
diff changeset
97 return true;
kono
parents: 67
diff changeset
98 }
kono
parents: 67
diff changeset
99
kono
parents: 67
diff changeset
100 unsigned int
kono
parents: 67
diff changeset
101 opt_pass::execute (function *)
kono
parents: 67
diff changeset
102 {
kono
parents: 67
diff changeset
103 return 0;
kono
parents: 67
diff changeset
104 }
kono
parents: 67
diff changeset
105
kono
parents: 67
diff changeset
106 opt_pass::opt_pass (const pass_data &data, context *ctxt)
kono
parents: 67
diff changeset
107 : pass_data (data),
kono
parents: 67
diff changeset
108 sub (NULL),
kono
parents: 67
diff changeset
109 next (NULL),
kono
parents: 67
diff changeset
110 static_pass_number (0),
kono
parents: 67
diff changeset
111 m_ctxt (ctxt)
kono
parents: 67
diff changeset
112 {
kono
parents: 67
diff changeset
113 }
kono
parents: 67
diff changeset
114
kono
parents: 67
diff changeset
115
kono
parents: 67
diff changeset
116 void
kono
parents: 67
diff changeset
117 pass_manager::execute_early_local_passes ()
kono
parents: 67
diff changeset
118 {
kono
parents: 67
diff changeset
119 execute_pass_list (cfun, pass_build_ssa_passes_1->sub);
kono
parents: 67
diff changeset
120 execute_pass_list (cfun, pass_local_optimization_passes_1->sub);
kono
parents: 67
diff changeset
121 }
kono
parents: 67
diff changeset
122
kono
parents: 67
diff changeset
123 unsigned int
kono
parents: 67
diff changeset
124 pass_manager::execute_pass_mode_switching ()
kono
parents: 67
diff changeset
125 {
kono
parents: 67
diff changeset
126 return pass_mode_switching_1->execute (cfun);
kono
parents: 67
diff changeset
127 }
kono
parents: 67
diff changeset
128
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 /* Call from anywhere to find out what pass this is. Useful for
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 printing out debugging information deep inside an service
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 routine. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 print_current_pass (FILE *file)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 if (current_pass)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
137 fprintf (file, "current pass = %s (%d)\n",
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 current_pass->name, current_pass->static_pass_number);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 fprintf (file, "no current pass.\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 /* Call from the debugger to get the current pass name. */
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
145 DEBUG_FUNCTION void
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 debug_pass (void)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 print_current_pass (stderr);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
149 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 /* Global variables used to communicate with passes. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 bool in_gimple_form;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 and TYPE_DECL nodes.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 This does nothing for local (non-static) variables, unless the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 variable is a register variable with DECL_ASSEMBLER_NAME set. In
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 that case, or if the variable is not an automatic, it sets up the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 RTL and outputs any assembler code (label definition, storage
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 allocation and initialization).
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 DECL is the declaration. TOP_LEVEL is nonzero
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 if this declaration is not within a function. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 rest_of_decl_compilation (tree decl,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 int top_level,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 int at_end)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 {
111
kono
parents: 67
diff changeset
174 bool finalize = true;
kono
parents: 67
diff changeset
175
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 /* We deferred calling assemble_alias so that we could collect
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 other attributes such as visibility. Emit the alias now. */
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
178 if (!in_lto_p)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 tree alias;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 if (alias)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 alias = TREE_VALUE (TREE_VALUE (alias));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 alias = get_identifier (TREE_STRING_POINTER (alias));
111
kono
parents: 67
diff changeset
186 /* A quirk of the initial implementation of aliases required that the
kono
parents: 67
diff changeset
187 user add "extern" to all of them. Which is silly, but now
kono
parents: 67
diff changeset
188 historical. Do note that the symbol is in fact locally defined. */
kono
parents: 67
diff changeset
189 DECL_EXTERNAL (decl) = 0;
kono
parents: 67
diff changeset
190 TREE_STATIC (decl) = 1;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191 assemble_alias (decl, alias);
111
kono
parents: 67
diff changeset
192 finalize = false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
195
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 /* Can't defer this, because it needs to happen before any
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 later function definitions are processed. */
111
kono
parents: 67
diff changeset
198 if (HAS_DECL_ASSEMBLER_NAME_P (decl)
kono
parents: 67
diff changeset
199 && DECL_ASSEMBLER_NAME_SET_P (decl)
kono
parents: 67
diff changeset
200 && DECL_REGISTER (decl))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 make_decl_rtl (decl);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
202
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 /* Forward declarations for nested functions are not "external",
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 but we need to treat them as if they were. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 || TREE_CODE (decl) == FUNCTION_DECL)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 timevar_push (TV_VARCONST);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
209
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 /* Don't output anything when a tentative file-scope definition
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 is seen. But at end of compilation, do output code for them.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
212
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 We do output all variables and rely on
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 callgraph code to defer them except for forward declarations
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 (see gcc.c-torture/compile/920624-1.c) */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 if ((at_end
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 || !DECL_DEFER_OUTPUT (decl)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 || DECL_INITIAL (decl))
111
kono
parents: 67
diff changeset
219 && (!VAR_P (decl) || !DECL_HAS_VALUE_EXPR_P (decl))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 && !DECL_EXTERNAL (decl))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 {
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
222 /* When reading LTO unit, we also read varpool, so do not
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
223 rebuild it. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
224 if (in_lto_p && !at_end)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
225 ;
111
kono
parents: 67
diff changeset
226 else if (finalize && TREE_CODE (decl) != FUNCTION_DECL)
kono
parents: 67
diff changeset
227 varpool_node::finalize_decl (decl);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230 #ifdef ASM_FINISH_DECLARE_OBJECT
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 if (decl == last_assemble_variable_decl)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 top_level, at_end);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 #endif
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
237
111
kono
parents: 67
diff changeset
238 /* Now that we have activated any function-specific attributes
kono
parents: 67
diff changeset
239 that might affect function decl, particularly align, relayout it. */
kono
parents: 67
diff changeset
240 if (TREE_CODE (decl) == FUNCTION_DECL)
kono
parents: 67
diff changeset
241 targetm.target_option.relayout_function (decl);
kono
parents: 67
diff changeset
242
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
243 timevar_pop (TV_VARCONST);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
244 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 else if (TREE_CODE (decl) == TYPE_DECL
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 /* Like in rest_of_type_compilation, avoid confusing the debug
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 information machinery when there are errors. */
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
248 && !seen_error ())
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 timevar_push (TV_SYMOUT);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 debug_hooks->type_decl (decl, !top_level);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 timevar_pop (TV_SYMOUT);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
254
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
255 /* Let cgraph know about the existence of variables. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
256 if (in_lto_p && !at_end)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
257 ;
111
kono
parents: 67
diff changeset
258 else if (VAR_P (decl) && !DECL_EXTERNAL (decl)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
259 && TREE_STATIC (decl))
111
kono
parents: 67
diff changeset
260 varpool_node::get_create (decl);
kono
parents: 67
diff changeset
261
kono
parents: 67
diff changeset
262 /* Generate early debug for global variables. Any local variables will
kono
parents: 67
diff changeset
263 be handled by either handling reachable functions from
kono
parents: 67
diff changeset
264 finalize_compilation_unit (and by consequence, locally scoped
kono
parents: 67
diff changeset
265 symbols), or by rest_of_type_compilation below.
kono
parents: 67
diff changeset
266
kono
parents: 67
diff changeset
267 For Go's hijack of the debug_hooks to implement -fdump-go-spec, pick up
kono
parents: 67
diff changeset
268 function prototypes. Go's debug_hooks will not forward them to the
kono
parents: 67
diff changeset
269 wrapped hooks. */
kono
parents: 67
diff changeset
270 if (!in_lto_p
kono
parents: 67
diff changeset
271 && (TREE_CODE (decl) != FUNCTION_DECL
kono
parents: 67
diff changeset
272 /* This will pick up function prototypes with no bodies,
kono
parents: 67
diff changeset
273 which are not visible in finalize_compilation_unit()
kono
parents: 67
diff changeset
274 while iterating with FOR_EACH_*_FUNCTION through the
kono
parents: 67
diff changeset
275 symbol table. */
kono
parents: 67
diff changeset
276 || (flag_dump_go_spec != NULL
kono
parents: 67
diff changeset
277 && !DECL_SAVED_TREE (decl)
kono
parents: 67
diff changeset
278 && DECL_STRUCT_FUNCTION (decl) == NULL))
kono
parents: 67
diff changeset
279
kono
parents: 67
diff changeset
280 /* We need to check both decl_function_context and
kono
parents: 67
diff changeset
281 current_function_decl here to make sure local extern
kono
parents: 67
diff changeset
282 declarations end up with the correct context.
kono
parents: 67
diff changeset
283
kono
parents: 67
diff changeset
284 For local extern declarations, decl_function_context is
kono
parents: 67
diff changeset
285 empty, but current_function_decl is set to the function where
kono
parents: 67
diff changeset
286 the extern was declared . Without the check for
kono
parents: 67
diff changeset
287 !current_function_decl below, the local extern ends up
kono
parents: 67
diff changeset
288 incorrectly with a top-level context.
kono
parents: 67
diff changeset
289
kono
parents: 67
diff changeset
290 For example:
kono
parents: 67
diff changeset
291
kono
parents: 67
diff changeset
292 namespace S
kono
parents: 67
diff changeset
293 {
kono
parents: 67
diff changeset
294 int
kono
parents: 67
diff changeset
295 f()
kono
parents: 67
diff changeset
296 {
kono
parents: 67
diff changeset
297 {
kono
parents: 67
diff changeset
298 int i = 42;
kono
parents: 67
diff changeset
299 {
kono
parents: 67
diff changeset
300 extern int i; // Local extern declaration.
kono
parents: 67
diff changeset
301 return i;
kono
parents: 67
diff changeset
302 }
kono
parents: 67
diff changeset
303 }
kono
parents: 67
diff changeset
304 }
kono
parents: 67
diff changeset
305 }
kono
parents: 67
diff changeset
306 */
kono
parents: 67
diff changeset
307 && !decl_function_context (decl)
kono
parents: 67
diff changeset
308 && !current_function_decl
kono
parents: 67
diff changeset
309 && DECL_SOURCE_LOCATION (decl) != BUILTINS_LOCATION
kono
parents: 67
diff changeset
310 && (!decl_type_context (decl)
kono
parents: 67
diff changeset
311 /* If we created a varpool node for the decl make sure to
kono
parents: 67
diff changeset
312 call early_global_decl. Otherwise we miss changes
kono
parents: 67
diff changeset
313 introduced by member definitions like
kono
parents: 67
diff changeset
314 struct A { static int staticdatamember; };
kono
parents: 67
diff changeset
315 int A::staticdatamember;
kono
parents: 67
diff changeset
316 and thus have incomplete early debug and late debug
kono
parents: 67
diff changeset
317 called from varpool node removal fails to handle it
kono
parents: 67
diff changeset
318 properly. */
kono
parents: 67
diff changeset
319 || (finalize
kono
parents: 67
diff changeset
320 && VAR_P (decl)
kono
parents: 67
diff changeset
321 && TREE_STATIC (decl) && !DECL_EXTERNAL (decl)))
kono
parents: 67
diff changeset
322 /* Avoid confusing the debug information machinery when there are
kono
parents: 67
diff changeset
323 errors. */
kono
parents: 67
diff changeset
324 && !seen_error ())
kono
parents: 67
diff changeset
325 (*debug_hooks->early_global_decl) (decl);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
326 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
327
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
328 /* Called after finishing a record, union or enumeral type. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
329
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
330 void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
331 rest_of_type_compilation (tree type, int toplev)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
332 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
333 /* Avoid confusing the debug information machinery when there are
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
334 errors. */
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
335 if (seen_error ())
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
336 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
337
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
338 timevar_push (TV_SYMOUT);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
339 debug_hooks->type_decl (TYPE_STUB_DECL (type), !toplev);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
340 timevar_pop (TV_SYMOUT);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
341 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
342
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
343
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
344
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
345 void
111
kono
parents: 67
diff changeset
346 pass_manager::
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
347 finish_optimization_passes (void)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 {
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
349 int i;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 struct dump_file_info *dfi;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
351 char *name;
111
kono
parents: 67
diff changeset
352 gcc::dump_manager *dumps = m_ctxt->get_dumps ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
353
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
354 timevar_push (TV_DUMP);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
355 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
356 {
111
kono
parents: 67
diff changeset
357 dumps->dump_start (pass_profile_1->static_pass_number, NULL);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
358 end_branch_prob ();
111
kono
parents: 67
diff changeset
359 dumps->dump_finish (pass_profile_1->static_pass_number);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
360 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
361
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
362 if (optimize > 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
363 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
364 dumps->dump_start (pass_combine_1->static_pass_number, NULL);
111
kono
parents: 67
diff changeset
365 print_combine_total_stats ();
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
366 dumps->dump_finish (pass_combine_1->static_pass_number);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
367 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
368
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
369 /* Do whatever is necessary to finish printing the graphs. */
111
kono
parents: 67
diff changeset
370 for (i = TDI_end; (dfi = dumps->get_dump_file_info (i)) != NULL; ++i)
kono
parents: 67
diff changeset
371 if (dfi->graph_dump_initialized)
kono
parents: 67
diff changeset
372 {
kono
parents: 67
diff changeset
373 name = dumps->get_dump_file_name (dfi);
kono
parents: 67
diff changeset
374 finish_graph_dump_file (name);
kono
parents: 67
diff changeset
375 free (name);
kono
parents: 67
diff changeset
376 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
377
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
378 timevar_pop (TV_DUMP);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
379 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
380
111
kono
parents: 67
diff changeset
381 static unsigned int
kono
parents: 67
diff changeset
382 execute_build_ssa_passes (void)
kono
parents: 67
diff changeset
383 {
kono
parents: 67
diff changeset
384 /* Once this pass (and its sub-passes) are complete, all functions
kono
parents: 67
diff changeset
385 will be in SSA form. Technically this state change is happening
kono
parents: 67
diff changeset
386 a tad early, since the sub-passes have not yet run, but since
kono
parents: 67
diff changeset
387 none of the sub-passes are IPA passes and do not create new
kono
parents: 67
diff changeset
388 functions, this is ok. We're setting this value for the benefit
kono
parents: 67
diff changeset
389 of IPA passes that follow. */
kono
parents: 67
diff changeset
390 if (symtab->state < IPA_SSA)
kono
parents: 67
diff changeset
391 symtab->state = IPA_SSA;
kono
parents: 67
diff changeset
392 return 0;
kono
parents: 67
diff changeset
393 }
kono
parents: 67
diff changeset
394
kono
parents: 67
diff changeset
395 namespace {
kono
parents: 67
diff changeset
396
kono
parents: 67
diff changeset
397 const pass_data pass_data_build_ssa_passes =
kono
parents: 67
diff changeset
398 {
kono
parents: 67
diff changeset
399 SIMPLE_IPA_PASS, /* type */
kono
parents: 67
diff changeset
400 "build_ssa_passes", /* name */
kono
parents: 67
diff changeset
401 OPTGROUP_NONE, /* optinfo_flags */
kono
parents: 67
diff changeset
402 TV_EARLY_LOCAL, /* tv_id */
kono
parents: 67
diff changeset
403 0, /* properties_required */
kono
parents: 67
diff changeset
404 0, /* properties_provided */
kono
parents: 67
diff changeset
405 0, /* properties_destroyed */
kono
parents: 67
diff changeset
406 0, /* todo_flags_start */
kono
parents: 67
diff changeset
407 /* todo_flags_finish is executed before subpases. For this reason
kono
parents: 67
diff changeset
408 it makes no sense to remove unreachable functions here. */
kono
parents: 67
diff changeset
409 0, /* todo_flags_finish */
kono
parents: 67
diff changeset
410 };
kono
parents: 67
diff changeset
411
kono
parents: 67
diff changeset
412 class pass_build_ssa_passes : public simple_ipa_opt_pass
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
413 {
111
kono
parents: 67
diff changeset
414 public:
kono
parents: 67
diff changeset
415 pass_build_ssa_passes (gcc::context *ctxt)
kono
parents: 67
diff changeset
416 : simple_ipa_opt_pass (pass_data_build_ssa_passes, ctxt)
kono
parents: 67
diff changeset
417 {}
kono
parents: 67
diff changeset
418
kono
parents: 67
diff changeset
419 /* opt_pass methods: */
kono
parents: 67
diff changeset
420 virtual bool gate (function *)
kono
parents: 67
diff changeset
421 {
kono
parents: 67
diff changeset
422 /* Don't bother doing anything if the program has errors. */
kono
parents: 67
diff changeset
423 return (!seen_error () && !in_lto_p);
kono
parents: 67
diff changeset
424 }
kono
parents: 67
diff changeset
425
kono
parents: 67
diff changeset
426 virtual unsigned int execute (function *)
kono
parents: 67
diff changeset
427 {
kono
parents: 67
diff changeset
428 return execute_build_ssa_passes ();
kono
parents: 67
diff changeset
429 }
kono
parents: 67
diff changeset
430
kono
parents: 67
diff changeset
431 }; // class pass_build_ssa_passes
kono
parents: 67
diff changeset
432
kono
parents: 67
diff changeset
433 const pass_data pass_data_local_optimization_passes =
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 {
111
kono
parents: 67
diff changeset
435 SIMPLE_IPA_PASS, /* type */
kono
parents: 67
diff changeset
436 "opt_local_passes", /* name */
kono
parents: 67
diff changeset
437 OPTGROUP_NONE, /* optinfo_flags */
kono
parents: 67
diff changeset
438 TV_NONE, /* tv_id */
kono
parents: 67
diff changeset
439 0, /* properties_required */
kono
parents: 67
diff changeset
440 0, /* properties_provided */
kono
parents: 67
diff changeset
441 0, /* properties_destroyed */
kono
parents: 67
diff changeset
442 0, /* todo_flags_start */
kono
parents: 67
diff changeset
443 0, /* todo_flags_finish */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
444 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
445
111
kono
parents: 67
diff changeset
446 class pass_local_optimization_passes : public simple_ipa_opt_pass
kono
parents: 67
diff changeset
447 {
kono
parents: 67
diff changeset
448 public:
kono
parents: 67
diff changeset
449 pass_local_optimization_passes (gcc::context *ctxt)
kono
parents: 67
diff changeset
450 : simple_ipa_opt_pass (pass_data_local_optimization_passes, ctxt)
kono
parents: 67
diff changeset
451 {}
kono
parents: 67
diff changeset
452
kono
parents: 67
diff changeset
453 /* opt_pass methods: */
kono
parents: 67
diff changeset
454 virtual bool gate (function *)
kono
parents: 67
diff changeset
455 {
kono
parents: 67
diff changeset
456 /* Don't bother doing anything if the program has errors. */
kono
parents: 67
diff changeset
457 return (!seen_error () && !in_lto_p);
kono
parents: 67
diff changeset
458 }
kono
parents: 67
diff changeset
459
kono
parents: 67
diff changeset
460 }; // class pass_local_optimization_passes
kono
parents: 67
diff changeset
461
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
462 const pass_data pass_data_ipa_remove_symbols =
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
463 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
464 SIMPLE_IPA_PASS, /* type */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
465 "remove_symbols", /* name */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
466 OPTGROUP_NONE, /* optinfo_flags */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
467 TV_NONE, /* tv_id */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
468 0, /* properties_required */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
469 0, /* properties_provided */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
470 0, /* properties_destroyed */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
471 0, /* todo_flags_start */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
472 TODO_remove_functions | TODO_dump_symtab, /* todo_flags_finish */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
473 };
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
474
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
475 class pass_ipa_remove_symbols : public simple_ipa_opt_pass
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
476 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
477 public:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
478 pass_ipa_remove_symbols (gcc::context *ctxt)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
479 : simple_ipa_opt_pass (pass_data_ipa_remove_symbols, ctxt)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
480 {}
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
481
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
482 /* opt_pass methods: */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
483 virtual bool gate (function *)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
484 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
485 /* Don't bother doing anything if the program has errors. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
486 return (!seen_error () && !in_lto_p);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
487 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
488
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
489 }; // class pass_local_optimization_passes
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
490
111
kono
parents: 67
diff changeset
491 } // anon namespace
kono
parents: 67
diff changeset
492
kono
parents: 67
diff changeset
493 simple_ipa_opt_pass *
kono
parents: 67
diff changeset
494 make_pass_build_ssa_passes (gcc::context *ctxt)
kono
parents: 67
diff changeset
495 {
kono
parents: 67
diff changeset
496 return new pass_build_ssa_passes (ctxt);
kono
parents: 67
diff changeset
497 }
kono
parents: 67
diff changeset
498
kono
parents: 67
diff changeset
499 simple_ipa_opt_pass *
kono
parents: 67
diff changeset
500 make_pass_local_optimization_passes (gcc::context *ctxt)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
501 {
111
kono
parents: 67
diff changeset
502 return new pass_local_optimization_passes (ctxt);
kono
parents: 67
diff changeset
503 }
kono
parents: 67
diff changeset
504
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
505 simple_ipa_opt_pass *
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
506 make_pass_ipa_remove_symbols (gcc::context *ctxt)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
507 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
508 return new pass_ipa_remove_symbols (ctxt);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
509 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
510
111
kono
parents: 67
diff changeset
511 namespace {
kono
parents: 67
diff changeset
512
kono
parents: 67
diff changeset
513 const pass_data pass_data_all_early_optimizations =
kono
parents: 67
diff changeset
514 {
kono
parents: 67
diff changeset
515 GIMPLE_PASS, /* type */
kono
parents: 67
diff changeset
516 "early_optimizations", /* name */
kono
parents: 67
diff changeset
517 OPTGROUP_NONE, /* optinfo_flags */
kono
parents: 67
diff changeset
518 TV_NONE, /* tv_id */
kono
parents: 67
diff changeset
519 0, /* properties_required */
kono
parents: 67
diff changeset
520 0, /* properties_provided */
kono
parents: 67
diff changeset
521 0, /* properties_destroyed */
kono
parents: 67
diff changeset
522 0, /* todo_flags_start */
kono
parents: 67
diff changeset
523 0, /* todo_flags_finish */
kono
parents: 67
diff changeset
524 };
kono
parents: 67
diff changeset
525
kono
parents: 67
diff changeset
526 class pass_all_early_optimizations : public gimple_opt_pass
kono
parents: 67
diff changeset
527 {
kono
parents: 67
diff changeset
528 public:
kono
parents: 67
diff changeset
529 pass_all_early_optimizations (gcc::context *ctxt)
kono
parents: 67
diff changeset
530 : gimple_opt_pass (pass_data_all_early_optimizations, ctxt)
kono
parents: 67
diff changeset
531 {}
kono
parents: 67
diff changeset
532
kono
parents: 67
diff changeset
533 /* opt_pass methods: */
kono
parents: 67
diff changeset
534 virtual bool gate (function *)
kono
parents: 67
diff changeset
535 {
kono
parents: 67
diff changeset
536 return (optimize >= 1
kono
parents: 67
diff changeset
537 /* Don't bother doing anything if the program has errors. */
kono
parents: 67
diff changeset
538 && !seen_error ());
kono
parents: 67
diff changeset
539 }
kono
parents: 67
diff changeset
540
kono
parents: 67
diff changeset
541 }; // class pass_all_early_optimizations
kono
parents: 67
diff changeset
542
kono
parents: 67
diff changeset
543 } // anon namespace
kono
parents: 67
diff changeset
544
kono
parents: 67
diff changeset
545 static gimple_opt_pass *
kono
parents: 67
diff changeset
546 make_pass_all_early_optimizations (gcc::context *ctxt)
kono
parents: 67
diff changeset
547 {
kono
parents: 67
diff changeset
548 return new pass_all_early_optimizations (ctxt);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
549 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
550
111
kono
parents: 67
diff changeset
551 namespace {
kono
parents: 67
diff changeset
552
kono
parents: 67
diff changeset
553 const pass_data pass_data_all_optimizations =
kono
parents: 67
diff changeset
554 {
kono
parents: 67
diff changeset
555 GIMPLE_PASS, /* type */
kono
parents: 67
diff changeset
556 "*all_optimizations", /* name */
kono
parents: 67
diff changeset
557 OPTGROUP_NONE, /* optinfo_flags */
kono
parents: 67
diff changeset
558 TV_OPTIMIZE, /* tv_id */
kono
parents: 67
diff changeset
559 0, /* properties_required */
kono
parents: 67
diff changeset
560 0, /* properties_provided */
kono
parents: 67
diff changeset
561 0, /* properties_destroyed */
kono
parents: 67
diff changeset
562 0, /* todo_flags_start */
kono
parents: 67
diff changeset
563 0, /* todo_flags_finish */
kono
parents: 67
diff changeset
564 };
kono
parents: 67
diff changeset
565
kono
parents: 67
diff changeset
566 class pass_all_optimizations : public gimple_opt_pass
kono
parents: 67
diff changeset
567 {
kono
parents: 67
diff changeset
568 public:
kono
parents: 67
diff changeset
569 pass_all_optimizations (gcc::context *ctxt)
kono
parents: 67
diff changeset
570 : gimple_opt_pass (pass_data_all_optimizations, ctxt)
kono
parents: 67
diff changeset
571 {}
kono
parents: 67
diff changeset
572
kono
parents: 67
diff changeset
573 /* opt_pass methods: */
kono
parents: 67
diff changeset
574 virtual bool gate (function *) { return optimize >= 1 && !optimize_debug; }
kono
parents: 67
diff changeset
575
kono
parents: 67
diff changeset
576 }; // class pass_all_optimizations
kono
parents: 67
diff changeset
577
kono
parents: 67
diff changeset
578 } // anon namespace
kono
parents: 67
diff changeset
579
kono
parents: 67
diff changeset
580 static gimple_opt_pass *
kono
parents: 67
diff changeset
581 make_pass_all_optimizations (gcc::context *ctxt)
kono
parents: 67
diff changeset
582 {
kono
parents: 67
diff changeset
583 return new pass_all_optimizations (ctxt);
kono
parents: 67
diff changeset
584 }
kono
parents: 67
diff changeset
585
kono
parents: 67
diff changeset
586 namespace {
kono
parents: 67
diff changeset
587
kono
parents: 67
diff changeset
588 const pass_data pass_data_all_optimizations_g =
kono
parents: 67
diff changeset
589 {
kono
parents: 67
diff changeset
590 GIMPLE_PASS, /* type */
kono
parents: 67
diff changeset
591 "*all_optimizations_g", /* name */
kono
parents: 67
diff changeset
592 OPTGROUP_NONE, /* optinfo_flags */
kono
parents: 67
diff changeset
593 TV_OPTIMIZE, /* tv_id */
kono
parents: 67
diff changeset
594 0, /* properties_required */
kono
parents: 67
diff changeset
595 0, /* properties_provided */
kono
parents: 67
diff changeset
596 0, /* properties_destroyed */
kono
parents: 67
diff changeset
597 0, /* todo_flags_start */
kono
parents: 67
diff changeset
598 0, /* todo_flags_finish */
kono
parents: 67
diff changeset
599 };
kono
parents: 67
diff changeset
600
kono
parents: 67
diff changeset
601 class pass_all_optimizations_g : public gimple_opt_pass
kono
parents: 67
diff changeset
602 {
kono
parents: 67
diff changeset
603 public:
kono
parents: 67
diff changeset
604 pass_all_optimizations_g (gcc::context *ctxt)
kono
parents: 67
diff changeset
605 : gimple_opt_pass (pass_data_all_optimizations_g, ctxt)
kono
parents: 67
diff changeset
606 {}
kono
parents: 67
diff changeset
607
kono
parents: 67
diff changeset
608 /* opt_pass methods: */
kono
parents: 67
diff changeset
609 virtual bool gate (function *) { return optimize >= 1 && optimize_debug; }
kono
parents: 67
diff changeset
610
kono
parents: 67
diff changeset
611 }; // class pass_all_optimizations_g
kono
parents: 67
diff changeset
612
kono
parents: 67
diff changeset
613 } // anon namespace
kono
parents: 67
diff changeset
614
kono
parents: 67
diff changeset
615 static gimple_opt_pass *
kono
parents: 67
diff changeset
616 make_pass_all_optimizations_g (gcc::context *ctxt)
kono
parents: 67
diff changeset
617 {
kono
parents: 67
diff changeset
618 return new pass_all_optimizations_g (ctxt);
kono
parents: 67
diff changeset
619 }
kono
parents: 67
diff changeset
620
kono
parents: 67
diff changeset
621 namespace {
kono
parents: 67
diff changeset
622
kono
parents: 67
diff changeset
623 const pass_data pass_data_rest_of_compilation =
kono
parents: 67
diff changeset
624 {
kono
parents: 67
diff changeset
625 RTL_PASS, /* type */
kono
parents: 67
diff changeset
626 "*rest_of_compilation", /* name */
kono
parents: 67
diff changeset
627 OPTGROUP_NONE, /* optinfo_flags */
kono
parents: 67
diff changeset
628 TV_REST_OF_COMPILATION, /* tv_id */
kono
parents: 67
diff changeset
629 PROP_rtl, /* properties_required */
kono
parents: 67
diff changeset
630 0, /* properties_provided */
kono
parents: 67
diff changeset
631 0, /* properties_destroyed */
kono
parents: 67
diff changeset
632 0, /* todo_flags_start */
kono
parents: 67
diff changeset
633 0, /* todo_flags_finish */
kono
parents: 67
diff changeset
634 };
kono
parents: 67
diff changeset
635
kono
parents: 67
diff changeset
636 class pass_rest_of_compilation : public rtl_opt_pass
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
637 {
111
kono
parents: 67
diff changeset
638 public:
kono
parents: 67
diff changeset
639 pass_rest_of_compilation (gcc::context *ctxt)
kono
parents: 67
diff changeset
640 : rtl_opt_pass (pass_data_rest_of_compilation, ctxt)
kono
parents: 67
diff changeset
641 {}
kono
parents: 67
diff changeset
642
kono
parents: 67
diff changeset
643 /* opt_pass methods: */
kono
parents: 67
diff changeset
644 virtual bool gate (function *)
kono
parents: 67
diff changeset
645 {
kono
parents: 67
diff changeset
646 /* Early return if there were errors. We can run afoul of our
kono
parents: 67
diff changeset
647 consistency checks, and there's not really much point in fixing them. */
kono
parents: 67
diff changeset
648 return !(rtl_dump_and_exit || flag_syntax_only || seen_error ());
kono
parents: 67
diff changeset
649 }
kono
parents: 67
diff changeset
650
kono
parents: 67
diff changeset
651 }; // class pass_rest_of_compilation
kono
parents: 67
diff changeset
652
kono
parents: 67
diff changeset
653 } // anon namespace
kono
parents: 67
diff changeset
654
kono
parents: 67
diff changeset
655 static rtl_opt_pass *
kono
parents: 67
diff changeset
656 make_pass_rest_of_compilation (gcc::context *ctxt)
kono
parents: 67
diff changeset
657 {
kono
parents: 67
diff changeset
658 return new pass_rest_of_compilation (ctxt);
kono
parents: 67
diff changeset
659 }
kono
parents: 67
diff changeset
660
kono
parents: 67
diff changeset
661 namespace {
kono
parents: 67
diff changeset
662
kono
parents: 67
diff changeset
663 const pass_data pass_data_postreload =
kono
parents: 67
diff changeset
664 {
kono
parents: 67
diff changeset
665 RTL_PASS, /* type */
kono
parents: 67
diff changeset
666 "*all-postreload", /* name */
kono
parents: 67
diff changeset
667 OPTGROUP_NONE, /* optinfo_flags */
kono
parents: 67
diff changeset
668 TV_POSTRELOAD, /* tv_id */
kono
parents: 67
diff changeset
669 PROP_rtl, /* properties_required */
kono
parents: 67
diff changeset
670 0, /* properties_provided */
kono
parents: 67
diff changeset
671 0, /* properties_destroyed */
kono
parents: 67
diff changeset
672 0, /* todo_flags_start */
kono
parents: 67
diff changeset
673 0, /* todo_flags_finish */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
674 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
675
111
kono
parents: 67
diff changeset
676 class pass_postreload : public rtl_opt_pass
kono
parents: 67
diff changeset
677 {
kono
parents: 67
diff changeset
678 public:
kono
parents: 67
diff changeset
679 pass_postreload (gcc::context *ctxt)
kono
parents: 67
diff changeset
680 : rtl_opt_pass (pass_data_postreload, ctxt)
kono
parents: 67
diff changeset
681 {}
kono
parents: 67
diff changeset
682
kono
parents: 67
diff changeset
683 /* opt_pass methods: */
kono
parents: 67
diff changeset
684 virtual bool gate (function *) { return reload_completed; }
kono
parents: 67
diff changeset
685
kono
parents: 67
diff changeset
686 }; // class pass_postreload
kono
parents: 67
diff changeset
687
kono
parents: 67
diff changeset
688 } // anon namespace
kono
parents: 67
diff changeset
689
kono
parents: 67
diff changeset
690 static rtl_opt_pass *
kono
parents: 67
diff changeset
691 make_pass_postreload (gcc::context *ctxt)
kono
parents: 67
diff changeset
692 {
kono
parents: 67
diff changeset
693 return new pass_postreload (ctxt);
kono
parents: 67
diff changeset
694 }
kono
parents: 67
diff changeset
695
kono
parents: 67
diff changeset
696 namespace {
kono
parents: 67
diff changeset
697
kono
parents: 67
diff changeset
698 const pass_data pass_data_late_compilation =
kono
parents: 67
diff changeset
699 {
kono
parents: 67
diff changeset
700 RTL_PASS, /* type */
kono
parents: 67
diff changeset
701 "*all-late_compilation", /* name */
kono
parents: 67
diff changeset
702 OPTGROUP_NONE, /* optinfo_flags */
kono
parents: 67
diff changeset
703 TV_LATE_COMPILATION, /* tv_id */
kono
parents: 67
diff changeset
704 PROP_rtl, /* properties_required */
kono
parents: 67
diff changeset
705 0, /* properties_provided */
kono
parents: 67
diff changeset
706 0, /* properties_destroyed */
kono
parents: 67
diff changeset
707 0, /* todo_flags_start */
kono
parents: 67
diff changeset
708 0, /* todo_flags_finish */
kono
parents: 67
diff changeset
709 };
kono
parents: 67
diff changeset
710
kono
parents: 67
diff changeset
711 class pass_late_compilation : public rtl_opt_pass
kono
parents: 67
diff changeset
712 {
kono
parents: 67
diff changeset
713 public:
kono
parents: 67
diff changeset
714 pass_late_compilation (gcc::context *ctxt)
kono
parents: 67
diff changeset
715 : rtl_opt_pass (pass_data_late_compilation, ctxt)
kono
parents: 67
diff changeset
716 {}
kono
parents: 67
diff changeset
717
kono
parents: 67
diff changeset
718 /* opt_pass methods: */
kono
parents: 67
diff changeset
719 virtual bool gate (function *)
kono
parents: 67
diff changeset
720 {
kono
parents: 67
diff changeset
721 return reload_completed || targetm.no_register_allocation;
kono
parents: 67
diff changeset
722 }
kono
parents: 67
diff changeset
723
kono
parents: 67
diff changeset
724 }; // class pass_late_compilation
kono
parents: 67
diff changeset
725
kono
parents: 67
diff changeset
726 } // anon namespace
kono
parents: 67
diff changeset
727
kono
parents: 67
diff changeset
728 static rtl_opt_pass *
kono
parents: 67
diff changeset
729 make_pass_late_compilation (gcc::context *ctxt)
kono
parents: 67
diff changeset
730 {
kono
parents: 67
diff changeset
731 return new pass_late_compilation (ctxt);
kono
parents: 67
diff changeset
732 }
kono
parents: 67
diff changeset
733
kono
parents: 67
diff changeset
734
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
735
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
736 /* Set the static pass number of pass PASS to ID and record that
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
737 in the mapping from static pass number to pass. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
738
111
kono
parents: 67
diff changeset
739 void
kono
parents: 67
diff changeset
740 pass_manager::
kono
parents: 67
diff changeset
741 set_pass_for_id (int id, opt_pass *pass)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
742 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
743 pass->static_pass_number = id;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
744 if (passes_by_id_size <= id)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
745 {
111
kono
parents: 67
diff changeset
746 passes_by_id = XRESIZEVEC (opt_pass *, passes_by_id, id + 1);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
747 memset (passes_by_id + passes_by_id_size, 0,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
748 (id + 1 - passes_by_id_size) * sizeof (void *));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
749 passes_by_id_size = id + 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
750 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
751 passes_by_id[id] = pass;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
752 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
753
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
754 /* Return the pass with the static pass number ID. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
755
111
kono
parents: 67
diff changeset
756 opt_pass *
kono
parents: 67
diff changeset
757 pass_manager::get_pass_for_id (int id) const
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
758 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
759 if (id >= passes_by_id_size)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
760 return NULL;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
761 return passes_by_id[id];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
762 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
763
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
764 /* Iterate over the pass tree allocating dump file numbers. We want
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
765 to do this depth first, and independent of whether the pass is
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
766 enabled or not. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
767
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
768 void
111
kono
parents: 67
diff changeset
769 register_one_dump_file (opt_pass *pass)
kono
parents: 67
diff changeset
770 {
kono
parents: 67
diff changeset
771 g->get_passes ()->register_one_dump_file (pass);
kono
parents: 67
diff changeset
772 }
kono
parents: 67
diff changeset
773
kono
parents: 67
diff changeset
774 void
kono
parents: 67
diff changeset
775 pass_manager::register_one_dump_file (opt_pass *pass)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
776 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
777 char *dot_name, *flag_name, *glob_name;
111
kono
parents: 67
diff changeset
778 const char *name, *full_name, *prefix;
kono
parents: 67
diff changeset
779
kono
parents: 67
diff changeset
780 /* Buffer big enough to format a 32-bit UINT_MAX into. */
kono
parents: 67
diff changeset
781 char num[11];
kono
parents: 67
diff changeset
782 dump_kind dkind;
kono
parents: 67
diff changeset
783 int id;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
784 optgroup_flags_t optgroup_flags = OPTGROUP_NONE;
111
kono
parents: 67
diff changeset
785 gcc::dump_manager *dumps = m_ctxt->get_dumps ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
786
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
787 /* See below in next_pass_1. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
788 num[0] = '\0';
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
789 if (pass->static_pass_number != -1)
111
kono
parents: 67
diff changeset
790 sprintf (num, "%u", ((int) pass->static_pass_number < 0
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
791 ? 1 : pass->static_pass_number));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
792
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
793 /* The name is both used to identify the pass for the purposes of plugins,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
794 and to specify dump file name and option.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
795 The latter two might want something short which is not quite unique; for
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
796 that reason, we may have a disambiguating prefix, followed by a space
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
797 to mark the start of the following dump file name / option string. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
798 name = strchr (pass->name, ' ');
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
799 name = name ? name + 1 : pass->name;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
800 dot_name = concat (".", name, num, NULL);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
801 if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS)
111
kono
parents: 67
diff changeset
802 {
kono
parents: 67
diff changeset
803 prefix = "ipa-";
kono
parents: 67
diff changeset
804 dkind = DK_ipa;
kono
parents: 67
diff changeset
805 optgroup_flags |= OPTGROUP_IPA;
kono
parents: 67
diff changeset
806 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
807 else if (pass->type == GIMPLE_PASS)
111
kono
parents: 67
diff changeset
808 {
kono
parents: 67
diff changeset
809 prefix = "tree-";
kono
parents: 67
diff changeset
810 dkind = DK_tree;
kono
parents: 67
diff changeset
811 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
812 else
111
kono
parents: 67
diff changeset
813 {
kono
parents: 67
diff changeset
814 prefix = "rtl-";
kono
parents: 67
diff changeset
815 dkind = DK_rtl;
kono
parents: 67
diff changeset
816 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
817
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
818 flag_name = concat (prefix, name, num, NULL);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
819 glob_name = concat (prefix, name, NULL);
111
kono
parents: 67
diff changeset
820 optgroup_flags |= pass->optinfo_flags;
kono
parents: 67
diff changeset
821 /* For any passes that do not have an optgroup set, and which are not
kono
parents: 67
diff changeset
822 IPA passes setup above, set the optgroup to OPTGROUP_OTHER so that
kono
parents: 67
diff changeset
823 any dump messages are emitted properly under -fopt-info(-optall). */
kono
parents: 67
diff changeset
824 if (optgroup_flags == OPTGROUP_NONE)
kono
parents: 67
diff changeset
825 optgroup_flags = OPTGROUP_OTHER;
kono
parents: 67
diff changeset
826 id = dumps->dump_register (dot_name, flag_name, glob_name, dkind,
kono
parents: 67
diff changeset
827 optgroup_flags,
kono
parents: 67
diff changeset
828 true);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
829 set_pass_for_id (id, pass);
111
kono
parents: 67
diff changeset
830 full_name = concat (prefix, pass->name, num, NULL);
kono
parents: 67
diff changeset
831 register_pass_name (pass, full_name);
kono
parents: 67
diff changeset
832 free (CONST_CAST (char *, full_name));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
833 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
834
111
kono
parents: 67
diff changeset
835 /* Register the dump files for the pass_manager starting at PASS. */
kono
parents: 67
diff changeset
836
kono
parents: 67
diff changeset
837 void
kono
parents: 67
diff changeset
838 pass_manager::register_dump_files (opt_pass *pass)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
839 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
840 do
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
841 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
842 if (pass->name && pass->name[0] != '*')
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
843 register_one_dump_file (pass);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
844
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
845 if (pass->sub)
111
kono
parents: 67
diff changeset
846 register_dump_files (pass->sub);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
847
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
848 pass = pass->next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
849 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
850 while (pass);
111
kono
parents: 67
diff changeset
851 }
kono
parents: 67
diff changeset
852
kono
parents: 67
diff changeset
853 /* Register PASS with NAME. */
kono
parents: 67
diff changeset
854
kono
parents: 67
diff changeset
855 void
kono
parents: 67
diff changeset
856 pass_manager::register_pass_name (opt_pass *pass, const char *name)
kono
parents: 67
diff changeset
857 {
kono
parents: 67
diff changeset
858 if (!m_name_to_pass_map)
kono
parents: 67
diff changeset
859 m_name_to_pass_map = new hash_map<nofree_string_hash, opt_pass *> (256);
kono
parents: 67
diff changeset
860
kono
parents: 67
diff changeset
861 if (m_name_to_pass_map->get (name))
kono
parents: 67
diff changeset
862 return; /* Ignore plugin passes. */
kono
parents: 67
diff changeset
863
kono
parents: 67
diff changeset
864 const char *unique_name = xstrdup (name);
kono
parents: 67
diff changeset
865 m_name_to_pass_map->put (unique_name, pass);
kono
parents: 67
diff changeset
866 }
kono
parents: 67
diff changeset
867
kono
parents: 67
diff changeset
868 /* Map from pass id to canonicalized pass name. */
kono
parents: 67
diff changeset
869
kono
parents: 67
diff changeset
870 typedef const char *char_ptr;
kono
parents: 67
diff changeset
871 static vec<char_ptr> pass_tab;
kono
parents: 67
diff changeset
872
kono
parents: 67
diff changeset
873 /* Callback function for traversing NAME_TO_PASS_MAP. */
kono
parents: 67
diff changeset
874
kono
parents: 67
diff changeset
875 bool
kono
parents: 67
diff changeset
876 passes_pass_traverse (const char *const &name, opt_pass *const &pass, void *)
kono
parents: 67
diff changeset
877 {
kono
parents: 67
diff changeset
878 gcc_assert (pass->static_pass_number > 0);
kono
parents: 67
diff changeset
879 gcc_assert (pass_tab.exists ());
kono
parents: 67
diff changeset
880
kono
parents: 67
diff changeset
881 pass_tab[pass->static_pass_number] = name;
kono
parents: 67
diff changeset
882
kono
parents: 67
diff changeset
883 return 1;
kono
parents: 67
diff changeset
884 }
kono
parents: 67
diff changeset
885
kono
parents: 67
diff changeset
886 /* The function traverses NAME_TO_PASS_MAP and creates a pass info
kono
parents: 67
diff changeset
887 table for dumping purpose. */
kono
parents: 67
diff changeset
888
kono
parents: 67
diff changeset
889 void
kono
parents: 67
diff changeset
890 pass_manager::create_pass_tab (void) const
kono
parents: 67
diff changeset
891 {
kono
parents: 67
diff changeset
892 if (!flag_dump_passes)
kono
parents: 67
diff changeset
893 return;
kono
parents: 67
diff changeset
894
kono
parents: 67
diff changeset
895 pass_tab.safe_grow_cleared (passes_by_id_size + 1);
kono
parents: 67
diff changeset
896 m_name_to_pass_map->traverse <void *, passes_pass_traverse> (NULL);
kono
parents: 67
diff changeset
897 }
kono
parents: 67
diff changeset
898
kono
parents: 67
diff changeset
899 static bool override_gate_status (opt_pass *, tree, bool);
kono
parents: 67
diff changeset
900
kono
parents: 67
diff changeset
901 /* Dump the instantiated name for PASS. IS_ON indicates if PASS
kono
parents: 67
diff changeset
902 is turned on or not. */
kono
parents: 67
diff changeset
903
kono
parents: 67
diff changeset
904 static void
kono
parents: 67
diff changeset
905 dump_one_pass (opt_pass *pass, int pass_indent)
kono
parents: 67
diff changeset
906 {
kono
parents: 67
diff changeset
907 int indent = 3 * pass_indent;
kono
parents: 67
diff changeset
908 const char *pn;
kono
parents: 67
diff changeset
909 bool is_on, is_really_on;
kono
parents: 67
diff changeset
910
kono
parents: 67
diff changeset
911 is_on = pass->gate (cfun);
kono
parents: 67
diff changeset
912 is_really_on = override_gate_status (pass, current_function_decl, is_on);
kono
parents: 67
diff changeset
913
kono
parents: 67
diff changeset
914 if (pass->static_pass_number <= 0)
kono
parents: 67
diff changeset
915 pn = pass->name;
kono
parents: 67
diff changeset
916 else
kono
parents: 67
diff changeset
917 pn = pass_tab[pass->static_pass_number];
kono
parents: 67
diff changeset
918
kono
parents: 67
diff changeset
919 fprintf (stderr, "%*s%-40s%*s:%s%s\n", indent, " ", pn,
kono
parents: 67
diff changeset
920 (15 - indent < 0 ? 0 : 15 - indent), " ",
kono
parents: 67
diff changeset
921 is_on ? " ON" : " OFF",
kono
parents: 67
diff changeset
922 ((!is_on) == (!is_really_on) ? ""
kono
parents: 67
diff changeset
923 : (is_really_on ? " (FORCED_ON)" : " (FORCED_OFF)")));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
924 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
925
111
kono
parents: 67
diff changeset
926 /* Dump pass list PASS with indentation INDENT. */
kono
parents: 67
diff changeset
927
kono
parents: 67
diff changeset
928 static void
kono
parents: 67
diff changeset
929 dump_pass_list (opt_pass *pass, int indent)
kono
parents: 67
diff changeset
930 {
kono
parents: 67
diff changeset
931 do
kono
parents: 67
diff changeset
932 {
kono
parents: 67
diff changeset
933 dump_one_pass (pass, indent);
kono
parents: 67
diff changeset
934 if (pass->sub)
kono
parents: 67
diff changeset
935 dump_pass_list (pass->sub, indent + 1);
kono
parents: 67
diff changeset
936 pass = pass->next;
kono
parents: 67
diff changeset
937 }
kono
parents: 67
diff changeset
938 while (pass);
kono
parents: 67
diff changeset
939 }
kono
parents: 67
diff changeset
940
kono
parents: 67
diff changeset
941 /* Dump all optimization passes. */
kono
parents: 67
diff changeset
942
kono
parents: 67
diff changeset
943 void
kono
parents: 67
diff changeset
944 dump_passes (void)
kono
parents: 67
diff changeset
945 {
kono
parents: 67
diff changeset
946 g->get_passes ()->dump_passes ();
kono
parents: 67
diff changeset
947 }
kono
parents: 67
diff changeset
948
kono
parents: 67
diff changeset
949 void
kono
parents: 67
diff changeset
950 pass_manager::dump_passes () const
kono
parents: 67
diff changeset
951 {
kono
parents: 67
diff changeset
952 push_dummy_function (true);
kono
parents: 67
diff changeset
953
kono
parents: 67
diff changeset
954 create_pass_tab ();
kono
parents: 67
diff changeset
955
kono
parents: 67
diff changeset
956 dump_pass_list (all_lowering_passes, 1);
kono
parents: 67
diff changeset
957 dump_pass_list (all_small_ipa_passes, 1);
kono
parents: 67
diff changeset
958 dump_pass_list (all_regular_ipa_passes, 1);
kono
parents: 67
diff changeset
959 dump_pass_list (all_late_ipa_passes, 1);
kono
parents: 67
diff changeset
960 dump_pass_list (all_passes, 1);
kono
parents: 67
diff changeset
961
kono
parents: 67
diff changeset
962 pop_dummy_function ();
kono
parents: 67
diff changeset
963 }
kono
parents: 67
diff changeset
964
kono
parents: 67
diff changeset
965 /* Returns the pass with NAME. */
kono
parents: 67
diff changeset
966
kono
parents: 67
diff changeset
967 opt_pass *
kono
parents: 67
diff changeset
968 pass_manager::get_pass_by_name (const char *name)
kono
parents: 67
diff changeset
969 {
kono
parents: 67
diff changeset
970 opt_pass **p = m_name_to_pass_map->get (name);
kono
parents: 67
diff changeset
971 if (p)
kono
parents: 67
diff changeset
972 return *p;
kono
parents: 67
diff changeset
973
kono
parents: 67
diff changeset
974 return NULL;
kono
parents: 67
diff changeset
975 }
kono
parents: 67
diff changeset
976
kono
parents: 67
diff changeset
977
kono
parents: 67
diff changeset
978 /* Range [start, last]. */
kono
parents: 67
diff changeset
979
kono
parents: 67
diff changeset
980 struct uid_range
kono
parents: 67
diff changeset
981 {
kono
parents: 67
diff changeset
982 unsigned int start;
kono
parents: 67
diff changeset
983 unsigned int last;
kono
parents: 67
diff changeset
984 const char *assem_name;
kono
parents: 67
diff changeset
985 struct uid_range *next;
kono
parents: 67
diff changeset
986 };
kono
parents: 67
diff changeset
987
kono
parents: 67
diff changeset
988 typedef struct uid_range *uid_range_p;
kono
parents: 67
diff changeset
989
kono
parents: 67
diff changeset
990
kono
parents: 67
diff changeset
991 static vec<uid_range_p> enabled_pass_uid_range_tab;
kono
parents: 67
diff changeset
992 static vec<uid_range_p> disabled_pass_uid_range_tab;
kono
parents: 67
diff changeset
993
kono
parents: 67
diff changeset
994
kono
parents: 67
diff changeset
995 /* Parse option string for -fdisable- and -fenable-
kono
parents: 67
diff changeset
996 The syntax of the options:
kono
parents: 67
diff changeset
997
kono
parents: 67
diff changeset
998 -fenable-<pass_name>
kono
parents: 67
diff changeset
999 -fdisable-<pass_name>
kono
parents: 67
diff changeset
1000
kono
parents: 67
diff changeset
1001 -fenable-<pass_name>=s1:e1,s2:e2,...
kono
parents: 67
diff changeset
1002 -fdisable-<pass_name>=s1:e1,s2:e2,...
kono
parents: 67
diff changeset
1003 */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1004
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1005 static void
111
kono
parents: 67
diff changeset
1006 enable_disable_pass (const char *arg, bool is_enable)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1007 {
111
kono
parents: 67
diff changeset
1008 opt_pass *pass;
kono
parents: 67
diff changeset
1009 char *range_str, *phase_name;
kono
parents: 67
diff changeset
1010 char *argstr = xstrdup (arg);
kono
parents: 67
diff changeset
1011 vec<uid_range_p> *tab = 0;
kono
parents: 67
diff changeset
1012
kono
parents: 67
diff changeset
1013 range_str = strchr (argstr,'=');
kono
parents: 67
diff changeset
1014 if (range_str)
kono
parents: 67
diff changeset
1015 {
kono
parents: 67
diff changeset
1016 *range_str = '\0';
kono
parents: 67
diff changeset
1017 range_str++;
kono
parents: 67
diff changeset
1018 }
kono
parents: 67
diff changeset
1019
kono
parents: 67
diff changeset
1020 phase_name = argstr;
kono
parents: 67
diff changeset
1021 if (!*phase_name)
kono
parents: 67
diff changeset
1022 {
kono
parents: 67
diff changeset
1023 if (is_enable)
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1024 error ("unrecognized option %<-fenable%>");
111
kono
parents: 67
diff changeset
1025 else
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1026 error ("unrecognized option %<-fdisable%>");
111
kono
parents: 67
diff changeset
1027 free (argstr);
kono
parents: 67
diff changeset
1028 return;
kono
parents: 67
diff changeset
1029 }
kono
parents: 67
diff changeset
1030 pass = g->get_passes ()->get_pass_by_name (phase_name);
kono
parents: 67
diff changeset
1031 if (!pass || pass->static_pass_number == -1)
kono
parents: 67
diff changeset
1032 {
kono
parents: 67
diff changeset
1033 if (is_enable)
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1034 error ("unknown pass %s specified in %<-fenable%>", phase_name);
111
kono
parents: 67
diff changeset
1035 else
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1036 error ("unknown pass %s specified in %<-fdisable%>", phase_name);
111
kono
parents: 67
diff changeset
1037 free (argstr);
kono
parents: 67
diff changeset
1038 return;
kono
parents: 67
diff changeset
1039 }
kono
parents: 67
diff changeset
1040
kono
parents: 67
diff changeset
1041 if (is_enable)
kono
parents: 67
diff changeset
1042 tab = &enabled_pass_uid_range_tab;
kono
parents: 67
diff changeset
1043 else
kono
parents: 67
diff changeset
1044 tab = &disabled_pass_uid_range_tab;
kono
parents: 67
diff changeset
1045
kono
parents: 67
diff changeset
1046 if ((unsigned) pass->static_pass_number >= tab->length ())
kono
parents: 67
diff changeset
1047 tab->safe_grow_cleared (pass->static_pass_number + 1);
kono
parents: 67
diff changeset
1048
kono
parents: 67
diff changeset
1049 if (!range_str)
kono
parents: 67
diff changeset
1050 {
kono
parents: 67
diff changeset
1051 uid_range_p slot;
kono
parents: 67
diff changeset
1052 uid_range_p new_range = XCNEW (struct uid_range);
kono
parents: 67
diff changeset
1053
kono
parents: 67
diff changeset
1054 new_range->start = 0;
kono
parents: 67
diff changeset
1055 new_range->last = (unsigned)-1;
kono
parents: 67
diff changeset
1056
kono
parents: 67
diff changeset
1057 slot = (*tab)[pass->static_pass_number];
kono
parents: 67
diff changeset
1058 new_range->next = slot;
kono
parents: 67
diff changeset
1059 (*tab)[pass->static_pass_number] = new_range;
kono
parents: 67
diff changeset
1060 if (is_enable)
kono
parents: 67
diff changeset
1061 inform (UNKNOWN_LOCATION, "enable pass %s for functions in the range "
kono
parents: 67
diff changeset
1062 "of [%u, %u]", phase_name, new_range->start, new_range->last);
kono
parents: 67
diff changeset
1063 else
kono
parents: 67
diff changeset
1064 inform (UNKNOWN_LOCATION, "disable pass %s for functions in the range "
kono
parents: 67
diff changeset
1065 "of [%u, %u]", phase_name, new_range->start, new_range->last);
kono
parents: 67
diff changeset
1066 }
kono
parents: 67
diff changeset
1067 else
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1068 {
111
kono
parents: 67
diff changeset
1069 char *next_range = NULL;
kono
parents: 67
diff changeset
1070 char *one_range = range_str;
kono
parents: 67
diff changeset
1071 char *end_val = NULL;
kono
parents: 67
diff changeset
1072
kono
parents: 67
diff changeset
1073 do
kono
parents: 67
diff changeset
1074 {
kono
parents: 67
diff changeset
1075 uid_range_p slot;
kono
parents: 67
diff changeset
1076 uid_range_p new_range;
kono
parents: 67
diff changeset
1077 char *invalid = NULL;
kono
parents: 67
diff changeset
1078 long start;
kono
parents: 67
diff changeset
1079 char *func_name = NULL;
kono
parents: 67
diff changeset
1080
kono
parents: 67
diff changeset
1081 next_range = strchr (one_range, ',');
kono
parents: 67
diff changeset
1082 if (next_range)
kono
parents: 67
diff changeset
1083 {
kono
parents: 67
diff changeset
1084 *next_range = '\0';
kono
parents: 67
diff changeset
1085 next_range++;
kono
parents: 67
diff changeset
1086 }
kono
parents: 67
diff changeset
1087
kono
parents: 67
diff changeset
1088 end_val = strchr (one_range, ':');
kono
parents: 67
diff changeset
1089 if (end_val)
kono
parents: 67
diff changeset
1090 {
kono
parents: 67
diff changeset
1091 *end_val = '\0';
kono
parents: 67
diff changeset
1092 end_val++;
kono
parents: 67
diff changeset
1093 }
kono
parents: 67
diff changeset
1094 start = strtol (one_range, &invalid, 10);
kono
parents: 67
diff changeset
1095 if (*invalid || start < 0)
kono
parents: 67
diff changeset
1096 {
kono
parents: 67
diff changeset
1097 if (end_val || (one_range[0] >= '0'
kono
parents: 67
diff changeset
1098 && one_range[0] <= '9'))
kono
parents: 67
diff changeset
1099 {
kono
parents: 67
diff changeset
1100 error ("Invalid range %s in option %s",
kono
parents: 67
diff changeset
1101 one_range,
kono
parents: 67
diff changeset
1102 is_enable ? "-fenable" : "-fdisable");
kono
parents: 67
diff changeset
1103 free (argstr);
kono
parents: 67
diff changeset
1104 return;
kono
parents: 67
diff changeset
1105 }
kono
parents: 67
diff changeset
1106 func_name = one_range;
kono
parents: 67
diff changeset
1107 }
kono
parents: 67
diff changeset
1108 if (!end_val)
kono
parents: 67
diff changeset
1109 {
kono
parents: 67
diff changeset
1110 new_range = XCNEW (struct uid_range);
kono
parents: 67
diff changeset
1111 if (!func_name)
kono
parents: 67
diff changeset
1112 {
kono
parents: 67
diff changeset
1113 new_range->start = (unsigned) start;
kono
parents: 67
diff changeset
1114 new_range->last = (unsigned) start;
kono
parents: 67
diff changeset
1115 }
kono
parents: 67
diff changeset
1116 else
kono
parents: 67
diff changeset
1117 {
kono
parents: 67
diff changeset
1118 new_range->start = (unsigned) -1;
kono
parents: 67
diff changeset
1119 new_range->last = (unsigned) -1;
kono
parents: 67
diff changeset
1120 new_range->assem_name = xstrdup (func_name);
kono
parents: 67
diff changeset
1121 }
kono
parents: 67
diff changeset
1122 }
kono
parents: 67
diff changeset
1123 else
kono
parents: 67
diff changeset
1124 {
kono
parents: 67
diff changeset
1125 long last = strtol (end_val, &invalid, 10);
kono
parents: 67
diff changeset
1126 if (*invalid || last < start)
kono
parents: 67
diff changeset
1127 {
kono
parents: 67
diff changeset
1128 error ("Invalid range %s in option %s",
kono
parents: 67
diff changeset
1129 end_val,
kono
parents: 67
diff changeset
1130 is_enable ? "-fenable" : "-fdisable");
kono
parents: 67
diff changeset
1131 free (argstr);
kono
parents: 67
diff changeset
1132 return;
kono
parents: 67
diff changeset
1133 }
kono
parents: 67
diff changeset
1134 new_range = XCNEW (struct uid_range);
kono
parents: 67
diff changeset
1135 new_range->start = (unsigned) start;
kono
parents: 67
diff changeset
1136 new_range->last = (unsigned) last;
kono
parents: 67
diff changeset
1137 }
kono
parents: 67
diff changeset
1138
kono
parents: 67
diff changeset
1139 slot = (*tab)[pass->static_pass_number];
kono
parents: 67
diff changeset
1140 new_range->next = slot;
kono
parents: 67
diff changeset
1141 (*tab)[pass->static_pass_number] = new_range;
kono
parents: 67
diff changeset
1142 if (is_enable)
kono
parents: 67
diff changeset
1143 {
kono
parents: 67
diff changeset
1144 if (new_range->assem_name)
kono
parents: 67
diff changeset
1145 inform (UNKNOWN_LOCATION,
kono
parents: 67
diff changeset
1146 "enable pass %s for function %s",
kono
parents: 67
diff changeset
1147 phase_name, new_range->assem_name);
kono
parents: 67
diff changeset
1148 else
kono
parents: 67
diff changeset
1149 inform (UNKNOWN_LOCATION,
kono
parents: 67
diff changeset
1150 "enable pass %s for functions in the range of [%u, %u]",
kono
parents: 67
diff changeset
1151 phase_name, new_range->start, new_range->last);
kono
parents: 67
diff changeset
1152 }
kono
parents: 67
diff changeset
1153 else
kono
parents: 67
diff changeset
1154 {
kono
parents: 67
diff changeset
1155 if (new_range->assem_name)
kono
parents: 67
diff changeset
1156 inform (UNKNOWN_LOCATION,
kono
parents: 67
diff changeset
1157 "disable pass %s for function %s",
kono
parents: 67
diff changeset
1158 phase_name, new_range->assem_name);
kono
parents: 67
diff changeset
1159 else
kono
parents: 67
diff changeset
1160 inform (UNKNOWN_LOCATION,
kono
parents: 67
diff changeset
1161 "disable pass %s for functions in the range of [%u, %u]",
kono
parents: 67
diff changeset
1162 phase_name, new_range->start, new_range->last);
kono
parents: 67
diff changeset
1163 }
kono
parents: 67
diff changeset
1164
kono
parents: 67
diff changeset
1165 one_range = next_range;
kono
parents: 67
diff changeset
1166 } while (next_range);
kono
parents: 67
diff changeset
1167 }
kono
parents: 67
diff changeset
1168
kono
parents: 67
diff changeset
1169 free (argstr);
kono
parents: 67
diff changeset
1170 }
kono
parents: 67
diff changeset
1171
kono
parents: 67
diff changeset
1172 /* Enable pass specified by ARG. */
kono
parents: 67
diff changeset
1173
kono
parents: 67
diff changeset
1174 void
kono
parents: 67
diff changeset
1175 enable_pass (const char *arg)
kono
parents: 67
diff changeset
1176 {
kono
parents: 67
diff changeset
1177 enable_disable_pass (arg, true);
kono
parents: 67
diff changeset
1178 }
kono
parents: 67
diff changeset
1179
kono
parents: 67
diff changeset
1180 /* Disable pass specified by ARG. */
kono
parents: 67
diff changeset
1181
kono
parents: 67
diff changeset
1182 void
kono
parents: 67
diff changeset
1183 disable_pass (const char *arg)
kono
parents: 67
diff changeset
1184 {
kono
parents: 67
diff changeset
1185 enable_disable_pass (arg, false);
kono
parents: 67
diff changeset
1186 }
kono
parents: 67
diff changeset
1187
kono
parents: 67
diff changeset
1188 /* Returns true if PASS is explicitly enabled/disabled for FUNC. */
kono
parents: 67
diff changeset
1189
kono
parents: 67
diff changeset
1190 static bool
kono
parents: 67
diff changeset
1191 is_pass_explicitly_enabled_or_disabled (opt_pass *pass,
kono
parents: 67
diff changeset
1192 tree func,
kono
parents: 67
diff changeset
1193 vec<uid_range_p> tab)
kono
parents: 67
diff changeset
1194 {
kono
parents: 67
diff changeset
1195 uid_range_p slot, range;
kono
parents: 67
diff changeset
1196 int cgraph_uid;
kono
parents: 67
diff changeset
1197 const char *aname = NULL;
kono
parents: 67
diff changeset
1198
kono
parents: 67
diff changeset
1199 if (!tab.exists ()
kono
parents: 67
diff changeset
1200 || (unsigned) pass->static_pass_number >= tab.length ()
kono
parents: 67
diff changeset
1201 || pass->static_pass_number == -1)
kono
parents: 67
diff changeset
1202 return false;
kono
parents: 67
diff changeset
1203
kono
parents: 67
diff changeset
1204 slot = tab[pass->static_pass_number];
kono
parents: 67
diff changeset
1205 if (!slot)
kono
parents: 67
diff changeset
1206 return false;
kono
parents: 67
diff changeset
1207
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1208 cgraph_uid = func ? cgraph_node::get (func)->get_uid () : 0;
111
kono
parents: 67
diff changeset
1209 if (func && DECL_ASSEMBLER_NAME_SET_P (func))
kono
parents: 67
diff changeset
1210 aname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (func));
kono
parents: 67
diff changeset
1211
kono
parents: 67
diff changeset
1212 range = slot;
kono
parents: 67
diff changeset
1213 while (range)
kono
parents: 67
diff changeset
1214 {
kono
parents: 67
diff changeset
1215 if ((unsigned) cgraph_uid >= range->start
kono
parents: 67
diff changeset
1216 && (unsigned) cgraph_uid <= range->last)
kono
parents: 67
diff changeset
1217 return true;
kono
parents: 67
diff changeset
1218 if (range->assem_name && aname
kono
parents: 67
diff changeset
1219 && !strcmp (range->assem_name, aname))
kono
parents: 67
diff changeset
1220 return true;
kono
parents: 67
diff changeset
1221 range = range->next;
kono
parents: 67
diff changeset
1222 }
kono
parents: 67
diff changeset
1223
kono
parents: 67
diff changeset
1224 return false;
kono
parents: 67
diff changeset
1225 }
kono
parents: 67
diff changeset
1226
kono
parents: 67
diff changeset
1227
kono
parents: 67
diff changeset
1228 /* Update static_pass_number for passes (and the flag
kono
parents: 67
diff changeset
1229 TODO_mark_first_instance).
kono
parents: 67
diff changeset
1230
kono
parents: 67
diff changeset
1231 Passes are constructed with static_pass_number preinitialized to 0
kono
parents: 67
diff changeset
1232
kono
parents: 67
diff changeset
1233 This field is used in two different ways: initially as instance numbers
kono
parents: 67
diff changeset
1234 of their kind, and then as ids within the entire pass manager.
kono
parents: 67
diff changeset
1235
kono
parents: 67
diff changeset
1236 Within pass_manager::pass_manager:
kono
parents: 67
diff changeset
1237
kono
parents: 67
diff changeset
1238 * In add_pass_instance(), as called by next_pass_1 in
kono
parents: 67
diff changeset
1239 NEXT_PASS in init_optimization_passes
kono
parents: 67
diff changeset
1240
kono
parents: 67
diff changeset
1241 * When the initial instance of a pass within a pass manager is seen,
kono
parents: 67
diff changeset
1242 it is flagged, and its static_pass_number is set to -1
kono
parents: 67
diff changeset
1243
kono
parents: 67
diff changeset
1244 * On subsequent times that it is seen, the static pass number
kono
parents: 67
diff changeset
1245 is decremented each time, so that if there are e.g. 4 dups,
kono
parents: 67
diff changeset
1246 they have static_pass_number -4, 2, 3, 4 respectively (note
kono
parents: 67
diff changeset
1247 how the initial one is negative and gives the count); these
kono
parents: 67
diff changeset
1248 can be thought of as instance numbers of the specific pass
kono
parents: 67
diff changeset
1249
kono
parents: 67
diff changeset
1250 * Within the register_dump_files () traversal, set_pass_for_id()
kono
parents: 67
diff changeset
1251 is called on each pass, using these instance numbers to create
kono
parents: 67
diff changeset
1252 dumpfile switches, and then overwriting them with a pass id,
kono
parents: 67
diff changeset
1253 which are global to the whole pass manager (based on
kono
parents: 67
diff changeset
1254 (TDI_end + current value of extra_dump_files_in_use) ) */
kono
parents: 67
diff changeset
1255
kono
parents: 67
diff changeset
1256 static void
kono
parents: 67
diff changeset
1257 add_pass_instance (opt_pass *new_pass, bool track_duplicates,
kono
parents: 67
diff changeset
1258 opt_pass *initial_pass)
kono
parents: 67
diff changeset
1259 {
kono
parents: 67
diff changeset
1260 /* Are we dealing with the first pass of its kind, or a clone? */
kono
parents: 67
diff changeset
1261 if (new_pass != initial_pass)
kono
parents: 67
diff changeset
1262 {
kono
parents: 67
diff changeset
1263 /* We're dealing with a clone. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1264 new_pass->todo_flags_start &= ~TODO_mark_first_instance;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1265
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1266 /* Indicate to register_dump_files that this pass has duplicates,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1267 and so it should rename the dump file. The first instance will
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1268 be -1, and be number of duplicates = -static_pass_number - 1.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1269 Subsequent instances will be > 0 and just the duplicate number. */
111
kono
parents: 67
diff changeset
1270 if ((new_pass->name && new_pass->name[0] != '*') || track_duplicates)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1271 {
111
kono
parents: 67
diff changeset
1272 initial_pass->static_pass_number -= 1;
kono
parents: 67
diff changeset
1273 new_pass->static_pass_number = -initial_pass->static_pass_number;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1274 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1275 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1276 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1277 {
111
kono
parents: 67
diff changeset
1278 /* We're dealing with the first pass of its kind. */
kono
parents: 67
diff changeset
1279 new_pass->todo_flags_start |= TODO_mark_first_instance;
kono
parents: 67
diff changeset
1280 new_pass->static_pass_number = -1;
kono
parents: 67
diff changeset
1281
kono
parents: 67
diff changeset
1282 invoke_plugin_callbacks (PLUGIN_NEW_PASS, new_pass);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1283 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1284 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1285
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1286 /* Add a pass to the pass list. Duplicate the pass if it's already
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1287 in the list. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1288
111
kono
parents: 67
diff changeset
1289 static opt_pass **
kono
parents: 67
diff changeset
1290 next_pass_1 (opt_pass **list, opt_pass *pass, opt_pass *initial_pass)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1291 {
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1292 /* Every pass should have a name so that plugins can refer to them. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1293 gcc_assert (pass->name != NULL);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1294
111
kono
parents: 67
diff changeset
1295 add_pass_instance (pass, false, initial_pass);
kono
parents: 67
diff changeset
1296 *list = pass;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1297
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1298 return &(*list)->next;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1299 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1300
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1301 /* List node for an inserted pass instance. We need to keep track of all
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1302 the newly-added pass instances (with 'added_pass_nodes' defined below)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1303 so that we can register their dump files after pass-positioning is finished.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1304 Registering dumping files needs to be post-processed or the
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1305 static_pass_number of the opt_pass object would be modified and mess up
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1306 the dump file names of future pass instances to be added. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1307
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1308 struct pass_list_node
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1309 {
111
kono
parents: 67
diff changeset
1310 opt_pass *pass;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1311 struct pass_list_node *next;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1312 };
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1313
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1314 static struct pass_list_node *added_pass_nodes = NULL;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1315 static struct pass_list_node *prev_added_pass_node;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1316
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1317 /* Insert the pass at the proper position. Return true if the pass
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1318 is successfully added.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1319
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1320 NEW_PASS_INFO - new pass to be inserted
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1321 PASS_LIST - root of the pass list to insert the new pass to */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1322
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1323 static bool
111
kono
parents: 67
diff changeset
1324 position_pass (struct register_pass_info *new_pass_info, opt_pass **pass_list)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1325 {
111
kono
parents: 67
diff changeset
1326 opt_pass *pass = *pass_list, *prev_pass = NULL;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1327 bool success = false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1328
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1329 for ( ; pass; prev_pass = pass, pass = pass->next)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1330 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1331 /* Check if the current pass is of the same type as the new pass and
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1332 matches the name and the instance number of the reference pass. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1333 if (pass->type == new_pass_info->pass->type
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1334 && pass->name
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1335 && !strcmp (pass->name, new_pass_info->reference_pass_name)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1336 && ((new_pass_info->ref_pass_instance_number == 0)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1337 || (new_pass_info->ref_pass_instance_number ==
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1338 pass->static_pass_number)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1339 || (new_pass_info->ref_pass_instance_number == 1
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1340 && pass->todo_flags_start & TODO_mark_first_instance)))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1341 {
111
kono
parents: 67
diff changeset
1342 opt_pass *new_pass;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1343 struct pass_list_node *new_pass_node;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1344
111
kono
parents: 67
diff changeset
1345 if (new_pass_info->ref_pass_instance_number == 0)
kono
parents: 67
diff changeset
1346 {
kono
parents: 67
diff changeset
1347 new_pass = new_pass_info->pass->clone ();
kono
parents: 67
diff changeset
1348 add_pass_instance (new_pass, true, new_pass_info->pass);
kono
parents: 67
diff changeset
1349 }
kono
parents: 67
diff changeset
1350 else
kono
parents: 67
diff changeset
1351 {
kono
parents: 67
diff changeset
1352 new_pass = new_pass_info->pass;
kono
parents: 67
diff changeset
1353 add_pass_instance (new_pass, true, new_pass);
kono
parents: 67
diff changeset
1354 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1355
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1356 /* Insert the new pass instance based on the positioning op. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1357 switch (new_pass_info->pos_op)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1358 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1359 case PASS_POS_INSERT_AFTER:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1360 new_pass->next = pass->next;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1361 pass->next = new_pass;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1362
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1363 /* Skip newly inserted pass to avoid repeated
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1364 insertions in the case where the new pass and the
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1365 existing one have the same name. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1366 pass = new_pass;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1367 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1368 case PASS_POS_INSERT_BEFORE:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1369 new_pass->next = pass;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1370 if (prev_pass)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1371 prev_pass->next = new_pass;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1372 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1373 *pass_list = new_pass;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1374 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1375 case PASS_POS_REPLACE:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1376 new_pass->next = pass->next;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1377 if (prev_pass)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1378 prev_pass->next = new_pass;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1379 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1380 *pass_list = new_pass;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1381 new_pass->sub = pass->sub;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1382 new_pass->tv_id = pass->tv_id;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1383 pass = new_pass;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1384 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1385 default:
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1386 error ("invalid pass positioning operation");
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1387 return false;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1388 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1389
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1390 /* Save the newly added pass (instance) in the added_pass_nodes
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1391 list so that we can register its dump file later. Note that
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1392 we cannot register the dump file now because doing so will modify
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1393 the static_pass_number of the opt_pass object and therefore
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1394 mess up the dump file name of future instances. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1395 new_pass_node = XCNEW (struct pass_list_node);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1396 new_pass_node->pass = new_pass;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1397 if (!added_pass_nodes)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1398 added_pass_nodes = new_pass_node;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1399 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1400 prev_added_pass_node->next = new_pass_node;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1401 prev_added_pass_node = new_pass_node;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1402
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1403 success = true;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1404 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1405
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1406 if (pass->sub && position_pass (new_pass_info, &pass->sub))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1407 success = true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1408 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1409
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1410 return success;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1411 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1412
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1413 /* Hooks a new pass into the pass lists.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1414
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1415 PASS_INFO - pass information that specifies the opt_pass object,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1416 reference pass, instance number, and how to position
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1417 the pass */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1418
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1419 void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1420 register_pass (struct register_pass_info *pass_info)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1421 {
111
kono
parents: 67
diff changeset
1422 g->get_passes ()->register_pass (pass_info);
kono
parents: 67
diff changeset
1423 }
kono
parents: 67
diff changeset
1424
kono
parents: 67
diff changeset
1425 void
kono
parents: 67
diff changeset
1426 register_pass (opt_pass* pass, pass_positioning_ops pos,
kono
parents: 67
diff changeset
1427 const char* ref_pass_name, int ref_pass_inst_number)
kono
parents: 67
diff changeset
1428 {
kono
parents: 67
diff changeset
1429 register_pass_info i;
kono
parents: 67
diff changeset
1430 i.pass = pass;
kono
parents: 67
diff changeset
1431 i.reference_pass_name = ref_pass_name;
kono
parents: 67
diff changeset
1432 i.ref_pass_instance_number = ref_pass_inst_number;
kono
parents: 67
diff changeset
1433 i.pos_op = pos;
kono
parents: 67
diff changeset
1434
kono
parents: 67
diff changeset
1435 g->get_passes ()->register_pass (&i);
kono
parents: 67
diff changeset
1436 }
kono
parents: 67
diff changeset
1437
kono
parents: 67
diff changeset
1438 void
kono
parents: 67
diff changeset
1439 pass_manager::register_pass (struct register_pass_info *pass_info)
kono
parents: 67
diff changeset
1440 {
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1441 bool all_instances, success;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1442
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1443 /* The checks below could fail in buggy plugins. Existing GCC
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1444 passes should never fail these checks, so we mention plugin in
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1445 the messages. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1446 if (!pass_info->pass)
111
kono
parents: 67
diff changeset
1447 fatal_error (input_location, "plugin cannot register a missing pass");
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1448
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1449 if (!pass_info->pass->name)
111
kono
parents: 67
diff changeset
1450 fatal_error (input_location, "plugin cannot register an unnamed pass");
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1451
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1452 if (!pass_info->reference_pass_name)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1453 fatal_error
111
kono
parents: 67
diff changeset
1454 (input_location,
kono
parents: 67
diff changeset
1455 "plugin cannot register pass %qs without reference pass name",
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1456 pass_info->pass->name);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1457
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1458 /* Try to insert the new pass to the pass lists. We need to check
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1459 all five lists as the reference pass could be in one (or all) of
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1460 them. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1461 all_instances = pass_info->ref_pass_instance_number == 0;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1462 success = position_pass (pass_info, &all_lowering_passes);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1463 if (!success || all_instances)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1464 success |= position_pass (pass_info, &all_small_ipa_passes);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1465 if (!success || all_instances)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1466 success |= position_pass (pass_info, &all_regular_ipa_passes);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1467 if (!success || all_instances)
111
kono
parents: 67
diff changeset
1468 success |= position_pass (pass_info, &all_late_ipa_passes);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1469 if (!success || all_instances)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1470 success |= position_pass (pass_info, &all_passes);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1471 if (!success)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1472 fatal_error
111
kono
parents: 67
diff changeset
1473 (input_location,
kono
parents: 67
diff changeset
1474 "pass %qs not found but is referenced by new pass %qs",
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1475 pass_info->reference_pass_name, pass_info->pass->name);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1476
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1477 /* OK, we have successfully inserted the new pass. We need to register
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1478 the dump files for the newly added pass and its duplicates (if any).
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1479 While doing so, we also delete the pass_list_node
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1480 objects created during pass positioning. */
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1481 gcc::dump_manager *dumps = m_ctxt->get_dumps ();
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1482 while (added_pass_nodes)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1483 {
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1484 struct pass_list_node *next_node = added_pass_nodes->next;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1485
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1486 /* Handle -fdump-* and -fopt-info. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1487 dumps->register_pass (added_pass_nodes->pass);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1488
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1489 XDELETE (added_pass_nodes);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1490 added_pass_nodes = next_node;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1491 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1492 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1493
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1494 /* Construct the pass tree. The sequencing of passes is driven by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1495 the cgraph routines:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1496
111
kono
parents: 67
diff changeset
1497 finalize_compilation_unit ()
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1498 for each node N in the cgraph
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1499 cgraph_analyze_function (N)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1500 cgraph_lower_function (N) -> all_lowering_passes
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1501
111
kono
parents: 67
diff changeset
1502 If we are optimizing, compile is then invoked:
kono
parents: 67
diff changeset
1503
kono
parents: 67
diff changeset
1504 compile ()
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1505 ipa_passes () -> all_small_ipa_passes
111
kono
parents: 67
diff changeset
1506 -> Analysis of all_regular_ipa_passes
kono
parents: 67
diff changeset
1507 * possible LTO streaming at copmilation time *
kono
parents: 67
diff changeset
1508 -> Execution of all_regular_ipa_passes
kono
parents: 67
diff changeset
1509 * possible LTO streaming at link time *
kono
parents: 67
diff changeset
1510 -> all_late_ipa_passes
kono
parents: 67
diff changeset
1511 expand_all_functions ()
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1512 for each node N in the cgraph
111
kono
parents: 67
diff changeset
1513 expand_function (N) -> Transformation of all_regular_ipa_passes
kono
parents: 67
diff changeset
1514 -> all_passes
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1515 */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1516
111
kono
parents: 67
diff changeset
1517 pass_manager::pass_manager (context *ctxt)
kono
parents: 67
diff changeset
1518 : all_passes (NULL), all_small_ipa_passes (NULL), all_lowering_passes (NULL),
kono
parents: 67
diff changeset
1519 all_regular_ipa_passes (NULL),
kono
parents: 67
diff changeset
1520 all_late_ipa_passes (NULL), passes_by_id (NULL), passes_by_id_size (0),
kono
parents: 67
diff changeset
1521 m_ctxt (ctxt), m_name_to_pass_map (NULL)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1522 {
111
kono
parents: 67
diff changeset
1523 opt_pass **p;
kono
parents: 67
diff changeset
1524
kono
parents: 67
diff changeset
1525 /* Zero-initialize pass members. */
kono
parents: 67
diff changeset
1526 #define INSERT_PASSES_AFTER(PASS)
kono
parents: 67
diff changeset
1527 #define PUSH_INSERT_PASSES_WITHIN(PASS)
kono
parents: 67
diff changeset
1528 #define POP_INSERT_PASSES()
kono
parents: 67
diff changeset
1529 #define NEXT_PASS(PASS, NUM) PASS ## _ ## NUM = NULL
kono
parents: 67
diff changeset
1530 #define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM)
kono
parents: 67
diff changeset
1531 #define TERMINATE_PASS_LIST(PASS)
kono
parents: 67
diff changeset
1532 #include "pass-instances.def"
kono
parents: 67
diff changeset
1533 #undef INSERT_PASSES_AFTER
kono
parents: 67
diff changeset
1534 #undef PUSH_INSERT_PASSES_WITHIN
kono
parents: 67
diff changeset
1535 #undef POP_INSERT_PASSES
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1536 #undef NEXT_PASS
111
kono
parents: 67
diff changeset
1537 #undef NEXT_PASS_WITH_ARG
kono
parents: 67
diff changeset
1538 #undef TERMINATE_PASS_LIST
kono
parents: 67
diff changeset
1539
kono
parents: 67
diff changeset
1540 /* Initialize the pass_lists array. */
kono
parents: 67
diff changeset
1541 #define DEF_PASS_LIST(LIST) pass_lists[PASS_LIST_NO_##LIST] = &LIST;
kono
parents: 67
diff changeset
1542 GCC_PASS_LISTS
kono
parents: 67
diff changeset
1543 #undef DEF_PASS_LIST
kono
parents: 67
diff changeset
1544
kono
parents: 67
diff changeset
1545 /* Build the tree of passes. */
kono
parents: 67
diff changeset
1546
kono
parents: 67
diff changeset
1547 #define INSERT_PASSES_AFTER(PASS) \
kono
parents: 67
diff changeset
1548 { \
kono
parents: 67
diff changeset
1549 opt_pass **p_start; \
kono
parents: 67
diff changeset
1550 p_start = p = &(PASS);
kono
parents: 67
diff changeset
1551
kono
parents: 67
diff changeset
1552 #define TERMINATE_PASS_LIST(PASS) \
kono
parents: 67
diff changeset
1553 gcc_assert (p_start == &PASS); \
kono
parents: 67
diff changeset
1554 *p = NULL; \
kono
parents: 67
diff changeset
1555 }
kono
parents: 67
diff changeset
1556
kono
parents: 67
diff changeset
1557 #define PUSH_INSERT_PASSES_WITHIN(PASS) \
kono
parents: 67
diff changeset
1558 { \
kono
parents: 67
diff changeset
1559 opt_pass **p = &(PASS ## _1)->sub;
kono
parents: 67
diff changeset
1560
kono
parents: 67
diff changeset
1561 #define POP_INSERT_PASSES() \
kono
parents: 67
diff changeset
1562 }
kono
parents: 67
diff changeset
1563
kono
parents: 67
diff changeset
1564 #define NEXT_PASS(PASS, NUM) \
kono
parents: 67
diff changeset
1565 do { \
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1566 gcc_assert (PASS ## _ ## NUM == NULL); \
111
kono
parents: 67
diff changeset
1567 if ((NUM) == 1) \
kono
parents: 67
diff changeset
1568 PASS ## _1 = make_##PASS (m_ctxt); \
kono
parents: 67
diff changeset
1569 else \
kono
parents: 67
diff changeset
1570 { \
kono
parents: 67
diff changeset
1571 gcc_assert (PASS ## _1); \
kono
parents: 67
diff changeset
1572 PASS ## _ ## NUM = PASS ## _1->clone (); \
kono
parents: 67
diff changeset
1573 } \
kono
parents: 67
diff changeset
1574 p = next_pass_1 (p, PASS ## _ ## NUM, PASS ## _1); \
kono
parents: 67
diff changeset
1575 } while (0)
kono
parents: 67
diff changeset
1576
kono
parents: 67
diff changeset
1577 #define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) \
kono
parents: 67
diff changeset
1578 do { \
kono
parents: 67
diff changeset
1579 NEXT_PASS (PASS, NUM); \
kono
parents: 67
diff changeset
1580 PASS ## _ ## NUM->set_pass_param (0, ARG); \
kono
parents: 67
diff changeset
1581 } while (0)
kono
parents: 67
diff changeset
1582
kono
parents: 67
diff changeset
1583 #include "pass-instances.def"
kono
parents: 67
diff changeset
1584
kono
parents: 67
diff changeset
1585 #undef INSERT_PASSES_AFTER
kono
parents: 67
diff changeset
1586 #undef PUSH_INSERT_PASSES_WITHIN
kono
parents: 67
diff changeset
1587 #undef POP_INSERT_PASSES
kono
parents: 67
diff changeset
1588 #undef NEXT_PASS
kono
parents: 67
diff changeset
1589 #undef NEXT_PASS_WITH_ARG
kono
parents: 67
diff changeset
1590 #undef TERMINATE_PASS_LIST
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1591
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1592 /* Register the passes with the tree dump code. */
111
kono
parents: 67
diff changeset
1593 register_dump_files (all_lowering_passes);
kono
parents: 67
diff changeset
1594 register_dump_files (all_small_ipa_passes);
kono
parents: 67
diff changeset
1595 register_dump_files (all_regular_ipa_passes);
kono
parents: 67
diff changeset
1596 register_dump_files (all_late_ipa_passes);
kono
parents: 67
diff changeset
1597 register_dump_files (all_passes);
kono
parents: 67
diff changeset
1598 }
kono
parents: 67
diff changeset
1599
kono
parents: 67
diff changeset
1600 static void
kono
parents: 67
diff changeset
1601 delete_pass_tree (opt_pass *pass)
kono
parents: 67
diff changeset
1602 {
kono
parents: 67
diff changeset
1603 while (pass)
kono
parents: 67
diff changeset
1604 {
kono
parents: 67
diff changeset
1605 /* Recurse into child passes. */
kono
parents: 67
diff changeset
1606 delete_pass_tree (pass->sub);
kono
parents: 67
diff changeset
1607
kono
parents: 67
diff changeset
1608 opt_pass *next = pass->next;
kono
parents: 67
diff changeset
1609
kono
parents: 67
diff changeset
1610 /* Delete this pass. */
kono
parents: 67
diff changeset
1611 delete pass;
kono
parents: 67
diff changeset
1612
kono
parents: 67
diff changeset
1613 /* Iterate onto sibling passes. */
kono
parents: 67
diff changeset
1614 pass = next;
kono
parents: 67
diff changeset
1615 }
kono
parents: 67
diff changeset
1616 }
kono
parents: 67
diff changeset
1617
kono
parents: 67
diff changeset
1618 pass_manager::~pass_manager ()
kono
parents: 67
diff changeset
1619 {
kono
parents: 67
diff changeset
1620 XDELETEVEC (passes_by_id);
kono
parents: 67
diff changeset
1621
kono
parents: 67
diff changeset
1622 /* Call delete_pass_tree on each of the pass_lists. */
kono
parents: 67
diff changeset
1623 #define DEF_PASS_LIST(LIST) \
kono
parents: 67
diff changeset
1624 delete_pass_tree (*pass_lists[PASS_LIST_NO_##LIST]);
kono
parents: 67
diff changeset
1625 GCC_PASS_LISTS
kono
parents: 67
diff changeset
1626 #undef DEF_PASS_LIST
kono
parents: 67
diff changeset
1627
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1628 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1629
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1630 /* If we are in IPA mode (i.e., current_function_decl is NULL), call
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1631 function CALLBACK for every function in the call graph. Otherwise,
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1632 call CALLBACK on the current function. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1633
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1634 static void
111
kono
parents: 67
diff changeset
1635 do_per_function (void (*callback) (function *, void *data), void *data)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1636 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1637 if (current_function_decl)
111
kono
parents: 67
diff changeset
1638 callback (cfun, data);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1639 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1640 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1641 struct cgraph_node *node;
111
kono
parents: 67
diff changeset
1642 FOR_EACH_DEFINED_FUNCTION (node)
kono
parents: 67
diff changeset
1643 if (node->analyzed && (gimple_has_body_p (node->decl) && !in_lto_p)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1644 && (!node->clone_of || node->decl != node->clone_of->decl))
111
kono
parents: 67
diff changeset
1645 callback (DECL_STRUCT_FUNCTION (node->decl), data);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1646 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1647 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1648
111
kono
parents: 67
diff changeset
1649 /* Hook called when NODE is removed and therefore should be
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1650 excluded from order vector. DATA is a hash set with removed nodes. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1651
111
kono
parents: 67
diff changeset
1652 static void
kono
parents: 67
diff changeset
1653 remove_cgraph_node_from_order (cgraph_node *node, void *data)
kono
parents: 67
diff changeset
1654 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1655 hash_set<cgraph_node *> *removed_nodes = (hash_set<cgraph_node *> *)data;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1656 removed_nodes->add (node);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1657 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1658
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1659 /* Hook called when NODE is insert and therefore should be
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1660 excluded from removed_nodes. DATA is a hash set with removed nodes. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1661
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1662 static void
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1663 insert_cgraph_node_to_order (cgraph_node *node, void *data)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1664 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1665 hash_set<cgraph_node *> *removed_nodes = (hash_set<cgraph_node *> *)data;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1666 removed_nodes->remove (node);
111
kono
parents: 67
diff changeset
1667 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1668
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1669 /* Hook called when NODE is duplicated and therefore should be
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1670 excluded from removed_nodes. DATA is a hash set with removed nodes. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1671
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1672 static void
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1673 duplicate_cgraph_node_to_order (cgraph_node *node, cgraph_node *node2,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1674 void *data)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1675 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1676 hash_set<cgraph_node *> *removed_nodes = (hash_set<cgraph_node *> *)data;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1677 gcc_checking_assert (!removed_nodes->contains (node));
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1678 removed_nodes->remove (node2);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1679 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1680
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1681
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1682 /* If we are in IPA mode (i.e., current_function_decl is NULL), call
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1683 function CALLBACK for every function in the call graph. Otherwise,
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1684 call CALLBACK on the current function.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1685 This function is global so that plugins can use it. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1686 void
111
kono
parents: 67
diff changeset
1687 do_per_function_toporder (void (*callback) (function *, void *data), void *data)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1688 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1689 int i;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1690
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1691 if (current_function_decl)
111
kono
parents: 67
diff changeset
1692 callback (cfun, data);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1693 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1694 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1695 hash_set<cgraph_node *> removed_nodes;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1696 unsigned nnodes = symtab->cgraph_count;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1697 cgraph_node **order = XNEWVEC (cgraph_node *, nnodes);
111
kono
parents: 67
diff changeset
1698
kono
parents: 67
diff changeset
1699 nnodes = ipa_reverse_postorder (order);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1700 for (i = nnodes - 1; i >= 0; i--)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1701 order[i]->process = 1;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1702 cgraph_node_hook_list *removal_hook
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1703 = symtab->add_cgraph_removal_hook (remove_cgraph_node_from_order,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1704 &removed_nodes);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1705 cgraph_node_hook_list *insertion_hook
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1706 = symtab->add_cgraph_insertion_hook (insert_cgraph_node_to_order,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1707 &removed_nodes);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1708 cgraph_2node_hook_list *duplication_hook
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1709 = symtab->add_cgraph_duplication_hook (duplicate_cgraph_node_to_order,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1710 &removed_nodes);
111
kono
parents: 67
diff changeset
1711 for (i = nnodes - 1; i >= 0; i--)
kono
parents: 67
diff changeset
1712 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1713 cgraph_node *node = order[i];
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1714
111
kono
parents: 67
diff changeset
1715 /* Function could be inlined and removed as unreachable. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1716 if (node == NULL || removed_nodes.contains (node))
111
kono
parents: 67
diff changeset
1717 continue;
kono
parents: 67
diff changeset
1718
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1719 node->process = 0;
111
kono
parents: 67
diff changeset
1720 if (node->has_gimple_body_p ())
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1721 {
111
kono
parents: 67
diff changeset
1722 struct function *fn = DECL_STRUCT_FUNCTION (node->decl);
kono
parents: 67
diff changeset
1723 push_cfun (fn);
kono
parents: 67
diff changeset
1724 callback (fn, data);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1725 pop_cfun ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1726 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1727 }
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1728 symtab->remove_cgraph_removal_hook (removal_hook);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1729 symtab->remove_cgraph_insertion_hook (insertion_hook);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1730 symtab->remove_cgraph_duplication_hook (duplication_hook);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1731
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1732 free (order);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1733 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1734 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1735
111
kono
parents: 67
diff changeset
1736 /* Helper function to perform function body dump. */
kono
parents: 67
diff changeset
1737
kono
parents: 67
diff changeset
1738 static void
kono
parents: 67
diff changeset
1739 execute_function_dump (function *fn, void *data)
kono
parents: 67
diff changeset
1740 {
kono
parents: 67
diff changeset
1741 opt_pass *pass = (opt_pass *)data;
kono
parents: 67
diff changeset
1742
kono
parents: 67
diff changeset
1743 if (dump_file)
kono
parents: 67
diff changeset
1744 {
kono
parents: 67
diff changeset
1745 push_cfun (fn);
kono
parents: 67
diff changeset
1746
kono
parents: 67
diff changeset
1747 if (fn->curr_properties & PROP_trees)
kono
parents: 67
diff changeset
1748 dump_function_to_file (fn->decl, dump_file, dump_flags);
kono
parents: 67
diff changeset
1749 else
kono
parents: 67
diff changeset
1750 print_rtl_with_bb (dump_file, get_insns (), dump_flags);
kono
parents: 67
diff changeset
1751
kono
parents: 67
diff changeset
1752 /* Flush the file. If verification fails, we won't be able to
kono
parents: 67
diff changeset
1753 close the file before aborting. */
kono
parents: 67
diff changeset
1754 fflush (dump_file);
kono
parents: 67
diff changeset
1755
kono
parents: 67
diff changeset
1756 if ((fn->curr_properties & PROP_cfg)
kono
parents: 67
diff changeset
1757 && (dump_flags & TDF_GRAPH))
kono
parents: 67
diff changeset
1758 {
kono
parents: 67
diff changeset
1759 gcc::dump_manager *dumps = g->get_dumps ();
kono
parents: 67
diff changeset
1760 struct dump_file_info *dfi
kono
parents: 67
diff changeset
1761 = dumps->get_dump_file_info (pass->static_pass_number);
kono
parents: 67
diff changeset
1762 if (!dfi->graph_dump_initialized)
kono
parents: 67
diff changeset
1763 {
kono
parents: 67
diff changeset
1764 clean_graph_dump_file (dump_file_name);
kono
parents: 67
diff changeset
1765 dfi->graph_dump_initialized = true;
kono
parents: 67
diff changeset
1766 }
kono
parents: 67
diff changeset
1767 print_graph_cfg (dump_file_name, fn);
kono
parents: 67
diff changeset
1768 }
kono
parents: 67
diff changeset
1769
kono
parents: 67
diff changeset
1770 pop_cfun ();
kono
parents: 67
diff changeset
1771 }
kono
parents: 67
diff changeset
1772 }
kono
parents: 67
diff changeset
1773
kono
parents: 67
diff changeset
1774 /* This function is called when an internal compiler error is encountered.
kono
parents: 67
diff changeset
1775 Ensure that function dump is made available before compiler is aborted. */
kono
parents: 67
diff changeset
1776
kono
parents: 67
diff changeset
1777 void
kono
parents: 67
diff changeset
1778 emergency_dump_function ()
kono
parents: 67
diff changeset
1779 {
kono
parents: 67
diff changeset
1780 if (!current_pass)
kono
parents: 67
diff changeset
1781 return;
kono
parents: 67
diff changeset
1782 enum opt_pass_type pt = current_pass->type;
kono
parents: 67
diff changeset
1783 fnotice (stderr, "during %s pass: %s\n",
kono
parents: 67
diff changeset
1784 pt == GIMPLE_PASS ? "GIMPLE" : pt == RTL_PASS ? "RTL" : "IPA",
kono
parents: 67
diff changeset
1785 current_pass->name);
kono
parents: 67
diff changeset
1786 if (!dump_file || !cfun)
kono
parents: 67
diff changeset
1787 return;
kono
parents: 67
diff changeset
1788 fnotice (stderr, "dump file: %s\n", dump_file_name);
kono
parents: 67
diff changeset
1789 fprintf (dump_file, "\n\n\nEMERGENCY DUMP:\n\n");
kono
parents: 67
diff changeset
1790 execute_function_dump (cfun, current_pass);
kono
parents: 67
diff changeset
1791 }
kono
parents: 67
diff changeset
1792
kono
parents: 67
diff changeset
1793 static struct profile_record *profile_record;
kono
parents: 67
diff changeset
1794
kono
parents: 67
diff changeset
1795 /* Do profile consistency book-keeping for the pass with static number INDEX.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1796 RUN is true if the pass really runs, or FALSE
111
kono
parents: 67
diff changeset
1797 if we are only book-keeping on passes that may have selectively disabled
kono
parents: 67
diff changeset
1798 themselves on a given function. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1799
111
kono
parents: 67
diff changeset
1800 static void
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1801 check_profile_consistency (int index, bool run)
111
kono
parents: 67
diff changeset
1802 {
kono
parents: 67
diff changeset
1803 pass_manager *passes = g->get_passes ();
kono
parents: 67
diff changeset
1804 if (index == -1)
kono
parents: 67
diff changeset
1805 return;
kono
parents: 67
diff changeset
1806 if (!profile_record)
kono
parents: 67
diff changeset
1807 profile_record = XCNEWVEC (struct profile_record,
kono
parents: 67
diff changeset
1808 passes->passes_by_id_size);
kono
parents: 67
diff changeset
1809 gcc_assert (index < passes->passes_by_id_size && index >= 0);
kono
parents: 67
diff changeset
1810 profile_record[index].run |= run;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1811 profile_record_check_consistency (&profile_record[index]);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1812 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1813
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1814 /* Account profile the pass with static number INDEX.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1815 RUN is true if the pass really runs, or FALSE
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1816 if we are only book-keeping on passes that may have selectively disabled
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1817 themselves on a given function. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1818
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1819 static void
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1820 account_profile (int index, bool run)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1821 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1822 pass_manager *passes = g->get_passes ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1823 if (index == -1)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1824 return;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1825 if (!profile_record)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1826 profile_record = XCNEWVEC (struct profile_record,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1827 passes->passes_by_id_size);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1828 gcc_assert (index < passes->passes_by_id_size && index >= 0);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1829 profile_record[index].run |= run;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1830 profile_record_account_profile (&profile_record[index]);
111
kono
parents: 67
diff changeset
1831 }
kono
parents: 67
diff changeset
1832
kono
parents: 67
diff changeset
1833 /* Output profile consistency. */
kono
parents: 67
diff changeset
1834
kono
parents: 67
diff changeset
1835 void
kono
parents: 67
diff changeset
1836 dump_profile_report (void)
kono
parents: 67
diff changeset
1837 {
kono
parents: 67
diff changeset
1838 g->get_passes ()->dump_profile_report ();
kono
parents: 67
diff changeset
1839 }
kono
parents: 67
diff changeset
1840
kono
parents: 67
diff changeset
1841 void
kono
parents: 67
diff changeset
1842 pass_manager::dump_profile_report () const
kono
parents: 67
diff changeset
1843 {
kono
parents: 67
diff changeset
1844 int last_freq_in = 0, last_count_in = 0, last_freq_out = 0, last_count_out = 0;
kono
parents: 67
diff changeset
1845 gcov_type last_time = 0, last_size = 0;
kono
parents: 67
diff changeset
1846 double rel_time_change, rel_size_change;
kono
parents: 67
diff changeset
1847 int last_reported = 0;
kono
parents: 67
diff changeset
1848
kono
parents: 67
diff changeset
1849 if (!profile_record)
kono
parents: 67
diff changeset
1850 return;
kono
parents: 67
diff changeset
1851 fprintf (stderr, "\nProfile consistency report:\n\n");
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1852 fprintf (stderr, " |mismatch |mismatch | |\n");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1853 fprintf (stderr, "Pass name |IN |IN |OUT |OUT |overall |\n");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1854 fprintf (stderr, " |freq |count |freq |count |size |time |\n");
111
kono
parents: 67
diff changeset
1855
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1856 for (int i = 1; i < passes_by_id_size; i++)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1857 if (profile_record[i].run)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1858 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1859 if (last_time)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1860 rel_time_change = (profile_record[i].time
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1861 - (double)last_time) * 100 / (double)last_time;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1862 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1863 rel_time_change = 0;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1864 if (last_size)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1865 rel_size_change = (profile_record[i].size
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1866 - (double)last_size) * 100 / (double)last_size;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1867 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1868 rel_size_change = 0;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1869
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1870 if (profile_record[i].num_mismatched_freq_in != last_freq_in
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1871 || profile_record[i].num_mismatched_freq_out != last_freq_out
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1872 || profile_record[i].num_mismatched_count_in != last_count_in
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1873 || profile_record[i].num_mismatched_count_out != last_count_out
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1874 || rel_time_change || rel_size_change)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1875 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1876 last_reported = i;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1877 fprintf (stderr, "%-33s", passes_by_id[i]->name);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1878 if (profile_record[i].num_mismatched_freq_in != last_freq_in)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1879 fprintf (stderr, "| %+5i",
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1880 profile_record[i].num_mismatched_freq_in
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1881 - last_freq_in);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1882 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1883 fprintf (stderr, "| ");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1884 if (profile_record[i].num_mismatched_count_in != last_count_in)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1885 fprintf (stderr, "| %+5i",
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1886 profile_record[i].num_mismatched_count_in
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1887 - last_count_in);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1888 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1889 fprintf (stderr, "| ");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1890 if (profile_record[i].num_mismatched_freq_out != last_freq_out)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1891 fprintf (stderr, "| %+5i",
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1892 profile_record[i].num_mismatched_freq_out
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1893 - last_freq_out);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1894 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1895 fprintf (stderr, "| ");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1896 if (profile_record[i].num_mismatched_count_out != last_count_out)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1897 fprintf (stderr, "| %+5i",
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1898 profile_record[i].num_mismatched_count_out
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1899 - last_count_out);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1900 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1901 fprintf (stderr, "| ");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1902
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1903 /* Size/time units change across gimple and RTL. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1904 if (i == pass_expand_1->static_pass_number)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1905 fprintf (stderr, "|----------|----------");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1906 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1907 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1908 if (rel_size_change)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1909 fprintf (stderr, "| %+8.1f%%", rel_size_change);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1910 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1911 fprintf (stderr, "| ");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1912 if (rel_time_change)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1913 fprintf (stderr, "| %+8.1f%%", rel_time_change);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1914 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1915 fprintf (stderr, "| ");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1916 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1917 fprintf (stderr, "|\n");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1918 last_freq_in = profile_record[i].num_mismatched_freq_in;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1919 last_freq_out = profile_record[i].num_mismatched_freq_out;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1920 last_count_in = profile_record[i].num_mismatched_count_in;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1921 last_count_out = profile_record[i].num_mismatched_count_out;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1922 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1923 else if (last_reported != i)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1924 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1925 last_reported = i;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1926 fprintf (stderr, "%-20s ------------| | | | | | |\n",
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1927 passes_by_id[i]->name);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1928 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1929 last_time = profile_record[i].time;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1930 last_size = profile_record[i].size;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1931 }
111
kono
parents: 67
diff changeset
1932 }
kono
parents: 67
diff changeset
1933
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1934 /* Perform all TODO actions that ought to be done on each function. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1935
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1936 static void
111
kono
parents: 67
diff changeset
1937 execute_function_todo (function *fn, void *data)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1938 {
111
kono
parents: 67
diff changeset
1939 bool from_ipa_pass = (cfun == NULL);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1940 unsigned int flags = (size_t)data;
111
kono
parents: 67
diff changeset
1941 flags &= ~fn->last_verified;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1942 if (!flags)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1943 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1944
111
kono
parents: 67
diff changeset
1945 push_cfun (fn);
kono
parents: 67
diff changeset
1946
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1947 /* If we need to cleanup the CFG let it perform a needed SSA update. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1948 if (flags & TODO_cleanup_cfg)
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1949 cleanup_tree_cfg (flags & TODO_update_ssa_any);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1950 else if (flags & TODO_update_ssa_any)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1951 update_ssa (flags & TODO_update_ssa_any);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1952 gcc_assert (!need_ssa_update_p (fn));
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1953
111
kono
parents: 67
diff changeset
1954 if (flag_tree_pta && (flags & TODO_rebuild_alias))
kono
parents: 67
diff changeset
1955 compute_may_aliases ();
kono
parents: 67
diff changeset
1956
kono
parents: 67
diff changeset
1957 if (optimize && (flags & TODO_update_address_taken))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1958 execute_update_addresses_taken ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1959
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1960 if (flags & TODO_remove_unused_locals)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1961 remove_unused_locals ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1962
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1963 if (flags & TODO_rebuild_frequencies)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1964 rebuild_frequencies ();
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1965
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1966 if (flags & TODO_rebuild_cgraph_edges)
111
kono
parents: 67
diff changeset
1967 cgraph_edge::rebuild_edges ();
kono
parents: 67
diff changeset
1968
kono
parents: 67
diff changeset
1969 gcc_assert (dom_info_state (fn, CDI_POST_DOMINATORS) == DOM_NONE);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1970 /* If we've seen errors do not bother running any verifiers. */
111
kono
parents: 67
diff changeset
1971 if (flag_checking && !seen_error ())
kono
parents: 67
diff changeset
1972 {
kono
parents: 67
diff changeset
1973 dom_state pre_verify_state = dom_info_state (fn, CDI_DOMINATORS);
kono
parents: 67
diff changeset
1974 dom_state pre_verify_pstate = dom_info_state (fn, CDI_POST_DOMINATORS);
kono
parents: 67
diff changeset
1975
kono
parents: 67
diff changeset
1976 if (flags & TODO_verify_il)
kono
parents: 67
diff changeset
1977 {
kono
parents: 67
diff changeset
1978 if (cfun->curr_properties & PROP_trees)
kono
parents: 67
diff changeset
1979 {
kono
parents: 67
diff changeset
1980 if (cfun->curr_properties & PROP_cfg)
kono
parents: 67
diff changeset
1981 /* IPA passes leave stmts to be fixed up, so make sure to
kono
parents: 67
diff changeset
1982 not verify stmts really throw. */
kono
parents: 67
diff changeset
1983 verify_gimple_in_cfg (cfun, !from_ipa_pass);
kono
parents: 67
diff changeset
1984 else
kono
parents: 67
diff changeset
1985 verify_gimple_in_seq (gimple_body (cfun->decl));
kono
parents: 67
diff changeset
1986 }
kono
parents: 67
diff changeset
1987 if (cfun->curr_properties & PROP_ssa)
kono
parents: 67
diff changeset
1988 /* IPA passes leave stmts to be fixed up, so make sure to
kono
parents: 67
diff changeset
1989 not verify SSA operands whose verifier will choke on that. */
kono
parents: 67
diff changeset
1990 verify_ssa (true, !from_ipa_pass);
kono
parents: 67
diff changeset
1991 /* IPA passes leave basic-blocks unsplit, so make sure to
kono
parents: 67
diff changeset
1992 not trip on that. */
kono
parents: 67
diff changeset
1993 if ((cfun->curr_properties & PROP_cfg)
kono
parents: 67
diff changeset
1994 && !from_ipa_pass)
kono
parents: 67
diff changeset
1995 verify_flow_info ();
kono
parents: 67
diff changeset
1996 if (current_loops
kono
parents: 67
diff changeset
1997 && ! loops_state_satisfies_p (LOOPS_NEED_FIXUP))
kono
parents: 67
diff changeset
1998 {
kono
parents: 67
diff changeset
1999 verify_loop_structure ();
kono
parents: 67
diff changeset
2000 if (loops_state_satisfies_p (LOOP_CLOSED_SSA))
kono
parents: 67
diff changeset
2001 verify_loop_closed_ssa (false);
kono
parents: 67
diff changeset
2002 }
kono
parents: 67
diff changeset
2003 if (cfun->curr_properties & PROP_rtl)
kono
parents: 67
diff changeset
2004 verify_rtl_sharing ();
kono
parents: 67
diff changeset
2005 }
kono
parents: 67
diff changeset
2006
kono
parents: 67
diff changeset
2007 /* Make sure verifiers don't change dominator state. */
kono
parents: 67
diff changeset
2008 gcc_assert (dom_info_state (fn, CDI_DOMINATORS) == pre_verify_state);
kono
parents: 67
diff changeset
2009 gcc_assert (dom_info_state (fn, CDI_POST_DOMINATORS) == pre_verify_pstate);
kono
parents: 67
diff changeset
2010 }
kono
parents: 67
diff changeset
2011
kono
parents: 67
diff changeset
2012 fn->last_verified = flags & TODO_verify_all;
kono
parents: 67
diff changeset
2013
kono
parents: 67
diff changeset
2014 pop_cfun ();
kono
parents: 67
diff changeset
2015
kono
parents: 67
diff changeset
2016 /* For IPA passes make sure to release dominator info, it can be
kono
parents: 67
diff changeset
2017 computed by non-verifying TODOs. */
kono
parents: 67
diff changeset
2018 if (from_ipa_pass)
kono
parents: 67
diff changeset
2019 {
kono
parents: 67
diff changeset
2020 free_dominance_info (fn, CDI_DOMINATORS);
kono
parents: 67
diff changeset
2021 free_dominance_info (fn, CDI_POST_DOMINATORS);
kono
parents: 67
diff changeset
2022 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2023 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2024
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2025 /* Perform all TODO actions. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2026 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2027 execute_todo (unsigned int flags)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2028 {
111
kono
parents: 67
diff changeset
2029 if (flag_checking
kono
parents: 67
diff changeset
2030 && cfun
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2031 && need_ssa_update_p (cfun))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2032 gcc_assert (flags & TODO_update_ssa_any);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2033
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2034 statistics_fini_pass ();
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2035
111
kono
parents: 67
diff changeset
2036 if (flags)
kono
parents: 67
diff changeset
2037 do_per_function (execute_function_todo, (void *)(size_t) flags);
kono
parents: 67
diff changeset
2038
kono
parents: 67
diff changeset
2039 /* At this point we should not have any unreachable code in the
kono
parents: 67
diff changeset
2040 CFG, so it is safe to flush the pending freelist for SSA_NAMES. */
kono
parents: 67
diff changeset
2041 if (cfun && cfun->gimple_df)
kono
parents: 67
diff changeset
2042 flush_ssaname_freelist ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2043
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2044 /* Always remove functions just as before inlining: IPA passes might be
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2045 interested to see bodies of extern inline functions that are not inlined
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2046 to analyze side effects. The full removal is done just at the end
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2047 of IPA pass queue. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2048 if (flags & TODO_remove_functions)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2049 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2050 gcc_assert (!cfun);
111
kono
parents: 67
diff changeset
2051 symtab->remove_unreachable_nodes (dump_file);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2052 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2053
111
kono
parents: 67
diff changeset
2054 if ((flags & TODO_dump_symtab) && dump_file && !current_function_decl)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2055 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2056 gcc_assert (!cfun);
111
kono
parents: 67
diff changeset
2057 symtab->dump (dump_file);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2058 /* Flush the file. If verification fails, we won't be able to
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2059 close the file before aborting. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2060 fflush (dump_file);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2061 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2062
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2063 /* Now that the dumping has been done, we can get rid of the optional
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2064 df problems. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2065 if (flags & TODO_df_finish)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2066 df_finish_pass ((flags & TODO_df_verify) != 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2067 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2068
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2069 /* Verify invariants that should hold between passes. This is a place
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2070 to put simple sanity checks. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2071
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2072 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2073 verify_interpass_invariants (void)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2074 {
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2075 gcc_checking_assert (!fold_deferring_overflow_warnings_p ());
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2076 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2077
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2078 /* Clear the last verified flag. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2079
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2080 static void
111
kono
parents: 67
diff changeset
2081 clear_last_verified (function *fn, void *data ATTRIBUTE_UNUSED)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2082 {
111
kono
parents: 67
diff changeset
2083 fn->last_verified = 0;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2084 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2085
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2086 /* Helper function. Verify that the properties has been turn into the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2087 properties expected by the pass. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2088
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2089 static void
111
kono
parents: 67
diff changeset
2090 verify_curr_properties (function *fn, void *data)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2091 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2092 unsigned int props = (size_t)data;
111
kono
parents: 67
diff changeset
2093 gcc_assert ((fn->curr_properties & props) == props);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2094 }
111
kono
parents: 67
diff changeset
2095
kono
parents: 67
diff changeset
2096 /* Release dump file name if set. */
kono
parents: 67
diff changeset
2097
kono
parents: 67
diff changeset
2098 static void
kono
parents: 67
diff changeset
2099 release_dump_file_name (void)
kono
parents: 67
diff changeset
2100 {
kono
parents: 67
diff changeset
2101 if (dump_file_name)
kono
parents: 67
diff changeset
2102 {
kono
parents: 67
diff changeset
2103 free (CONST_CAST (char *, dump_file_name));
kono
parents: 67
diff changeset
2104 dump_file_name = NULL;
kono
parents: 67
diff changeset
2105 }
kono
parents: 67
diff changeset
2106 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2107
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2108 /* Initialize pass dump file. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2109 /* This is non-static so that the plugins can use it. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2110
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2111 bool
111
kono
parents: 67
diff changeset
2112 pass_init_dump_file (opt_pass *pass)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2113 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2114 /* If a dump file name is present, open it if enabled. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2115 if (pass->static_pass_number != -1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2116 {
111
kono
parents: 67
diff changeset
2117 timevar_push (TV_DUMP);
kono
parents: 67
diff changeset
2118 gcc::dump_manager *dumps = g->get_dumps ();
kono
parents: 67
diff changeset
2119 bool initializing_dump =
kono
parents: 67
diff changeset
2120 !dumps->dump_initialized_p (pass->static_pass_number);
kono
parents: 67
diff changeset
2121 release_dump_file_name ();
kono
parents: 67
diff changeset
2122 dump_file_name = dumps->get_dump_file_name (pass->static_pass_number);
kono
parents: 67
diff changeset
2123 dumps->dump_start (pass->static_pass_number, &dump_flags);
kono
parents: 67
diff changeset
2124 if (dump_file && current_function_decl && ! (dump_flags & TDF_GIMPLE))
kono
parents: 67
diff changeset
2125 dump_function_header (dump_file, current_function_decl, dump_flags);
kono
parents: 67
diff changeset
2126 if (initializing_dump
kono
parents: 67
diff changeset
2127 && dump_file && (dump_flags & TDF_GRAPH)
kono
parents: 67
diff changeset
2128 && cfun && (cfun->curr_properties & PROP_cfg))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2129 {
111
kono
parents: 67
diff changeset
2130 clean_graph_dump_file (dump_file_name);
kono
parents: 67
diff changeset
2131 struct dump_file_info *dfi
kono
parents: 67
diff changeset
2132 = dumps->get_dump_file_info (pass->static_pass_number);
kono
parents: 67
diff changeset
2133 dfi->graph_dump_initialized = true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2134 }
111
kono
parents: 67
diff changeset
2135 timevar_pop (TV_DUMP);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2136 return initializing_dump;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2137 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2138 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2139 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2140 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2141
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2142 /* Flush PASS dump file. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2143 /* This is non-static so that plugins can use it. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2144
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2145 void
111
kono
parents: 67
diff changeset
2146 pass_fini_dump_file (opt_pass *pass)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2147 {
111
kono
parents: 67
diff changeset
2148 timevar_push (TV_DUMP);
kono
parents: 67
diff changeset
2149
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2150 /* Flush and close dump file. */
111
kono
parents: 67
diff changeset
2151 release_dump_file_name ();
kono
parents: 67
diff changeset
2152
kono
parents: 67
diff changeset
2153 g->get_dumps ()->dump_finish (pass->static_pass_number);
kono
parents: 67
diff changeset
2154 timevar_pop (TV_DUMP);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2155 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2156
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2157 /* After executing the pass, apply expected changes to the function
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2158 properties. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2159
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2160 static void
111
kono
parents: 67
diff changeset
2161 update_properties_after_pass (function *fn, void *data)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2162 {
111
kono
parents: 67
diff changeset
2163 opt_pass *pass = (opt_pass *) data;
kono
parents: 67
diff changeset
2164 fn->curr_properties = (fn->curr_properties | pass->properties_provided)
kono
parents: 67
diff changeset
2165 & ~pass->properties_destroyed;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2166 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2167
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2168 /* Execute summary generation for all of the passes in IPA_PASS. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2169
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2170 void
111
kono
parents: 67
diff changeset
2171 execute_ipa_summary_passes (ipa_opt_pass_d *ipa_pass)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2172 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2173 while (ipa_pass)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2174 {
111
kono
parents: 67
diff changeset
2175 opt_pass *pass = ipa_pass;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2176
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2177 /* Execute all of the IPA_PASSes in the list. */
111
kono
parents: 67
diff changeset
2178 if (ipa_pass->type == IPA_PASS
kono
parents: 67
diff changeset
2179 && pass->gate (cfun)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2180 && ipa_pass->generate_summary)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2181 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2182 pass_init_dump_file (pass);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2183
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2184 /* If a timevar is present, start it. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2185 if (pass->tv_id)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2186 timevar_push (pass->tv_id);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2187
111
kono
parents: 67
diff changeset
2188 current_pass = pass;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2189 ipa_pass->generate_summary ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2190
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2191 /* Stop timevar. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2192 if (pass->tv_id)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2193 timevar_pop (pass->tv_id);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2194
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2195 pass_fini_dump_file (pass);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2196 }
111
kono
parents: 67
diff changeset
2197 ipa_pass = (ipa_opt_pass_d *)ipa_pass->next;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2198 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2199 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2200
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2201 /* Execute IPA_PASS function transform on NODE. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2202
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2203 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2204 execute_one_ipa_transform_pass (struct cgraph_node *node,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2205 ipa_opt_pass_d *ipa_pass, bool do_not_collect)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2206 {
111
kono
parents: 67
diff changeset
2207 opt_pass *pass = ipa_pass;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2208 unsigned int todo_after = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2209
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2210 current_pass = pass;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2211 if (!ipa_pass->function_transform)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2212 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2213
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2214 /* Note that the folders should only create gimple expressions.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2215 This is a hack until the new folder is ready. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2216 in_gimple_form = (cfun && (cfun->curr_properties & PROP_trees)) != 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2217
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2218 pass_init_dump_file (pass);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2219
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2220 /* If a timevar is present, start it. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2221 if (pass->tv_id != TV_NONE)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2222 timevar_push (pass->tv_id);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2223
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2224 if (profile_report && cfun && (cfun->curr_properties & PROP_cfg))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2225 check_profile_consistency (pass->static_pass_number, true);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2226
111
kono
parents: 67
diff changeset
2227 /* Run pre-pass verification. */
kono
parents: 67
diff changeset
2228 execute_todo (ipa_pass->function_transform_todo_flags_start);
kono
parents: 67
diff changeset
2229
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2230 /* Do it! */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2231 todo_after = ipa_pass->function_transform (node);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2232
111
kono
parents: 67
diff changeset
2233 /* Run post-pass cleanup and verification. */
kono
parents: 67
diff changeset
2234 execute_todo (todo_after);
kono
parents: 67
diff changeset
2235 verify_interpass_invariants ();
kono
parents: 67
diff changeset
2236 if (profile_report && cfun && (cfun->curr_properties & PROP_cfg))
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2237 account_profile (pass->static_pass_number, true);
111
kono
parents: 67
diff changeset
2238
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2239 /* Stop timevar. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2240 if (pass->tv_id != TV_NONE)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2241 timevar_pop (pass->tv_id);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2242
111
kono
parents: 67
diff changeset
2243 if (dump_file)
kono
parents: 67
diff changeset
2244 do_per_function (execute_function_dump, pass);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2245 pass_fini_dump_file (pass);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2246
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2247 current_pass = NULL;
111
kono
parents: 67
diff changeset
2248 redirect_edge_var_map_empty ();
kono
parents: 67
diff changeset
2249
kono
parents: 67
diff changeset
2250 /* Signal this is a suitable GC collection point. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2251 if (!do_not_collect && !(todo_after & TODO_do_not_ggc_collect))
111
kono
parents: 67
diff changeset
2252 ggc_collect ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2253 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2254
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2255 /* For the current function, execute all ipa transforms. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2256
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2257 void
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2258 execute_all_ipa_transforms (bool do_not_collect)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2259 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2260 struct cgraph_node *node;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2261 if (!cfun)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2262 return;
111
kono
parents: 67
diff changeset
2263 node = cgraph_node::get (current_function_decl);
kono
parents: 67
diff changeset
2264
kono
parents: 67
diff changeset
2265 if (node->ipa_transforms_to_apply.exists ())
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2266 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2267 unsigned int i;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2268
111
kono
parents: 67
diff changeset
2269 for (i = 0; i < node->ipa_transforms_to_apply.length (); i++)
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2270 execute_one_ipa_transform_pass (node, node->ipa_transforms_to_apply[i],
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2271 do_not_collect);
111
kono
parents: 67
diff changeset
2272 node->ipa_transforms_to_apply.release ();
kono
parents: 67
diff changeset
2273 }
kono
parents: 67
diff changeset
2274 }
kono
parents: 67
diff changeset
2275
kono
parents: 67
diff changeset
2276 /* Check if PASS is explicitly disabled or enabled and return
kono
parents: 67
diff changeset
2277 the gate status. FUNC is the function to be processed, and
kono
parents: 67
diff changeset
2278 GATE_STATUS is the gate status determined by pass manager by
kono
parents: 67
diff changeset
2279 default. */
kono
parents: 67
diff changeset
2280
kono
parents: 67
diff changeset
2281 static bool
kono
parents: 67
diff changeset
2282 override_gate_status (opt_pass *pass, tree func, bool gate_status)
kono
parents: 67
diff changeset
2283 {
kono
parents: 67
diff changeset
2284 bool explicitly_enabled = false;
kono
parents: 67
diff changeset
2285 bool explicitly_disabled = false;
kono
parents: 67
diff changeset
2286
kono
parents: 67
diff changeset
2287 explicitly_enabled
kono
parents: 67
diff changeset
2288 = is_pass_explicitly_enabled_or_disabled (pass, func,
kono
parents: 67
diff changeset
2289 enabled_pass_uid_range_tab);
kono
parents: 67
diff changeset
2290 explicitly_disabled
kono
parents: 67
diff changeset
2291 = is_pass_explicitly_enabled_or_disabled (pass, func,
kono
parents: 67
diff changeset
2292 disabled_pass_uid_range_tab);
kono
parents: 67
diff changeset
2293
kono
parents: 67
diff changeset
2294 gate_status = !explicitly_disabled && (gate_status || explicitly_enabled);
kono
parents: 67
diff changeset
2295
kono
parents: 67
diff changeset
2296 return gate_status;
kono
parents: 67
diff changeset
2297 }
kono
parents: 67
diff changeset
2298
kono
parents: 67
diff changeset
2299 /* Determine if PASS_NAME matches CRITERION.
kono
parents: 67
diff changeset
2300 Not a pure predicate, since it can update CRITERION, to support
kono
parents: 67
diff changeset
2301 matching the Nth invocation of a pass.
kono
parents: 67
diff changeset
2302 Subroutine of should_skip_pass_p. */
kono
parents: 67
diff changeset
2303
kono
parents: 67
diff changeset
2304 static bool
kono
parents: 67
diff changeset
2305 determine_pass_name_match (const char *pass_name, char *criterion)
kono
parents: 67
diff changeset
2306 {
kono
parents: 67
diff changeset
2307 size_t namelen = strlen (pass_name);
kono
parents: 67
diff changeset
2308 if (! strncmp (pass_name, criterion, namelen))
kono
parents: 67
diff changeset
2309 {
kono
parents: 67
diff changeset
2310 /* The following supports starting with the Nth invocation
kono
parents: 67
diff changeset
2311 of a pass (where N does not necessarily is equal to the
kono
parents: 67
diff changeset
2312 dump file suffix). */
kono
parents: 67
diff changeset
2313 if (criterion[namelen] == '\0'
kono
parents: 67
diff changeset
2314 || (criterion[namelen] == '1'
kono
parents: 67
diff changeset
2315 && criterion[namelen + 1] == '\0'))
kono
parents: 67
diff changeset
2316 return true;
kono
parents: 67
diff changeset
2317 else
kono
parents: 67
diff changeset
2318 {
kono
parents: 67
diff changeset
2319 if (criterion[namelen + 1] == '\0')
kono
parents: 67
diff changeset
2320 --criterion[namelen];
kono
parents: 67
diff changeset
2321 return false;
kono
parents: 67
diff changeset
2322 }
kono
parents: 67
diff changeset
2323 }
kono
parents: 67
diff changeset
2324 else
kono
parents: 67
diff changeset
2325 return false;
kono
parents: 67
diff changeset
2326 }
kono
parents: 67
diff changeset
2327
kono
parents: 67
diff changeset
2328 /* For skipping passes until "startwith" pass.
kono
parents: 67
diff changeset
2329 Return true iff PASS should be skipped.
kono
parents: 67
diff changeset
2330 Clear cfun->pass_startwith when encountering the "startwith" pass,
kono
parents: 67
diff changeset
2331 so that all subsequent passes are run. */
kono
parents: 67
diff changeset
2332
kono
parents: 67
diff changeset
2333 static bool
kono
parents: 67
diff changeset
2334 should_skip_pass_p (opt_pass *pass)
kono
parents: 67
diff changeset
2335 {
kono
parents: 67
diff changeset
2336 if (!cfun)
kono
parents: 67
diff changeset
2337 return false;
kono
parents: 67
diff changeset
2338 if (!cfun->pass_startwith)
kono
parents: 67
diff changeset
2339 return false;
kono
parents: 67
diff changeset
2340
kono
parents: 67
diff changeset
2341 /* For __GIMPLE functions, we have to at least start when we leave
kono
parents: 67
diff changeset
2342 SSA. Hence, we need to detect the "expand" pass, and stop skipping
kono
parents: 67
diff changeset
2343 when we encounter it. A cheap way to identify "expand" is it to
kono
parents: 67
diff changeset
2344 detect the destruction of PROP_ssa.
kono
parents: 67
diff changeset
2345 For __RTL functions, we invoke "rest_of_compilation" directly, which
kono
parents: 67
diff changeset
2346 is after "expand", and hence we don't reach this conditional. */
kono
parents: 67
diff changeset
2347 if (pass->properties_destroyed & PROP_ssa)
kono
parents: 67
diff changeset
2348 {
kono
parents: 67
diff changeset
2349 if (!quiet_flag)
kono
parents: 67
diff changeset
2350 fprintf (stderr, "starting anyway when leaving SSA: %s\n", pass->name);
kono
parents: 67
diff changeset
2351 cfun->pass_startwith = NULL;
kono
parents: 67
diff changeset
2352 return false;
kono
parents: 67
diff changeset
2353 }
kono
parents: 67
diff changeset
2354
kono
parents: 67
diff changeset
2355 if (determine_pass_name_match (pass->name, cfun->pass_startwith))
kono
parents: 67
diff changeset
2356 {
kono
parents: 67
diff changeset
2357 if (!quiet_flag)
kono
parents: 67
diff changeset
2358 fprintf (stderr, "found starting pass: %s\n", pass->name);
kono
parents: 67
diff changeset
2359 cfun->pass_startwith = NULL;
kono
parents: 67
diff changeset
2360 return false;
kono
parents: 67
diff changeset
2361 }
kono
parents: 67
diff changeset
2362
kono
parents: 67
diff changeset
2363 /* For GIMPLE passes, run any property provider (but continue skipping
kono
parents: 67
diff changeset
2364 afterwards).
kono
parents: 67
diff changeset
2365 We don't want to force running RTL passes that are property providers:
kono
parents: 67
diff changeset
2366 "expand" is covered above, and the only pass other than "expand" that
kono
parents: 67
diff changeset
2367 provides a property is "into_cfglayout" (PROP_cfglayout), which does
kono
parents: 67
diff changeset
2368 too much for a dumped __RTL function. */
kono
parents: 67
diff changeset
2369 if (pass->type == GIMPLE_PASS
kono
parents: 67
diff changeset
2370 && pass->properties_provided != 0)
kono
parents: 67
diff changeset
2371 return false;
kono
parents: 67
diff changeset
2372
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2373 /* We need to (re-)build cgraph edges as needed. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2374 if (strstr (pass->name, "build_cgraph_edges") != NULL)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2375 return false;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2376
111
kono
parents: 67
diff changeset
2377 /* Don't skip df init; later RTL passes need it. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2378 if (strstr (pass->name, "dfinit") != NULL
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2379 || strstr (pass->name, "dfinish") != NULL)
111
kono
parents: 67
diff changeset
2380 return false;
kono
parents: 67
diff changeset
2381
kono
parents: 67
diff changeset
2382 if (!quiet_flag)
kono
parents: 67
diff changeset
2383 fprintf (stderr, "skipping pass: %s\n", pass->name);
kono
parents: 67
diff changeset
2384
kono
parents: 67
diff changeset
2385 /* If we get here, then we have a "startwith" that we haven't seen yet;
kono
parents: 67
diff changeset
2386 skip the pass. */
kono
parents: 67
diff changeset
2387 return true;
kono
parents: 67
diff changeset
2388 }
kono
parents: 67
diff changeset
2389
kono
parents: 67
diff changeset
2390 /* Skip the given pass, for handling passes before "startwith"
kono
parents: 67
diff changeset
2391 in __GIMPLE and__RTL-marked functions.
kono
parents: 67
diff changeset
2392 In theory, this ought to be a no-op, but some of the RTL passes
kono
parents: 67
diff changeset
2393 need additional processing here. */
kono
parents: 67
diff changeset
2394
kono
parents: 67
diff changeset
2395 static void
kono
parents: 67
diff changeset
2396 skip_pass (opt_pass *pass)
kono
parents: 67
diff changeset
2397 {
kono
parents: 67
diff changeset
2398 /* Pass "reload" sets the global "reload_completed", and many
kono
parents: 67
diff changeset
2399 things depend on this (e.g. instructions in .md files). */
kono
parents: 67
diff changeset
2400 if (strcmp (pass->name, "reload") == 0)
kono
parents: 67
diff changeset
2401 reload_completed = 1;
kono
parents: 67
diff changeset
2402
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2403 /* Similar for pass "pro_and_epilogue" and the "epilogue_completed" global
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2404 variable. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2405 if (strcmp (pass->name, "pro_and_epilogue") == 0)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2406 epilogue_completed = 1;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2407
111
kono
parents: 67
diff changeset
2408 /* The INSN_ADDRESSES vec is normally set up by
kono
parents: 67
diff changeset
2409 shorten_branches; set it up for the benefit of passes that
kono
parents: 67
diff changeset
2410 run after this. */
kono
parents: 67
diff changeset
2411 if (strcmp (pass->name, "shorten") == 0)
kono
parents: 67
diff changeset
2412 INSN_ADDRESSES_ALLOC (get_max_uid ());
kono
parents: 67
diff changeset
2413
kono
parents: 67
diff changeset
2414 /* Update the cfg hooks as appropriate. */
kono
parents: 67
diff changeset
2415 if (strcmp (pass->name, "into_cfglayout") == 0)
kono
parents: 67
diff changeset
2416 {
kono
parents: 67
diff changeset
2417 cfg_layout_rtl_register_cfg_hooks ();
kono
parents: 67
diff changeset
2418 cfun->curr_properties |= PROP_cfglayout;
kono
parents: 67
diff changeset
2419 }
kono
parents: 67
diff changeset
2420 if (strcmp (pass->name, "outof_cfglayout") == 0)
kono
parents: 67
diff changeset
2421 {
kono
parents: 67
diff changeset
2422 rtl_register_cfg_hooks ();
kono
parents: 67
diff changeset
2423 cfun->curr_properties &= ~PROP_cfglayout;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2424 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2425 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2426
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2427 /* Execute PASS. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2428
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2429 bool
111
kono
parents: 67
diff changeset
2430 execute_one_pass (opt_pass *pass)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2431 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2432 unsigned int todo_after = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2433
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2434 bool gate_status;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2435
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2436 /* IPA passes are executed on whole program, so cfun should be NULL.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2437 Other passes need function context set. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2438 if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2439 gcc_assert (!cfun && !current_function_decl);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2440 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2441 gcc_assert (cfun && current_function_decl);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2442
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2443 current_pass = pass;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2444
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2445 /* Check whether gate check should be avoided.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2446 User controls the value of the gate through the parameter "gate_status". */
111
kono
parents: 67
diff changeset
2447 gate_status = pass->gate (cfun);
kono
parents: 67
diff changeset
2448 gate_status = override_gate_status (pass, current_function_decl, gate_status);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2449
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2450 /* Override gate with plugin. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2451 invoke_plugin_callbacks (PLUGIN_OVERRIDE_GATE, &gate_status);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2452
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2453 if (!gate_status)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2454 {
111
kono
parents: 67
diff changeset
2455 /* Run so passes selectively disabling themselves on a given function
kono
parents: 67
diff changeset
2456 are not miscounted. */
kono
parents: 67
diff changeset
2457 if (profile_report && cfun && (cfun->curr_properties & PROP_cfg))
kono
parents: 67
diff changeset
2458 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2459 check_profile_consistency (pass->static_pass_number, false);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2460 account_profile (pass->static_pass_number, false);
111
kono
parents: 67
diff changeset
2461 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2462 current_pass = NULL;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2463 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2464 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2465
111
kono
parents: 67
diff changeset
2466 if (should_skip_pass_p (pass))
kono
parents: 67
diff changeset
2467 {
kono
parents: 67
diff changeset
2468 skip_pass (pass);
kono
parents: 67
diff changeset
2469 return true;
kono
parents: 67
diff changeset
2470 }
kono
parents: 67
diff changeset
2471
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2472 /* Pass execution event trigger: useful to identify passes being
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2473 executed. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2474 invoke_plugin_callbacks (PLUGIN_PASS_EXECUTION, pass);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2475
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2476 if (!quiet_flag && !cfun)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2477 fprintf (stderr, " <%s>", pass->name ? pass->name : "");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2478
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2479 /* Note that the folders should only create gimple expressions.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2480 This is a hack until the new folder is ready. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2481 in_gimple_form = (cfun && (cfun->curr_properties & PROP_trees)) != 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2482
111
kono
parents: 67
diff changeset
2483 pass_init_dump_file (pass);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2484
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2485 /* If a timevar is present, start it. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2486 if (pass->tv_id != TV_NONE)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2487 timevar_push (pass->tv_id);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2488
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2489 if (profile_report && cfun && (cfun->curr_properties & PROP_cfg))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2490 check_profile_consistency (pass->static_pass_number, true);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2491
111
kono
parents: 67
diff changeset
2492 /* Run pre-pass verification. */
kono
parents: 67
diff changeset
2493 execute_todo (pass->todo_flags_start);
kono
parents: 67
diff changeset
2494
kono
parents: 67
diff changeset
2495 if (flag_checking)
kono
parents: 67
diff changeset
2496 do_per_function (verify_curr_properties,
kono
parents: 67
diff changeset
2497 (void *)(size_t)pass->properties_required);
kono
parents: 67
diff changeset
2498
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2499 /* Do it! */
111
kono
parents: 67
diff changeset
2500 todo_after = pass->execute (cfun);
kono
parents: 67
diff changeset
2501
kono
parents: 67
diff changeset
2502 if (todo_after & TODO_discard_function)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2503 {
111
kono
parents: 67
diff changeset
2504 /* Stop timevar. */
kono
parents: 67
diff changeset
2505 if (pass->tv_id != TV_NONE)
kono
parents: 67
diff changeset
2506 timevar_pop (pass->tv_id);
kono
parents: 67
diff changeset
2507
kono
parents: 67
diff changeset
2508 pass_fini_dump_file (pass);
kono
parents: 67
diff changeset
2509
kono
parents: 67
diff changeset
2510 gcc_assert (cfun);
kono
parents: 67
diff changeset
2511 /* As cgraph_node::release_body expects release dominators info,
kono
parents: 67
diff changeset
2512 we have to release it. */
kono
parents: 67
diff changeset
2513 if (dom_info_available_p (CDI_DOMINATORS))
kono
parents: 67
diff changeset
2514 free_dominance_info (CDI_DOMINATORS);
kono
parents: 67
diff changeset
2515
kono
parents: 67
diff changeset
2516 if (dom_info_available_p (CDI_POST_DOMINATORS))
kono
parents: 67
diff changeset
2517 free_dominance_info (CDI_POST_DOMINATORS);
kono
parents: 67
diff changeset
2518
kono
parents: 67
diff changeset
2519 tree fn = cfun->decl;
kono
parents: 67
diff changeset
2520 pop_cfun ();
kono
parents: 67
diff changeset
2521 gcc_assert (!cfun);
kono
parents: 67
diff changeset
2522 cgraph_node::get (fn)->release_body ();
kono
parents: 67
diff changeset
2523
kono
parents: 67
diff changeset
2524 current_pass = NULL;
kono
parents: 67
diff changeset
2525 redirect_edge_var_map_empty ();
kono
parents: 67
diff changeset
2526
kono
parents: 67
diff changeset
2527 ggc_collect ();
kono
parents: 67
diff changeset
2528
kono
parents: 67
diff changeset
2529 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2530 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2531
111
kono
parents: 67
diff changeset
2532 do_per_function (clear_last_verified, NULL);
kono
parents: 67
diff changeset
2533
kono
parents: 67
diff changeset
2534 do_per_function (update_properties_after_pass, pass);
kono
parents: 67
diff changeset
2535
kono
parents: 67
diff changeset
2536 /* Run post-pass cleanup and verification. */
kono
parents: 67
diff changeset
2537 execute_todo (todo_after | pass->todo_flags_finish | TODO_verify_il);
kono
parents: 67
diff changeset
2538 if (profile_report && cfun && (cfun->curr_properties & PROP_cfg))
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2539 account_profile (pass->static_pass_number, true);
111
kono
parents: 67
diff changeset
2540
kono
parents: 67
diff changeset
2541 verify_interpass_invariants ();
kono
parents: 67
diff changeset
2542
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2543 /* Stop timevar. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2544 if (pass->tv_id != TV_NONE)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2545 timevar_pop (pass->tv_id);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2546
111
kono
parents: 67
diff changeset
2547 if (pass->type == IPA_PASS
kono
parents: 67
diff changeset
2548 && ((ipa_opt_pass_d *)pass)->function_transform)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2549 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2550 struct cgraph_node *node;
111
kono
parents: 67
diff changeset
2551 FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node)
kono
parents: 67
diff changeset
2552 node->ipa_transforms_to_apply.safe_push ((ipa_opt_pass_d *)pass);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2553 }
111
kono
parents: 67
diff changeset
2554 else if (dump_file)
kono
parents: 67
diff changeset
2555 do_per_function (execute_function_dump, pass);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2556
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2557 if (!current_function_decl)
111
kono
parents: 67
diff changeset
2558 symtab->process_new_functions ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2559
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2560 pass_fini_dump_file (pass);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2561
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2562 if (pass->type != SIMPLE_IPA_PASS && pass->type != IPA_PASS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2563 gcc_assert (!(cfun->curr_properties & PROP_trees)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2564 || pass->type != RTL_PASS);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2565
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2566 current_pass = NULL;
111
kono
parents: 67
diff changeset
2567 redirect_edge_var_map_empty ();
kono
parents: 67
diff changeset
2568
kono
parents: 67
diff changeset
2569 /* Signal this is a suitable GC collection point. */
kono
parents: 67
diff changeset
2570 if (!((todo_after | pass->todo_flags_finish) & TODO_do_not_ggc_collect))
kono
parents: 67
diff changeset
2571 ggc_collect ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2572
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2573 if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2574 report_heap_memory_use ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2575 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2576 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2577
111
kono
parents: 67
diff changeset
2578 static void
kono
parents: 67
diff changeset
2579 execute_pass_list_1 (opt_pass *pass)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2580 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2581 do
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2582 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2583 gcc_assert (pass->type == GIMPLE_PASS
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2584 || pass->type == RTL_PASS);
111
kono
parents: 67
diff changeset
2585
kono
parents: 67
diff changeset
2586 if (cfun == NULL)
kono
parents: 67
diff changeset
2587 return;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2588 if (execute_one_pass (pass) && pass->sub)
111
kono
parents: 67
diff changeset
2589 execute_pass_list_1 (pass->sub);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2590 pass = pass->next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2591 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2592 while (pass);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2593 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2594
111
kono
parents: 67
diff changeset
2595 void
kono
parents: 67
diff changeset
2596 execute_pass_list (function *fn, opt_pass *pass)
kono
parents: 67
diff changeset
2597 {
kono
parents: 67
diff changeset
2598 gcc_assert (fn == cfun);
kono
parents: 67
diff changeset
2599 execute_pass_list_1 (pass);
kono
parents: 67
diff changeset
2600 if (cfun && fn->cfg)
kono
parents: 67
diff changeset
2601 {
kono
parents: 67
diff changeset
2602 free_dominance_info (CDI_DOMINATORS);
kono
parents: 67
diff changeset
2603 free_dominance_info (CDI_POST_DOMINATORS);
kono
parents: 67
diff changeset
2604 }
kono
parents: 67
diff changeset
2605 }
kono
parents: 67
diff changeset
2606
kono
parents: 67
diff changeset
2607 /* Write out all LTO data. */
kono
parents: 67
diff changeset
2608 static void
kono
parents: 67
diff changeset
2609 write_lto (void)
kono
parents: 67
diff changeset
2610 {
kono
parents: 67
diff changeset
2611 timevar_push (TV_IPA_LTO_GIMPLE_OUT);
kono
parents: 67
diff changeset
2612 lto_output ();
kono
parents: 67
diff changeset
2613 timevar_pop (TV_IPA_LTO_GIMPLE_OUT);
kono
parents: 67
diff changeset
2614 timevar_push (TV_IPA_LTO_DECL_OUT);
kono
parents: 67
diff changeset
2615 produce_asm_for_decls ();
kono
parents: 67
diff changeset
2616 timevar_pop (TV_IPA_LTO_DECL_OUT);
kono
parents: 67
diff changeset
2617 }
kono
parents: 67
diff changeset
2618
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2619 /* Same as execute_pass_list but assume that subpasses of IPA passes
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2620 are local passes. If SET is not NULL, write out summaries of only
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2621 those node in SET. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2622
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2623 static void
111
kono
parents: 67
diff changeset
2624 ipa_write_summaries_2 (opt_pass *pass, struct lto_out_decl_state *state)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2625 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2626 while (pass)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2627 {
111
kono
parents: 67
diff changeset
2628 ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *)pass;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2629 gcc_assert (!current_function_decl);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2630 gcc_assert (!cfun);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2631 gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2632 if (pass->type == IPA_PASS
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2633 && ipa_pass->write_summary
111
kono
parents: 67
diff changeset
2634 && pass->gate (cfun))
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2635 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2636 /* If a timevar is present, start it. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2637 if (pass->tv_id)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2638 timevar_push (pass->tv_id);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2639
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2640 pass_init_dump_file (pass);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2641
111
kono
parents: 67
diff changeset
2642 current_pass = pass;
kono
parents: 67
diff changeset
2643 ipa_pass->write_summary ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2644
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2645 pass_fini_dump_file (pass);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2646
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2647 /* If a timevar is present, start it. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2648 if (pass->tv_id)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2649 timevar_pop (pass->tv_id);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2650 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2651
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2652 if (pass->sub && pass->sub->type != GIMPLE_PASS)
111
kono
parents: 67
diff changeset
2653 ipa_write_summaries_2 (pass->sub, state);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2654
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2655 pass = pass->next;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2656 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2657 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2658
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2659 /* Helper function of ipa_write_summaries. Creates and destroys the
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2660 decl state and calls ipa_write_summaries_2 for all passes that have
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2661 summaries. SET is the set of nodes to be written. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2662
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2663 static void
111
kono
parents: 67
diff changeset
2664 ipa_write_summaries_1 (lto_symtab_encoder_t encoder)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2665 {
111
kono
parents: 67
diff changeset
2666 pass_manager *passes = g->get_passes ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2667 struct lto_out_decl_state *state = lto_new_out_decl_state ();
111
kono
parents: 67
diff changeset
2668 state->symtab_node_encoder = encoder;
kono
parents: 67
diff changeset
2669
kono
parents: 67
diff changeset
2670 lto_output_init_mode_table ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2671 lto_push_out_decl_state (state);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2672
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2673 gcc_assert (!flag_wpa);
111
kono
parents: 67
diff changeset
2674 ipa_write_summaries_2 (passes->all_regular_ipa_passes, state);
kono
parents: 67
diff changeset
2675
kono
parents: 67
diff changeset
2676 write_lto ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2677
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2678 gcc_assert (lto_get_out_decl_state () == state);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2679 lto_pop_out_decl_state ();
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2680 lto_delete_out_decl_state (state);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2681 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2682
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2683 /* Write out summaries for all the nodes in the callgraph. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2684
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2685 void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2686 ipa_write_summaries (void)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2687 {
111
kono
parents: 67
diff changeset
2688 lto_symtab_encoder_t encoder;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2689 int i, order_pos;
111
kono
parents: 67
diff changeset
2690 varpool_node *vnode;
kono
parents: 67
diff changeset
2691 struct cgraph_node *node;
kono
parents: 67
diff changeset
2692 struct cgraph_node **order;
kono
parents: 67
diff changeset
2693
kono
parents: 67
diff changeset
2694 if ((!flag_generate_lto && !flag_generate_offload) || seen_error ())
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2695 return;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2696
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2697 gcc_assert (!dump_file);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2698 streamer_dump_file = dump_begin (TDI_lto_stream_out, NULL);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2699
111
kono
parents: 67
diff changeset
2700 select_what_to_stream ();
kono
parents: 67
diff changeset
2701
kono
parents: 67
diff changeset
2702 encoder = lto_symtab_encoder_new (false);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2703
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2704 /* Create the callgraph set in the same order used in
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2705 cgraph_expand_all_functions. This mostly facilitates debugging,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2706 since it causes the gimple file to be processed in the same order
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2707 as the source code. */
111
kono
parents: 67
diff changeset
2708 order = XCNEWVEC (struct cgraph_node *, symtab->cgraph_count);
kono
parents: 67
diff changeset
2709 order_pos = ipa_reverse_postorder (order);
kono
parents: 67
diff changeset
2710 gcc_assert (order_pos == symtab->cgraph_count);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2711
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2712 for (i = order_pos - 1; i >= 0; i--)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2713 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2714 struct cgraph_node *node = order[i];
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2715
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2716 if (node->definition && node->need_lto_streaming)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2717 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2718 if (gimple_has_body_p (node->decl))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2719 lto_prepare_function_for_streaming (node);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2720 lto_set_symtab_encoder_in_partition (encoder, node);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2721 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2722 }
111
kono
parents: 67
diff changeset
2723
kono
parents: 67
diff changeset
2724 FOR_EACH_DEFINED_FUNCTION (node)
kono
parents: 67
diff changeset
2725 if (node->alias && node->need_lto_streaming)
kono
parents: 67
diff changeset
2726 lto_set_symtab_encoder_in_partition (encoder, node);
kono
parents: 67
diff changeset
2727 FOR_EACH_DEFINED_VARIABLE (vnode)
kono
parents: 67
diff changeset
2728 if (vnode->need_lto_streaming)
kono
parents: 67
diff changeset
2729 lto_set_symtab_encoder_in_partition (encoder, vnode);
kono
parents: 67
diff changeset
2730
kono
parents: 67
diff changeset
2731 ipa_write_summaries_1 (compute_ltrans_boundary (encoder));
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2732
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2733 free (order);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2734 if (streamer_dump_file)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2735 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2736 dump_end (TDI_lto_stream_out, streamer_dump_file);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2737 streamer_dump_file = NULL;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2738 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2739 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2740
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2741 /* Same as execute_pass_list but assume that subpasses of IPA passes
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2742 are local passes. If SET is not NULL, write out optimization summaries of
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2743 only those node in SET. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2744
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2745 static void
111
kono
parents: 67
diff changeset
2746 ipa_write_optimization_summaries_1 (opt_pass *pass,
kono
parents: 67
diff changeset
2747 struct lto_out_decl_state *state)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2748 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2749 while (pass)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2750 {
111
kono
parents: 67
diff changeset
2751 ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *)pass;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2752 gcc_assert (!current_function_decl);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2753 gcc_assert (!cfun);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2754 gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2755 if (pass->type == IPA_PASS
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2756 && ipa_pass->write_optimization_summary
111
kono
parents: 67
diff changeset
2757 && pass->gate (cfun))
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2758 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2759 /* If a timevar is present, start it. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2760 if (pass->tv_id)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2761 timevar_push (pass->tv_id);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2762
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2763 pass_init_dump_file (pass);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2764
111
kono
parents: 67
diff changeset
2765 current_pass = pass;
kono
parents: 67
diff changeset
2766 ipa_pass->write_optimization_summary ();
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2767
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2768 pass_fini_dump_file (pass);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2769
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2770 /* If a timevar is present, start it. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2771 if (pass->tv_id)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2772 timevar_pop (pass->tv_id);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2773 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2774
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2775 if (pass->sub && pass->sub->type != GIMPLE_PASS)
111
kono
parents: 67
diff changeset
2776 ipa_write_optimization_summaries_1 (pass->sub, state);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2777
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2778 pass = pass->next;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2779 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2780 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2781
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2782 /* Write all the optimization summaries for the cgraph nodes in SET. If SET is
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2783 NULL, write out all summaries of all nodes. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2784
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2785 void
111
kono
parents: 67
diff changeset
2786 ipa_write_optimization_summaries (lto_symtab_encoder_t encoder)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2787 {
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2788 struct lto_out_decl_state *state = lto_new_out_decl_state ();
111
kono
parents: 67
diff changeset
2789 state->symtab_node_encoder = encoder;
kono
parents: 67
diff changeset
2790
kono
parents: 67
diff changeset
2791 lto_output_init_mode_table ();
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2792 lto_push_out_decl_state (state);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2793
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2794 /* Be sure that we did not forget to renumber stmt uids. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2795 gcc_checking_assert (flag_wpa);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2796
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2797 gcc_assert (flag_wpa);
111
kono
parents: 67
diff changeset
2798 pass_manager *passes = g->get_passes ();
kono
parents: 67
diff changeset
2799 ipa_write_optimization_summaries_1 (passes->all_regular_ipa_passes, state);
kono
parents: 67
diff changeset
2800
kono
parents: 67
diff changeset
2801 write_lto ();
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2802
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2803 gcc_assert (lto_get_out_decl_state () == state);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2804 lto_pop_out_decl_state ();
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2805 lto_delete_out_decl_state (state);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2806 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2807
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2808 /* Same as execute_pass_list but assume that subpasses of IPA passes
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2809 are local passes. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2810
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2811 static void
111
kono
parents: 67
diff changeset
2812 ipa_read_summaries_1 (opt_pass *pass)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2813 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2814 while (pass)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2815 {
111
kono
parents: 67
diff changeset
2816 ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *) pass;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2817
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2818 gcc_assert (!current_function_decl);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2819 gcc_assert (!cfun);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2820 gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2821
111
kono
parents: 67
diff changeset
2822 if (pass->gate (cfun))
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2823 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2824 if (pass->type == IPA_PASS && ipa_pass->read_summary)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2825 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2826 /* If a timevar is present, start it. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2827 if (pass->tv_id)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2828 timevar_push (pass->tv_id);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2829 if (!quiet_flag)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2830 fprintf (stderr, " <%s>", pass->name ? pass->name : "");
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2831
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2832 pass_init_dump_file (pass);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2833
111
kono
parents: 67
diff changeset
2834 current_pass = pass;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2835 ipa_pass->read_summary ();
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2836
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2837 pass_fini_dump_file (pass);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2838
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2839 /* Stop timevar. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2840 if (pass->tv_id)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2841 timevar_pop (pass->tv_id);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2842 ggc_grow ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2843 report_heap_memory_use ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2844 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2845
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2846 if (pass->sub && pass->sub->type != GIMPLE_PASS)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2847 ipa_read_summaries_1 (pass->sub);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2848 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2849 pass = pass->next;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2850 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2851 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2852
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2853
111
kono
parents: 67
diff changeset
2854 /* Read all the summaries for all_regular_ipa_passes. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2855
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2856 void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2857 ipa_read_summaries (void)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2858 {
111
kono
parents: 67
diff changeset
2859 pass_manager *passes = g->get_passes ();
kono
parents: 67
diff changeset
2860 ipa_read_summaries_1 (passes->all_regular_ipa_passes);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2861 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2862
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2863 /* Same as execute_pass_list but assume that subpasses of IPA passes
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2864 are local passes. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2865
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2866 static void
111
kono
parents: 67
diff changeset
2867 ipa_read_optimization_summaries_1 (opt_pass *pass)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2868 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2869 while (pass)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2870 {
111
kono
parents: 67
diff changeset
2871 ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *) pass;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2872
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2873 gcc_assert (!current_function_decl);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2874 gcc_assert (!cfun);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2875 gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2876
111
kono
parents: 67
diff changeset
2877 if (pass->gate (cfun))
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2878 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2879 if (pass->type == IPA_PASS && ipa_pass->read_optimization_summary)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2880 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2881 /* If a timevar is present, start it. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2882 if (pass->tv_id)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2883 timevar_push (pass->tv_id);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2884 if (!quiet_flag)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2885 fprintf (stderr, " <%s>", pass->name ? pass->name : "");
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2886
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2887 pass_init_dump_file (pass);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2888
111
kono
parents: 67
diff changeset
2889 current_pass = pass;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2890 ipa_pass->read_optimization_summary ();
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2891
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2892 pass_fini_dump_file (pass);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2893
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2894 /* Stop timevar. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2895 if (pass->tv_id)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2896 timevar_pop (pass->tv_id);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2897 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2898
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2899 if (pass->sub && pass->sub->type != GIMPLE_PASS)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2900 ipa_read_optimization_summaries_1 (pass->sub);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2901 ggc_grow ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2902 report_heap_memory_use ();
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2903 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2904 pass = pass->next;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2905 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2906 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2907
111
kono
parents: 67
diff changeset
2908 /* Read all the summaries for all_regular_ipa_passes. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2909
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2910 void
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2911 ipa_read_optimization_summaries (void)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2912 {
111
kono
parents: 67
diff changeset
2913 pass_manager *passes = g->get_passes ();
kono
parents: 67
diff changeset
2914 ipa_read_optimization_summaries_1 (passes->all_regular_ipa_passes);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2915 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2916
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2917 /* Same as execute_pass_list but assume that subpasses of IPA passes
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2918 are local passes. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2919 void
111
kono
parents: 67
diff changeset
2920 execute_ipa_pass_list (opt_pass *pass)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2921 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2922 do
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2923 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2924 gcc_assert (!current_function_decl);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2925 gcc_assert (!cfun);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2926 gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2927 if (execute_one_pass (pass) && pass->sub)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2928 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2929 if (pass->sub->type == GIMPLE_PASS)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2930 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2931 invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_START, NULL);
111
kono
parents: 67
diff changeset
2932 do_per_function_toporder ((void (*)(function *, void *))
kono
parents: 67
diff changeset
2933 execute_pass_list,
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2934 pass->sub);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2935 invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_END, NULL);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2936 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2937 else if (pass->sub->type == SIMPLE_IPA_PASS
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2938 || pass->sub->type == IPA_PASS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2939 execute_ipa_pass_list (pass->sub);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2940 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2941 gcc_unreachable ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2942 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2943 gcc_assert (!current_function_decl);
111
kono
parents: 67
diff changeset
2944 symtab->process_new_functions ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2945 pass = pass->next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2946 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2947 while (pass);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2948 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2949
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2950 /* Execute stmt fixup hooks of all passes in PASS for NODE and STMTS. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2951
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2952 static void
111
kono
parents: 67
diff changeset
2953 execute_ipa_stmt_fixups (opt_pass *pass,
kono
parents: 67
diff changeset
2954 struct cgraph_node *node, gimple **stmts)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2955 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2956 while (pass)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2957 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2958 /* Execute all of the IPA_PASSes in the list. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2959 if (pass->type == IPA_PASS
111
kono
parents: 67
diff changeset
2960 && pass->gate (cfun))
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2961 {
111
kono
parents: 67
diff changeset
2962 ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *) pass;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2963
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2964 if (ipa_pass->stmt_fixup)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2965 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2966 pass_init_dump_file (pass);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2967 /* If a timevar is present, start it. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2968 if (pass->tv_id)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2969 timevar_push (pass->tv_id);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2970
111
kono
parents: 67
diff changeset
2971 current_pass = pass;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2972 ipa_pass->stmt_fixup (node, stmts);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2973
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2974 /* Stop timevar. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2975 if (pass->tv_id)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2976 timevar_pop (pass->tv_id);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2977 pass_fini_dump_file (pass);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2978 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2979 if (pass->sub)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2980 execute_ipa_stmt_fixups (pass->sub, node, stmts);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2981 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2982 pass = pass->next;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2983 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2984 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2985
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2986 /* Execute stmt fixup hooks of all IPA passes for NODE and STMTS. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2987
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2988 void
111
kono
parents: 67
diff changeset
2989 execute_all_ipa_stmt_fixups (struct cgraph_node *node, gimple **stmts)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2990 {
111
kono
parents: 67
diff changeset
2991 pass_manager *passes = g->get_passes ();
kono
parents: 67
diff changeset
2992 execute_ipa_stmt_fixups (passes->all_regular_ipa_passes, node, stmts);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2993 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2994
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2995
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2996 extern void debug_properties (unsigned int);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2997 extern void dump_properties (FILE *, unsigned int);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2998
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2999 DEBUG_FUNCTION void
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3000 dump_properties (FILE *dump, unsigned int props)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3001 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3002 fprintf (dump, "Properties:\n");
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3003 if (props & PROP_gimple_any)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3004 fprintf (dump, "PROP_gimple_any\n");
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3005 if (props & PROP_gimple_lcf)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3006 fprintf (dump, "PROP_gimple_lcf\n");
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3007 if (props & PROP_gimple_leh)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3008 fprintf (dump, "PROP_gimple_leh\n");
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3009 if (props & PROP_cfg)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3010 fprintf (dump, "PROP_cfg\n");
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3011 if (props & PROP_ssa)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3012 fprintf (dump, "PROP_ssa\n");
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3013 if (props & PROP_no_crit_edges)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3014 fprintf (dump, "PROP_no_crit_edges\n");
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3015 if (props & PROP_rtl)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3016 fprintf (dump, "PROP_rtl\n");
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3017 if (props & PROP_gimple_lomp)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3018 fprintf (dump, "PROP_gimple_lomp\n");
111
kono
parents: 67
diff changeset
3019 if (props & PROP_gimple_lomp_dev)
kono
parents: 67
diff changeset
3020 fprintf (dump, "PROP_gimple_lomp_dev\n");
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
3021 if (props & PROP_gimple_lcx)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
3022 fprintf (dump, "PROP_gimple_lcx\n");
111
kono
parents: 67
diff changeset
3023 if (props & PROP_gimple_lvec)
kono
parents: 67
diff changeset
3024 fprintf (dump, "PROP_gimple_lvec\n");
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
3025 if (props & PROP_cfglayout)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
3026 fprintf (dump, "PROP_cfglayout\n");
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3027 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3028
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
3029 DEBUG_FUNCTION void
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3030 debug_properties (unsigned int props)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3031 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3032 dump_properties (stderr, props);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3033 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3034
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3035 /* Called by local passes to see if function is called by already processed nodes.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3036 Because we process nodes in topological order, this means that function is
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3037 in recursive cycle or we introduced new direct calls. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3038 bool
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3039 function_called_by_processed_nodes_p (void)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3040 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3041 struct cgraph_edge *e;
111
kono
parents: 67
diff changeset
3042 for (e = cgraph_node::get (current_function_decl)->callers;
kono
parents: 67
diff changeset
3043 e;
kono
parents: 67
diff changeset
3044 e = e->next_caller)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3045 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3046 if (e->caller->decl == current_function_decl)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3047 continue;
111
kono
parents: 67
diff changeset
3048 if (!e->caller->has_gimple_body_p ())
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3049 continue;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3050 if (TREE_ASM_WRITTEN (e->caller->decl))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3051 continue;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
3052 if (!e->caller->process && !e->caller->inlined_to)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3053 break;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3054 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3055 if (dump_file && e)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3056 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3057 fprintf (dump_file, "Already processed call to:\n");
111
kono
parents: 67
diff changeset
3058 e->caller->dump (dump_file);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3059 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3060 return e != NULL;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3061 }