Mercurial > hg > CbC > CbC_gcc
comparison gcc/tree-ssanames.c @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | b7f97abdc517 |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
65:65488c3d617d | 67:f6334be47118 |
---|---|
1 /* Generic routines for manipulating SSA_NAME expressions | 1 /* Generic routines for manipulating SSA_NAME expressions |
2 Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 | 2 Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 |
3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify | 7 GCC is free software; you can redistribute it and/or modify |
238 TREE_CHAIN (var) = FREE_SSANAMES (cfun); | 238 TREE_CHAIN (var) = FREE_SSANAMES (cfun); |
239 FREE_SSANAMES (cfun) = var; | 239 FREE_SSANAMES (cfun) = var; |
240 } | 240 } |
241 } | 241 } |
242 | 242 |
243 /* Creates a duplicate of a ssa name NAME defined in statement STMT. */ | 243 |
244 /* Return the alias information associated with pointer T. It creates a | |
245 new instance if none existed. */ | |
246 | |
247 struct ptr_info_def * | |
248 get_ptr_info (tree t) | |
249 { | |
250 struct ptr_info_def *pi; | |
251 | |
252 gcc_assert (POINTER_TYPE_P (TREE_TYPE (t))); | |
253 | |
254 pi = SSA_NAME_PTR_INFO (t); | |
255 if (pi == NULL) | |
256 { | |
257 pi = ggc_alloc_cleared_ptr_info_def (); | |
258 pt_solution_reset (&pi->pt); | |
259 pi->align = 1; | |
260 pi->misalign = 0; | |
261 SSA_NAME_PTR_INFO (t) = pi; | |
262 } | |
263 | |
264 return pi; | |
265 } | |
266 | |
267 /* Creates a duplicate of the ptr_info_def at PTR_INFO for use by | |
268 the SSA name NAME. */ | |
269 | |
270 void | |
271 duplicate_ssa_name_ptr_info (tree name, struct ptr_info_def *ptr_info) | |
272 { | |
273 struct ptr_info_def *new_ptr_info; | |
274 | |
275 gcc_assert (POINTER_TYPE_P (TREE_TYPE (name))); | |
276 gcc_assert (!SSA_NAME_PTR_INFO (name)); | |
277 | |
278 if (!ptr_info) | |
279 return; | |
280 | |
281 new_ptr_info = ggc_alloc_ptr_info_def (); | |
282 *new_ptr_info = *ptr_info; | |
283 | |
284 SSA_NAME_PTR_INFO (name) = new_ptr_info; | |
285 } | |
286 | |
287 | |
288 /* Creates a duplicate of a ssa name NAME tobe defined by statement STMT. */ | |
244 | 289 |
245 tree | 290 tree |
246 duplicate_ssa_name (tree name, gimple stmt) | 291 duplicate_ssa_name (tree name, gimple stmt) |
247 { | 292 { |
248 tree new_name = make_ssa_name (SSA_NAME_VAR (name), stmt); | 293 tree new_name = make_ssa_name (SSA_NAME_VAR (name), stmt); |
250 | 295 |
251 if (old_ptr_info) | 296 if (old_ptr_info) |
252 duplicate_ssa_name_ptr_info (new_name, old_ptr_info); | 297 duplicate_ssa_name_ptr_info (new_name, old_ptr_info); |
253 | 298 |
254 return new_name; | 299 return new_name; |
255 } | |
256 | |
257 | |
258 /* Creates a duplicate of the ptr_info_def at PTR_INFO for use by | |
259 the SSA name NAME. */ | |
260 | |
261 void | |
262 duplicate_ssa_name_ptr_info (tree name, struct ptr_info_def *ptr_info) | |
263 { | |
264 struct ptr_info_def *new_ptr_info; | |
265 | |
266 gcc_assert (POINTER_TYPE_P (TREE_TYPE (name))); | |
267 gcc_assert (!SSA_NAME_PTR_INFO (name)); | |
268 | |
269 if (!ptr_info) | |
270 return; | |
271 | |
272 new_ptr_info = GGC_NEW (struct ptr_info_def); | |
273 *new_ptr_info = *ptr_info; | |
274 | |
275 SSA_NAME_PTR_INFO (name) = new_ptr_info; | |
276 } | 300 } |
277 | 301 |
278 | 302 |
279 /* Release all the SSA_NAMEs created by STMT. */ | 303 /* Release all the SSA_NAMEs created by STMT. */ |
280 | 304 |
312 { | 336 { |
313 tree t, next; | 337 tree t, next; |
314 int n = 0; | 338 int n = 0; |
315 referenced_var_iterator rvi; | 339 referenced_var_iterator rvi; |
316 | 340 |
317 /* Current defs point to various dead SSA names that in turn points to dead | 341 /* Current defs point to various dead SSA names that in turn point to |
318 statements so bunch of dead memory is held from releasing. */ | 342 eventually dead variables so a bunch of memory is held live. */ |
319 FOR_EACH_REFERENCED_VAR (t, rvi) | 343 FOR_EACH_REFERENCED_VAR (cfun, t, rvi) |
320 set_current_def (t, NULL); | 344 set_current_def (t, NULL); |
321 /* Now release the freelist. */ | 345 /* Now release the freelist. */ |
322 for (t = FREE_SSANAMES (cfun); t; t = next) | 346 for (t = FREE_SSANAMES (cfun); t; t = next) |
323 { | 347 { |
324 next = TREE_CHAIN (t); | 348 next = TREE_CHAIN (t); |
330 TREE_CHAIN (t) = NULL_TREE; | 354 TREE_CHAIN (t) = NULL_TREE; |
331 n++; | 355 n++; |
332 } | 356 } |
333 FREE_SSANAMES (cfun) = NULL; | 357 FREE_SSANAMES (cfun) = NULL; |
334 | 358 |
335 /* Cgraph edges has been invalidated and point to dead statement. We need to | 359 statistics_counter_event (cfun, "SSA names released", n); |
336 remove them now and will rebuild it before next IPA pass. */ | |
337 cgraph_node_remove_callees (cgraph_node (current_function_decl)); | |
338 | |
339 if (dump_file) | 360 if (dump_file) |
340 fprintf (dump_file, "Released %i names, %.2f%%\n", n, n * 100.0 / num_ssa_names); | 361 fprintf (dump_file, "Released %i names, %.2f%%\n", |
362 n, n * 100.0 / num_ssa_names); | |
341 return 0; | 363 return 0; |
342 } | 364 } |
343 | 365 |
344 struct gimple_opt_pass pass_release_ssa_names = | 366 struct gimple_opt_pass pass_release_ssa_names = |
345 { | 367 { |
349 NULL, /* gate */ | 371 NULL, /* gate */ |
350 release_dead_ssa_names, /* execute */ | 372 release_dead_ssa_names, /* execute */ |
351 NULL, /* sub */ | 373 NULL, /* sub */ |
352 NULL, /* next */ | 374 NULL, /* next */ |
353 0, /* static_pass_number */ | 375 0, /* static_pass_number */ |
354 TV_NONE, /* tv_id */ | 376 TV_TREE_SSA_OTHER, /* tv_id */ |
355 PROP_ssa, /* properties_required */ | 377 PROP_ssa, /* properties_required */ |
356 0, /* properties_provided */ | 378 0, /* properties_provided */ |
357 0, /* properties_destroyed */ | 379 0, /* properties_destroyed */ |
358 0, /* todo_flags_start */ | 380 0, /* todo_flags_start */ |
359 TODO_dump_func /* todo_flags_finish */ | 381 TODO_dump_func /* todo_flags_finish */ |