annotate gcc/lower-subreg.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 /* Decompose multiword subregs.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2007-2020 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 Contributed by Richard Henderson <rth@redhat.com>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 Ian Lance Taylor <iant@google.com>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 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
9 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
10 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
11 version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 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
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 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
16 for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 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
19 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 #include "config.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 #include "system.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 #include "coretypes.h"
111
kono
parents: 67
diff changeset
25 #include "backend.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 #include "rtl.h"
111
kono
parents: 67
diff changeset
27 #include "tree.h"
kono
parents: 67
diff changeset
28 #include "cfghooks.h"
kono
parents: 67
diff changeset
29 #include "df.h"
kono
parents: 67
diff changeset
30 #include "memmodel.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 #include "tm_p.h"
111
kono
parents: 67
diff changeset
32 #include "expmed.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 #include "insn-config.h"
111
kono
parents: 67
diff changeset
34 #include "emit-rtl.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 #include "recog.h"
111
kono
parents: 67
diff changeset
36 #include "cfgrtl.h"
kono
parents: 67
diff changeset
37 #include "cfgbuild.h"
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
38 #include "dce.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 #include "expr.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 #include "tree-pass.h"
111
kono
parents: 67
diff changeset
41 #include "lower-subreg.h"
kono
parents: 67
diff changeset
42 #include "rtl-iter.h"
kono
parents: 67
diff changeset
43 #include "target.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
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 /* Decompose multi-word pseudo-registers into individual
111
kono
parents: 67
diff changeset
47 pseudo-registers when possible and profitable. This is possible
kono
parents: 67
diff changeset
48 when all the uses of a multi-word register are via SUBREG, or are
kono
parents: 67
diff changeset
49 copies of the register to another location. Breaking apart the
kono
parents: 67
diff changeset
50 register permits more CSE and permits better register allocation.
kono
parents: 67
diff changeset
51 This is profitable if the machine does not have move instructions
kono
parents: 67
diff changeset
52 to do this.
kono
parents: 67
diff changeset
53
kono
parents: 67
diff changeset
54 This pass only splits moves with modes that are wider than
kono
parents: 67
diff changeset
55 word_mode and ASHIFTs, LSHIFTRTs, ASHIFTRTs and ZERO_EXTENDs with
kono
parents: 67
diff changeset
56 integer modes that are twice the width of word_mode. The latter
kono
parents: 67
diff changeset
57 could be generalized if there was a need to do this, but the trend in
kono
parents: 67
diff changeset
58 architectures is to not need this.
kono
parents: 67
diff changeset
59
kono
parents: 67
diff changeset
60 There are two useful preprocessor defines for use by maintainers:
kono
parents: 67
diff changeset
61
kono
parents: 67
diff changeset
62 #define LOG_COSTS 1
kono
parents: 67
diff changeset
63
kono
parents: 67
diff changeset
64 if you wish to see the actual cost estimates that are being used
kono
parents: 67
diff changeset
65 for each mode wider than word mode and the cost estimates for zero
kono
parents: 67
diff changeset
66 extension and the shifts. This can be useful when port maintainers
kono
parents: 67
diff changeset
67 are tuning insn rtx costs.
kono
parents: 67
diff changeset
68
kono
parents: 67
diff changeset
69 #define FORCE_LOWERING 1
kono
parents: 67
diff changeset
70
kono
parents: 67
diff changeset
71 if you wish to test the pass with all the transformation forced on.
kono
parents: 67
diff changeset
72 This can be useful for finding bugs in the transformations. */
kono
parents: 67
diff changeset
73
kono
parents: 67
diff changeset
74 #define LOG_COSTS 0
kono
parents: 67
diff changeset
75 #define FORCE_LOWERING 0
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 /* Bit N in this bitmap is set if regno N is used in a context in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 which we can decompose it. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 static bitmap decomposable_context;
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 /* Bit N in this bitmap is set if regno N is used in a context in
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
82 which it cannot be decomposed. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 static bitmap non_decomposable_context;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
85 /* Bit N in this bitmap is set if regno N is used in a subreg
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
86 which changes the mode but not the size. This typically happens
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
87 when the register accessed as a floating-point value; we want to
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
88 avoid generating accesses to its subwords in integer modes. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
89 static bitmap subreg_context;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
90
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 /* Bit N in the bitmap in element M of this array is set if there is a
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 copy from reg M to reg N. */
111
kono
parents: 67
diff changeset
93 static vec<bitmap> reg_copy_graph;
kono
parents: 67
diff changeset
94
kono
parents: 67
diff changeset
95 struct target_lower_subreg default_target_lower_subreg;
kono
parents: 67
diff changeset
96 #if SWITCHABLE_TARGET
kono
parents: 67
diff changeset
97 struct target_lower_subreg *this_target_lower_subreg
kono
parents: 67
diff changeset
98 = &default_target_lower_subreg;
kono
parents: 67
diff changeset
99 #endif
kono
parents: 67
diff changeset
100
kono
parents: 67
diff changeset
101 #define twice_word_mode \
kono
parents: 67
diff changeset
102 this_target_lower_subreg->x_twice_word_mode
kono
parents: 67
diff changeset
103 #define choices \
kono
parents: 67
diff changeset
104 this_target_lower_subreg->x_choices
kono
parents: 67
diff changeset
105
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
106 /* Return true if MODE is a mode we know how to lower. When returning true,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
107 store its byte size in *BYTES and its word size in *WORDS. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
108
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
109 static inline bool
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
110 interesting_mode_p (machine_mode mode, unsigned int *bytes,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
111 unsigned int *words)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
112 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
113 if (!GET_MODE_SIZE (mode).is_constant (bytes))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
114 return false;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
115 *words = CEIL (*bytes, UNITS_PER_WORD);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
116 return true;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
117 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
118
111
kono
parents: 67
diff changeset
119 /* RTXes used while computing costs. */
kono
parents: 67
diff changeset
120 struct cost_rtxes {
kono
parents: 67
diff changeset
121 /* Source and target registers. */
kono
parents: 67
diff changeset
122 rtx source;
kono
parents: 67
diff changeset
123 rtx target;
kono
parents: 67
diff changeset
124
kono
parents: 67
diff changeset
125 /* A twice_word_mode ZERO_EXTEND of SOURCE. */
kono
parents: 67
diff changeset
126 rtx zext;
kono
parents: 67
diff changeset
127
kono
parents: 67
diff changeset
128 /* A shift of SOURCE. */
kono
parents: 67
diff changeset
129 rtx shift;
kono
parents: 67
diff changeset
130
kono
parents: 67
diff changeset
131 /* A SET of TARGET. */
kono
parents: 67
diff changeset
132 rtx set;
kono
parents: 67
diff changeset
133 };
kono
parents: 67
diff changeset
134
kono
parents: 67
diff changeset
135 /* Return the cost of a CODE shift in mode MODE by OP1 bits, using the
kono
parents: 67
diff changeset
136 rtxes in RTXES. SPEED_P selects between the speed and size cost. */
kono
parents: 67
diff changeset
137
kono
parents: 67
diff changeset
138 static int
kono
parents: 67
diff changeset
139 shift_cost (bool speed_p, struct cost_rtxes *rtxes, enum rtx_code code,
kono
parents: 67
diff changeset
140 machine_mode mode, int op1)
kono
parents: 67
diff changeset
141 {
kono
parents: 67
diff changeset
142 PUT_CODE (rtxes->shift, code);
kono
parents: 67
diff changeset
143 PUT_MODE (rtxes->shift, mode);
kono
parents: 67
diff changeset
144 PUT_MODE (rtxes->source, mode);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
145 XEXP (rtxes->shift, 1) = gen_int_shift_amount (mode, op1);
111
kono
parents: 67
diff changeset
146 return set_src_cost (rtxes->shift, mode, speed_p);
kono
parents: 67
diff changeset
147 }
kono
parents: 67
diff changeset
148
kono
parents: 67
diff changeset
149 /* For each X in the range [0, BITS_PER_WORD), set SPLITTING[X]
kono
parents: 67
diff changeset
150 to true if it is profitable to split a double-word CODE shift
kono
parents: 67
diff changeset
151 of X + BITS_PER_WORD bits. SPEED_P says whether we are testing
kono
parents: 67
diff changeset
152 for speed or size profitability.
kono
parents: 67
diff changeset
153
kono
parents: 67
diff changeset
154 Use the rtxes in RTXES to calculate costs. WORD_MOVE_ZERO_COST is
kono
parents: 67
diff changeset
155 the cost of moving zero into a word-mode register. WORD_MOVE_COST
kono
parents: 67
diff changeset
156 is the cost of moving between word registers. */
kono
parents: 67
diff changeset
157
kono
parents: 67
diff changeset
158 static void
kono
parents: 67
diff changeset
159 compute_splitting_shift (bool speed_p, struct cost_rtxes *rtxes,
kono
parents: 67
diff changeset
160 bool *splitting, enum rtx_code code,
kono
parents: 67
diff changeset
161 int word_move_zero_cost, int word_move_cost)
kono
parents: 67
diff changeset
162 {
kono
parents: 67
diff changeset
163 int wide_cost, narrow_cost, upper_cost, i;
kono
parents: 67
diff changeset
164
kono
parents: 67
diff changeset
165 for (i = 0; i < BITS_PER_WORD; i++)
kono
parents: 67
diff changeset
166 {
kono
parents: 67
diff changeset
167 wide_cost = shift_cost (speed_p, rtxes, code, twice_word_mode,
kono
parents: 67
diff changeset
168 i + BITS_PER_WORD);
kono
parents: 67
diff changeset
169 if (i == 0)
kono
parents: 67
diff changeset
170 narrow_cost = word_move_cost;
kono
parents: 67
diff changeset
171 else
kono
parents: 67
diff changeset
172 narrow_cost = shift_cost (speed_p, rtxes, code, word_mode, i);
kono
parents: 67
diff changeset
173
kono
parents: 67
diff changeset
174 if (code != ASHIFTRT)
kono
parents: 67
diff changeset
175 upper_cost = word_move_zero_cost;
kono
parents: 67
diff changeset
176 else if (i == BITS_PER_WORD - 1)
kono
parents: 67
diff changeset
177 upper_cost = word_move_cost;
kono
parents: 67
diff changeset
178 else
kono
parents: 67
diff changeset
179 upper_cost = shift_cost (speed_p, rtxes, code, word_mode,
kono
parents: 67
diff changeset
180 BITS_PER_WORD - 1);
kono
parents: 67
diff changeset
181
kono
parents: 67
diff changeset
182 if (LOG_COSTS)
kono
parents: 67
diff changeset
183 fprintf (stderr, "%s %s by %d: original cost %d, split cost %d + %d\n",
kono
parents: 67
diff changeset
184 GET_MODE_NAME (twice_word_mode), GET_RTX_NAME (code),
kono
parents: 67
diff changeset
185 i + BITS_PER_WORD, wide_cost, narrow_cost, upper_cost);
kono
parents: 67
diff changeset
186
kono
parents: 67
diff changeset
187 if (FORCE_LOWERING || wide_cost >= narrow_cost + upper_cost)
kono
parents: 67
diff changeset
188 splitting[i] = true;
kono
parents: 67
diff changeset
189 }
kono
parents: 67
diff changeset
190 }
kono
parents: 67
diff changeset
191
kono
parents: 67
diff changeset
192 /* Compute what we should do when optimizing for speed or size; SPEED_P
kono
parents: 67
diff changeset
193 selects which. Use RTXES for computing costs. */
kono
parents: 67
diff changeset
194
kono
parents: 67
diff changeset
195 static void
kono
parents: 67
diff changeset
196 compute_costs (bool speed_p, struct cost_rtxes *rtxes)
kono
parents: 67
diff changeset
197 {
kono
parents: 67
diff changeset
198 unsigned int i;
kono
parents: 67
diff changeset
199 int word_move_zero_cost, word_move_cost;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200
111
kono
parents: 67
diff changeset
201 PUT_MODE (rtxes->target, word_mode);
kono
parents: 67
diff changeset
202 SET_SRC (rtxes->set) = CONST0_RTX (word_mode);
kono
parents: 67
diff changeset
203 word_move_zero_cost = set_rtx_cost (rtxes->set, speed_p);
kono
parents: 67
diff changeset
204
kono
parents: 67
diff changeset
205 SET_SRC (rtxes->set) = rtxes->source;
kono
parents: 67
diff changeset
206 word_move_cost = set_rtx_cost (rtxes->set, speed_p);
kono
parents: 67
diff changeset
207
kono
parents: 67
diff changeset
208 if (LOG_COSTS)
kono
parents: 67
diff changeset
209 fprintf (stderr, "%s move: from zero cost %d, from reg cost %d\n",
kono
parents: 67
diff changeset
210 GET_MODE_NAME (word_mode), word_move_zero_cost, word_move_cost);
kono
parents: 67
diff changeset
211
kono
parents: 67
diff changeset
212 for (i = 0; i < MAX_MACHINE_MODE; i++)
kono
parents: 67
diff changeset
213 {
kono
parents: 67
diff changeset
214 machine_mode mode = (machine_mode) i;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
215 unsigned int size, factor;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
216 if (interesting_mode_p (mode, &size, &factor) && factor > 1)
111
kono
parents: 67
diff changeset
217 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
218 unsigned int mode_move_cost;
111
kono
parents: 67
diff changeset
219
kono
parents: 67
diff changeset
220 PUT_MODE (rtxes->target, mode);
kono
parents: 67
diff changeset
221 PUT_MODE (rtxes->source, mode);
kono
parents: 67
diff changeset
222 mode_move_cost = set_rtx_cost (rtxes->set, speed_p);
kono
parents: 67
diff changeset
223
kono
parents: 67
diff changeset
224 if (LOG_COSTS)
kono
parents: 67
diff changeset
225 fprintf (stderr, "%s move: original cost %d, split cost %d * %d\n",
kono
parents: 67
diff changeset
226 GET_MODE_NAME (mode), mode_move_cost,
kono
parents: 67
diff changeset
227 word_move_cost, factor);
kono
parents: 67
diff changeset
228
kono
parents: 67
diff changeset
229 if (FORCE_LOWERING || mode_move_cost >= word_move_cost * factor)
kono
parents: 67
diff changeset
230 {
kono
parents: 67
diff changeset
231 choices[speed_p].move_modes_to_split[i] = true;
kono
parents: 67
diff changeset
232 choices[speed_p].something_to_do = true;
kono
parents: 67
diff changeset
233 }
kono
parents: 67
diff changeset
234 }
kono
parents: 67
diff changeset
235 }
kono
parents: 67
diff changeset
236
kono
parents: 67
diff changeset
237 /* For the moves and shifts, the only case that is checked is one
kono
parents: 67
diff changeset
238 where the mode of the target is an integer mode twice the width
kono
parents: 67
diff changeset
239 of the word_mode.
kono
parents: 67
diff changeset
240
kono
parents: 67
diff changeset
241 If it is not profitable to split a double word move then do not
kono
parents: 67
diff changeset
242 even consider the shifts or the zero extension. */
kono
parents: 67
diff changeset
243 if (choices[speed_p].move_modes_to_split[(int) twice_word_mode])
kono
parents: 67
diff changeset
244 {
kono
parents: 67
diff changeset
245 int zext_cost;
kono
parents: 67
diff changeset
246
kono
parents: 67
diff changeset
247 /* The only case here to check to see if moving the upper part with a
kono
parents: 67
diff changeset
248 zero is cheaper than doing the zext itself. */
kono
parents: 67
diff changeset
249 PUT_MODE (rtxes->source, word_mode);
kono
parents: 67
diff changeset
250 zext_cost = set_src_cost (rtxes->zext, twice_word_mode, speed_p);
kono
parents: 67
diff changeset
251
kono
parents: 67
diff changeset
252 if (LOG_COSTS)
kono
parents: 67
diff changeset
253 fprintf (stderr, "%s %s: original cost %d, split cost %d + %d\n",
kono
parents: 67
diff changeset
254 GET_MODE_NAME (twice_word_mode), GET_RTX_NAME (ZERO_EXTEND),
kono
parents: 67
diff changeset
255 zext_cost, word_move_cost, word_move_zero_cost);
kono
parents: 67
diff changeset
256
kono
parents: 67
diff changeset
257 if (FORCE_LOWERING || zext_cost >= word_move_cost + word_move_zero_cost)
kono
parents: 67
diff changeset
258 choices[speed_p].splitting_zext = true;
kono
parents: 67
diff changeset
259
kono
parents: 67
diff changeset
260 compute_splitting_shift (speed_p, rtxes,
kono
parents: 67
diff changeset
261 choices[speed_p].splitting_ashift, ASHIFT,
kono
parents: 67
diff changeset
262 word_move_zero_cost, word_move_cost);
kono
parents: 67
diff changeset
263 compute_splitting_shift (speed_p, rtxes,
kono
parents: 67
diff changeset
264 choices[speed_p].splitting_lshiftrt, LSHIFTRT,
kono
parents: 67
diff changeset
265 word_move_zero_cost, word_move_cost);
kono
parents: 67
diff changeset
266 compute_splitting_shift (speed_p, rtxes,
kono
parents: 67
diff changeset
267 choices[speed_p].splitting_ashiftrt, ASHIFTRT,
kono
parents: 67
diff changeset
268 word_move_zero_cost, word_move_cost);
kono
parents: 67
diff changeset
269 }
kono
parents: 67
diff changeset
270 }
kono
parents: 67
diff changeset
271
kono
parents: 67
diff changeset
272 /* Do one-per-target initialisation. This involves determining
kono
parents: 67
diff changeset
273 which operations on the machine are profitable. If none are found,
kono
parents: 67
diff changeset
274 then the pass just returns when called. */
kono
parents: 67
diff changeset
275
kono
parents: 67
diff changeset
276 void
kono
parents: 67
diff changeset
277 init_lower_subreg (void)
kono
parents: 67
diff changeset
278 {
kono
parents: 67
diff changeset
279 struct cost_rtxes rtxes;
kono
parents: 67
diff changeset
280
kono
parents: 67
diff changeset
281 memset (this_target_lower_subreg, 0, sizeof (*this_target_lower_subreg));
kono
parents: 67
diff changeset
282
kono
parents: 67
diff changeset
283 twice_word_mode = GET_MODE_2XWIDER_MODE (word_mode).require ();
kono
parents: 67
diff changeset
284
kono
parents: 67
diff changeset
285 rtxes.target = gen_rtx_REG (word_mode, LAST_VIRTUAL_REGISTER + 1);
kono
parents: 67
diff changeset
286 rtxes.source = gen_rtx_REG (word_mode, LAST_VIRTUAL_REGISTER + 2);
kono
parents: 67
diff changeset
287 rtxes.set = gen_rtx_SET (rtxes.target, rtxes.source);
kono
parents: 67
diff changeset
288 rtxes.zext = gen_rtx_ZERO_EXTEND (twice_word_mode, rtxes.source);
kono
parents: 67
diff changeset
289 rtxes.shift = gen_rtx_ASHIFT (twice_word_mode, rtxes.source, const0_rtx);
kono
parents: 67
diff changeset
290
kono
parents: 67
diff changeset
291 if (LOG_COSTS)
kono
parents: 67
diff changeset
292 fprintf (stderr, "\nSize costs\n==========\n\n");
kono
parents: 67
diff changeset
293 compute_costs (false, &rtxes);
kono
parents: 67
diff changeset
294
kono
parents: 67
diff changeset
295 if (LOG_COSTS)
kono
parents: 67
diff changeset
296 fprintf (stderr, "\nSpeed costs\n===========\n\n");
kono
parents: 67
diff changeset
297 compute_costs (true, &rtxes);
kono
parents: 67
diff changeset
298 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
299
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
300 static bool
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 simple_move_operand (rtx x)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
303 if (GET_CODE (x) == SUBREG)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 x = SUBREG_REG (x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
305
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 if (!OBJECT_P (x))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
307 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
308
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
309 if (GET_CODE (x) == LABEL_REF
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
310 || GET_CODE (x) == SYMBOL_REF
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
311 || GET_CODE (x) == HIGH
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
312 || GET_CODE (x) == CONST)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
314
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
315 if (MEM_P (x)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 && (MEM_VOLATILE_P (x)
111
kono
parents: 67
diff changeset
317 || mode_dependent_address_p (XEXP (x, 0), MEM_ADDR_SPACE (x))))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
318 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
319
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
321 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
322
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
323 /* If X is an operator that can be treated as a simple move that we
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
324 can split, then return the operand that is operated on. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
325
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
326 static rtx
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
327 operand_for_swap_move_operator (rtx x)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
328 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
329 /* A word sized rotate of a register pair is equivalent to swapping
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
330 the registers in the register pair. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
331 if (GET_CODE (x) == ROTATE
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
332 && GET_MODE (x) == twice_word_mode
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
333 && simple_move_operand (XEXP (x, 0))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
334 && CONST_INT_P (XEXP (x, 1))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
335 && INTVAL (XEXP (x, 1)) == BITS_PER_WORD)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
336 return XEXP (x, 0);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
337
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
338 return NULL_RTX;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
339 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
340
111
kono
parents: 67
diff changeset
341 /* If INSN is a single set between two objects that we want to split,
kono
parents: 67
diff changeset
342 return the single set. SPEED_P says whether we are optimizing
kono
parents: 67
diff changeset
343 INSN for speed or size.
kono
parents: 67
diff changeset
344
kono
parents: 67
diff changeset
345 INSN should have been passed to recog and extract_insn before this
kono
parents: 67
diff changeset
346 is called. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
347
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 static rtx
111
kono
parents: 67
diff changeset
349 simple_move (rtx_insn *insn, bool speed_p)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
351 rtx x, op;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
352 rtx set;
111
kono
parents: 67
diff changeset
353 machine_mode mode;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
354
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
355 if (recog_data.n_operands != 2)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
356 return NULL_RTX;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
357
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
358 set = single_set (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
359 if (!set)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
360 return NULL_RTX;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
361
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
362 x = SET_DEST (set);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
363 if (x != recog_data.operand[0] && x != recog_data.operand[1])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
364 return NULL_RTX;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
365 if (!simple_move_operand (x))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
366 return NULL_RTX;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
367
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
368 x = SET_SRC (set);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
369 if ((op = operand_for_swap_move_operator (x)) != NULL_RTX)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
370 x = op;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
371
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
372 if (x != recog_data.operand[0] && x != recog_data.operand[1])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
373 return NULL_RTX;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
374 /* For the src we can handle ASM_OPERANDS, and it is beneficial for
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
375 things like x86 rdtsc which returns a DImode value. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
376 if (GET_CODE (x) != ASM_OPERANDS
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
377 && !simple_move_operand (x))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
378 return NULL_RTX;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
379
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
380 /* We try to decompose in integer modes, to avoid generating
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
381 inefficient code copying between integer and floating point
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
382 registers. That means that we can't decompose if this is a
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
383 non-integer mode for which there is no integer mode of the same
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
384 size. */
111
kono
parents: 67
diff changeset
385 mode = GET_MODE (SET_DEST (set));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
386 if (!SCALAR_INT_MODE_P (mode)
111
kono
parents: 67
diff changeset
387 && !int_mode_for_size (GET_MODE_BITSIZE (mode), 0).exists ())
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
388 return NULL_RTX;
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 /* Reject PARTIAL_INT modes. They are used for processor specific
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
391 purposes and it's probably best not to tamper with them. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
392 if (GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
393 return NULL_RTX;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
394
111
kono
parents: 67
diff changeset
395 if (!choices[speed_p].move_modes_to_split[(int) mode])
kono
parents: 67
diff changeset
396 return NULL_RTX;
kono
parents: 67
diff changeset
397
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 return set;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
399 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
400
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
401 /* If SET is a copy from one multi-word pseudo-register to another,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
402 record that in reg_copy_graph. Return whether it is such a
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
403 copy. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
404
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 static bool
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
406 find_pseudo_copy (rtx set)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
407 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
408 rtx dest = SET_DEST (set);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
409 rtx src = SET_SRC (set);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
410 rtx op;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
411 unsigned int rd, rs;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
412 bitmap b;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
413
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
414 if ((op = operand_for_swap_move_operator (src)) != NULL_RTX)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
415 src = op;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
416
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
417 if (!REG_P (dest) || !REG_P (src))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
418 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
419
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
420 rd = REGNO (dest);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
421 rs = REGNO (src);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
422 if (HARD_REGISTER_NUM_P (rd) || HARD_REGISTER_NUM_P (rs))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
423 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
424
111
kono
parents: 67
diff changeset
425 b = reg_copy_graph[rs];
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
426 if (b == NULL)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
427 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
428 b = BITMAP_ALLOC (NULL);
111
kono
parents: 67
diff changeset
429 reg_copy_graph[rs] = b;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
430 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
431
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
432 bitmap_set_bit (b, rd);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
433
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
435 }
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 /* Look through the registers in DECOMPOSABLE_CONTEXT. For each case
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
438 where they are copied to another register, add the register to
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
439 which they are copied to DECOMPOSABLE_CONTEXT. Use
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
440 NON_DECOMPOSABLE_CONTEXT to limit this--we don't bother to track
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
441 copies of registers which are in NON_DECOMPOSABLE_CONTEXT. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
442
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
443 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
444 propagate_pseudo_copies (void)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
445 {
111
kono
parents: 67
diff changeset
446 auto_bitmap queue, propagate;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
447
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
448 bitmap_copy (queue, decomposable_context);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
449 do
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 bitmap_iterator iter;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
452 unsigned int i;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
453
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
454 bitmap_clear (propagate);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
455
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
456 EXECUTE_IF_SET_IN_BITMAP (queue, 0, i, iter)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
457 {
111
kono
parents: 67
diff changeset
458 bitmap b = reg_copy_graph[i];
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
459 if (b)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
460 bitmap_ior_and_compl_into (propagate, b, non_decomposable_context);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
461 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
462
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
463 bitmap_and_compl (queue, propagate, decomposable_context);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
464 bitmap_ior_into (decomposable_context, propagate);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
465 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
466 while (!bitmap_empty_p (queue));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
467 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
468
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
469 /* A pointer to one of these values is passed to
111
kono
parents: 67
diff changeset
470 find_decomposable_subregs. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
471
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
472 enum classify_move_insn
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
473 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 /* Not a simple move from one location to another. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
475 NOT_SIMPLE_MOVE,
111
kono
parents: 67
diff changeset
476 /* A simple move we want to decompose. */
kono
parents: 67
diff changeset
477 DECOMPOSABLE_SIMPLE_MOVE,
kono
parents: 67
diff changeset
478 /* Any other simple move. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
479 SIMPLE_MOVE
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
480 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
481
111
kono
parents: 67
diff changeset
482 /* If we find a SUBREG in *LOC which we could use to decompose a
kono
parents: 67
diff changeset
483 pseudo-register, set a bit in DECOMPOSABLE_CONTEXT. If we find an
kono
parents: 67
diff changeset
484 unadorned register which is not a simple pseudo-register copy,
kono
parents: 67
diff changeset
485 DATA will point at the type of move, and we set a bit in
kono
parents: 67
diff changeset
486 DECOMPOSABLE_CONTEXT or NON_DECOMPOSABLE_CONTEXT as appropriate. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
487
111
kono
parents: 67
diff changeset
488 static void
kono
parents: 67
diff changeset
489 find_decomposable_subregs (rtx *loc, enum classify_move_insn *pcmi)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
490 {
111
kono
parents: 67
diff changeset
491 subrtx_var_iterator::array_type array;
kono
parents: 67
diff changeset
492 FOR_EACH_SUBRTX_VAR (iter, array, *loc, NONCONST)
kono
parents: 67
diff changeset
493 {
kono
parents: 67
diff changeset
494 rtx x = *iter;
kono
parents: 67
diff changeset
495 if (GET_CODE (x) == SUBREG)
kono
parents: 67
diff changeset
496 {
kono
parents: 67
diff changeset
497 rtx inner = SUBREG_REG (x);
kono
parents: 67
diff changeset
498 unsigned int regno, outer_size, inner_size, outer_words, inner_words;
kono
parents: 67
diff changeset
499
kono
parents: 67
diff changeset
500 if (!REG_P (inner))
kono
parents: 67
diff changeset
501 continue;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
502
111
kono
parents: 67
diff changeset
503 regno = REGNO (inner);
kono
parents: 67
diff changeset
504 if (HARD_REGISTER_NUM_P (regno))
kono
parents: 67
diff changeset
505 {
kono
parents: 67
diff changeset
506 iter.skip_subrtxes ();
kono
parents: 67
diff changeset
507 continue;
kono
parents: 67
diff changeset
508 }
kono
parents: 67
diff changeset
509
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
510 if (!interesting_mode_p (GET_MODE (x), &outer_size, &outer_words)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
511 || !interesting_mode_p (GET_MODE (inner), &inner_size,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
512 &inner_words))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
513 continue;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
514
111
kono
parents: 67
diff changeset
515 /* We only try to decompose single word subregs of multi-word
kono
parents: 67
diff changeset
516 registers. When we find one, we return -1 to avoid iterating
kono
parents: 67
diff changeset
517 over the inner register.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
518
111
kono
parents: 67
diff changeset
519 ??? This doesn't allow, e.g., DImode subregs of TImode values
kono
parents: 67
diff changeset
520 on 32-bit targets. We would need to record the way the
kono
parents: 67
diff changeset
521 pseudo-register was used, and only decompose if all the uses
kono
parents: 67
diff changeset
522 were the same number and size of pieces. Hopefully this
kono
parents: 67
diff changeset
523 doesn't happen much. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
524
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
525 if (outer_words == 1
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
526 && inner_words > 1
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
527 /* Don't allow to decompose floating point subregs of
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
528 multi-word pseudos if the floating point mode does
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
529 not have word size, because otherwise we'd generate
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
530 a subreg with that floating mode from a different
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
531 sized integral pseudo which is not allowed by
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
532 validate_subreg. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
533 && (!FLOAT_MODE_P (GET_MODE (x))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
534 || outer_size == UNITS_PER_WORD))
111
kono
parents: 67
diff changeset
535 {
kono
parents: 67
diff changeset
536 bitmap_set_bit (decomposable_context, regno);
kono
parents: 67
diff changeset
537 iter.skip_subrtxes ();
kono
parents: 67
diff changeset
538 continue;
kono
parents: 67
diff changeset
539 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
540
111
kono
parents: 67
diff changeset
541 /* If this is a cast from one mode to another, where the modes
kono
parents: 67
diff changeset
542 have the same size, and they are not tieable, then mark this
kono
parents: 67
diff changeset
543 register as non-decomposable. If we decompose it we are
kono
parents: 67
diff changeset
544 likely to mess up whatever the backend is trying to do. */
kono
parents: 67
diff changeset
545 if (outer_words > 1
kono
parents: 67
diff changeset
546 && outer_size == inner_size
kono
parents: 67
diff changeset
547 && !targetm.modes_tieable_p (GET_MODE (x), GET_MODE (inner)))
kono
parents: 67
diff changeset
548 {
kono
parents: 67
diff changeset
549 bitmap_set_bit (non_decomposable_context, regno);
kono
parents: 67
diff changeset
550 bitmap_set_bit (subreg_context, regno);
kono
parents: 67
diff changeset
551 iter.skip_subrtxes ();
kono
parents: 67
diff changeset
552 continue;
kono
parents: 67
diff changeset
553 }
kono
parents: 67
diff changeset
554 }
kono
parents: 67
diff changeset
555 else if (REG_P (x))
kono
parents: 67
diff changeset
556 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
557 unsigned int regno, size, words;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
558
111
kono
parents: 67
diff changeset
559 /* We will see an outer SUBREG before we see the inner REG, so
kono
parents: 67
diff changeset
560 when we see a plain REG here it means a direct reference to
kono
parents: 67
diff changeset
561 the register.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
562
111
kono
parents: 67
diff changeset
563 If this is not a simple copy from one location to another,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
564 then we cannot decompose this register. If this is a simple
111
kono
parents: 67
diff changeset
565 copy we want to decompose, and the mode is right,
kono
parents: 67
diff changeset
566 then we mark the register as decomposable.
kono
parents: 67
diff changeset
567 Otherwise we don't say anything about this register --
kono
parents: 67
diff changeset
568 it could be decomposed, but whether that would be
kono
parents: 67
diff changeset
569 profitable depends upon how it is used elsewhere.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
570
111
kono
parents: 67
diff changeset
571 We only set bits in the bitmap for multi-word
kono
parents: 67
diff changeset
572 pseudo-registers, since those are the only ones we care about
kono
parents: 67
diff changeset
573 and it keeps the size of the bitmaps down. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
574
111
kono
parents: 67
diff changeset
575 regno = REGNO (x);
kono
parents: 67
diff changeset
576 if (!HARD_REGISTER_NUM_P (regno)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
577 && interesting_mode_p (GET_MODE (x), &size, &words)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
578 && words > 1)
111
kono
parents: 67
diff changeset
579 {
kono
parents: 67
diff changeset
580 switch (*pcmi)
kono
parents: 67
diff changeset
581 {
kono
parents: 67
diff changeset
582 case NOT_SIMPLE_MOVE:
kono
parents: 67
diff changeset
583 bitmap_set_bit (non_decomposable_context, regno);
kono
parents: 67
diff changeset
584 break;
kono
parents: 67
diff changeset
585 case DECOMPOSABLE_SIMPLE_MOVE:
kono
parents: 67
diff changeset
586 if (targetm.modes_tieable_p (GET_MODE (x), word_mode))
kono
parents: 67
diff changeset
587 bitmap_set_bit (decomposable_context, regno);
kono
parents: 67
diff changeset
588 break;
kono
parents: 67
diff changeset
589 case SIMPLE_MOVE:
kono
parents: 67
diff changeset
590 break;
kono
parents: 67
diff changeset
591 default:
kono
parents: 67
diff changeset
592 gcc_unreachable ();
kono
parents: 67
diff changeset
593 }
kono
parents: 67
diff changeset
594 }
kono
parents: 67
diff changeset
595 }
kono
parents: 67
diff changeset
596 else if (MEM_P (x))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
597 {
111
kono
parents: 67
diff changeset
598 enum classify_move_insn cmi_mem = NOT_SIMPLE_MOVE;
kono
parents: 67
diff changeset
599
kono
parents: 67
diff changeset
600 /* Any registers used in a MEM do not participate in a
kono
parents: 67
diff changeset
601 SIMPLE_MOVE or DECOMPOSABLE_SIMPLE_MOVE. Do our own recursion
kono
parents: 67
diff changeset
602 here, and return -1 to block the parent's recursion. */
kono
parents: 67
diff changeset
603 find_decomposable_subregs (&XEXP (x, 0), &cmi_mem);
kono
parents: 67
diff changeset
604 iter.skip_subrtxes ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
605 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
606 }
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 /* Decompose REGNO into word-sized components. We smash the REG node
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
610 in place. This ensures that (1) something goes wrong quickly if we
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
611 fail to make some replacement, and (2) the debug information inside
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
612 the symbol table is automatically kept up to date. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
613
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
614 static void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
615 decompose_register (unsigned int regno)
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 rtx reg;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
618 unsigned int size, words, i;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
619 rtvec v;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
620
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
621 reg = regno_reg_rtx[regno];
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 regno_reg_rtx[regno] = NULL_RTX;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
624
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
625 if (!interesting_mode_p (GET_MODE (reg), &size, &words))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
626 gcc_unreachable ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
627
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
628 v = rtvec_alloc (words);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
629 for (i = 0; i < words; ++i)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
630 RTVEC_ELT (v, i) = gen_reg_rtx_offset (reg, word_mode, i * UNITS_PER_WORD);
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 PUT_CODE (reg, CONCATN);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
633 XVEC (reg, 0) = v;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
634
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
635 if (dump_file)
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 fprintf (dump_file, "; Splitting reg %u ->", regno);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
638 for (i = 0; i < words; ++i)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
639 fprintf (dump_file, " %u", REGNO (XVECEXP (reg, 0, i)));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
640 fputc ('\n', dump_file);
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 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
643
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
644 /* Get a SUBREG of a CONCATN. */
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 static rtx
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
647 simplify_subreg_concatn (machine_mode outermode, rtx op, poly_uint64 orig_byte)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
648 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
649 unsigned int outer_size, outer_words, inner_size, inner_words;
111
kono
parents: 67
diff changeset
650 machine_mode innermode, partmode;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
651 rtx part;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
652 unsigned int final_offset;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
653 unsigned int byte;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
654
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
655 innermode = GET_MODE (op);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
656 if (!interesting_mode_p (outermode, &outer_size, &outer_words)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
657 || !interesting_mode_p (innermode, &inner_size, &inner_words))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
658 gcc_unreachable ();
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
659
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
660 /* Must be constant if interesting_mode_p passes. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
661 byte = orig_byte.to_constant ();
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
662 gcc_assert (GET_CODE (op) == CONCATN);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
663 gcc_assert (byte % outer_size == 0);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
664
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
665 gcc_assert (byte < inner_size);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
666 if (outer_size > inner_size)
111
kono
parents: 67
diff changeset
667 return NULL_RTX;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
668
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
669 inner_size /= XVECLEN (op, 0);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
670 part = XVECEXP (op, 0, byte / inner_size);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
671 partmode = GET_MODE (part);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
672
111
kono
parents: 67
diff changeset
673 final_offset = byte % inner_size;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
674 if (final_offset + outer_size > inner_size)
111
kono
parents: 67
diff changeset
675 return NULL_RTX;
kono
parents: 67
diff changeset
676
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
677 /* VECTOR_CSTs in debug expressions are expanded into CONCATN instead of
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
678 regular CONST_VECTORs. They have vector or integer modes, depending
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
679 on the capabilities of the target. Cope with them. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
680 if (partmode == VOIDmode && VECTOR_MODE_P (innermode))
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
681 partmode = GET_MODE_INNER (innermode);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
682 else if (partmode == VOIDmode)
111
kono
parents: 67
diff changeset
683 partmode = mode_for_size (inner_size * BITS_PER_UNIT,
kono
parents: 67
diff changeset
684 GET_MODE_CLASS (innermode), 0).require ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
685
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
686 return simplify_gen_subreg (outermode, part, partmode, final_offset);
0
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 /* Wrapper around simplify_gen_subreg which handles CONCATN. */
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 rtx
111
kono
parents: 67
diff changeset
692 simplify_gen_subreg_concatn (machine_mode outermode, rtx op,
kono
parents: 67
diff changeset
693 machine_mode innermode, unsigned int byte)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
694 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
695 rtx ret;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
696
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
697 /* We have to handle generating a SUBREG of a SUBREG of a CONCATN.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
698 If OP is a SUBREG of a CONCATN, then it must be a simple mode
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
699 change with the same size and offset 0, or it must extract a
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
700 part. We shouldn't see anything else here. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
701 if (GET_CODE (op) == SUBREG && GET_CODE (SUBREG_REG (op)) == CONCATN)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
702 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
703 rtx op2;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
704
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
705 if (known_eq (GET_MODE_SIZE (GET_MODE (op)),
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
706 GET_MODE_SIZE (GET_MODE (SUBREG_REG (op))))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
707 && known_eq (SUBREG_BYTE (op), 0))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
708 return simplify_gen_subreg_concatn (outermode, SUBREG_REG (op),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
709 GET_MODE (SUBREG_REG (op)), byte);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
710
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
711 op2 = simplify_subreg_concatn (GET_MODE (op), SUBREG_REG (op),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
712 SUBREG_BYTE (op));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
713 if (op2 == NULL_RTX)
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 /* We don't handle paradoxical subregs here. */
111
kono
parents: 67
diff changeset
716 gcc_assert (!paradoxical_subreg_p (outermode, GET_MODE (op)));
kono
parents: 67
diff changeset
717 gcc_assert (!paradoxical_subreg_p (op));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
718 op2 = simplify_subreg_concatn (outermode, SUBREG_REG (op),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
719 byte + SUBREG_BYTE (op));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
720 gcc_assert (op2 != NULL_RTX);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
721 return op2;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
722 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
723
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
724 op = op2;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
725 gcc_assert (op != NULL_RTX);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
726 gcc_assert (innermode == GET_MODE (op));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
727 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
728
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
729 if (GET_CODE (op) == CONCATN)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
730 return simplify_subreg_concatn (outermode, op, byte);
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 ret = simplify_gen_subreg (outermode, op, innermode, byte);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
733
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
734 /* If we see an insn like (set (reg:DI) (subreg:DI (reg:SI) 0)) then
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
735 resolve_simple_move will ask for the high part of the paradoxical
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
736 subreg, which does not have a value. Just return a zero. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
737 if (ret == NULL_RTX
111
kono
parents: 67
diff changeset
738 && paradoxical_subreg_p (op))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
739 return CONST0_RTX (outermode);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
740
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
741 gcc_assert (ret != NULL_RTX);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
742 return ret;
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 /* Return whether we should resolve X into the registers into which it
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
746 was decomposed. */
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 static bool
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
749 resolve_reg_p (rtx x)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
750 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
751 return GET_CODE (x) == CONCATN;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
752 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
753
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
754 /* Return whether X is a SUBREG of a register which we need to
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
755 resolve. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
756
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
757 static bool
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
758 resolve_subreg_p (rtx x)
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 if (GET_CODE (x) != SUBREG)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
761 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
762 return resolve_reg_p (SUBREG_REG (x));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
763 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
764
111
kono
parents: 67
diff changeset
765 /* Look for SUBREGs in *LOC which need to be decomposed. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
766
111
kono
parents: 67
diff changeset
767 static bool
kono
parents: 67
diff changeset
768 resolve_subreg_use (rtx *loc, rtx insn)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
769 {
111
kono
parents: 67
diff changeset
770 subrtx_ptr_iterator::array_type array;
kono
parents: 67
diff changeset
771 FOR_EACH_SUBRTX_PTR (iter, array, loc, NONCONST)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
772 {
111
kono
parents: 67
diff changeset
773 rtx *loc = *iter;
kono
parents: 67
diff changeset
774 rtx x = *loc;
kono
parents: 67
diff changeset
775 if (resolve_subreg_p (x))
kono
parents: 67
diff changeset
776 {
kono
parents: 67
diff changeset
777 x = simplify_subreg_concatn (GET_MODE (x), SUBREG_REG (x),
kono
parents: 67
diff changeset
778 SUBREG_BYTE (x));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
779
111
kono
parents: 67
diff changeset
780 /* It is possible for a note to contain a reference which we can
kono
parents: 67
diff changeset
781 decompose. In this case, return 1 to the caller to indicate
kono
parents: 67
diff changeset
782 that the note must be removed. */
kono
parents: 67
diff changeset
783 if (!x)
kono
parents: 67
diff changeset
784 {
kono
parents: 67
diff changeset
785 gcc_assert (!insn);
kono
parents: 67
diff changeset
786 return true;
kono
parents: 67
diff changeset
787 }
kono
parents: 67
diff changeset
788
kono
parents: 67
diff changeset
789 validate_change (insn, loc, x, 1);
kono
parents: 67
diff changeset
790 iter.skip_subrtxes ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
791 }
111
kono
parents: 67
diff changeset
792 else if (resolve_reg_p (x))
kono
parents: 67
diff changeset
793 /* Return 1 to the caller to indicate that we found a direct
kono
parents: 67
diff changeset
794 reference to a register which is being decomposed. This can
kono
parents: 67
diff changeset
795 happen inside notes, multiword shift or zero-extend
kono
parents: 67
diff changeset
796 instructions. */
kono
parents: 67
diff changeset
797 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
798 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
799
111
kono
parents: 67
diff changeset
800 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
801 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
802
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
803 /* Resolve any decomposed registers which appear in register notes on
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
804 INSN. */
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 static void
111
kono
parents: 67
diff changeset
807 resolve_reg_notes (rtx_insn *insn)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
808 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
809 rtx *pnote, note;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
810
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
811 note = find_reg_equal_equiv_note (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
812 if (note)
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 int old_count = num_validated_changes ();
111
kono
parents: 67
diff changeset
815 if (resolve_subreg_use (&XEXP (note, 0), NULL_RTX))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
816 remove_note (insn, note);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
817 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
818 if (old_count != num_validated_changes ())
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
819 df_notes_rescan (insn);
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 pnote = &REG_NOTES (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
823 while (*pnote != NULL_RTX)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
824 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
825 bool del = false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
826
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
827 note = *pnote;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
828 switch (REG_NOTE_KIND (note))
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 case REG_DEAD:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
831 case REG_UNUSED:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
832 if (resolve_reg_p (XEXP (note, 0)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
833 del = true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
834 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
835
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
836 default:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
837 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
838 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
839
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
840 if (del)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
841 *pnote = XEXP (note, 1);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
842 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
843 pnote = &XEXP (note, 1);
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
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
847 /* Return whether X can be decomposed into subwords. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
848
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
849 static bool
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
850 can_decompose_p (rtx x)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
851 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
852 if (REG_P (x))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
853 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
854 unsigned int regno = REGNO (x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
855
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
856 if (HARD_REGISTER_NUM_P (regno))
111
kono
parents: 67
diff changeset
857 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
858 unsigned int byte, num_bytes, num_words;
111
kono
parents: 67
diff changeset
859
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
860 if (!interesting_mode_p (GET_MODE (x), &num_bytes, &num_words))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
861 return false;
111
kono
parents: 67
diff changeset
862 for (byte = 0; byte < num_bytes; byte += UNITS_PER_WORD)
kono
parents: 67
diff changeset
863 if (simplify_subreg_regno (regno, GET_MODE (x), byte, word_mode) < 0)
kono
parents: 67
diff changeset
864 return false;
kono
parents: 67
diff changeset
865 return true;
kono
parents: 67
diff changeset
866 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
867 else
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
868 return !bitmap_bit_p (subreg_context, regno);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
869 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
870
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
871 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
872 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
873
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
874 /* OPND is a concatn operand this is used with a simple move operator.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
875 Return a new rtx with the concatn's operands swapped. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
876
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
877 static rtx
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
878 resolve_operand_for_swap_move_operator (rtx opnd)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
879 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
880 gcc_assert (GET_CODE (opnd) == CONCATN);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
881 rtx concatn = copy_rtx (opnd);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
882 rtx op0 = XVECEXP (concatn, 0, 0);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
883 rtx op1 = XVECEXP (concatn, 0, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
884 XVECEXP (concatn, 0, 0) = op1;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
885 XVECEXP (concatn, 0, 1) = op0;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
886 return concatn;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
887 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
888
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
889 /* Decompose the registers used in a simple move SET within INSN. If
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
890 we don't change anything, return INSN, otherwise return the start
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
891 of the sequence of moves. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
892
111
kono
parents: 67
diff changeset
893 static rtx_insn *
kono
parents: 67
diff changeset
894 resolve_simple_move (rtx set, rtx_insn *insn)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
895 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
896 rtx src, dest, real_dest, src_op;
111
kono
parents: 67
diff changeset
897 rtx_insn *insns;
kono
parents: 67
diff changeset
898 machine_mode orig_mode, dest_mode;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
899 unsigned int orig_size, words;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
900 bool pushing;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
901
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
902 src = SET_SRC (set);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
903 dest = SET_DEST (set);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
904 orig_mode = GET_MODE (dest);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
905
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
906 if (!interesting_mode_p (orig_mode, &orig_size, &words))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
907 gcc_unreachable ();
111
kono
parents: 67
diff changeset
908 gcc_assert (words > 1);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
909
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
910 start_sequence ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
911
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
912 /* We have to handle copying from a SUBREG of a decomposed reg where
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
913 the SUBREG is larger than word size. Rather than assume that we
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
914 can take a word_mode SUBREG of the destination, we copy to a new
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
915 register and then copy that to the destination. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
916
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
917 real_dest = NULL_RTX;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
918
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
919 if ((src_op = operand_for_swap_move_operator (src)) != NULL_RTX)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
920 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
921 if (resolve_reg_p (dest))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
922 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
923 /* DEST is a CONCATN, so swap its operands and strip
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
924 SRC's operator. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
925 dest = resolve_operand_for_swap_move_operator (dest);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
926 src = src_op;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
927 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
928 else if (resolve_reg_p (src_op))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
929 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
930 /* SRC is an operation on a CONCATN, so strip the operator and
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
931 swap the CONCATN's operands. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
932 src = resolve_operand_for_swap_move_operator (src_op);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
933 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
934 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
935
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
936 if (GET_CODE (src) == SUBREG
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
937 && resolve_reg_p (SUBREG_REG (src))
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
938 && (maybe_ne (SUBREG_BYTE (src), 0)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
939 || maybe_ne (orig_size, GET_MODE_SIZE (GET_MODE (SUBREG_REG (src))))))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
940 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
941 real_dest = dest;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
942 dest = gen_reg_rtx (orig_mode);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
943 if (REG_P (real_dest))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
944 REG_ATTRS (dest) = REG_ATTRS (real_dest);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
945 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
946
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
947 /* Similarly if we are copying to a SUBREG of a decomposed reg where
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
948 the SUBREG is larger than word size. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
949
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
950 if (GET_CODE (dest) == SUBREG
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
951 && resolve_reg_p (SUBREG_REG (dest))
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
952 && (maybe_ne (SUBREG_BYTE (dest), 0)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
953 || maybe_ne (orig_size,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
954 GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest))))))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
955 {
111
kono
parents: 67
diff changeset
956 rtx reg, smove;
kono
parents: 67
diff changeset
957 rtx_insn *minsn;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
958
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
959 reg = gen_reg_rtx (orig_mode);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
960 minsn = emit_move_insn (reg, src);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
961 smove = single_set (minsn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
962 gcc_assert (smove != NULL_RTX);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
963 resolve_simple_move (smove, minsn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
964 src = reg;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
965 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
966
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
967 /* If we didn't have any big SUBREGS of decomposed registers, and
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
968 neither side of the move is a register we are decomposing, then
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
969 we don't have to do anything here. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
970
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
971 if (src == SET_SRC (set)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
972 && dest == SET_DEST (set)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
973 && !resolve_reg_p (src)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
974 && !resolve_subreg_p (src)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
975 && !resolve_reg_p (dest)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
976 && !resolve_subreg_p (dest))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
977 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
978 end_sequence ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
979 return insn;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
980 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
981
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
982 /* It's possible for the code to use a subreg of a decomposed
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
983 register while forming an address. We need to handle that before
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
984 passing the address to emit_move_insn. We pass NULL_RTX as the
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
985 insn parameter to resolve_subreg_use because we cannot validate
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
986 the insn yet. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
987 if (MEM_P (src) || MEM_P (dest))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
988 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
989 int acg;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
990
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
991 if (MEM_P (src))
111
kono
parents: 67
diff changeset
992 resolve_subreg_use (&XEXP (src, 0), NULL_RTX);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
993 if (MEM_P (dest))
111
kono
parents: 67
diff changeset
994 resolve_subreg_use (&XEXP (dest, 0), NULL_RTX);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
995 acg = apply_change_group ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
996 gcc_assert (acg);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
997 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
998
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
999 /* If SRC is a register which we can't decompose, or has side
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1000 effects, we need to move via a temporary register. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1001
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1002 if (!can_decompose_p (src)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1003 || side_effects_p (src)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1004 || GET_CODE (src) == ASM_OPERANDS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1005 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1006 rtx reg;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1007
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1008 reg = gen_reg_rtx (orig_mode);
111
kono
parents: 67
diff changeset
1009
kono
parents: 67
diff changeset
1010 if (AUTO_INC_DEC)
kono
parents: 67
diff changeset
1011 {
kono
parents: 67
diff changeset
1012 rtx_insn *move = emit_move_insn (reg, src);
kono
parents: 67
diff changeset
1013 if (MEM_P (src))
kono
parents: 67
diff changeset
1014 {
kono
parents: 67
diff changeset
1015 rtx note = find_reg_note (insn, REG_INC, NULL_RTX);
kono
parents: 67
diff changeset
1016 if (note)
kono
parents: 67
diff changeset
1017 add_reg_note (move, REG_INC, XEXP (note, 0));
kono
parents: 67
diff changeset
1018 }
kono
parents: 67
diff changeset
1019 }
kono
parents: 67
diff changeset
1020 else
kono
parents: 67
diff changeset
1021 emit_move_insn (reg, src);
kono
parents: 67
diff changeset
1022
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1023 src = reg;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1024 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1025
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1026 /* If DEST is a register which we can't decompose, or has side
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1027 effects, we need to first move to a temporary register. We
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1028 handle the common case of pushing an operand directly. We also
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1029 go through a temporary register if it holds a floating point
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1030 value. This gives us better code on systems which can't move
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1031 data easily between integer and floating point registers. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1032
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1033 dest_mode = orig_mode;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1034 pushing = push_operand (dest, dest_mode);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1035 if (!can_decompose_p (dest)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1036 || (side_effects_p (dest) && !pushing)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1037 || (!SCALAR_INT_MODE_P (dest_mode)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1038 && !resolve_reg_p (dest)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1039 && !resolve_subreg_p (dest)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1040 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1041 if (real_dest == NULL_RTX)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1042 real_dest = dest;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1043 if (!SCALAR_INT_MODE_P (dest_mode))
111
kono
parents: 67
diff changeset
1044 dest_mode = int_mode_for_mode (dest_mode).require ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1045 dest = gen_reg_rtx (dest_mode);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1046 if (REG_P (real_dest))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1047 REG_ATTRS (dest) = REG_ATTRS (real_dest);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1048 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1049
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1050 if (pushing)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1051 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1052 unsigned int i, j, jinc;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1053
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1054 gcc_assert (orig_size % UNITS_PER_WORD == 0);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1055 gcc_assert (GET_CODE (XEXP (dest, 0)) != PRE_MODIFY);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1056 gcc_assert (GET_CODE (XEXP (dest, 0)) != POST_MODIFY);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1057
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1058 if (WORDS_BIG_ENDIAN == STACK_GROWS_DOWNWARD)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1059 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1060 j = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1061 jinc = 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1062 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1063 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1064 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1065 j = words - 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1066 jinc = -1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1067 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1068
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1069 for (i = 0; i < words; ++i, j += jinc)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1070 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1071 rtx temp;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1072
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1073 temp = copy_rtx (XEXP (dest, 0));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1074 temp = adjust_automodify_address_nv (dest, word_mode, temp,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1075 j * UNITS_PER_WORD);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1076 emit_move_insn (temp,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1077 simplify_gen_subreg_concatn (word_mode, src,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1078 orig_mode,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1079 j * UNITS_PER_WORD));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1080 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1081 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1082 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1083 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1084 unsigned int i;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1085
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1086 if (REG_P (dest) && !HARD_REGISTER_NUM_P (REGNO (dest)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1087 emit_clobber (dest);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1088
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1089 for (i = 0; i < words; ++i)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1090 emit_move_insn (simplify_gen_subreg_concatn (word_mode, dest,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1091 dest_mode,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1092 i * UNITS_PER_WORD),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1093 simplify_gen_subreg_concatn (word_mode, src,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1094 orig_mode,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1095 i * UNITS_PER_WORD));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1096 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1097
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1098 if (real_dest != NULL_RTX)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1099 {
111
kono
parents: 67
diff changeset
1100 rtx mdest, smove;
kono
parents: 67
diff changeset
1101 rtx_insn *minsn;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1102
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1103 if (dest_mode == orig_mode)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1104 mdest = dest;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1105 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1106 mdest = simplify_gen_subreg (orig_mode, dest, GET_MODE (dest), 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1107 minsn = emit_move_insn (real_dest, mdest);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1108
111
kono
parents: 67
diff changeset
1109 if (AUTO_INC_DEC && MEM_P (real_dest)
kono
parents: 67
diff changeset
1110 && !(resolve_reg_p (real_dest) || resolve_subreg_p (real_dest)))
kono
parents: 67
diff changeset
1111 {
kono
parents: 67
diff changeset
1112 rtx note = find_reg_note (insn, REG_INC, NULL_RTX);
kono
parents: 67
diff changeset
1113 if (note)
kono
parents: 67
diff changeset
1114 add_reg_note (minsn, REG_INC, XEXP (note, 0));
kono
parents: 67
diff changeset
1115 }
kono
parents: 67
diff changeset
1116
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1117 smove = single_set (minsn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1118 gcc_assert (smove != NULL_RTX);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1119
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1120 resolve_simple_move (smove, minsn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1121 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1122
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1123 insns = get_insns ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1124 end_sequence ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1125
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1126 copy_reg_eh_region_note_forward (insn, insns, NULL_RTX);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1127
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1128 emit_insn_before (insns, insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1129
111
kono
parents: 67
diff changeset
1130 /* If we get here via self-recursion, then INSN is not yet in the insns
kono
parents: 67
diff changeset
1131 chain and delete_insn will fail. We only want to remove INSN from the
kono
parents: 67
diff changeset
1132 current sequence. See PR56738. */
kono
parents: 67
diff changeset
1133 if (in_sequence_p ())
kono
parents: 67
diff changeset
1134 remove_insn (insn);
kono
parents: 67
diff changeset
1135 else
kono
parents: 67
diff changeset
1136 delete_insn (insn);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1137
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1138 return insns;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1139 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1140
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1141 /* Change a CLOBBER of a decomposed register into a CLOBBER of the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1142 component registers. Return whether we changed something. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1143
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1144 static bool
111
kono
parents: 67
diff changeset
1145 resolve_clobber (rtx pat, rtx_insn *insn)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1146 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1147 rtx reg;
111
kono
parents: 67
diff changeset
1148 machine_mode orig_mode;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1149 unsigned int orig_size, words, i;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1150 int ret;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1151
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1152 reg = XEXP (pat, 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1153 if (!resolve_reg_p (reg) && !resolve_subreg_p (reg))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1154 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1155
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1156 orig_mode = GET_MODE (reg);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1157 if (!interesting_mode_p (orig_mode, &orig_size, &words))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1158 gcc_unreachable ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1159
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1160 ret = validate_change (NULL_RTX, &XEXP (pat, 0),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1161 simplify_gen_subreg_concatn (word_mode, reg,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1162 orig_mode, 0),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1163 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1164 df_insn_rescan (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1165 gcc_assert (ret != 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1166
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1167 for (i = words - 1; i > 0; --i)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1168 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1169 rtx x;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1170
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1171 x = simplify_gen_subreg_concatn (word_mode, reg, orig_mode,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1172 i * UNITS_PER_WORD);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1173 x = gen_rtx_CLOBBER (VOIDmode, x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1174 emit_insn_after (x, insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1175 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1176
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1177 resolve_reg_notes (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1178
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1179 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1180 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1181
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1182 /* A USE of a decomposed register is no longer meaningful. Return
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1183 whether we changed something. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1184
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1185 static bool
111
kono
parents: 67
diff changeset
1186 resolve_use (rtx pat, rtx_insn *insn)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1187 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1188 if (resolve_reg_p (XEXP (pat, 0)) || resolve_subreg_p (XEXP (pat, 0)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1189 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1190 delete_insn (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1191 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1192 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1193
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1194 resolve_reg_notes (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1195
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1196 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1197 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1198
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1199 /* A VAR_LOCATION can be simplified. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1200
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1201 static void
111
kono
parents: 67
diff changeset
1202 resolve_debug (rtx_insn *insn)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1203 {
111
kono
parents: 67
diff changeset
1204 subrtx_ptr_iterator::array_type array;
kono
parents: 67
diff changeset
1205 FOR_EACH_SUBRTX_PTR (iter, array, &PATTERN (insn), NONCONST)
kono
parents: 67
diff changeset
1206 {
kono
parents: 67
diff changeset
1207 rtx *loc = *iter;
kono
parents: 67
diff changeset
1208 rtx x = *loc;
kono
parents: 67
diff changeset
1209 if (resolve_subreg_p (x))
kono
parents: 67
diff changeset
1210 {
kono
parents: 67
diff changeset
1211 x = simplify_subreg_concatn (GET_MODE (x), SUBREG_REG (x),
kono
parents: 67
diff changeset
1212 SUBREG_BYTE (x));
kono
parents: 67
diff changeset
1213
kono
parents: 67
diff changeset
1214 if (x)
kono
parents: 67
diff changeset
1215 *loc = x;
kono
parents: 67
diff changeset
1216 else
kono
parents: 67
diff changeset
1217 x = copy_rtx (*loc);
kono
parents: 67
diff changeset
1218 }
kono
parents: 67
diff changeset
1219 if (resolve_reg_p (x))
kono
parents: 67
diff changeset
1220 *loc = copy_rtx (x);
kono
parents: 67
diff changeset
1221 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1222
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1223 df_insn_rescan (insn);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1224
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1225 resolve_reg_notes (insn);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1226 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1227
111
kono
parents: 67
diff changeset
1228 /* Check if INSN is a decomposable multiword-shift or zero-extend and
kono
parents: 67
diff changeset
1229 set the decomposable_context bitmap accordingly. SPEED_P is true
kono
parents: 67
diff changeset
1230 if we are optimizing INSN for speed rather than size. Return true
kono
parents: 67
diff changeset
1231 if INSN is decomposable. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1232
111
kono
parents: 67
diff changeset
1233 static bool
kono
parents: 67
diff changeset
1234 find_decomposable_shift_zext (rtx_insn *insn, bool speed_p)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1235 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1236 rtx set;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1237 rtx op;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1238 rtx op_operand;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1239
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1240 set = single_set (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1241 if (!set)
111
kono
parents: 67
diff changeset
1242 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1243
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1244 op = SET_SRC (set);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1245 if (GET_CODE (op) != ASHIFT
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1246 && GET_CODE (op) != LSHIFTRT
111
kono
parents: 67
diff changeset
1247 && GET_CODE (op) != ASHIFTRT
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1248 && GET_CODE (op) != ZERO_EXTEND)
111
kono
parents: 67
diff changeset
1249 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1250
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1251 op_operand = XEXP (op, 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1252 if (!REG_P (SET_DEST (set)) || !REG_P (op_operand)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1253 || HARD_REGISTER_NUM_P (REGNO (SET_DEST (set)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1254 || HARD_REGISTER_NUM_P (REGNO (op_operand))
111
kono
parents: 67
diff changeset
1255 || GET_MODE (op) != twice_word_mode)
kono
parents: 67
diff changeset
1256 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1257
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1258 if (GET_CODE (op) == ZERO_EXTEND)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1259 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1260 if (GET_MODE (op_operand) != word_mode
111
kono
parents: 67
diff changeset
1261 || !choices[speed_p].splitting_zext)
kono
parents: 67
diff changeset
1262 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1263 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1264 else /* left or right shift */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1265 {
111
kono
parents: 67
diff changeset
1266 bool *splitting = (GET_CODE (op) == ASHIFT
kono
parents: 67
diff changeset
1267 ? choices[speed_p].splitting_ashift
kono
parents: 67
diff changeset
1268 : GET_CODE (op) == ASHIFTRT
kono
parents: 67
diff changeset
1269 ? choices[speed_p].splitting_ashiftrt
kono
parents: 67
diff changeset
1270 : choices[speed_p].splitting_lshiftrt);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1271 if (!CONST_INT_P (XEXP (op, 1))
111
kono
parents: 67
diff changeset
1272 || !IN_RANGE (INTVAL (XEXP (op, 1)), BITS_PER_WORD,
kono
parents: 67
diff changeset
1273 2 * BITS_PER_WORD - 1)
kono
parents: 67
diff changeset
1274 || !splitting[INTVAL (XEXP (op, 1)) - BITS_PER_WORD])
kono
parents: 67
diff changeset
1275 return false;
kono
parents: 67
diff changeset
1276
kono
parents: 67
diff changeset
1277 bitmap_set_bit (decomposable_context, REGNO (op_operand));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1278 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1279
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1280 bitmap_set_bit (decomposable_context, REGNO (SET_DEST (set)));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1281
111
kono
parents: 67
diff changeset
1282 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1283 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1284
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1285 /* Decompose a more than word wide shift (in INSN) of a multiword
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1286 pseudo or a multiword zero-extend of a wordmode pseudo into a move
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1287 and 'set to zero' insn. Return a pointer to the new insn when a
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1288 replacement was done. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1289
111
kono
parents: 67
diff changeset
1290 static rtx_insn *
kono
parents: 67
diff changeset
1291 resolve_shift_zext (rtx_insn *insn)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1292 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1293 rtx set;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1294 rtx op;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1295 rtx op_operand;
111
kono
parents: 67
diff changeset
1296 rtx_insn *insns;
kono
parents: 67
diff changeset
1297 rtx src_reg, dest_reg, dest_upper, upper_src = NULL_RTX;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1298 int src_reg_num, dest_reg_num, offset1, offset2, src_offset;
111
kono
parents: 67
diff changeset
1299 scalar_int_mode inner_mode;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1300
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1301 set = single_set (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1302 if (!set)
111
kono
parents: 67
diff changeset
1303 return NULL;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1304
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1305 op = SET_SRC (set);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1306 if (GET_CODE (op) != ASHIFT
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1307 && GET_CODE (op) != LSHIFTRT
111
kono
parents: 67
diff changeset
1308 && GET_CODE (op) != ASHIFTRT
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1309 && GET_CODE (op) != ZERO_EXTEND)
111
kono
parents: 67
diff changeset
1310 return NULL;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1311
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1312 op_operand = XEXP (op, 0);
111
kono
parents: 67
diff changeset
1313 if (!is_a <scalar_int_mode> (GET_MODE (op_operand), &inner_mode))
kono
parents: 67
diff changeset
1314 return NULL;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1315
111
kono
parents: 67
diff changeset
1316 /* We can tear this operation apart only if the regs were already
kono
parents: 67
diff changeset
1317 torn apart. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1318 if (!resolve_reg_p (SET_DEST (set)) && !resolve_reg_p (op_operand))
111
kono
parents: 67
diff changeset
1319 return NULL;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1320
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1321 /* src_reg_num is the number of the word mode register which we
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1322 are operating on. For a left shift and a zero_extend on little
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1323 endian machines this is register 0. */
111
kono
parents: 67
diff changeset
1324 src_reg_num = (GET_CODE (op) == LSHIFTRT || GET_CODE (op) == ASHIFTRT)
kono
parents: 67
diff changeset
1325 ? 1 : 0;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1326
111
kono
parents: 67
diff changeset
1327 if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (inner_mode) > UNITS_PER_WORD)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1328 src_reg_num = 1 - src_reg_num;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1329
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1330 if (GET_CODE (op) == ZERO_EXTEND)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1331 dest_reg_num = WORDS_BIG_ENDIAN ? 1 : 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1332 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1333 dest_reg_num = 1 - src_reg_num;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1334
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1335 offset1 = UNITS_PER_WORD * dest_reg_num;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1336 offset2 = UNITS_PER_WORD * (1 - dest_reg_num);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1337 src_offset = UNITS_PER_WORD * src_reg_num;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1338
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1339 start_sequence ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1340
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1341 dest_reg = simplify_gen_subreg_concatn (word_mode, SET_DEST (set),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1342 GET_MODE (SET_DEST (set)),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1343 offset1);
111
kono
parents: 67
diff changeset
1344 dest_upper = simplify_gen_subreg_concatn (word_mode, SET_DEST (set),
kono
parents: 67
diff changeset
1345 GET_MODE (SET_DEST (set)),
kono
parents: 67
diff changeset
1346 offset2);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1347 src_reg = simplify_gen_subreg_concatn (word_mode, op_operand,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1348 GET_MODE (op_operand),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1349 src_offset);
111
kono
parents: 67
diff changeset
1350 if (GET_CODE (op) == ASHIFTRT
kono
parents: 67
diff changeset
1351 && INTVAL (XEXP (op, 1)) != 2 * BITS_PER_WORD - 1)
kono
parents: 67
diff changeset
1352 upper_src = expand_shift (RSHIFT_EXPR, word_mode, copy_rtx (src_reg),
kono
parents: 67
diff changeset
1353 BITS_PER_WORD - 1, NULL_RTX, 0);
kono
parents: 67
diff changeset
1354
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1355 if (GET_CODE (op) != ZERO_EXTEND)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1356 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1357 int shift_count = INTVAL (XEXP (op, 1));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1358 if (shift_count > BITS_PER_WORD)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1359 src_reg = expand_shift (GET_CODE (op) == ASHIFT ?
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1360 LSHIFT_EXPR : RSHIFT_EXPR,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1361 word_mode, src_reg,
111
kono
parents: 67
diff changeset
1362 shift_count - BITS_PER_WORD,
kono
parents: 67
diff changeset
1363 dest_reg, GET_CODE (op) != ASHIFTRT);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1364 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1365
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1366 if (dest_reg != src_reg)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1367 emit_move_insn (dest_reg, src_reg);
111
kono
parents: 67
diff changeset
1368 if (GET_CODE (op) != ASHIFTRT)
kono
parents: 67
diff changeset
1369 emit_move_insn (dest_upper, CONST0_RTX (word_mode));
kono
parents: 67
diff changeset
1370 else if (INTVAL (XEXP (op, 1)) == 2 * BITS_PER_WORD - 1)
kono
parents: 67
diff changeset
1371 emit_move_insn (dest_upper, copy_rtx (src_reg));
kono
parents: 67
diff changeset
1372 else
kono
parents: 67
diff changeset
1373 emit_move_insn (dest_upper, upper_src);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1374 insns = get_insns ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1375
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1376 end_sequence ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1377
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1378 emit_insn_before (insns, insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1379
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1380 if (dump_file)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1381 {
111
kono
parents: 67
diff changeset
1382 rtx_insn *in;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1383 fprintf (dump_file, "; Replacing insn: %d with insns: ", INSN_UID (insn));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1384 for (in = insns; in != insn; in = NEXT_INSN (in))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1385 fprintf (dump_file, "%d ", INSN_UID (in));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1386 fprintf (dump_file, "\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1387 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1388
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1389 delete_insn (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1390 return insns;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1391 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1392
111
kono
parents: 67
diff changeset
1393 /* Print to dump_file a description of what we're doing with shift code CODE.
kono
parents: 67
diff changeset
1394 SPLITTING[X] is true if we are splitting shifts by X + BITS_PER_WORD. */
kono
parents: 67
diff changeset
1395
kono
parents: 67
diff changeset
1396 static void
kono
parents: 67
diff changeset
1397 dump_shift_choices (enum rtx_code code, bool *splitting)
kono
parents: 67
diff changeset
1398 {
kono
parents: 67
diff changeset
1399 int i;
kono
parents: 67
diff changeset
1400 const char *sep;
kono
parents: 67
diff changeset
1401
kono
parents: 67
diff changeset
1402 fprintf (dump_file,
kono
parents: 67
diff changeset
1403 " Splitting mode %s for %s lowering with shift amounts = ",
kono
parents: 67
diff changeset
1404 GET_MODE_NAME (twice_word_mode), GET_RTX_NAME (code));
kono
parents: 67
diff changeset
1405 sep = "";
kono
parents: 67
diff changeset
1406 for (i = 0; i < BITS_PER_WORD; i++)
kono
parents: 67
diff changeset
1407 if (splitting[i])
kono
parents: 67
diff changeset
1408 {
kono
parents: 67
diff changeset
1409 fprintf (dump_file, "%s%d", sep, i + BITS_PER_WORD);
kono
parents: 67
diff changeset
1410 sep = ",";
kono
parents: 67
diff changeset
1411 }
kono
parents: 67
diff changeset
1412 fprintf (dump_file, "\n");
kono
parents: 67
diff changeset
1413 }
kono
parents: 67
diff changeset
1414
kono
parents: 67
diff changeset
1415 /* Print to dump_file a description of what we're doing when optimizing
kono
parents: 67
diff changeset
1416 for speed or size; SPEED_P says which. DESCRIPTION is a description
kono
parents: 67
diff changeset
1417 of the SPEED_P choice. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1418
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1419 static void
111
kono
parents: 67
diff changeset
1420 dump_choices (bool speed_p, const char *description)
kono
parents: 67
diff changeset
1421 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1422 unsigned int size, factor, i;
111
kono
parents: 67
diff changeset
1423
kono
parents: 67
diff changeset
1424 fprintf (dump_file, "Choices when optimizing for %s:\n", description);
kono
parents: 67
diff changeset
1425
kono
parents: 67
diff changeset
1426 for (i = 0; i < MAX_MACHINE_MODE; i++)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1427 if (interesting_mode_p ((machine_mode) i, &size, &factor)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1428 && factor > 1)
111
kono
parents: 67
diff changeset
1429 fprintf (dump_file, " %s mode %s for copy lowering.\n",
kono
parents: 67
diff changeset
1430 choices[speed_p].move_modes_to_split[i]
kono
parents: 67
diff changeset
1431 ? "Splitting"
kono
parents: 67
diff changeset
1432 : "Skipping",
kono
parents: 67
diff changeset
1433 GET_MODE_NAME ((machine_mode) i));
kono
parents: 67
diff changeset
1434
kono
parents: 67
diff changeset
1435 fprintf (dump_file, " %s mode %s for zero_extend lowering.\n",
kono
parents: 67
diff changeset
1436 choices[speed_p].splitting_zext ? "Splitting" : "Skipping",
kono
parents: 67
diff changeset
1437 GET_MODE_NAME (twice_word_mode));
kono
parents: 67
diff changeset
1438
kono
parents: 67
diff changeset
1439 dump_shift_choices (ASHIFT, choices[speed_p].splitting_ashift);
kono
parents: 67
diff changeset
1440 dump_shift_choices (LSHIFTRT, choices[speed_p].splitting_lshiftrt);
kono
parents: 67
diff changeset
1441 dump_shift_choices (ASHIFTRT, choices[speed_p].splitting_ashiftrt);
kono
parents: 67
diff changeset
1442 fprintf (dump_file, "\n");
kono
parents: 67
diff changeset
1443 }
kono
parents: 67
diff changeset
1444
kono
parents: 67
diff changeset
1445 /* Look for registers which are always accessed via word-sized SUBREGs
kono
parents: 67
diff changeset
1446 or -if DECOMPOSE_COPIES is true- via copies. Decompose these
kono
parents: 67
diff changeset
1447 registers into several word-sized pseudo-registers. */
kono
parents: 67
diff changeset
1448
kono
parents: 67
diff changeset
1449 static void
kono
parents: 67
diff changeset
1450 decompose_multiword_subregs (bool decompose_copies)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1451 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1452 unsigned int max;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1453 basic_block bb;
111
kono
parents: 67
diff changeset
1454 bool speed_p;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1455
111
kono
parents: 67
diff changeset
1456 if (dump_file)
kono
parents: 67
diff changeset
1457 {
kono
parents: 67
diff changeset
1458 dump_choices (false, "size");
kono
parents: 67
diff changeset
1459 dump_choices (true, "speed");
kono
parents: 67
diff changeset
1460 }
kono
parents: 67
diff changeset
1461
kono
parents: 67
diff changeset
1462 /* Check if this target even has any modes to consider lowering. */
kono
parents: 67
diff changeset
1463 if (!choices[false].something_to_do && !choices[true].something_to_do)
kono
parents: 67
diff changeset
1464 {
kono
parents: 67
diff changeset
1465 if (dump_file)
kono
parents: 67
diff changeset
1466 fprintf (dump_file, "Nothing to do!\n");
kono
parents: 67
diff changeset
1467 return;
kono
parents: 67
diff changeset
1468 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1469
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1470 max = max_reg_num ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1471
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1472 /* First see if there are any multi-word pseudo-registers. If there
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1473 aren't, there is nothing we can do. This should speed up this
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1474 pass in the normal case, since it should be faster than scanning
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1475 all the insns. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1476 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1477 unsigned int i;
111
kono
parents: 67
diff changeset
1478 bool useful_modes_seen = false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1479
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1480 for (i = FIRST_PSEUDO_REGISTER; i < max; ++i)
111
kono
parents: 67
diff changeset
1481 if (regno_reg_rtx[i] != NULL)
kono
parents: 67
diff changeset
1482 {
kono
parents: 67
diff changeset
1483 machine_mode mode = GET_MODE (regno_reg_rtx[i]);
kono
parents: 67
diff changeset
1484 if (choices[false].move_modes_to_split[(int) mode]
kono
parents: 67
diff changeset
1485 || choices[true].move_modes_to_split[(int) mode])
kono
parents: 67
diff changeset
1486 {
kono
parents: 67
diff changeset
1487 useful_modes_seen = true;
kono
parents: 67
diff changeset
1488 break;
kono
parents: 67
diff changeset
1489 }
kono
parents: 67
diff changeset
1490 }
kono
parents: 67
diff changeset
1491
kono
parents: 67
diff changeset
1492 if (!useful_modes_seen)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1493 {
111
kono
parents: 67
diff changeset
1494 if (dump_file)
kono
parents: 67
diff changeset
1495 fprintf (dump_file, "Nothing to lower in this function.\n");
kono
parents: 67
diff changeset
1496 return;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1497 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1498 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1499
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1500 if (df)
111
kono
parents: 67
diff changeset
1501 {
kono
parents: 67
diff changeset
1502 df_set_flags (DF_DEFER_INSN_RESCAN);
kono
parents: 67
diff changeset
1503 run_word_dce ();
kono
parents: 67
diff changeset
1504 }
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1505
111
kono
parents: 67
diff changeset
1506 /* FIXME: It may be possible to change this code to look for each
kono
parents: 67
diff changeset
1507 multi-word pseudo-register and to find each insn which sets or
kono
parents: 67
diff changeset
1508 uses that register. That should be faster than scanning all the
kono
parents: 67
diff changeset
1509 insns. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1510
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1511 decomposable_context = BITMAP_ALLOC (NULL);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1512 non_decomposable_context = BITMAP_ALLOC (NULL);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1513 subreg_context = BITMAP_ALLOC (NULL);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1514
111
kono
parents: 67
diff changeset
1515 reg_copy_graph.create (max);
kono
parents: 67
diff changeset
1516 reg_copy_graph.safe_grow_cleared (max);
kono
parents: 67
diff changeset
1517 memset (reg_copy_graph.address (), 0, sizeof (bitmap) * max);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1518
111
kono
parents: 67
diff changeset
1519 speed_p = optimize_function_for_speed_p (cfun);
kono
parents: 67
diff changeset
1520 FOR_EACH_BB_FN (bb, cfun)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1521 {
111
kono
parents: 67
diff changeset
1522 rtx_insn *insn;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1523
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1524 FOR_BB_INSNS (bb, insn)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1525 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1526 rtx set;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1527 enum classify_move_insn cmi;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1528 int i, n;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1529
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1530 if (!INSN_P (insn)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1531 || GET_CODE (PATTERN (insn)) == CLOBBER
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1532 || GET_CODE (PATTERN (insn)) == USE)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1533 continue;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1534
111
kono
parents: 67
diff changeset
1535 recog_memoized (insn);
kono
parents: 67
diff changeset
1536
kono
parents: 67
diff changeset
1537 if (find_decomposable_shift_zext (insn, speed_p))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1538 continue;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1539
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1540 extract_insn (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1541
111
kono
parents: 67
diff changeset
1542 set = simple_move (insn, speed_p);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1543
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1544 if (!set)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1545 cmi = NOT_SIMPLE_MOVE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1546 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1547 {
111
kono
parents: 67
diff changeset
1548 /* We mark pseudo-to-pseudo copies as decomposable during the
kono
parents: 67
diff changeset
1549 second pass only. The first pass is so early that there is
kono
parents: 67
diff changeset
1550 good chance such moves will be optimized away completely by
kono
parents: 67
diff changeset
1551 subsequent optimizations anyway.
kono
parents: 67
diff changeset
1552
kono
parents: 67
diff changeset
1553 However, we call find_pseudo_copy even during the first pass
kono
parents: 67
diff changeset
1554 so as to properly set up the reg_copy_graph. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1555 if (find_pseudo_copy (set))
111
kono
parents: 67
diff changeset
1556 cmi = decompose_copies? DECOMPOSABLE_SIMPLE_MOVE : SIMPLE_MOVE;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1557 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1558 cmi = SIMPLE_MOVE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1559 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1560
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1561 n = recog_data.n_operands;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1562 for (i = 0; i < n; ++i)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1563 {
111
kono
parents: 67
diff changeset
1564 find_decomposable_subregs (&recog_data.operand[i], &cmi);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1565
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1566 /* We handle ASM_OPERANDS as a special case to support
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1567 things like x86 rdtsc which returns a DImode value.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1568 We can decompose the output, which will certainly be
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1569 operand 0, but not the inputs. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1570
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1571 if (cmi == SIMPLE_MOVE
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1572 && GET_CODE (SET_SRC (set)) == ASM_OPERANDS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1573 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1574 gcc_assert (i == 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1575 cmi = NOT_SIMPLE_MOVE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1576 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1577 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1578 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1579 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1580
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1581 bitmap_and_compl_into (decomposable_context, non_decomposable_context);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1582 if (!bitmap_empty_p (decomposable_context))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1583 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1584 unsigned int i;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1585 sbitmap_iterator sbi;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1586 bitmap_iterator iter;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1587 unsigned int regno;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1588
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1589 propagate_pseudo_copies ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1590
111
kono
parents: 67
diff changeset
1591 auto_sbitmap sub_blocks (last_basic_block_for_fn (cfun));
kono
parents: 67
diff changeset
1592 bitmap_clear (sub_blocks);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1593
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1594 EXECUTE_IF_SET_IN_BITMAP (decomposable_context, 0, regno, iter)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1595 decompose_register (regno);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1596
111
kono
parents: 67
diff changeset
1597 FOR_EACH_BB_FN (bb, cfun)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1598 {
111
kono
parents: 67
diff changeset
1599 rtx_insn *insn;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1600
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1601 FOR_BB_INSNS (bb, insn)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1602 {
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1603 rtx pat;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1604
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1605 if (!INSN_P (insn))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1606 continue;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1607
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1608 pat = PATTERN (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1609 if (GET_CODE (pat) == CLOBBER)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1610 resolve_clobber (pat, insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1611 else if (GET_CODE (pat) == USE)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1612 resolve_use (pat, insn);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1613 else if (DEBUG_INSN_P (insn))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1614 resolve_debug (insn);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1615 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1616 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1617 rtx set;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1618 int i;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1619
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1620 recog_memoized (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1621 extract_insn (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1622
111
kono
parents: 67
diff changeset
1623 set = simple_move (insn, speed_p);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1624 if (set)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1625 {
111
kono
parents: 67
diff changeset
1626 rtx_insn *orig_insn = insn;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1627 bool cfi = control_flow_insn_p (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1628
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1629 /* We can end up splitting loads to multi-word pseudos
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1630 into separate loads to machine word size pseudos.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1631 When this happens, we first had one load that can
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1632 throw, and after resolve_simple_move we'll have a
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1633 bunch of loads (at least two). All those loads may
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1634 trap if we can have non-call exceptions, so they
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1635 all will end the current basic block. We split the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1636 block after the outer loop over all insns, but we
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1637 make sure here that we will be able to split the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1638 basic block and still produce the correct control
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1639 flow graph for it. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1640 gcc_assert (!cfi
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1641 || (cfun->can_throw_non_call_exceptions
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1642 && can_throw_internal (insn)));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1643
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1644 insn = resolve_simple_move (set, insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1645 if (insn != orig_insn)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1646 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1647 recog_memoized (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1648 extract_insn (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1649
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1650 if (cfi)
111
kono
parents: 67
diff changeset
1651 bitmap_set_bit (sub_blocks, bb->index);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1652 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1653 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1654 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1655 {
111
kono
parents: 67
diff changeset
1656 rtx_insn *decomposed_shift;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1657
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1658 decomposed_shift = resolve_shift_zext (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1659 if (decomposed_shift != NULL_RTX)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1660 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1661 insn = decomposed_shift;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1662 recog_memoized (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1663 extract_insn (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1664 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1665 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1666
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1667 for (i = recog_data.n_operands - 1; i >= 0; --i)
111
kono
parents: 67
diff changeset
1668 resolve_subreg_use (recog_data.operand_loc[i], insn);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1669
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1670 resolve_reg_notes (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1671
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1672 if (num_validated_changes () > 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1673 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1674 for (i = recog_data.n_dups - 1; i >= 0; --i)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1675 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1676 rtx *pl = recog_data.dup_loc[i];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1677 int dup_num = recog_data.dup_num[i];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1678 rtx *px = recog_data.operand_loc[dup_num];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1679
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1680 validate_unshare_change (insn, pl, *px, 1);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1681 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1682
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1683 i = apply_change_group ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1684 gcc_assert (i);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1685 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1686 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1687 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1688 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1689
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1690 /* If we had insns to split that caused control flow insns in the middle
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1691 of a basic block, split those blocks now. Note that we only handle
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1692 the case where splitting a load has caused multiple possibly trapping
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1693 loads to appear. */
111
kono
parents: 67
diff changeset
1694 EXECUTE_IF_SET_IN_BITMAP (sub_blocks, 0, i, sbi)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1695 {
111
kono
parents: 67
diff changeset
1696 rtx_insn *insn, *end;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1697 edge fallthru;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1698
111
kono
parents: 67
diff changeset
1699 bb = BASIC_BLOCK_FOR_FN (cfun, i);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1700 insn = BB_HEAD (bb);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1701 end = BB_END (bb);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1702
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1703 while (insn != end)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1704 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1705 if (control_flow_insn_p (insn))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1706 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1707 /* Split the block after insn. There will be a fallthru
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1708 edge, which is OK so we keep it. We have to create the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1709 exception edges ourselves. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1710 fallthru = split_block (bb, insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1711 rtl_make_eh_edge (NULL, bb, BB_END (bb));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1712 bb = fallthru->dest;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1713 insn = BB_HEAD (bb);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1714 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1715 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1716 insn = NEXT_INSN (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1717 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1718 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1719 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1720
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1721 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1722 unsigned int i;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1723 bitmap b;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1724
111
kono
parents: 67
diff changeset
1725 FOR_EACH_VEC_ELT (reg_copy_graph, i, b)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1726 if (b)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1727 BITMAP_FREE (b);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1728 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1729
111
kono
parents: 67
diff changeset
1730 reg_copy_graph.release ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1731
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1732 BITMAP_FREE (decomposable_context);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1733 BITMAP_FREE (non_decomposable_context);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1734 BITMAP_FREE (subreg_context);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1735 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1736
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1737 /* Implement first lower subreg pass. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1738
111
kono
parents: 67
diff changeset
1739 namespace {
kono
parents: 67
diff changeset
1740
kono
parents: 67
diff changeset
1741 const pass_data pass_data_lower_subreg =
kono
parents: 67
diff changeset
1742 {
kono
parents: 67
diff changeset
1743 RTL_PASS, /* type */
kono
parents: 67
diff changeset
1744 "subreg1", /* name */
kono
parents: 67
diff changeset
1745 OPTGROUP_NONE, /* optinfo_flags */
kono
parents: 67
diff changeset
1746 TV_LOWER_SUBREG, /* tv_id */
kono
parents: 67
diff changeset
1747 0, /* properties_required */
kono
parents: 67
diff changeset
1748 0, /* properties_provided */
kono
parents: 67
diff changeset
1749 0, /* properties_destroyed */
kono
parents: 67
diff changeset
1750 0, /* todo_flags_start */
kono
parents: 67
diff changeset
1751 0, /* todo_flags_finish */
kono
parents: 67
diff changeset
1752 };
kono
parents: 67
diff changeset
1753
kono
parents: 67
diff changeset
1754 class pass_lower_subreg : public rtl_opt_pass
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1755 {
111
kono
parents: 67
diff changeset
1756 public:
kono
parents: 67
diff changeset
1757 pass_lower_subreg (gcc::context *ctxt)
kono
parents: 67
diff changeset
1758 : rtl_opt_pass (pass_data_lower_subreg, ctxt)
kono
parents: 67
diff changeset
1759 {}
kono
parents: 67
diff changeset
1760
kono
parents: 67
diff changeset
1761 /* opt_pass methods: */
kono
parents: 67
diff changeset
1762 virtual bool gate (function *) { return flag_split_wide_types != 0; }
kono
parents: 67
diff changeset
1763 virtual unsigned int execute (function *)
kono
parents: 67
diff changeset
1764 {
kono
parents: 67
diff changeset
1765 decompose_multiword_subregs (false);
kono
parents: 67
diff changeset
1766 return 0;
kono
parents: 67
diff changeset
1767 }
kono
parents: 67
diff changeset
1768
kono
parents: 67
diff changeset
1769 }; // class pass_lower_subreg
kono
parents: 67
diff changeset
1770
kono
parents: 67
diff changeset
1771 } // anon namespace
kono
parents: 67
diff changeset
1772
kono
parents: 67
diff changeset
1773 rtl_opt_pass *
kono
parents: 67
diff changeset
1774 make_pass_lower_subreg (gcc::context *ctxt)
kono
parents: 67
diff changeset
1775 {
kono
parents: 67
diff changeset
1776 return new pass_lower_subreg (ctxt);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1777 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1778
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1779 /* Implement second lower subreg pass. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1780
111
kono
parents: 67
diff changeset
1781 namespace {
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1782
111
kono
parents: 67
diff changeset
1783 const pass_data pass_data_lower_subreg2 =
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1784 {
111
kono
parents: 67
diff changeset
1785 RTL_PASS, /* type */
kono
parents: 67
diff changeset
1786 "subreg2", /* name */
kono
parents: 67
diff changeset
1787 OPTGROUP_NONE, /* optinfo_flags */
kono
parents: 67
diff changeset
1788 TV_LOWER_SUBREG, /* tv_id */
kono
parents: 67
diff changeset
1789 0, /* properties_required */
kono
parents: 67
diff changeset
1790 0, /* properties_provided */
kono
parents: 67
diff changeset
1791 0, /* properties_destroyed */
kono
parents: 67
diff changeset
1792 0, /* todo_flags_start */
kono
parents: 67
diff changeset
1793 TODO_df_finish, /* todo_flags_finish */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1794 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1795
111
kono
parents: 67
diff changeset
1796 class pass_lower_subreg2 : public rtl_opt_pass
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1797 {
111
kono
parents: 67
diff changeset
1798 public:
kono
parents: 67
diff changeset
1799 pass_lower_subreg2 (gcc::context *ctxt)
kono
parents: 67
diff changeset
1800 : rtl_opt_pass (pass_data_lower_subreg2, ctxt)
kono
parents: 67
diff changeset
1801 {}
kono
parents: 67
diff changeset
1802
kono
parents: 67
diff changeset
1803 /* opt_pass methods: */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1804 virtual bool gate (function *) { return flag_split_wide_types
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1805 && flag_split_wide_types_early; }
111
kono
parents: 67
diff changeset
1806 virtual unsigned int execute (function *)
kono
parents: 67
diff changeset
1807 {
kono
parents: 67
diff changeset
1808 decompose_multiword_subregs (true);
kono
parents: 67
diff changeset
1809 return 0;
kono
parents: 67
diff changeset
1810 }
kono
parents: 67
diff changeset
1811
kono
parents: 67
diff changeset
1812 }; // class pass_lower_subreg2
kono
parents: 67
diff changeset
1813
kono
parents: 67
diff changeset
1814 } // anon namespace
kono
parents: 67
diff changeset
1815
kono
parents: 67
diff changeset
1816 rtl_opt_pass *
kono
parents: 67
diff changeset
1817 make_pass_lower_subreg2 (gcc::context *ctxt)
kono
parents: 67
diff changeset
1818 {
kono
parents: 67
diff changeset
1819 return new pass_lower_subreg2 (ctxt);
kono
parents: 67
diff changeset
1820 }
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1821
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1822 /* Implement third lower subreg pass. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1823
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1824 namespace {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1825
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1826 const pass_data pass_data_lower_subreg3 =
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1827 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1828 RTL_PASS, /* type */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1829 "subreg3", /* name */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1830 OPTGROUP_NONE, /* optinfo_flags */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1831 TV_LOWER_SUBREG, /* tv_id */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1832 0, /* properties_required */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1833 0, /* properties_provided */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1834 0, /* properties_destroyed */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1835 0, /* todo_flags_start */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1836 TODO_df_finish, /* todo_flags_finish */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1837 };
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1838
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1839 class pass_lower_subreg3 : public rtl_opt_pass
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1840 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1841 public:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1842 pass_lower_subreg3 (gcc::context *ctxt)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1843 : rtl_opt_pass (pass_data_lower_subreg3, ctxt)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1844 {}
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1845
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1846 /* opt_pass methods: */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1847 virtual bool gate (function *) { return flag_split_wide_types
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1848 && !flag_split_wide_types_early; }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1849 virtual unsigned int execute (function *)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1850 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1851 decompose_multiword_subregs (true);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1852 return 0;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1853 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1854
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1855 }; // class pass_lower_subreg3
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1856
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1857 } // anon namespace
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1858
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1859 rtl_opt_pass *
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1860 make_pass_lower_subreg3 (gcc::context *ctxt)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1861 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1862 return new pass_lower_subreg3 (ctxt);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1863 }