annotate gcc/gimple-low.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
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 /* GIMPLE lowering pass. Converts High GIMPLE into Low GIMPLE.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
3 Copyright (C) 2003-2020 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 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
8 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
9 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
10 version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 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
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 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
15 for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 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
18 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #include "config.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 #include "system.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 #include "coretypes.h"
111
kono
parents: 67
diff changeset
24 #include "backend.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 #include "tree.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 #include "gimple.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 #include "tree-pass.h"
111
kono
parents: 67
diff changeset
28 #include "fold-const.h"
kono
parents: 67
diff changeset
29 #include "tree-nested.h"
kono
parents: 67
diff changeset
30 #include "calls.h"
kono
parents: 67
diff changeset
31 #include "gimple-iterator.h"
kono
parents: 67
diff changeset
32 #include "gimple-low.h"
kono
parents: 67
diff changeset
33 #include "predict.h"
kono
parents: 67
diff changeset
34 #include "gimple-predict.h"
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
35 #include "gimple-fold.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 /* The differences between High GIMPLE and Low GIMPLE are the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 following:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 1- Lexical scopes are removed (i.e., GIMPLE_BIND disappears).
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 2- GIMPLE_TRY and GIMPLE_CATCH are converted to abnormal control
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 flow and exception regions are built as an on-the-side region
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 hierarchy (See tree-eh.c:lower_eh_constructs).
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 3- Multiple identical return statements are grouped into a single
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 return and gotos to the unique return site. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 /* Match a return statement with a label. During lowering, we identify
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 identical return statements and replace duplicates with a jump to
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 the corresponding label. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 struct return_statements_t
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 tree label;
111
kono
parents: 67
diff changeset
55 greturn *stmt;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 typedef struct return_statements_t return_statements_t;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 struct lower_data
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 /* Block the current statement belongs to. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 tree block;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 /* A vector of label and return statements to be moved to the end
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 of the function. */
111
kono
parents: 67
diff changeset
67 vec<return_statements_t> return_statements;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
69 /* True if the current statement cannot fall through. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
70 bool cannot_fallthru;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 static void lower_stmt (gimple_stmt_iterator *, struct lower_data *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 static void lower_gimple_bind (gimple_stmt_iterator *, struct lower_data *);
111
kono
parents: 67
diff changeset
75 static void lower_try_catch (gimple_stmt_iterator *, struct lower_data *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 static void lower_gimple_return (gimple_stmt_iterator *, struct lower_data *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 static void lower_builtin_setjmp (gimple_stmt_iterator *);
111
kono
parents: 67
diff changeset
78 static void lower_builtin_posix_memalign (gimple_stmt_iterator *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 /* Lower the body of current_function_decl from High GIMPLE into Low
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 GIMPLE. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 static unsigned int
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 lower_function_body (void)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 struct lower_data data;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 gimple_seq body = gimple_body (current_function_decl);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 gimple_seq lowered_body;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 gimple_stmt_iterator i;
111
kono
parents: 67
diff changeset
91 gimple *bind;
kono
parents: 67
diff changeset
92 gimple *x;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 /* The gimplifier should've left a body of exactly one statement,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 namely a GIMPLE_BIND. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 gcc_assert (gimple_seq_first (body) == gimple_seq_last (body)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 && gimple_code (gimple_seq_first_stmt (body)) == GIMPLE_BIND);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 memset (&data, 0, sizeof (data));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 data.block = DECL_INITIAL (current_function_decl);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 BLOCK_SUBBLOCKS (data.block) = NULL_TREE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 BLOCK_CHAIN (data.block) = NULL_TREE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 TREE_ASM_WRITTEN (data.block) = 1;
111
kono
parents: 67
diff changeset
104 data.return_statements.create (8);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 bind = gimple_seq_first_stmt (body);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 lowered_body = NULL;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 gimple_seq_add_stmt (&lowered_body, bind);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 i = gsi_start (lowered_body);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 lower_gimple_bind (&i, &data);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 i = gsi_last (lowered_body);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
114 /* If we had begin stmt markers from e.g. PCH, but this compilation
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
115 doesn't want them, lower_stmt will have cleaned them up; we can
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
116 now clear the flag that indicates we had them. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
117 if (!MAY_HAVE_DEBUG_MARKER_STMTS && cfun->debug_nonbind_markers)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
118 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
119 /* This counter needs not be exact, but before lowering it will
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
120 most certainly be. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
121 gcc_assert (cfun->debug_marker_count == 0);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
122 cfun->debug_nonbind_markers = false;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
123 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
124
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 /* If the function falls off the end, we need a null return statement.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 If we've already got one in the return_statements vector, we don't
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 need to do anything special. Otherwise build one by hand. */
111
kono
parents: 67
diff changeset
128 bool may_fallthru = gimple_seq_may_fallthru (lowered_body);
kono
parents: 67
diff changeset
129 if (may_fallthru
kono
parents: 67
diff changeset
130 && (data.return_statements.is_empty ()
kono
parents: 67
diff changeset
131 || (gimple_return_retval (data.return_statements.last().stmt)
kono
parents: 67
diff changeset
132 != NULL)))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 x = gimple_build_return (NULL);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 gimple_set_location (x, cfun->function_end_locus);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 gimple_set_block (x, DECL_INITIAL (current_function_decl));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
111
kono
parents: 67
diff changeset
138 may_fallthru = false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
140
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 /* If we lowered any return statements, emit the representative
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 at the end of the function. */
111
kono
parents: 67
diff changeset
143 while (!data.return_statements.is_empty ())
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 {
111
kono
parents: 67
diff changeset
145 return_statements_t t = data.return_statements.pop ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 x = gimple_build_label (t.label);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 gsi_insert_after (&i, t.stmt, GSI_CONTINUE_LINKING);
111
kono
parents: 67
diff changeset
149 if (may_fallthru)
kono
parents: 67
diff changeset
150 {
kono
parents: 67
diff changeset
151 /* Remove the line number from the representative return statement.
kono
parents: 67
diff changeset
152 It now fills in for the fallthru too. Failure to remove this
kono
parents: 67
diff changeset
153 will result in incorrect results for coverage analysis. */
kono
parents: 67
diff changeset
154 gimple_set_location (t.stmt, UNKNOWN_LOCATION);
kono
parents: 67
diff changeset
155 may_fallthru = false;
kono
parents: 67
diff changeset
156 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158
111
kono
parents: 67
diff changeset
159 /* Once the old body has been lowered, replace it with the new
kono
parents: 67
diff changeset
160 lowered sequence. */
kono
parents: 67
diff changeset
161 gimple_set_body (current_function_decl, lowered_body);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 gcc_assert (data.block == DECL_INITIAL (current_function_decl));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 BLOCK_SUBBLOCKS (data.block)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 = blocks_nreverse (BLOCK_SUBBLOCKS (data.block));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 clear_block_marks (data.block);
111
kono
parents: 67
diff changeset
168 data.return_statements.release ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 return 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171
111
kono
parents: 67
diff changeset
172 namespace {
kono
parents: 67
diff changeset
173
kono
parents: 67
diff changeset
174 const pass_data pass_data_lower_cf =
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 {
111
kono
parents: 67
diff changeset
176 GIMPLE_PASS, /* type */
kono
parents: 67
diff changeset
177 "lower", /* name */
kono
parents: 67
diff changeset
178 OPTGROUP_NONE, /* optinfo_flags */
kono
parents: 67
diff changeset
179 TV_NONE, /* tv_id */
kono
parents: 67
diff changeset
180 PROP_gimple_any, /* properties_required */
kono
parents: 67
diff changeset
181 PROP_gimple_lcf, /* properties_provided */
kono
parents: 67
diff changeset
182 0, /* properties_destroyed */
kono
parents: 67
diff changeset
183 0, /* todo_flags_start */
kono
parents: 67
diff changeset
184 0, /* todo_flags_finish */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186
111
kono
parents: 67
diff changeset
187 class pass_lower_cf : public gimple_opt_pass
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 {
111
kono
parents: 67
diff changeset
189 public:
kono
parents: 67
diff changeset
190 pass_lower_cf (gcc::context *ctxt)
kono
parents: 67
diff changeset
191 : gimple_opt_pass (pass_data_lower_cf, ctxt)
kono
parents: 67
diff changeset
192 {}
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193
111
kono
parents: 67
diff changeset
194 /* opt_pass methods: */
kono
parents: 67
diff changeset
195 virtual unsigned int execute (function *) { return lower_function_body (); }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196
111
kono
parents: 67
diff changeset
197 }; // class pass_lower_cf
kono
parents: 67
diff changeset
198
kono
parents: 67
diff changeset
199 } // anon namespace
kono
parents: 67
diff changeset
200
kono
parents: 67
diff changeset
201 gimple_opt_pass *
kono
parents: 67
diff changeset
202 make_pass_lower_cf (gcc::context *ctxt)
kono
parents: 67
diff changeset
203 {
kono
parents: 67
diff changeset
204 return new pass_lower_cf (ctxt);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 /* Lower sequence SEQ. Unlike gimplification the statements are not relowered
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 when they are changed -- if this has to be done, the lowering routine must
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 do it explicitly. DATA is passed through the recursion. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
210
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 static void
111
kono
parents: 67
diff changeset
212 lower_sequence (gimple_seq *seq, struct lower_data *data)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 gimple_stmt_iterator gsi;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
215
111
kono
parents: 67
diff changeset
216 for (gsi = gsi_start (*seq); !gsi_end_p (gsi); )
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 lower_stmt (&gsi, data);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
219
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
220
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 /* Lower the OpenMP directive statement pointed by GSI. DATA is
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 passed through the recursion. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
223
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
225 lower_omp_directive (gimple_stmt_iterator *gsi, struct lower_data *data)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 {
111
kono
parents: 67
diff changeset
227 gimple *stmt;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
228
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 stmt = gsi_stmt (*gsi);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230
111
kono
parents: 67
diff changeset
231 lower_sequence (gimple_omp_body_ptr (stmt), data);
kono
parents: 67
diff changeset
232 gsi_insert_seq_after (gsi, gimple_omp_body (stmt), GSI_CONTINUE_LINKING);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 gimple_omp_set_body (stmt, NULL);
111
kono
parents: 67
diff changeset
234 gsi_next (gsi);
0
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
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
237
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
238 /* Lower statement GSI. DATA is passed through the recursion. We try to
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
239 track the fallthruness of statements and get rid of unreachable return
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
240 statements in order to prevent the EH lowering pass from adding useless
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
241 edges that can cause bogus warnings to be issued later; this guess need
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
242 not be 100% accurate, simply be conservative and reset cannot_fallthru
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
243 to false if we don't know. */
0
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 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 {
111
kono
parents: 67
diff changeset
248 gimple *stmt = gsi_stmt (*gsi);
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 gimple_set_block (stmt, data->block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
251
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 switch (gimple_code (stmt))
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 case GIMPLE_BIND:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
255 lower_gimple_bind (gsi, data);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
256 /* Propagate fallthruness. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
258
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
259 case GIMPLE_COND:
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
260 case GIMPLE_GOTO:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
261 case GIMPLE_SWITCH:
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
262 data->cannot_fallthru = true;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
263 gsi_next (gsi);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
264 return;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
265
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 case GIMPLE_RETURN:
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
267 if (data->cannot_fallthru)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
268 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
269 gsi_remove (gsi, false);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
270 /* Propagate fallthruness. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
271 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
272 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
273 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
274 lower_gimple_return (gsi, data);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
275 data->cannot_fallthru = true;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
276 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 case GIMPLE_TRY:
111
kono
parents: 67
diff changeset
280 if (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH)
kono
parents: 67
diff changeset
281 lower_try_catch (gsi, data);
kono
parents: 67
diff changeset
282 else
kono
parents: 67
diff changeset
283 {
kono
parents: 67
diff changeset
284 /* It must be a GIMPLE_TRY_FINALLY. */
kono
parents: 67
diff changeset
285 bool cannot_fallthru;
kono
parents: 67
diff changeset
286 lower_sequence (gimple_try_eval_ptr (stmt), data);
kono
parents: 67
diff changeset
287 cannot_fallthru = data->cannot_fallthru;
kono
parents: 67
diff changeset
288
kono
parents: 67
diff changeset
289 /* The finally clause is always executed after the try clause,
kono
parents: 67
diff changeset
290 so if it does not fall through, then the try-finally will not
kono
parents: 67
diff changeset
291 fall through. Otherwise, if the try clause does not fall
kono
parents: 67
diff changeset
292 through, then when the finally clause falls through it will
kono
parents: 67
diff changeset
293 resume execution wherever the try clause was going. So the
kono
parents: 67
diff changeset
294 whole try-finally will only fall through if both the try
kono
parents: 67
diff changeset
295 clause and the finally clause fall through. */
kono
parents: 67
diff changeset
296 data->cannot_fallthru = false;
kono
parents: 67
diff changeset
297 lower_sequence (gimple_try_cleanup_ptr (stmt), data);
kono
parents: 67
diff changeset
298 data->cannot_fallthru |= cannot_fallthru;
kono
parents: 67
diff changeset
299 gsi_next (gsi);
kono
parents: 67
diff changeset
300 }
kono
parents: 67
diff changeset
301 return;
kono
parents: 67
diff changeset
302
kono
parents: 67
diff changeset
303 case GIMPLE_EH_ELSE:
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
304 {
111
kono
parents: 67
diff changeset
305 geh_else *eh_else_stmt = as_a <geh_else *> (stmt);
kono
parents: 67
diff changeset
306 lower_sequence (gimple_eh_else_n_body_ptr (eh_else_stmt), data);
kono
parents: 67
diff changeset
307 lower_sequence (gimple_eh_else_e_body_ptr (eh_else_stmt), data);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
308 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
309 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
310
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
311 case GIMPLE_DEBUG:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
312 gcc_checking_assert (cfun->debug_nonbind_markers);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
313 /* We can't possibly have debug bind stmts before lowering, we
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
314 first emit them when entering SSA. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
315 gcc_checking_assert (gimple_debug_nonbind_marker_p (stmt));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
316 /* Propagate fallthruness. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
317 /* If the function (e.g. from PCH) had debug stmts, but they're
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
318 disabled for this compilation, remove them. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
319 if (!MAY_HAVE_DEBUG_MARKER_STMTS)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
320 gsi_remove (gsi, true);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
321 else
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
322 gsi_next (gsi);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
323 return;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
324
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
325 case GIMPLE_NOP:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
326 case GIMPLE_ASM:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
327 case GIMPLE_ASSIGN:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
328 case GIMPLE_PREDICT:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
329 case GIMPLE_LABEL:
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
330 case GIMPLE_EH_MUST_NOT_THROW:
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
331 case GIMPLE_OMP_FOR:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
332 case GIMPLE_OMP_SECTIONS:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
333 case GIMPLE_OMP_SECTIONS_SWITCH:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
334 case GIMPLE_OMP_SECTION:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
335 case GIMPLE_OMP_SINGLE:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
336 case GIMPLE_OMP_MASTER:
111
kono
parents: 67
diff changeset
337 case GIMPLE_OMP_TASKGROUP:
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
338 case GIMPLE_OMP_ORDERED:
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
339 case GIMPLE_OMP_SCAN:
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
340 case GIMPLE_OMP_CRITICAL:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
341 case GIMPLE_OMP_RETURN:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
342 case GIMPLE_OMP_ATOMIC_LOAD:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
343 case GIMPLE_OMP_ATOMIC_STORE:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
344 case GIMPLE_OMP_CONTINUE:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
345 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
346
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
347 case GIMPLE_CALL:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
349 tree decl = gimple_call_fndecl (stmt);
111
kono
parents: 67
diff changeset
350 unsigned i;
kono
parents: 67
diff changeset
351
kono
parents: 67
diff changeset
352 for (i = 0; i < gimple_call_num_args (stmt); i++)
kono
parents: 67
diff changeset
353 {
kono
parents: 67
diff changeset
354 tree arg = gimple_call_arg (stmt, i);
kono
parents: 67
diff changeset
355 if (EXPR_P (arg))
kono
parents: 67
diff changeset
356 TREE_SET_BLOCK (arg, data->block);
kono
parents: 67
diff changeset
357 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
358
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
359 if (decl
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
360 && fndecl_built_in_p (decl, BUILT_IN_NORMAL))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
361 {
111
kono
parents: 67
diff changeset
362 if (DECL_FUNCTION_CODE (decl) == BUILT_IN_SETJMP)
kono
parents: 67
diff changeset
363 {
kono
parents: 67
diff changeset
364 lower_builtin_setjmp (gsi);
kono
parents: 67
diff changeset
365 data->cannot_fallthru = false;
kono
parents: 67
diff changeset
366 return;
kono
parents: 67
diff changeset
367 }
kono
parents: 67
diff changeset
368 else if (DECL_FUNCTION_CODE (decl) == BUILT_IN_POSIX_MEMALIGN
kono
parents: 67
diff changeset
369 && flag_tree_bit_ccp
kono
parents: 67
diff changeset
370 && gimple_builtin_call_types_compatible_p (stmt, decl))
kono
parents: 67
diff changeset
371 {
kono
parents: 67
diff changeset
372 lower_builtin_posix_memalign (gsi);
kono
parents: 67
diff changeset
373 return;
kono
parents: 67
diff changeset
374 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
375 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
376
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
377 if (decl && (flags_from_decl_or_type (decl) & ECF_NORETURN))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
378 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
379 data->cannot_fallthru = true;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
380 gsi_next (gsi);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
381 return;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
382 }
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
383
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
384 /* We delay folding of built calls from gimplification to
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
385 here so the IL is in consistent state for the diagnostic
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
386 machineries job. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
387 if (gimple_call_builtin_p (stmt))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
388 fold_stmt (gsi);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
389 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
390 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
391
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
392 case GIMPLE_OMP_PARALLEL:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
393 case GIMPLE_OMP_TASK:
111
kono
parents: 67
diff changeset
394 case GIMPLE_OMP_TARGET:
kono
parents: 67
diff changeset
395 case GIMPLE_OMP_TEAMS:
kono
parents: 67
diff changeset
396 case GIMPLE_OMP_GRID_BODY:
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
397 data->cannot_fallthru = false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 lower_omp_directive (gsi, data);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
399 data->cannot_fallthru = false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
400 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
401
111
kono
parents: 67
diff changeset
402 case GIMPLE_TRANSACTION:
kono
parents: 67
diff changeset
403 lower_sequence (gimple_transaction_body_ptr (
kono
parents: 67
diff changeset
404 as_a <gtransaction *> (stmt)),
kono
parents: 67
diff changeset
405 data);
kono
parents: 67
diff changeset
406 break;
kono
parents: 67
diff changeset
407
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
408 default:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
409 gcc_unreachable ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
410 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
411
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
412 data->cannot_fallthru = false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
413 gsi_next (gsi);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
414 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
415
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
416 /* Lower a bind_expr TSI. DATA is passed through the recursion. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
417
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
418 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
419 lower_gimple_bind (gimple_stmt_iterator *gsi, struct lower_data *data)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
420 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
421 tree old_block = data->block;
111
kono
parents: 67
diff changeset
422 gbind *stmt = as_a <gbind *> (gsi_stmt (*gsi));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
423 tree new_block = gimple_bind_block (stmt);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
424
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
425 if (new_block)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
426 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
427 if (new_block == old_block)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
428 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
429 /* The outermost block of the original function may not be the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
430 outermost statement chain of the gimplified function. So we
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
431 may see the outermost block just inside the function. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
432 gcc_assert (new_block == DECL_INITIAL (current_function_decl));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
433 new_block = NULL;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
435 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
436 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
437 /* We do not expect to handle duplicate blocks. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
438 gcc_assert (!TREE_ASM_WRITTEN (new_block));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
439 TREE_ASM_WRITTEN (new_block) = 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
440
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
441 /* Block tree may get clobbered by inlining. Normally this would
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
442 be fixed in rest_of_decl_compilation using block notes, but
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
443 since we are not going to emit them, it is up to us. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
444 BLOCK_CHAIN (new_block) = BLOCK_SUBBLOCKS (old_block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
445 BLOCK_SUBBLOCKS (old_block) = new_block;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
446 BLOCK_SUBBLOCKS (new_block) = NULL_TREE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
447 BLOCK_SUPERCONTEXT (new_block) = old_block;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
448
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
449 data->block = new_block;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
450 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
451 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
452
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
453 record_vars (gimple_bind_vars (stmt));
111
kono
parents: 67
diff changeset
454
kono
parents: 67
diff changeset
455 /* Scrap DECL_CHAIN up to BLOCK_VARS to ease GC after we no longer
kono
parents: 67
diff changeset
456 need gimple_bind_vars. */
kono
parents: 67
diff changeset
457 tree next;
kono
parents: 67
diff changeset
458 /* BLOCK_VARS and gimple_bind_vars share a common sub-chain. Find
kono
parents: 67
diff changeset
459 it by marking all BLOCK_VARS. */
kono
parents: 67
diff changeset
460 if (gimple_bind_block (stmt))
kono
parents: 67
diff changeset
461 for (tree t = BLOCK_VARS (gimple_bind_block (stmt)); t; t = DECL_CHAIN (t))
kono
parents: 67
diff changeset
462 TREE_VISITED (t) = 1;
kono
parents: 67
diff changeset
463 for (tree var = gimple_bind_vars (stmt);
kono
parents: 67
diff changeset
464 var && ! TREE_VISITED (var); var = next)
kono
parents: 67
diff changeset
465 {
kono
parents: 67
diff changeset
466 next = DECL_CHAIN (var);
kono
parents: 67
diff changeset
467 DECL_CHAIN (var) = NULL_TREE;
kono
parents: 67
diff changeset
468 }
kono
parents: 67
diff changeset
469 /* Unmark BLOCK_VARS. */
kono
parents: 67
diff changeset
470 if (gimple_bind_block (stmt))
kono
parents: 67
diff changeset
471 for (tree t = BLOCK_VARS (gimple_bind_block (stmt)); t; t = DECL_CHAIN (t))
kono
parents: 67
diff changeset
472 TREE_VISITED (t) = 0;
kono
parents: 67
diff changeset
473
kono
parents: 67
diff changeset
474 lower_sequence (gimple_bind_body_ptr (stmt), data);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
475
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
476 if (new_block)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
477 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
478 gcc_assert (data->block == new_block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
479
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
480 BLOCK_SUBBLOCKS (new_block)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
481 = blocks_nreverse (BLOCK_SUBBLOCKS (new_block));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
482 data->block = old_block;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
483 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
484
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
485 /* The GIMPLE_BIND no longer carries any useful information -- kill it. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
486 gsi_insert_seq_before (gsi, gimple_bind_body (stmt), GSI_SAME_STMT);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
487 gsi_remove (gsi, false);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
488 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
489
111
kono
parents: 67
diff changeset
490 /* Same as above, but for a GIMPLE_TRY_CATCH. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
491
111
kono
parents: 67
diff changeset
492 static void
kono
parents: 67
diff changeset
493 lower_try_catch (gimple_stmt_iterator *gsi, struct lower_data *data)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
494 {
111
kono
parents: 67
diff changeset
495 bool cannot_fallthru;
kono
parents: 67
diff changeset
496 gimple *stmt = gsi_stmt (*gsi);
kono
parents: 67
diff changeset
497 gimple_stmt_iterator i;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
498
111
kono
parents: 67
diff changeset
499 /* We don't handle GIMPLE_TRY_FINALLY. */
kono
parents: 67
diff changeset
500 gcc_assert (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH);
kono
parents: 67
diff changeset
501
kono
parents: 67
diff changeset
502 lower_sequence (gimple_try_eval_ptr (stmt), data);
kono
parents: 67
diff changeset
503 cannot_fallthru = data->cannot_fallthru;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
504
111
kono
parents: 67
diff changeset
505 i = gsi_start (*gimple_try_cleanup_ptr (stmt));
kono
parents: 67
diff changeset
506 switch (gimple_code (gsi_stmt (i)))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
507 {
111
kono
parents: 67
diff changeset
508 case GIMPLE_CATCH:
kono
parents: 67
diff changeset
509 /* We expect to see a sequence of GIMPLE_CATCH stmts, each with a
kono
parents: 67
diff changeset
510 catch expression and a body. The whole try/catch may fall
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
511 through iff any of the catch bodies falls through. */
111
kono
parents: 67
diff changeset
512 for (; !gsi_end_p (i); gsi_next (&i))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
513 {
111
kono
parents: 67
diff changeset
514 data->cannot_fallthru = false;
kono
parents: 67
diff changeset
515 lower_sequence (gimple_catch_handler_ptr (
kono
parents: 67
diff changeset
516 as_a <gcatch *> (gsi_stmt (i))),
kono
parents: 67
diff changeset
517 data);
kono
parents: 67
diff changeset
518 if (!data->cannot_fallthru)
kono
parents: 67
diff changeset
519 cannot_fallthru = false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
520 }
111
kono
parents: 67
diff changeset
521 break;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
522
111
kono
parents: 67
diff changeset
523 case GIMPLE_EH_FILTER:
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
524 /* The exception filter expression only matters if there is an
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
525 exception. If the exception does not match EH_FILTER_TYPES,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
526 we will execute EH_FILTER_FAILURE, and we will fall through
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
527 if that falls through. If the exception does match
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
528 EH_FILTER_TYPES, the stack unwinder will continue up the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
529 stack, so we will not fall through. We don't know whether we
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
530 will throw an exception which matches EH_FILTER_TYPES or not,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
531 so we just ignore EH_FILTER_TYPES and assume that we might
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
532 throw an exception which doesn't match. */
111
kono
parents: 67
diff changeset
533 data->cannot_fallthru = false;
kono
parents: 67
diff changeset
534 lower_sequence (gimple_eh_filter_failure_ptr (gsi_stmt (i)), data);
kono
parents: 67
diff changeset
535 if (!data->cannot_fallthru)
kono
parents: 67
diff changeset
536 cannot_fallthru = false;
kono
parents: 67
diff changeset
537 break;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
538
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
539 case GIMPLE_DEBUG:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
540 gcc_checking_assert (gimple_debug_begin_stmt_p (stmt));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
541 break;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
542
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
543 default:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
544 /* This case represents statements to be executed when an
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
545 exception occurs. Those statements are implicitly followed
111
kono
parents: 67
diff changeset
546 by a GIMPLE_RESX to resume execution after the exception. So
kono
parents: 67
diff changeset
547 in this case the try/catch never falls through. */
kono
parents: 67
diff changeset
548 data->cannot_fallthru = false;
kono
parents: 67
diff changeset
549 lower_sequence (gimple_try_cleanup_ptr (stmt), data);
kono
parents: 67
diff changeset
550 break;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
551 }
111
kono
parents: 67
diff changeset
552
kono
parents: 67
diff changeset
553 data->cannot_fallthru = cannot_fallthru;
kono
parents: 67
diff changeset
554 gsi_next (gsi);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
555 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
556
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
557
111
kono
parents: 67
diff changeset
558 /* Try to determine whether a TRY_CATCH expression can fall through.
kono
parents: 67
diff changeset
559 This is a subroutine of gimple_stmt_may_fallthru. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
560
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
561 static bool
111
kono
parents: 67
diff changeset
562 gimple_try_catch_may_fallthru (gtry *stmt)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
563 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
564 gimple_stmt_iterator i;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
565
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
566 /* We don't handle GIMPLE_TRY_FINALLY. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
567 gcc_assert (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
568
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
569 /* If the TRY block can fall through, the whole TRY_CATCH can
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
570 fall through. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
571 if (gimple_seq_may_fallthru (gimple_try_eval (stmt)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
572 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
573
111
kono
parents: 67
diff changeset
574 i = gsi_start (*gimple_try_cleanup_ptr (stmt));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
575 switch (gimple_code (gsi_stmt (i)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
576 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
577 case GIMPLE_CATCH:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
578 /* We expect to see a sequence of GIMPLE_CATCH stmts, each with a
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
579 catch expression and a body. The whole try/catch may fall
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
580 through iff any of the catch bodies falls through. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
581 for (; !gsi_end_p (i); gsi_next (&i))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
582 {
111
kono
parents: 67
diff changeset
583 if (gimple_seq_may_fallthru (gimple_catch_handler (
kono
parents: 67
diff changeset
584 as_a <gcatch *> (gsi_stmt (i)))))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
585 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
586 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
587 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
588
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
589 case GIMPLE_EH_FILTER:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
590 /* The exception filter expression only matters if there is an
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
591 exception. If the exception does not match EH_FILTER_TYPES,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
592 we will execute EH_FILTER_FAILURE, and we will fall through
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
593 if that falls through. If the exception does match
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
594 EH_FILTER_TYPES, the stack unwinder will continue up the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
595 stack, so we will not fall through. We don't know whether we
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
596 will throw an exception which matches EH_FILTER_TYPES or not,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
597 so we just ignore EH_FILTER_TYPES and assume that we might
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
598 throw an exception which doesn't match. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
599 return gimple_seq_may_fallthru (gimple_eh_filter_failure (gsi_stmt (i)));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
600
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
601 default:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
602 /* This case represents statements to be executed when an
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
603 exception occurs. Those statements are implicitly followed
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
604 by a GIMPLE_RESX to resume execution after the exception. So
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
605 in this case the try/catch never falls through. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
606 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
607 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
608 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
609
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
610
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
611 /* Try to determine if we can continue executing the statement
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
612 immediately following STMT. This guess need not be 100% accurate;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
613 simply be conservative and return true if we don't know. This is
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
614 used only to avoid stupidly generating extra code. If we're wrong,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
615 we'll just delete the extra code later. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
616
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
617 bool
111
kono
parents: 67
diff changeset
618 gimple_stmt_may_fallthru (gimple *stmt)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
619 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
620 if (!stmt)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
621 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
622
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
623 switch (gimple_code (stmt))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
624 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
625 case GIMPLE_GOTO:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
626 case GIMPLE_RETURN:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
627 case GIMPLE_RESX:
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
628 /* Easy cases. If the last statement of the seq implies
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
629 control transfer, then we can't fall through. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
630 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
631
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
632 case GIMPLE_SWITCH:
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
633 /* Switch has already been lowered and represents a branch
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
634 to a selected label and hence can't fall through. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
635 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
636
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
637 case GIMPLE_COND:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
638 /* GIMPLE_COND's are already lowered into a two-way branch. They
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
639 can't fall through. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
640 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
641
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
642 case GIMPLE_BIND:
111
kono
parents: 67
diff changeset
643 return gimple_seq_may_fallthru (
kono
parents: 67
diff changeset
644 gimple_bind_body (as_a <gbind *> (stmt)));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
645
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
646 case GIMPLE_TRY:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
647 if (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH)
111
kono
parents: 67
diff changeset
648 return gimple_try_catch_may_fallthru (as_a <gtry *> (stmt));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
649
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
650 /* It must be a GIMPLE_TRY_FINALLY. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
651
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
652 /* The finally clause is always executed after the try clause,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
653 so if it does not fall through, then the try-finally will not
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
654 fall through. Otherwise, if the try clause does not fall
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
655 through, then when the finally clause falls through it will
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
656 resume execution wherever the try clause was going. So the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
657 whole try-finally will only fall through if both the try
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
658 clause and the finally clause fall through. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
659 return (gimple_seq_may_fallthru (gimple_try_eval (stmt))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
660 && gimple_seq_may_fallthru (gimple_try_cleanup (stmt)));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
661
111
kono
parents: 67
diff changeset
662 case GIMPLE_EH_ELSE:
kono
parents: 67
diff changeset
663 {
kono
parents: 67
diff changeset
664 geh_else *eh_else_stmt = as_a <geh_else *> (stmt);
kono
parents: 67
diff changeset
665 return (gimple_seq_may_fallthru (gimple_eh_else_n_body (eh_else_stmt))
kono
parents: 67
diff changeset
666 || gimple_seq_may_fallthru (gimple_eh_else_e_body (
kono
parents: 67
diff changeset
667 eh_else_stmt)));
kono
parents: 67
diff changeset
668 }
kono
parents: 67
diff changeset
669
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
670 case GIMPLE_CALL:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
671 /* Functions that do not return do not fall through. */
111
kono
parents: 67
diff changeset
672 return !gimple_call_noreturn_p (stmt);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
673
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
674 default:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
675 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
676 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
677 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
678
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
679
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
680 /* Same as gimple_stmt_may_fallthru, but for the gimple sequence SEQ. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
681
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
682 bool
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
683 gimple_seq_may_fallthru (gimple_seq seq)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
684 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
685 return gimple_stmt_may_fallthru (gimple_seq_last_nondebug_stmt (seq));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
686 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
687
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
688
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
689 /* Lower a GIMPLE_RETURN GSI. DATA is passed through the recursion. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
690
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
691 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
692 lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
693 {
111
kono
parents: 67
diff changeset
694 greturn *stmt = as_a <greturn *> (gsi_stmt (*gsi));
kono
parents: 67
diff changeset
695 gimple *t;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
696 int i;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
697 return_statements_t tmp_rs;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
698
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
699 /* Match this up with an existing return statement that's been created. */
111
kono
parents: 67
diff changeset
700 for (i = data->return_statements.length () - 1;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
701 i >= 0; i--)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
702 {
111
kono
parents: 67
diff changeset
703 tmp_rs = data->return_statements[i];
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
704
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
705 if (gimple_return_retval (stmt) == gimple_return_retval (tmp_rs.stmt))
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
706 {
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
707 /* Remove the line number from the representative return statement.
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
708 It now fills in for many such returns. Failure to remove this
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
709 will result in incorrect results for coverage analysis. */
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
710 gimple_set_location (tmp_rs.stmt, UNKNOWN_LOCATION);
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
711
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
712 goto found;
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
713 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
714 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
715
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
716 /* Not found. Create a new label and record the return statement. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
717 tmp_rs.label = create_artificial_label (cfun->function_end_locus);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
718 tmp_rs.stmt = stmt;
111
kono
parents: 67
diff changeset
719 data->return_statements.safe_push (tmp_rs);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
720
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
721 /* Generate a goto statement and remove the return statement. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
722 found:
111
kono
parents: 67
diff changeset
723 /* When not optimizing, make sure user returns are preserved. */
kono
parents: 67
diff changeset
724 if (!optimize && gimple_has_location (stmt))
kono
parents: 67
diff changeset
725 DECL_ARTIFICIAL (tmp_rs.label) = 0;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
726 t = gimple_build_goto (tmp_rs.label);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
727 /* location includes block. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
728 gimple_set_location (t, gimple_location (stmt));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
729 gsi_insert_before (gsi, t, GSI_SAME_STMT);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
730 gsi_remove (gsi, false);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
731 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
732
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
733 /* Lower a __builtin_setjmp GSI.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
734
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
735 __builtin_setjmp is passed a pointer to an array of five words (not
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
736 all will be used on all machines). It operates similarly to the C
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
737 library function of the same name, but is more efficient.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
738
111
kono
parents: 67
diff changeset
739 It is lowered into 2 other builtins, namely __builtin_setjmp_setup,
kono
parents: 67
diff changeset
740 __builtin_setjmp_receiver.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
741
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
742 After full lowering, the body of the function should look like:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
743
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
744 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
745 int D.1844;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
746 int D.2844;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
747
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
748 [...]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
749
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
750 __builtin_setjmp_setup (&buf, &<D1847>);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
751 D.1844 = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
752 goto <D1846>;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
753 <D1847>:;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
754 __builtin_setjmp_receiver (&<D1847>);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
755 D.1844 = 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
756 <D1846>:;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
757 if (D.1844 == 0) goto <D1848>; else goto <D1849>;
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 [...]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
760
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
761 __builtin_setjmp_setup (&buf, &<D2847>);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
762 D.2844 = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
763 goto <D2846>;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
764 <D2847>:;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
765 __builtin_setjmp_receiver (&<D2847>);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
766 D.2844 = 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
767 <D2846>:;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
768 if (D.2844 == 0) goto <D2848>; else goto <D2849>;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
769
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
770 [...]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
771
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
772 <D3850>:;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
773 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
774 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
775
111
kono
parents: 67
diff changeset
776 During cfg creation an extra per-function (or per-OpenMP region)
kono
parents: 67
diff changeset
777 block with ABNORMAL_DISPATCHER internal call will be added, unique
kono
parents: 67
diff changeset
778 destination of all the abnormal call edges and the unique source of
kono
parents: 67
diff changeset
779 all the abnormal edges to the receivers, thus keeping the complexity
kono
parents: 67
diff changeset
780 explosion localized. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
781
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
782 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
783 lower_builtin_setjmp (gimple_stmt_iterator *gsi)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
784 {
111
kono
parents: 67
diff changeset
785 gimple *stmt = gsi_stmt (*gsi);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
786 location_t loc = gimple_location (stmt);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
787 tree cont_label = create_artificial_label (loc);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
788 tree next_label = create_artificial_label (loc);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
789 tree dest, t, arg;
111
kono
parents: 67
diff changeset
790 gimple *g;
kono
parents: 67
diff changeset
791
kono
parents: 67
diff changeset
792 /* __builtin_setjmp_{setup,receiver} aren't ECF_RETURNS_TWICE and for RTL
kono
parents: 67
diff changeset
793 these builtins are modelled as non-local label jumps to the label
kono
parents: 67
diff changeset
794 that is passed to these two builtins, so pretend we have a non-local
kono
parents: 67
diff changeset
795 label during GIMPLE passes too. See PR60003. */
kono
parents: 67
diff changeset
796 cfun->has_nonlocal_label = 1;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
797
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
798 /* NEXT_LABEL is the label __builtin_longjmp will jump to. Its address is
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
799 passed to both __builtin_setjmp_setup and __builtin_setjmp_receiver. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
800 FORCED_LABEL (next_label) = 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
801
111
kono
parents: 67
diff changeset
802 tree orig_dest = dest = gimple_call_lhs (stmt);
kono
parents: 67
diff changeset
803 if (orig_dest && TREE_CODE (orig_dest) == SSA_NAME)
kono
parents: 67
diff changeset
804 dest = create_tmp_reg (TREE_TYPE (orig_dest));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
805
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
806 /* Build '__builtin_setjmp_setup (BUF, NEXT_LABEL)' and insert. */
111
kono
parents: 67
diff changeset
807 arg = build_addr (next_label);
kono
parents: 67
diff changeset
808 t = builtin_decl_implicit (BUILT_IN_SETJMP_SETUP);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
809 g = gimple_build_call (t, 2, gimple_call_arg (stmt, 0), arg);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
810 /* location includes block. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
811 gimple_set_location (g, loc);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
812 gsi_insert_before (gsi, g, GSI_SAME_STMT);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
813
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
814 /* Build 'DEST = 0' and insert. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
815 if (dest)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
816 {
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
817 g = gimple_build_assign (dest, build_zero_cst (TREE_TYPE (dest)));
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
818 gimple_set_location (g, loc);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
819 gsi_insert_before (gsi, g, GSI_SAME_STMT);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
820 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
821
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
822 /* Build 'goto CONT_LABEL' and insert. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
823 g = gimple_build_goto (cont_label);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
824 gsi_insert_before (gsi, g, GSI_SAME_STMT);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
825
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
826 /* Build 'NEXT_LABEL:' and insert. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
827 g = gimple_build_label (next_label);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
828 gsi_insert_before (gsi, g, GSI_SAME_STMT);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
829
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
830 /* Build '__builtin_setjmp_receiver (NEXT_LABEL)' and insert. */
111
kono
parents: 67
diff changeset
831 arg = build_addr (next_label);
kono
parents: 67
diff changeset
832 t = builtin_decl_implicit (BUILT_IN_SETJMP_RECEIVER);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
833 g = gimple_build_call (t, 1, arg);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
834 gimple_set_location (g, loc);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
835 gsi_insert_before (gsi, g, GSI_SAME_STMT);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
836
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
837 /* Build 'DEST = 1' and insert. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
838 if (dest)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
839 {
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
840 g = gimple_build_assign (dest, fold_convert_loc (loc, TREE_TYPE (dest),
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
841 integer_one_node));
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
842 gimple_set_location (g, loc);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
843 gsi_insert_before (gsi, g, GSI_SAME_STMT);
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
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
846 /* Build 'CONT_LABEL:' and insert. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
847 g = gimple_build_label (cont_label);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
848 gsi_insert_before (gsi, g, GSI_SAME_STMT);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
849
111
kono
parents: 67
diff changeset
850 /* Build orig_dest = dest if necessary. */
kono
parents: 67
diff changeset
851 if (dest != orig_dest)
kono
parents: 67
diff changeset
852 {
kono
parents: 67
diff changeset
853 g = gimple_build_assign (orig_dest, dest);
kono
parents: 67
diff changeset
854 gsi_insert_before (gsi, g, GSI_SAME_STMT);
kono
parents: 67
diff changeset
855 }
kono
parents: 67
diff changeset
856
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
857 /* Remove the call to __builtin_setjmp. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
858 gsi_remove (gsi, false);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
859 }
111
kono
parents: 67
diff changeset
860
kono
parents: 67
diff changeset
861 /* Lower calls to posix_memalign to
kono
parents: 67
diff changeset
862 res = posix_memalign (ptr, align, size);
kono
parents: 67
diff changeset
863 if (res == 0)
kono
parents: 67
diff changeset
864 *ptr = __builtin_assume_aligned (*ptr, align);
kono
parents: 67
diff changeset
865 or to
kono
parents: 67
diff changeset
866 void *tem;
kono
parents: 67
diff changeset
867 res = posix_memalign (&tem, align, size);
kono
parents: 67
diff changeset
868 if (res == 0)
kono
parents: 67
diff changeset
869 ptr = __builtin_assume_aligned (tem, align);
kono
parents: 67
diff changeset
870 in case the first argument was &ptr. That way we can get at the
kono
parents: 67
diff changeset
871 alignment of the heap pointer in CCP. */
kono
parents: 67
diff changeset
872
kono
parents: 67
diff changeset
873 static void
kono
parents: 67
diff changeset
874 lower_builtin_posix_memalign (gimple_stmt_iterator *gsi)
kono
parents: 67
diff changeset
875 {
kono
parents: 67
diff changeset
876 gimple *stmt, *call = gsi_stmt (*gsi);
kono
parents: 67
diff changeset
877 tree pptr = gimple_call_arg (call, 0);
kono
parents: 67
diff changeset
878 tree align = gimple_call_arg (call, 1);
kono
parents: 67
diff changeset
879 tree res = gimple_call_lhs (call);
kono
parents: 67
diff changeset
880 tree ptr = create_tmp_reg (ptr_type_node);
kono
parents: 67
diff changeset
881 if (TREE_CODE (pptr) == ADDR_EXPR)
kono
parents: 67
diff changeset
882 {
kono
parents: 67
diff changeset
883 tree tem = create_tmp_var (ptr_type_node);
kono
parents: 67
diff changeset
884 TREE_ADDRESSABLE (tem) = 1;
kono
parents: 67
diff changeset
885 gimple_call_set_arg (call, 0, build_fold_addr_expr (tem));
kono
parents: 67
diff changeset
886 stmt = gimple_build_assign (ptr, tem);
kono
parents: 67
diff changeset
887 }
kono
parents: 67
diff changeset
888 else
kono
parents: 67
diff changeset
889 stmt = gimple_build_assign (ptr,
kono
parents: 67
diff changeset
890 fold_build2 (MEM_REF, ptr_type_node, pptr,
kono
parents: 67
diff changeset
891 build_int_cst (ptr_type_node, 0)));
kono
parents: 67
diff changeset
892 if (res == NULL_TREE)
kono
parents: 67
diff changeset
893 {
kono
parents: 67
diff changeset
894 res = create_tmp_reg (integer_type_node);
kono
parents: 67
diff changeset
895 gimple_call_set_lhs (call, res);
kono
parents: 67
diff changeset
896 }
kono
parents: 67
diff changeset
897 tree align_label = create_artificial_label (UNKNOWN_LOCATION);
kono
parents: 67
diff changeset
898 tree noalign_label = create_artificial_label (UNKNOWN_LOCATION);
kono
parents: 67
diff changeset
899 gimple *cond = gimple_build_cond (EQ_EXPR, res, integer_zero_node,
kono
parents: 67
diff changeset
900 align_label, noalign_label);
kono
parents: 67
diff changeset
901 gsi_insert_after (gsi, cond, GSI_NEW_STMT);
kono
parents: 67
diff changeset
902 gsi_insert_after (gsi, gimple_build_label (align_label), GSI_NEW_STMT);
kono
parents: 67
diff changeset
903 gsi_insert_after (gsi, stmt, GSI_NEW_STMT);
kono
parents: 67
diff changeset
904 stmt = gimple_build_call (builtin_decl_implicit (BUILT_IN_ASSUME_ALIGNED),
kono
parents: 67
diff changeset
905 2, ptr, align);
kono
parents: 67
diff changeset
906 gimple_call_set_lhs (stmt, ptr);
kono
parents: 67
diff changeset
907 gsi_insert_after (gsi, stmt, GSI_NEW_STMT);
kono
parents: 67
diff changeset
908 stmt = gimple_build_assign (fold_build2 (MEM_REF, ptr_type_node, pptr,
kono
parents: 67
diff changeset
909 build_int_cst (ptr_type_node, 0)),
kono
parents: 67
diff changeset
910 ptr);
kono
parents: 67
diff changeset
911 gsi_insert_after (gsi, stmt, GSI_NEW_STMT);
kono
parents: 67
diff changeset
912 gsi_insert_after (gsi, gimple_build_label (noalign_label), GSI_NEW_STMT);
kono
parents: 67
diff changeset
913 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
914
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
915
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
916 /* Record the variables in VARS into function FN. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
917
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
918 void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
919 record_vars_into (tree vars, tree fn)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
920 {
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
921 for (; vars; vars = DECL_CHAIN (vars))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
922 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
923 tree var = vars;
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 /* BIND_EXPRs contains also function/type/constant declarations
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
926 we don't need to care about. */
111
kono
parents: 67
diff changeset
927 if (!VAR_P (var))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
928 continue;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
929
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
930 /* Nothing to do in this case. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
931 if (DECL_EXTERNAL (var))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
932 continue;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
933
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
934 /* Record the variable. */
111
kono
parents: 67
diff changeset
935 add_local_decl (DECL_STRUCT_FUNCTION (fn), var);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
936 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
937 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
938
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
939
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
940 /* Record the variables in VARS into current_function_decl. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
941
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
942 void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
943 record_vars (tree vars)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
944 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
945 record_vars_into (vars, current_function_decl);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
946 }