comparison gcc/bt-load.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 f6334be47118
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
1 /* Perform branch target register load optimizations. 1 /* Perform branch target register load optimizations.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
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 it under 7 GCC is free software; you can redistribute it and/or modify it under
455 int i; 455 int i;
456 int insn_luid = 0; 456 int insn_luid = 0;
457 btr_def_group all_btr_def_groups = NULL; 457 btr_def_group all_btr_def_groups = NULL;
458 defs_uses_info info; 458 defs_uses_info info;
459 459
460 sbitmap_vector_zero (bb_gen, n_basic_blocks); 460 sbitmap_vector_zero (bb_gen, last_basic_block);
461 for (i = NUM_FIXED_BLOCKS; i < n_basic_blocks; i++) 461 for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
462 { 462 {
463 basic_block bb = BASIC_BLOCK (i); 463 basic_block bb = BASIC_BLOCK (i);
464 int reg; 464 int reg;
465 btr_def defs_this_bb = NULL; 465 btr_def defs_this_bb = NULL;
466 rtx insn; 466 rtx insn;
616 int i; 616 int i;
617 int regno; 617 int regno;
618 618
619 /* For each basic block, form the set BB_KILL - the set 619 /* For each basic block, form the set BB_KILL - the set
620 of definitions that the block kills. */ 620 of definitions that the block kills. */
621 sbitmap_vector_zero (bb_kill, n_basic_blocks); 621 sbitmap_vector_zero (bb_kill, last_basic_block);
622 for (i = NUM_FIXED_BLOCKS; i < n_basic_blocks; i++) 622 for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
623 { 623 {
624 for (regno = first_btr; regno <= last_btr; regno++) 624 for (regno = first_btr; regno <= last_btr; regno++)
625 if (TEST_HARD_REG_BIT (all_btrs, regno) 625 if (TEST_HARD_REG_BIT (all_btrs, regno)
626 && TEST_HARD_REG_BIT (btrs_written[i], regno)) 626 && TEST_HARD_REG_BIT (btrs_written[i], regno))
627 sbitmap_a_or_b (bb_kill[i], bb_kill[i], 627 sbitmap_a_or_b (bb_kill[i], bb_kill[i],
640 Iterate until the bb_out sets stop growing. */ 640 Iterate until the bb_out sets stop growing. */
641 int i; 641 int i;
642 int changed; 642 int changed;
643 sbitmap bb_in = sbitmap_alloc (max_uid); 643 sbitmap bb_in = sbitmap_alloc (max_uid);
644 644
645 for (i = NUM_FIXED_BLOCKS; i < n_basic_blocks; i++) 645 for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
646 sbitmap_copy (bb_out[i], bb_gen[i]); 646 sbitmap_copy (bb_out[i], bb_gen[i]);
647 647
648 changed = 1; 648 changed = 1;
649 while (changed) 649 while (changed)
650 { 650 {
651 changed = 0; 651 changed = 0;
652 for (i = NUM_FIXED_BLOCKS; i < n_basic_blocks; i++) 652 for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
653 { 653 {
654 sbitmap_union_of_preds (bb_in, bb_out, i); 654 sbitmap_union_of_preds (bb_in, bb_out, i);
655 changed |= sbitmap_union_of_diff_cg (bb_out[i], bb_gen[i], 655 changed |= sbitmap_union_of_diff_cg (bb_out[i], bb_gen[i],
656 bb_in, bb_kill[i]); 656 bb_in, bb_kill[i]);
657 } 657 }
666 int i; 666 int i;
667 sbitmap reaching_defs = sbitmap_alloc (max_uid); 667 sbitmap reaching_defs = sbitmap_alloc (max_uid);
668 668
669 /* Link uses to the uses lists of all of their reaching defs. 669 /* Link uses to the uses lists of all of their reaching defs.
670 Count up the number of reaching defs of each use. */ 670 Count up the number of reaching defs of each use. */
671 for (i = NUM_FIXED_BLOCKS; i < n_basic_blocks; i++) 671 for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
672 { 672 {
673 basic_block bb = BASIC_BLOCK (i); 673 basic_block bb = BASIC_BLOCK (i);
674 rtx insn; 674 rtx insn;
675 rtx last; 675 rtx last;
676 676
778 const int max_uid = get_max_uid (); 778 const int max_uid = get_max_uid ();
779 btr_def *def_array = XCNEWVEC (btr_def, max_uid); 779 btr_def *def_array = XCNEWVEC (btr_def, max_uid);
780 btr_user *use_array = XCNEWVEC (btr_user, max_uid); 780 btr_user *use_array = XCNEWVEC (btr_user, max_uid);
781 sbitmap *btr_defset = sbitmap_vector_alloc ( 781 sbitmap *btr_defset = sbitmap_vector_alloc (
782 (last_btr - first_btr) + 1, max_uid); 782 (last_btr - first_btr) + 1, max_uid);
783 sbitmap *bb_gen = sbitmap_vector_alloc (n_basic_blocks, max_uid); 783 sbitmap *bb_gen = sbitmap_vector_alloc (last_basic_block, max_uid);
784 HARD_REG_SET *btrs_written = XCNEWVEC (HARD_REG_SET, n_basic_blocks); 784 HARD_REG_SET *btrs_written = XCNEWVEC (HARD_REG_SET, last_basic_block);
785 sbitmap *bb_kill; 785 sbitmap *bb_kill;
786 sbitmap *bb_out; 786 sbitmap *bb_out;
787 787
788 sbitmap_vector_zero (btr_defset, (last_btr - first_btr) + 1); 788 sbitmap_vector_zero (btr_defset, (last_btr - first_btr) + 1);
789 789
790 compute_defs_uses_and_gen (all_btr_defs, def_array, use_array, btr_defset, 790 compute_defs_uses_and_gen (all_btr_defs, def_array, use_array, btr_defset,
791 bb_gen, btrs_written); 791 bb_gen, btrs_written);
792 792
793 bb_kill = sbitmap_vector_alloc (n_basic_blocks, max_uid); 793 bb_kill = sbitmap_vector_alloc (last_basic_block, max_uid);
794 compute_kill (bb_kill, btr_defset, btrs_written); 794 compute_kill (bb_kill, btr_defset, btrs_written);
795 free (btrs_written); 795 free (btrs_written);
796 796
797 bb_out = sbitmap_vector_alloc (n_basic_blocks, max_uid); 797 bb_out = sbitmap_vector_alloc (last_basic_block, max_uid);
798 compute_out (bb_out, bb_gen, bb_kill, max_uid); 798 compute_out (bb_out, bb_gen, bb_kill, max_uid);
799 799
800 sbitmap_vector_free (bb_gen); 800 sbitmap_vector_free (bb_gen);
801 sbitmap_vector_free (bb_kill); 801 sbitmap_vector_free (bb_kill);
802 802
1401 gcc_obstack_init (&migrate_btrl_obstack); 1401 gcc_obstack_init (&migrate_btrl_obstack);
1402 if (dump_file) 1402 if (dump_file)
1403 { 1403 {
1404 int i; 1404 int i;
1405 1405
1406 for (i = NUM_FIXED_BLOCKS; i < n_basic_blocks; i++) 1406 for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
1407 { 1407 {
1408 basic_block bb = BASIC_BLOCK (i); 1408 basic_block bb = BASIC_BLOCK (i);
1409 fprintf(dump_file, 1409 fprintf(dump_file,
1410 "Basic block %d: count = " HOST_WIDEST_INT_PRINT_DEC 1410 "Basic block %d: count = " HOST_WIDEST_INT_PRINT_DEC
1411 " loop-depth = %d idom = %d\n", 1411 " loop-depth = %d idom = %d\n",
1415 } 1415 }
1416 1416
1417 CLEAR_HARD_REG_SET (all_btrs); 1417 CLEAR_HARD_REG_SET (all_btrs);
1418 for (first_btr = -1, reg = 0; reg < FIRST_PSEUDO_REGISTER; reg++) 1418 for (first_btr = -1, reg = 0; reg < FIRST_PSEUDO_REGISTER; reg++)
1419 if (TEST_HARD_REG_BIT (reg_class_contents[(int) btr_class], reg) 1419 if (TEST_HARD_REG_BIT (reg_class_contents[(int) btr_class], reg)
1420 && (allow_callee_save || call_used_regs[reg] 1420 && (allow_callee_save || call_used_regs[reg]
1421 || df_regs_ever_live_p (reg))) 1421 || df_regs_ever_live_p (reg)))
1422 { 1422 {
1423 SET_HARD_REG_BIT (all_btrs, reg); 1423 SET_HARD_REG_BIT (all_btrs, reg);
1424 last_btr = reg; 1424 last_btr = reg;
1425 if (first_btr < 0) 1425 if (first_btr < 0)
1426 first_btr = reg; 1426 first_btr = reg;
1427 } 1427 }
1428 1428
1429 btrs_live = XCNEWVEC (HARD_REG_SET, n_basic_blocks); 1429 btrs_live = XCNEWVEC (HARD_REG_SET, last_basic_block);
1430 btrs_live_at_end = XCNEWVEC (HARD_REG_SET, n_basic_blocks); 1430 btrs_live_at_end = XCNEWVEC (HARD_REG_SET, last_basic_block);
1431 1431
1432 build_btr_def_use_webs (all_btr_defs); 1432 build_btr_def_use_webs (all_btr_defs);
1433 1433
1434 while (!fibheap_empty (all_btr_defs)) 1434 while (!fibheap_empty (all_btr_defs))
1435 { 1435 {
1511 gate_handle_branch_target_load_optimize1, /* gate */ 1511 gate_handle_branch_target_load_optimize1, /* gate */
1512 rest_of_handle_branch_target_load_optimize1, /* execute */ 1512 rest_of_handle_branch_target_load_optimize1, /* execute */
1513 NULL, /* sub */ 1513 NULL, /* sub */
1514 NULL, /* next */ 1514 NULL, /* next */
1515 0, /* static_pass_number */ 1515 0, /* static_pass_number */
1516 0, /* tv_id */ 1516 TV_NONE, /* tv_id */
1517 0, /* properties_required */ 1517 0, /* properties_required */
1518 0, /* properties_provided */ 1518 0, /* properties_provided */
1519 0, /* properties_destroyed */ 1519 0, /* properties_destroyed */
1520 0, /* todo_flags_start */ 1520 0, /* todo_flags_start */
1521 TODO_dump_func | 1521 TODO_dump_func |
1561 gate_handle_branch_target_load_optimize2, /* gate */ 1561 gate_handle_branch_target_load_optimize2, /* gate */
1562 rest_of_handle_branch_target_load_optimize2, /* execute */ 1562 rest_of_handle_branch_target_load_optimize2, /* execute */
1563 NULL, /* sub */ 1563 NULL, /* sub */
1564 NULL, /* next */ 1564 NULL, /* next */
1565 0, /* static_pass_number */ 1565 0, /* static_pass_number */
1566 0, /* tv_id */ 1566 TV_NONE, /* tv_id */
1567 0, /* properties_required */ 1567 0, /* properties_required */
1568 0, /* properties_provided */ 1568 0, /* properties_provided */
1569 0, /* properties_destroyed */ 1569 0, /* properties_destroyed */
1570 0, /* todo_flags_start */ 1570 0, /* todo_flags_start */
1571 TODO_dump_func | 1571 TODO_dump_func |
1572 TODO_ggc_collect, /* todo_flags_finish */ 1572 TODO_ggc_collect, /* todo_flags_finish */
1573 } 1573 }
1574 }; 1574 };
1575