Mercurial > hg > CbC > CbC_gcc
comparison gcc/df-byte-scan.c @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
41 | 41 |
42 | 42 |
43 /* Helper for df_compute_accessed_bytes. Ref is some sort of extract. | 43 /* Helper for df_compute_accessed_bytes. Ref is some sort of extract. |
44 Return true if this effects the entire reg in REF. Return false if | 44 Return true if this effects the entire reg in REF. Return false if |
45 otherwise and set START_BYTE and LAST_BYTE. See the description of | 45 otherwise and set START_BYTE and LAST_BYTE. See the description of |
46 df_compute_accessed_bytes for a description of MM. */ | 46 df_compute_accessed_bytes for a description of MM. */ |
47 | 47 |
48 static bool | 48 static bool |
49 df_compute_accessed_bytes_extract (df_ref ref, | 49 df_compute_accessed_bytes_extract (df_ref ref, |
50 enum df_mm mm , | 50 enum df_mm mm , |
51 unsigned int *start_byte, | 51 unsigned int *start_byte, |
52 unsigned int *last_byte) | 52 unsigned int *last_byte) |
53 { | 53 { |
54 int start; | 54 int start; |
55 int last; | 55 int last; |
56 rtx reg = DF_REF_REG (ref); | 56 rtx reg = DF_REF_REG (ref); |
59 enum machine_mode m2; | 59 enum machine_mode m2; |
60 int m2_size; | 60 int m2_size; |
61 | 61 |
62 /* (*_extract:M1 (reg:M2 X) WIDTH POS) | 62 /* (*_extract:M1 (reg:M2 X) WIDTH POS) |
63 (*_extract:M1 (subreg:M1 (reg:M2 X N) WIDTH POS) | 63 (*_extract:M1 (subreg:M1 (reg:M2 X N) WIDTH POS) |
64 | 64 |
65 This is a bitfield extraction. The assignment clobbers/extracts | 65 This is a bitfield extraction. The assignment clobbers/extracts |
66 exactly the bits named by WIDTH and POS and does not affect the | 66 exactly the bits named by WIDTH and POS and does not affect the |
67 other bits in register X. It is also technically possible that | 67 other bits in register X. It is also technically possible that |
68 the bits asked for are longer than units per word. */ | 68 the bits asked for are longer than units per word. */ |
69 | 69 |
70 int offset = DF_REF_EXTRACT_OFFSET (ref); | 70 int offset = DF_REF_EXTRACT_OFFSET (ref); |
71 int width = DF_REF_EXTRACT_WIDTH (ref); | 71 int width = DF_REF_EXTRACT_WIDTH (ref); |
72 | 72 |
73 if (width == -1 || offset == -1) | 73 if (width == -1 || offset == -1) |
74 return true; | 74 return true; |
132 start = 0; | 132 start = 0; |
133 if (last > m2_size) | 133 if (last > m2_size) |
134 last = m2_size; | 134 last = m2_size; |
135 | 135 |
136 if (dump_file) | 136 if (dump_file) |
137 fprintf (dump_file, " cpb extract regno=%d start=%d last=%d\n", | 137 fprintf (dump_file, " cpb extract regno=%d start=%d last=%d\n", |
138 DF_REF_REGNO (ref), start, last); | 138 DF_REF_REGNO (ref), start, last); |
139 | 139 |
140 *start_byte = start; | 140 *start_byte = start; |
141 *last_byte = last; | 141 *last_byte = last; |
142 return false; | 142 return false; |
143 } | 143 } |
144 | 144 |
145 | 145 |
146 /* Helper for df_compute_accessed_bytes. Ref is a strict_low_part. | 146 /* Helper for df_compute_accessed_bytes. Ref is a strict_low_part. |
147 Return true if this effects the entire reg in REF. Return false if | 147 Return true if this effects the entire reg in REF. Return false if |
148 otherwise and set START_BYTE and LAST_BYTE. */ | 148 otherwise and set START_BYTE and LAST_BYTE. */ |
149 | 149 |
150 static bool | 150 static bool |
151 df_compute_accessed_bytes_strict_low_part (df_ref ref, | 151 df_compute_accessed_bytes_strict_low_part (df_ref ref, |
152 unsigned int *start_byte, | 152 unsigned int *start_byte, |
153 unsigned int *last_byte) | 153 unsigned int *last_byte) |
154 { | 154 { |
155 int start; | 155 int start; |
156 int last; | 156 int last; |
157 rtx reg = DF_REF_REG (ref); | 157 rtx reg = DF_REF_REG (ref); |
175 /* It does not seem to be meaningful to apply a strict_low_part of a | 175 /* It does not seem to be meaningful to apply a strict_low_part of a |
176 paradoxical register. */ | 176 paradoxical register. */ |
177 gcc_assert (m1_size <= m2_size); | 177 gcc_assert (m1_size <= m2_size); |
178 | 178 |
179 /* (set (strict_low_part (subreg:M1 (reg:M2 X) N)) ...) | 179 /* (set (strict_low_part (subreg:M1 (reg:M2 X) N)) ...) |
180 | 180 |
181 This is a bitfield insertion. The assignment clobbers exactly the | 181 This is a bitfield insertion. The assignment clobbers exactly the |
182 bits named by the subreg--the M1 bits at position N. It is also | 182 bits named by the subreg--the M1 bits at position N. It is also |
183 technically possible that the bits asked for are longer than units | 183 technically possible that the bits asked for are longer than units |
184 per word. */ | 184 per word. */ |
185 | 185 |
186 start = offset; | 186 start = offset; |
187 last = offset + m1_size; | 187 last = offset + m1_size; |
188 | 188 |
189 if (dump_file) | 189 if (dump_file) |
190 fprintf (dump_file, " cpb strict low part regno=%d start=%d last=%d\n", | 190 fprintf (dump_file, " cpb strict low part regno=%d start=%d last=%d\n", |
191 DF_REF_REGNO (ref), start, last); | 191 DF_REF_REGNO (ref), start, last); |
192 | 192 |
193 *start_byte = start; | 193 *start_byte = start; |
194 *last_byte = last; | 194 *last_byte = last; |
195 return false; | 195 return false; |
196 } | 196 } |
197 | 197 |
198 /* Helper for df_compute_accessed_bytes. Ref is a naked subreg. | 198 /* Helper for df_compute_accessed_bytes. Ref is a naked subreg. |
199 Return true if this effects the entire reg in REF. Return false if | 199 Return true if this effects the entire reg in REF. Return false if |
200 otherwise and set START_BYTE and LAST_BYTE. */ | 200 otherwise and set START_BYTE and LAST_BYTE. */ |
201 | 201 |
202 static bool | 202 static bool |
203 df_compute_accessed_bytes_subreg (df_ref ref, unsigned int *start_byte, | 203 df_compute_accessed_bytes_subreg (df_ref ref, unsigned int *start_byte, |
204 unsigned int *last_byte) | 204 unsigned int *last_byte) |
205 | 205 |
206 { | 206 { |
207 /* (subreg:M1 (reg:M2 X) N) */ | 207 /* (subreg:M1 (reg:M2 X) N) */ |
208 int start; | 208 int start; |
229 return true; | 229 return true; |
230 | 230 |
231 /* Defs and uses are different in the amount of the reg that touch. */ | 231 /* Defs and uses are different in the amount of the reg that touch. */ |
232 if (DF_REF_REG_DEF_P (ref)) | 232 if (DF_REF_REG_DEF_P (ref)) |
233 { | 233 { |
234 /* This is an lvalue. */ | 234 /* This is an lvalue. */ |
235 | 235 |
236 if (m2_size > UNITS_PER_WORD) | 236 if (m2_size > UNITS_PER_WORD) |
237 { | 237 { |
238 /* The assignment clobbers UNITS_PER_WORD segments of X. | 238 /* The assignment clobbers UNITS_PER_WORD segments of X. |
239 Look at the bytes named by the subreg, and expand it to | 239 Look at the bytes named by the subreg, and expand it to |
240 cover a UNITS_PER_WORD part of register X. That part of | 240 cover a UNITS_PER_WORD part of register X. That part of |
241 register X is clobbered, the rest is not. | 241 register X is clobbered, the rest is not. |
242 | 242 |
243 E.g., (subreg:SI (reg:DI X) 0), where UNITS_PER_WORD is the | 243 E.g., (subreg:SI (reg:DI X) 0), where UNITS_PER_WORD is the |
244 size of SImode, clobbers the first SImode part of X, and does | 244 size of SImode, clobbers the first SImode part of X, and does |
245 not affect the second SImode part. | 245 not affect the second SImode part. |
246 | 246 |
247 E.g., (subreg:QI (reg:DI X) 0), where UNITS_PER_WORD is the | 247 E.g., (subreg:QI (reg:DI X) 0), where UNITS_PER_WORD is the |
248 size of SImode, clobbers the first SImode part of X, and does | 248 size of SImode, clobbers the first SImode part of X, and does |
249 not affect the second SImode part. Here the QImode byte is | 249 not affect the second SImode part. Here the QImode byte is |
250 expanded to a UNITS_PER_WORD portion of the register for | 250 expanded to a UNITS_PER_WORD portion of the register for |
251 purposes of determining what is clobbered. | 251 purposes of determining what is clobbered. |
252 | 252 |
253 If this is an rvalue, then it touches just the bytes that it | 253 If this is an rvalue, then it touches just the bytes that it |
254 talks about. */ | 254 talks about. */ |
255 int offset = SUBREG_BYTE (reg); | 255 int offset = SUBREG_BYTE (reg); |
256 | 256 |
257 start = offset & ~(UNITS_PER_WORD - 1); | 257 start = offset & ~(UNITS_PER_WORD - 1); |
258 last = (offset + m1_size + UNITS_PER_WORD - 1) | 258 last = (offset + m1_size + UNITS_PER_WORD - 1) |
259 & ~(UNITS_PER_WORD - 1); | 259 & ~(UNITS_PER_WORD - 1); |
260 } | 260 } |
261 else | 261 else |
262 /* Whole register size M2 equal to or smaller than | 262 /* Whole register size M2 equal to or smaller than |
263 UNITS_PER_WORD The assignment clobbers the entire register | 263 UNITS_PER_WORD The assignment clobbers the entire register |
264 X. */ | 264 X. */ |
265 return true; | 265 return true; |
266 } | 266 } |
267 else | 267 else |
268 { | 268 { |
269 /* This is an rvalue. It touches just the bytes they explicitly | 269 /* This is an rvalue. It touches just the bytes they explicitly |
270 mentioned. */ | 270 mentioned. */ |
271 int offset = SUBREG_BYTE (reg); | 271 int offset = SUBREG_BYTE (reg); |
272 start = offset; | 272 start = offset; |
273 last = start + m1_size; | 273 last = start + m1_size; |
274 } | 274 } |
275 | 275 |
276 if (dump_file) | 276 if (dump_file) |
277 fprintf (dump_file, " cpb subreg regno=%d start=%d last=%d\n", | 277 fprintf (dump_file, " cpb subreg regno=%d start=%d last=%d\n", |
278 DF_REF_REGNO (ref), start, last); | 278 DF_REF_REGNO (ref), start, last); |
279 | 279 |
280 *start_byte = start; | 280 *start_byte = start; |
281 *last_byte = last; | 281 *last_byte = last; |
282 return false; | 282 return false; |
297 to part of the register, return FALSE and set START_BYTE and | 297 to part of the register, return FALSE and set START_BYTE and |
298 LAST_BYTE properly. In the case where fabricated uses are passed | 298 LAST_BYTE properly. In the case where fabricated uses are passed |
299 in, START_BYTE and LAST_BYTE are set to 0 and false is returned. | 299 in, START_BYTE and LAST_BYTE are set to 0 and false is returned. |
300 This means that this use can be ignored. */ | 300 This means that this use can be ignored. */ |
301 | 301 |
302 bool | 302 bool |
303 df_compute_accessed_bytes (df_ref ref, enum df_mm mm, | 303 df_compute_accessed_bytes (df_ref ref, enum df_mm mm, |
304 unsigned int *start_byte, | 304 unsigned int *start_byte, |
305 unsigned int *last_byte) | 305 unsigned int *last_byte) |
306 { | 306 { |
307 if (!dbg_cnt (df_byte_scan)) | 307 if (!dbg_cnt (df_byte_scan)) |
308 return true; | 308 return true; |
309 | 309 |
310 if (!DF_REF_REG_DEF_P (ref) | 310 if (!DF_REF_REG_DEF_P (ref) |
311 && DF_REF_FLAGS_IS_SET (ref, DF_REF_READ_WRITE)) | 311 && DF_REF_FLAGS_IS_SET (ref, DF_REF_READ_WRITE)) |
312 { | 312 { |
313 if (DF_REF_FLAGS_IS_SET (ref, DF_REF_PRE_POST_MODIFY)) | 313 if (DF_REF_FLAGS_IS_SET (ref, DF_REF_PRE_POST_MODIFY)) |
314 /* Pre/post modify/inc/dec always read and write the entire | 314 /* Pre/post modify/inc/dec always read and write the entire |
315 reg. */ | 315 reg. */ |
329 } | 329 } |
330 | 330 |
331 if (DF_REF_FLAGS_IS_SET (ref, DF_REF_SIGN_EXTRACT | DF_REF_ZERO_EXTRACT)) | 331 if (DF_REF_FLAGS_IS_SET (ref, DF_REF_SIGN_EXTRACT | DF_REF_ZERO_EXTRACT)) |
332 return df_compute_accessed_bytes_extract (ref, mm, start_byte, last_byte); | 332 return df_compute_accessed_bytes_extract (ref, mm, start_byte, last_byte); |
333 else if (DF_REF_FLAGS_IS_SET (ref, DF_REF_STRICT_LOW_PART)) | 333 else if (DF_REF_FLAGS_IS_SET (ref, DF_REF_STRICT_LOW_PART)) |
334 return df_compute_accessed_bytes_strict_low_part (ref, | 334 return df_compute_accessed_bytes_strict_low_part (ref, |
335 start_byte, last_byte); | 335 start_byte, last_byte); |
336 else if (GET_CODE (DF_REF_REG (ref)) == SUBREG) | 336 else if (GET_CODE (DF_REF_REG (ref)) == SUBREG) |
337 return df_compute_accessed_bytes_subreg (ref, start_byte, last_byte); | 337 return df_compute_accessed_bytes_subreg (ref, start_byte, last_byte); |
338 return true; | 338 return true; |
339 } | 339 } |