Mercurial > hg > CbC > CbC_gcc
comparison gcc/tree-nrv.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 |
---|---|
23 #include "coretypes.h" | 23 #include "coretypes.h" |
24 #include "tm.h" | 24 #include "tm.h" |
25 #include "tree.h" | 25 #include "tree.h" |
26 #include "function.h" | 26 #include "function.h" |
27 #include "basic-block.h" | 27 #include "basic-block.h" |
28 #include "diagnostic.h" | |
29 #include "tree-pretty-print.h" | 28 #include "tree-pretty-print.h" |
30 #include "tree-flow.h" | 29 #include "tree-flow.h" |
31 #include "timevar.h" | 30 #include "timevar.h" |
32 #include "tree-dump.h" | 31 #include "tree-dump.h" |
33 #include "tree-pass.h" | 32 #include "tree-pass.h" |
258 gsi_next (&gsi); | 257 gsi_next (&gsi); |
259 } | 258 } |
260 } | 259 } |
261 } | 260 } |
262 | 261 |
262 SET_DECL_VALUE_EXPR (found, result); | |
263 DECL_HAS_VALUE_EXPR_P (found) = 1; | |
264 | |
263 /* FOUND is no longer used. Ensure it gets removed. */ | 265 /* FOUND is no longer used. Ensure it gets removed. */ |
264 var_ann (found)->used = 0; | 266 clear_is_used (found); |
265 return 0; | 267 return 0; |
266 } | 268 } |
267 | 269 |
268 static bool | 270 static bool |
269 gate_pass_return_slot (void) | 271 gate_pass_return_slot (void) |
292 | 294 |
293 /* Determine (pessimistically) whether DEST is available for NRV | 295 /* Determine (pessimistically) whether DEST is available for NRV |
294 optimization, where DEST is expected to be the LHS of a modify | 296 optimization, where DEST is expected to be the LHS of a modify |
295 expression where the RHS is a function returning an aggregate. | 297 expression where the RHS is a function returning an aggregate. |
296 | 298 |
297 DEST is available if it is not clobbered by the call. */ | 299 DEST is available if it is not clobbered or used by the call. */ |
298 | 300 |
299 static bool | 301 static bool |
300 dest_safe_for_nrv_p (gimple call) | 302 dest_safe_for_nrv_p (gimple call) |
301 { | 303 { |
302 tree dest = gimple_call_lhs (call); | 304 tree dest = gimple_call_lhs (call); |
306 return false; | 308 return false; |
307 | 309 |
308 if (TREE_CODE (dest) == SSA_NAME) | 310 if (TREE_CODE (dest) == SSA_NAME) |
309 return true; | 311 return true; |
310 | 312 |
311 if (call_may_clobber_ref_p (call, dest)) | 313 if (call_may_clobber_ref_p (call, dest) |
314 || ref_maybe_used_by_stmt_p (call, dest)) | |
312 return false; | 315 return false; |
313 | 316 |
314 return true; | 317 return true; |
315 } | 318 } |
316 | 319 |
341 | 344 |
342 if (is_gimple_call (stmt) | 345 if (is_gimple_call (stmt) |
343 && gimple_call_lhs (stmt) | 346 && gimple_call_lhs (stmt) |
344 && !gimple_call_return_slot_opt_p (stmt) | 347 && !gimple_call_return_slot_opt_p (stmt) |
345 && aggregate_value_p (TREE_TYPE (gimple_call_lhs (stmt)), | 348 && aggregate_value_p (TREE_TYPE (gimple_call_lhs (stmt)), |
346 gimple_call_fndecl (stmt)) | 349 gimple_call_fndecl (stmt))) |
347 ) | |
348 { | 350 { |
349 /* Check if the location being assigned to is | 351 /* Check if the location being assigned to is |
350 clobbered by the call. */ | 352 clobbered by the call. */ |
351 slot_opt_p = dest_safe_for_nrv_p (stmt); | 353 slot_opt_p = dest_safe_for_nrv_p (stmt); |
352 gimple_call_set_return_slot_opt (stmt, slot_opt_p); | 354 gimple_call_set_return_slot_opt (stmt, slot_opt_p); |