comparison gcc/cfg.c @ 14: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
13:65488c3d617d 14:f6334be47118
55 #include "regs.h" 55 #include "regs.h"
56 #include "flags.h" 56 #include "flags.h"
57 #include "output.h" 57 #include "output.h"
58 #include "function.h" 58 #include "function.h"
59 #include "except.h" 59 #include "except.h"
60 #include "toplev.h" 60 #include "diagnostic-core.h"
61 #include "tm_p.h" 61 #include "tm_p.h"
62 #include "obstack.h" 62 #include "obstack.h"
63 #include "timevar.h" 63 #include "timevar.h"
64 #include "tree-pass.h" 64 #include "tree-pass.h"
65 #include "ggc.h" 65 #include "ggc.h"
82 82
83 void 83 void
84 init_flow (struct function *the_fun) 84 init_flow (struct function *the_fun)
85 { 85 {
86 if (!the_fun->cfg) 86 if (!the_fun->cfg)
87 the_fun->cfg = GGC_CNEW (struct control_flow_graph); 87 the_fun->cfg = ggc_alloc_cleared_control_flow_graph ();
88 n_edges_for_function (the_fun) = 0; 88 n_edges_for_function (the_fun) = 0;
89 ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun) 89 ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)
90 = GGC_CNEW (struct basic_block_def); 90 = ggc_alloc_cleared_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_alloc_cleared_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);
137 137
138 basic_block 138 basic_block
139 alloc_block (void) 139 alloc_block (void)
140 { 140 {
141 basic_block bb; 141 basic_block bb;
142 bb = GGC_CNEW (struct basic_block_def); 142 bb = ggc_alloc_cleared_basic_block_def ();
143 return bb; 143 return bb;
144 } 144 }
145 145
146 /* Link block B to chain after AFTER. */ 146 /* Link block B to chain after AFTER. */
147 void 147 void
275 275
276 edge 276 edge
277 unchecked_make_edge (basic_block src, basic_block dst, int flags) 277 unchecked_make_edge (basic_block src, basic_block dst, int flags)
278 { 278 {
279 edge e; 279 edge e;
280 e = GGC_CNEW (struct edge_def); 280 e = ggc_alloc_cleared_edge_def ();
281 n_edges++; 281 n_edges++;
282 282
283 e->src = src; 283 e->src = src;
284 e->dest = dst; 284 e->dest = dst;
285 e->flags = flags; 285 e->flags = flags;
512 512
513 /* Print a human-readable representation of R on the standard error 513 /* Print a human-readable representation of R on the standard error
514 stream. This function is designed to be used from within the 514 stream. This function is designed to be used from within the
515 debugger. */ 515 debugger. */
516 516
517 void 517 DEBUG_FUNCTION void
518 debug_regset (regset r) 518 debug_regset (regset r)
519 { 519 {
520 dump_regset (r, stderr); 520 dump_regset (r, stderr);
521 putc ('\n', stderr); 521 putc ('\n', stderr);
522 } 522 }
666 } 666 }
667 667
668 putc ('\n', file); 668 putc ('\n', file);
669 } 669 }
670 670
671 void 671 DEBUG_FUNCTION void
672 debug_flow_info (void) 672 debug_flow_info (void)
673 { 673 {
674 dump_flow_info (stderr, TDF_DETAILS); 674 dump_flow_info (stderr, TDF_DETAILS);
675 } 675 }
676 676
732 static void *first_edge_aux_obj = 0; 732 static void *first_edge_aux_obj = 0;
733 733
734 /* Allocate a memory block of SIZE as BB->aux. The obstack must 734 /* Allocate a memory block of SIZE as BB->aux. The obstack must
735 be first initialized by alloc_aux_for_blocks. */ 735 be first initialized by alloc_aux_for_blocks. */
736 736
737 void 737 static void
738 alloc_aux_for_block (basic_block bb, int size) 738 alloc_aux_for_block (basic_block bb, int size)
739 { 739 {
740 /* Verify that aux field is clear. */ 740 /* Verify that aux field is clear. */
741 gcc_assert (!bb->aux && first_block_aux_obj); 741 gcc_assert (!bb->aux && first_block_aux_obj);
742 bb->aux = obstack_alloc (&block_aux_obstack, size); 742 bb->aux = obstack_alloc (&block_aux_obstack, size);
763 first_block_aux_obj = obstack_alloc (&block_aux_obstack, 0); 763 first_block_aux_obj = obstack_alloc (&block_aux_obstack, 0);
764 if (size) 764 if (size)
765 { 765 {
766 basic_block bb; 766 basic_block bb;
767 767
768 FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) 768 FOR_ALL_BB (bb)
769 alloc_aux_for_block (bb, size); 769 alloc_aux_for_block (bb, size);
770 } 770 }
771 } 771 }
772 772
773 /* Clear AUX pointers of all blocks. */ 773 /* Clear AUX pointers of all blocks. */
775 void 775 void
776 clear_aux_for_blocks (void) 776 clear_aux_for_blocks (void)
777 { 777 {
778 basic_block bb; 778 basic_block bb;
779 779
780 FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) 780 FOR_ALL_BB (bb)
781 bb->aux = NULL; 781 bb->aux = NULL;
782 } 782 }
783 783
784 /* Free data allocated in block_aux_obstack and clear AUX pointers 784 /* Free data allocated in block_aux_obstack and clear AUX pointers
785 of all blocks. */ 785 of all blocks. */
795 } 795 }
796 796
797 /* Allocate a memory edge of SIZE as BB->aux. The obstack must 797 /* Allocate a memory edge of SIZE as BB->aux. The obstack must
798 be first initialized by alloc_aux_for_edges. */ 798 be first initialized by alloc_aux_for_edges. */
799 799
800 void 800 static void
801 alloc_aux_for_edge (edge e, int size) 801 alloc_aux_for_edge (edge e, int size)
802 { 802 {
803 /* Verify that aux field is clear. */ 803 /* Verify that aux field is clear. */
804 gcc_assert (!e->aux && first_edge_aux_obj); 804 gcc_assert (!e->aux && first_edge_aux_obj);
805 e->aux = obstack_alloc (&edge_aux_obstack, size); 805 e->aux = obstack_alloc (&edge_aux_obstack, size);
866 first_edge_aux_obj = NULL; 866 first_edge_aux_obj = NULL;
867 867
868 clear_aux_for_edges (); 868 clear_aux_for_edges ();
869 } 869 }
870 870
871 void 871 DEBUG_FUNCTION void
872 debug_bb (basic_block bb) 872 debug_bb (basic_block bb)
873 { 873 {
874 dump_bb (bb, stderr, 0); 874 dump_bb (bb, stderr, 0);
875 } 875 }
876 876
877 basic_block 877 DEBUG_FUNCTION basic_block
878 debug_bb_n (int n) 878 debug_bb_n (int n)
879 { 879 {
880 basic_block bb = BASIC_BLOCK (n); 880 basic_block bb = BASIC_BLOCK (n);
881 dump_bb (bb, stderr, 0); 881 dump_bb (bb, stderr, 0);
882 return bb; 882 return bb;