comparison gcc/cfg.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
90 = GGC_CNEW (struct basic_block_def); 90 = GGC_CNEW (struct basic_block_def);
91 ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)->index = ENTRY_BLOCK; 91 ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)->index = ENTRY_BLOCK;
92 EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun) 92 EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun)
93 = GGC_CNEW (struct basic_block_def); 93 = GGC_CNEW (struct basic_block_def);
94 EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun)->index = EXIT_BLOCK; 94 EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun)->index = EXIT_BLOCK;
95 ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)->next_bb 95 ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)->next_bb
96 = EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun); 96 = EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun);
97 EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun)->prev_bb 97 EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun)->prev_bb
98 = ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun); 98 = ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun);
99 } 99 }
100 100
101 /* Helper function for remove_edge and clear_edges. Frees edge structure 101 /* Helper function for remove_edge and clear_edges. Frees edge structure
102 without actually unlinking it from the pred/succ lists. */ 102 without actually unlinking it from the pred/succ lists. */
169 { 169 {
170 int i; 170 int i;
171 171
172 SET_BASIC_BLOCK (ENTRY_BLOCK, ENTRY_BLOCK_PTR); 172 SET_BASIC_BLOCK (ENTRY_BLOCK, ENTRY_BLOCK_PTR);
173 SET_BASIC_BLOCK (EXIT_BLOCK, EXIT_BLOCK_PTR); 173 SET_BASIC_BLOCK (EXIT_BLOCK, EXIT_BLOCK_PTR);
174 174
175 if (df) 175 if (df)
176 df_compact_blocks (); 176 df_compact_blocks ();
177 else 177 else
178 { 178 {
179 basic_block bb; 179 basic_block bb;
180 180
181 i = NUM_FIXED_BLOCKS; 181 i = NUM_FIXED_BLOCKS;
182 FOR_EACH_BB (bb) 182 FOR_EACH_BB (bb)
183 { 183 {
184 SET_BASIC_BLOCK (i, bb); 184 SET_BASIC_BLOCK (i, bb);
185 bb->index = i; 185 bb->index = i;
431 clear_bb_flags (void) 431 clear_bb_flags (void)
432 { 432 {
433 basic_block bb; 433 basic_block bb;
434 434
435 FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) 435 FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
436 bb->flags = (BB_PARTITION (bb) 436 bb->flags = (BB_PARTITION (bb)
437 | (bb->flags & (BB_DISABLE_SCHEDULE + BB_RTL + BB_NON_LOCAL_GOTO_TARGET))); 437 | (bb->flags & (BB_DISABLE_SCHEDULE + BB_RTL + BB_NON_LOCAL_GOTO_TARGET)));
438 } 438 }
439 439
440 /* Check the consistency of profile information. We can't do that 440 /* Check the consistency of profile information. We can't do that
441 in verify_flow_info, as the counts may get invalid for incompletely 441 in verify_flow_info, as the counts may get invalid for incompletely
542 fprintf (file, ", next %d", bb->next_bb->index); 542 fprintf (file, ", next %d", bb->next_bb->index);
543 fprintf (file, ", loop_depth %d, count ", bb->loop_depth); 543 fprintf (file, ", loop_depth %d, count ", bb->loop_depth);
544 fprintf (file, HOST_WIDEST_INT_PRINT_DEC, bb->count); 544 fprintf (file, HOST_WIDEST_INT_PRINT_DEC, bb->count);
545 fprintf (file, ", freq %i", bb->frequency); 545 fprintf (file, ", freq %i", bb->frequency);
546 /* Both maybe_hot_bb_p & probably_never_executed_bb_p functions 546 /* Both maybe_hot_bb_p & probably_never_executed_bb_p functions
547 crash without cfun. */ 547 crash without cfun. */
548 if (cfun && maybe_hot_bb_p (bb)) 548 if (cfun && maybe_hot_bb_p (bb))
549 fprintf (file, ", maybe hot"); 549 fputs (", maybe hot", file);
550 if (cfun && probably_never_executed_bb_p (bb)) 550 if (cfun && probably_never_executed_bb_p (bb))
551 fprintf (file, ", probably never executed"); 551 fputs (", probably never executed", file);
552 fprintf (file, ".\n"); 552 fputs (".\n", file);
553 553
554 fprintf (file, "%sPredecessors: ", prefix); 554 fprintf (file, "%sPredecessors: ", prefix);
555 FOR_EACH_EDGE (e, ei, bb->preds) 555 FOR_EACH_EDGE (e, ei, bb->preds)
556 dump_edge_info (file, e, 0); 556 dump_edge_info (file, e, 0);
557 557
558 if ((flags & TDF_DETAILS) 558 if ((flags & TDF_DETAILS)
559 && (bb->flags & BB_RTL) 559 && (bb->flags & BB_RTL)
560 && df) 560 && df)
561 { 561 {
562 fprintf (file, "\n"); 562 putc ('\n', file);
563 df_dump_top (bb, file); 563 df_dump_top (bb, file);
564 } 564 }
565 } 565 }
566 566
567 if (footer) 567 if (footer)
572 572
573 if ((flags & TDF_DETAILS) 573 if ((flags & TDF_DETAILS)
574 && (bb->flags & BB_RTL) 574 && (bb->flags & BB_RTL)
575 && df) 575 && df)
576 { 576 {
577 fprintf (file, "\n"); 577 putc ('\n', file);
578 df_dump_bottom (bb, file); 578 df_dump_bottom (bb, file);
579 } 579 }
580 } 580 }
581 581
582 putc ('\n', file); 582 putc ('\n', file);
583 } 583 }
584 584
585 /* Dump the register info to FILE. */ 585 /* Dump the register info to FILE. */
586 586
587 void 587 void
588 dump_reg_info (FILE *file) 588 dump_reg_info (FILE *file)
589 { 589 {
590 unsigned int i, max = max_reg_num (); 590 unsigned int i, max = max_reg_num ();
591 if (reload_completed) 591 if (reload_completed)
592 return; 592 return;
596 596
597 fprintf (file, "%d registers.\n", max); 597 fprintf (file, "%d registers.\n", max);
598 for (i = FIRST_PSEUDO_REGISTER; i < max; i++) 598 for (i = FIRST_PSEUDO_REGISTER; i < max; i++)
599 { 599 {
600 enum reg_class rclass, altclass; 600 enum reg_class rclass, altclass;
601 601
602 if (regstat_n_sets_and_refs) 602 if (regstat_n_sets_and_refs)
603 fprintf (file, "\nRegister %d used %d times across %d insns", 603 fprintf (file, "\nRegister %d used %d times across %d insns",
604 i, REG_N_REFS (i), REG_LIVE_LENGTH (i)); 604 i, REG_N_REFS (i), REG_LIVE_LENGTH (i));
605 else if (df) 605 else if (df)
606 fprintf (file, "\nRegister %d used %d times across %d insns", 606 fprintf (file, "\nRegister %d used %d times across %d insns",
607 i, DF_REG_USE_COUNT (i) + DF_REG_DEF_COUNT (i), REG_LIVE_LENGTH (i)); 607 i, DF_REG_USE_COUNT (i) + DF_REG_DEF_COUNT (i), REG_LIVE_LENGTH (i));
608 608
609 if (REG_BASIC_BLOCK (i) >= NUM_FIXED_BLOCKS) 609 if (REG_BASIC_BLOCK (i) >= NUM_FIXED_BLOCKS)
610 fprintf (file, " in block %d", REG_BASIC_BLOCK (i)); 610 fprintf (file, " in block %d", REG_BASIC_BLOCK (i));
611 if (regstat_n_sets_and_refs) 611 if (regstat_n_sets_and_refs)
612 fprintf (file, "; set %d time%s", REG_N_SETS (i), 612 fprintf (file, "; set %d time%s", REG_N_SETS (i),
613 (REG_N_SETS (i) == 1) ? "" : "s"); 613 (REG_N_SETS (i) == 1) ? "" : "s");
614 else if (df) 614 else if (df)
615 fprintf (file, "; set %d time%s", DF_REG_DEF_COUNT (i), 615 fprintf (file, "; set %d time%s", DF_REG_DEF_COUNT (i),
616 (DF_REG_DEF_COUNT (i) == 1) ? "" : "s"); 616 (DF_REG_DEF_COUNT (i) == 1) ? "" : "s");
617 if (regno_reg_rtx[i] != NULL && REG_USERVAR_P (regno_reg_rtx[i])) 617 if (regno_reg_rtx[i] != NULL && REG_USERVAR_P (regno_reg_rtx[i]))
618 fprintf (file, "; user var"); 618 fputs ("; user var", file);
619 if (REG_N_DEATHS (i) != 1) 619 if (REG_N_DEATHS (i) != 1)
620 fprintf (file, "; dies in %d places", REG_N_DEATHS (i)); 620 fprintf (file, "; dies in %d places", REG_N_DEATHS (i));
621 if (REG_N_CALLS_CROSSED (i) == 1) 621 if (REG_N_CALLS_CROSSED (i) == 1)
622 fprintf (file, "; crosses 1 call"); 622 fputs ("; crosses 1 call", file);
623 else if (REG_N_CALLS_CROSSED (i)) 623 else if (REG_N_CALLS_CROSSED (i))
624 fprintf (file, "; crosses %d calls", REG_N_CALLS_CROSSED (i)); 624 fprintf (file, "; crosses %d calls", REG_N_CALLS_CROSSED (i));
625 if (REG_FREQ_CALLS_CROSSED (i)) 625 if (REG_FREQ_CALLS_CROSSED (i))
626 fprintf (file, "; crosses call with %d frequency", REG_FREQ_CALLS_CROSSED (i)); 626 fprintf (file, "; crosses call with %d frequency", REG_FREQ_CALLS_CROSSED (i));
627 if (regno_reg_rtx[i] != NULL 627 if (regno_reg_rtx[i] != NULL
628 && PSEUDO_REGNO_BYTES (i) != UNITS_PER_WORD) 628 && PSEUDO_REGNO_BYTES (i) != UNITS_PER_WORD)
629 fprintf (file, "; %d bytes", PSEUDO_REGNO_BYTES (i)); 629 fprintf (file, "; %d bytes", PSEUDO_REGNO_BYTES (i));
630 630
631 rclass = reg_preferred_class (i); 631 rclass = reg_preferred_class (i);
632 altclass = reg_alternate_class (i); 632 altclass = reg_alternate_class (i);
633 if (rclass != GENERAL_REGS || altclass != ALL_REGS) 633 if (rclass != GENERAL_REGS || altclass != ALL_REGS)
634 { 634 {
635 if (altclass == ALL_REGS || rclass == ALL_REGS) 635 if (altclass == ALL_REGS || rclass == ALL_REGS)
639 else 639 else
640 fprintf (file, "; pref %s, else %s", 640 fprintf (file, "; pref %s, else %s",
641 reg_class_names[(int) rclass], 641 reg_class_names[(int) rclass],
642 reg_class_names[(int) altclass]); 642 reg_class_names[(int) altclass]);
643 } 643 }
644 644
645 if (regno_reg_rtx[i] != NULL && REG_POINTER (regno_reg_rtx[i])) 645 if (regno_reg_rtx[i] != NULL && REG_POINTER (regno_reg_rtx[i]))
646 fprintf (file, "; pointer"); 646 fputs ("; pointer", file);
647 fprintf (file, ".\n"); 647 fputs (".\n", file);
648 } 648 }
649 } 649 }
650 650
651 651
652 void 652 void
689 if (e->probability) 689 if (e->probability)
690 fprintf (file, " [%.1f%%] ", e->probability * 100.0 / REG_BR_PROB_BASE); 690 fprintf (file, " [%.1f%%] ", e->probability * 100.0 / REG_BR_PROB_BASE);
691 691
692 if (e->count) 692 if (e->count)
693 { 693 {
694 fprintf (file, " count:"); 694 fputs (" count:", file);
695 fprintf (file, HOST_WIDEST_INT_PRINT_DEC, e->count); 695 fprintf (file, HOST_WIDEST_INT_PRINT_DEC, e->count);
696 } 696 }
697 697
698 if (e->flags) 698 if (e->flags)
699 { 699 {
902 fprintf (file, "Basic block %d", bb->index); 902 fprintf (file, "Basic block %d", bb->index);
903 for (i = 0; i < n_bitnames; i++) 903 for (i = 0; i < n_bitnames; i++)
904 if (bb->flags & (1 << i)) 904 if (bb->flags & (1 << i))
905 { 905 {
906 if (first) 906 if (first)
907 fprintf (file, " ("); 907 fputs (" (", file);
908 else 908 else
909 fprintf (file, ", "); 909 fputs (", ", file);
910 first = false; 910 first = false;
911 fprintf (file, bb_bitnames[i]); 911 fputs (bb_bitnames[i], file);
912 } 912 }
913 if (!first) 913 if (!first)
914 fprintf (file, ")"); 914 putc (')', file);
915 fprintf (file, "\n"); 915 putc ('\n', file);
916 916
917 fprintf (file, "Predecessors: "); 917 fputs ("Predecessors: ", file);
918 FOR_EACH_EDGE (e, ei, bb->preds) 918 FOR_EACH_EDGE (e, ei, bb->preds)
919 dump_edge_info (file, e, 0); 919 dump_edge_info (file, e, 0);
920 920
921 fprintf (file, "\nSuccessors: "); 921 fprintf (file, "\nSuccessors: ");
922 FOR_EACH_EDGE (e, ei, bb->succs) 922 FOR_EACH_EDGE (e, ei, bb->succs)
923 dump_edge_info (file, e, 1); 923 dump_edge_info (file, e, 1);
924 fprintf (file, "\n\n"); 924 fputs ("\n\n", file);
925 } 925 }
926 926
927 /* Dumps a brief description of cfg to FILE. */ 927 /* Dumps a brief description of cfg to FILE. */
928 928
929 void 929 void