Mercurial > hg > CbC > CbC_gcc
comparison gcc/gimple-iterator.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 | b7f97abdc517 |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
43 | 43 |
44 static void | 44 static void |
45 update_modified_stmts (gimple_seq seq) | 45 update_modified_stmts (gimple_seq seq) |
46 { | 46 { |
47 gimple_stmt_iterator gsi; | 47 gimple_stmt_iterator gsi; |
48 | 48 |
49 if (!ssa_operands_active ()) | 49 if (!ssa_operands_active ()) |
50 return; | 50 return; |
51 for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi)) | 51 for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi)) |
52 update_stmt_if_modified (gsi_stmt (gsi)); | 52 update_stmt_if_modified (gsi_stmt (gsi)); |
53 } | 53 } |
54 | 54 |
55 | 55 |
58 | 58 |
59 static void | 59 static void |
60 update_bb_for_stmts (gimple_seq_node first, basic_block bb) | 60 update_bb_for_stmts (gimple_seq_node first, basic_block bb) |
61 { | 61 { |
62 gimple_seq_node n; | 62 gimple_seq_node n; |
63 | 63 |
64 for (n = first; n; n = n->next) | 64 for (n = first; n; n = n->next) |
65 gimple_set_bb (n->stmt, bb); | 65 gimple_set_bb (n->stmt, bb); |
66 } | 66 } |
67 | 67 |
68 | 68 |
356 } | 356 } |
357 | 357 |
358 | 358 |
359 /* Replace the statement pointed-to by GSI to STMT. If UPDATE_EH_INFO | 359 /* Replace the statement pointed-to by GSI to STMT. If UPDATE_EH_INFO |
360 is true, the exception handling information of the original | 360 is true, the exception handling information of the original |
361 statement is moved to the new statement. */ | 361 statement is moved to the new statement. Assignments must only be |
362 replaced with assignments to the same LHS. */ | |
362 | 363 |
363 void | 364 void |
364 gsi_replace (gimple_stmt_iterator *gsi, gimple stmt, bool update_eh_info) | 365 gsi_replace (gimple_stmt_iterator *gsi, gimple stmt, bool update_eh_info) |
365 { | 366 { |
366 int eh_region; | |
367 gimple orig_stmt = gsi_stmt (*gsi); | 367 gimple orig_stmt = gsi_stmt (*gsi); |
368 | 368 |
369 if (stmt == orig_stmt) | 369 if (stmt == orig_stmt) |
370 return; | 370 return; |
371 | |
372 gcc_assert (!gimple_has_lhs (orig_stmt) | |
373 || gimple_get_lhs (orig_stmt) == gimple_get_lhs (stmt)); | |
371 | 374 |
372 gimple_set_location (stmt, gimple_location (orig_stmt)); | 375 gimple_set_location (stmt, gimple_location (orig_stmt)); |
373 gimple_set_bb (stmt, gsi_bb (*gsi)); | 376 gimple_set_bb (stmt, gsi_bb (*gsi)); |
374 | 377 |
375 /* Preserve EH region information from the original statement, if | 378 /* Preserve EH region information from the original statement, if |
376 requested by the caller. */ | 379 requested by the caller. */ |
377 if (update_eh_info) | 380 if (update_eh_info) |
378 { | 381 maybe_clean_or_replace_eh_stmt (orig_stmt, stmt); |
379 eh_region = lookup_stmt_eh_region (orig_stmt); | |
380 if (eh_region >= 0) | |
381 { | |
382 remove_stmt_from_eh_region (orig_stmt); | |
383 add_stmt_to_eh_region (stmt, eh_region); | |
384 } | |
385 } | |
386 | 382 |
387 gimple_duplicate_stmt_histograms (cfun, stmt, cfun, orig_stmt); | 383 gimple_duplicate_stmt_histograms (cfun, stmt, cfun, orig_stmt); |
388 gimple_remove_stmt_histograms (cfun, orig_stmt); | 384 gimple_remove_stmt_histograms (cfun, orig_stmt); |
389 delink_stmt_imm_use (orig_stmt); | 385 delink_stmt_imm_use (orig_stmt); |
390 *gsi_stmt_ptr (gsi) = stmt; | 386 *gsi_stmt_ptr (gsi) = stmt; |
476 gsi_remove (gimple_stmt_iterator *i, bool remove_permanently) | 472 gsi_remove (gimple_stmt_iterator *i, bool remove_permanently) |
477 { | 473 { |
478 gimple_seq_node cur, next, prev; | 474 gimple_seq_node cur, next, prev; |
479 gimple stmt = gsi_stmt (*i); | 475 gimple stmt = gsi_stmt (*i); |
480 | 476 |
477 insert_debug_temps_for_defs (i); | |
478 | |
481 /* Free all the data flow information for STMT. */ | 479 /* Free all the data flow information for STMT. */ |
482 gimple_set_bb (stmt, NULL); | 480 gimple_set_bb (stmt, NULL); |
483 delink_stmt_imm_use (stmt); | 481 delink_stmt_imm_use (stmt); |
484 gimple_set_modified (stmt, true); | 482 gimple_set_modified (stmt, true); |
485 | 483 |
486 if (remove_permanently) | 484 if (remove_permanently) |
487 { | 485 { |
488 remove_stmt_from_eh_region (stmt); | 486 remove_stmt_from_eh_lp (stmt); |
489 gimple_remove_stmt_histograms (cfun, stmt); | 487 gimple_remove_stmt_histograms (cfun, stmt); |
490 } | 488 } |
491 | 489 |
492 /* Update the iterator and re-wire the links in I->SEQ. */ | 490 /* Update the iterator and re-wire the links in I->SEQ. */ |
493 cur = i->ptr; | 491 cur = i->ptr; |
602 sometimes that isn't possible. When it isn't possible, the edge is | 600 sometimes that isn't possible. When it isn't possible, the edge is |
603 split and the statement is added to the new block. | 601 split and the statement is added to the new block. |
604 | 602 |
605 In all cases, the returned *GSI points to the correct location. The | 603 In all cases, the returned *GSI points to the correct location. The |
606 return value is true if insertion should be done after the location, | 604 return value is true if insertion should be done after the location, |
607 or false if it should be done before the location. If new basic block | 605 or false if it should be done before the location. If a new basic block |
608 has to be created, it is stored in *NEW_BB. */ | 606 has to be created, it is stored in *NEW_BB. */ |
609 | 607 |
610 static bool | 608 static bool |
611 gimple_find_edge_insert_loc (edge e, gimple_stmt_iterator *gsi, | 609 gimple_find_edge_insert_loc (edge e, gimple_stmt_iterator *gsi, |
612 basic_block *new_bb) | 610 basic_block *new_bb) |
621 | 619 |
622 The requirement for no PHI nodes could be relaxed. Basically we | 620 The requirement for no PHI nodes could be relaxed. Basically we |
623 would have to examine the PHIs to prove that none of them used | 621 would have to examine the PHIs to prove that none of them used |
624 the value set by the statement we want to insert on E. That | 622 the value set by the statement we want to insert on E. That |
625 hardly seems worth the effort. */ | 623 hardly seems worth the effort. */ |
626 restart: | 624 restart: |
627 if (single_pred_p (dest) | 625 if (single_pred_p (dest) |
628 && ! phi_nodes (dest) | 626 && gimple_seq_empty_p (phi_nodes (dest)) |
629 && dest != EXIT_BLOCK_PTR) | 627 && dest != EXIT_BLOCK_PTR) |
630 { | 628 { |
631 *gsi = gsi_start_bb (dest); | 629 *gsi = gsi_start_bb (dest); |
632 if (gsi_end_p (*gsi)) | 630 if (gsi_end_p (*gsi)) |
633 return true; | 631 return true; |
665 | 663 |
666 tmp = gsi_stmt (*gsi); | 664 tmp = gsi_stmt (*gsi); |
667 if (!stmt_ends_bb_p (tmp)) | 665 if (!stmt_ends_bb_p (tmp)) |
668 return true; | 666 return true; |
669 | 667 |
670 if (gimple_code (tmp) == GIMPLE_RETURN) | 668 switch (gimple_code (tmp)) |
671 { | 669 { |
672 gsi_prev (gsi); | 670 case GIMPLE_RETURN: |
673 return true; | 671 case GIMPLE_RESX: |
672 return false; | |
673 default: | |
674 break; | |
674 } | 675 } |
675 } | 676 } |
676 | 677 |
677 /* Otherwise, create a new basic block, and split this edge. */ | 678 /* Otherwise, create a new basic block, and split this edge. */ |
678 dest = split_edge (e); | 679 dest = split_edge (e); |