OSDN Git Service

* hooks.c (hook_bool_tree_true): New.
[pf3gnuchains/gcc-fork.git] / gcc / bt-load.c
index 4f4d4a2..b3ba22b 100644 (file)
@@ -36,6 +36,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "flags.h"
 #include "insn-attr.h"
 #include "function.h"
+#include "tm_p.h"
 
 /* Target register optimizations - these are performed after reload.  */
 
@@ -88,7 +89,7 @@ typedef struct btr_def_s
   btr_user uses;
   /* If this def has a reaching use which is not a simple use
      in a branch instruction, then has_ambiguous_use will be true,
-     and we will not attempt to migrate this definition.       */
+     and we will not attempt to migrate this definition.  */
   char has_ambiguous_use;
   /* live_range is an approximation to the true live range for this
      def/use web, because it records the set of blocks that contain
@@ -97,7 +98,7 @@ typedef struct btr_def_s
      containing the def (before the def), or in a block containing
      a use (after the use).  If there are such other live ranges, then
      other_btr_uses_before_def or other_btr_uses_after_use must be set true
-     as appropriate. */
+     as appropriate.  */
   char other_btr_uses_before_def;
   char other_btr_uses_after_use;
   bitmap live_range;
@@ -248,7 +249,7 @@ insn_sets_btr_p (rtx insn, int check_const, int *regno)
   return 0;
 }
 
-/* Find and return a use of a target register within an instruction INSN. */
+/* Find and return a use of a target register within an instruction INSN.  */
 static rtx *
 find_btr_use (rtx insn)
 {
@@ -276,9 +277,8 @@ find_btr_def_group (btr_def_group *all_btr_def_groups, btr_def def)
 
       if (!this_group)
        {
-         this_group = (btr_def_group)
-           obstack_alloc (&migrate_btrl_obstack,
-                          sizeof (struct btr_def_group_s));
+         this_group = obstack_alloc (&migrate_btrl_obstack,
+                                     sizeof (struct btr_def_group_s));
          this_group->src = def_src;
          this_group->members = NULL;
          this_group->next = *all_btr_def_groups;
@@ -300,8 +300,8 @@ add_btr_def (fibheap_t all_btr_defs, basic_block bb, int insn_luid, rtx insn,
             unsigned int dest_reg, int other_btr_uses_before_def,
             btr_def_group *all_btr_def_groups)
 {
-  btr_def this = (btr_def)
-    obstack_alloc (&migrate_btrl_obstack, sizeof (struct btr_def_s));
+  btr_def this
+    obstack_alloc (&migrate_btrl_obstack, sizeof (struct btr_def_s));
   this->bb = bb;
   this->luid = insn_luid;
   this->insn = insn;
@@ -352,8 +352,7 @@ new_btr_user (basic_block bb, int insn_luid, rtx insn)
        usep = NULL;
     }
   use = usep ? *usep : NULL_RTX;
-  user = (btr_user)
-    obstack_alloc (&migrate_btrl_obstack, sizeof (struct btr_user_s));
+  user = obstack_alloc (&migrate_btrl_obstack, sizeof (struct btr_user_s));
   user->bb = bb;
   user->luid = insn_luid;
   user->insn = insn;
@@ -376,7 +375,7 @@ new_btr_user (basic_block bb, int insn_luid, rtx insn)
   return user;
 }
 
-/* Write the contents of S to the dump file. */
+/* Write the contents of S to the dump file.  */
 static void
 dump_hard_reg_set (HARD_REG_SET s)
 {
@@ -386,7 +385,7 @@ dump_hard_reg_set (HARD_REG_SET s)
       fprintf (rtl_dump_file, " %d", reg);
 }
 
-/* Write the set of target regs live in block BB to the dump file. */
+/* Write the set of target regs live in block BB to the dump file.  */
 static void
 dump_btrs_live (int bb)
 {
@@ -420,7 +419,7 @@ typedef struct {
 /* Called via note_stores or directly to register stores into /
    clobbers of a branch target register DEST that are not recognized as
    straightforward definitions.  DATA points to information about the
-   current basic block that needs updating.   */
+   current basic block that needs updating.  */
 static void
 note_btr_set (rtx dest, rtx set ATTRIBUTE_UNUSED, void *data)
 {
@@ -572,7 +571,7 @@ compute_kill (sbitmap *bb_kill, sbitmap *btr_defset,
   int regno;
 
   /* For each basic block, form the set BB_KILL - the set
-     of definitions that the block kills. */
+     of definitions that the block kills.  */
   sbitmap_vector_zero (bb_kill, n_basic_blocks);
   for (i = 0; i < n_basic_blocks; i++)
     {
@@ -592,7 +591,7 @@ compute_out (sbitmap *bb_out, sbitmap *bb_gen, sbitmap *bb_kill, int max_uid)
       For each block,
        BB_IN  = union over predecessors of BB_OUT(pred)
        BB_OUT = (BB_IN - BB_KILL) + BB_GEN
-     Iterate until the bb_out sets stop growing.   */
+     Iterate until the bb_out sets stop growing.  */
   int i;
   int changed;
   sbitmap bb_in = sbitmap_alloc (max_uid);
@@ -622,7 +621,7 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out,
   sbitmap reaching_defs = sbitmap_alloc (max_uid);
 
   /* Link uses to the uses lists of all of their reaching defs.
-     Count up the number of reaching defs of each use. */
+     Count up the number of reaching defs of each use.  */
   for (i = 0; i < n_basic_blocks; i++)
     {
       basic_block bb = BASIC_BLOCK (i);
@@ -643,7 +642,7 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out,
              if (def != NULL)
                {
                  /* Remove all reaching defs of regno except
-                    for this one. */
+                    for this one.  */
                  sbitmap_difference (reaching_defs, reaching_defs,
                                      btr_defset[def->btr - first_btr]);
                  SET_BIT(reaching_defs, insn_uid);
@@ -651,7 +650,7 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out,
 
              if (user != NULL)
                {
-                 /* Find all the reaching defs for this use */
+                 /* Find all the reaching defs for this use */
                  sbitmap reaching_defs_of_reg = sbitmap_alloc(max_uid);
                  int uid;
 
@@ -678,7 +677,7 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out,
                    {
                      btr_def def = def_array[uid];
 
-                     /* We now know that def reaches user */
+                     /* We now know that def reaches user */
 
                      if (rtl_dump_file)
                        fprintf (rtl_dump_file,
@@ -691,7 +690,7 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out,
                      if (user->first_reaching_def != -1)
                        { /* There is more than one reaching def.  This is
                             a rare case, so just give up on this def/use
-                            web when it occurs. */
+                            web when it occurs.  */
                          def->has_ambiguous_use = 1;
                          def_array[user->first_reaching_def]
                            ->has_ambiguous_use = 1;
@@ -735,8 +734,7 @@ build_btr_def_use_webs (fibheap_t all_btr_defs)
   sbitmap *btr_defset   = sbitmap_vector_alloc (
                           (last_btr - first_btr) + 1, max_uid);
   sbitmap *bb_gen      = sbitmap_vector_alloc (n_basic_blocks, max_uid);
-  HARD_REG_SET *btrs_written = (HARD_REG_SET *) xcalloc (
-                              n_basic_blocks, sizeof (HARD_REG_SET));
+  HARD_REG_SET *btrs_written = xcalloc (n_basic_blocks, sizeof (HARD_REG_SET));
   sbitmap *bb_kill;
   sbitmap *bb_out;
 
@@ -788,7 +786,7 @@ block_at_edge_of_live_range_p (int bb, btr_def def)
    Blocks at the boundary of the live range may contain other live
    ranges for the same target register, so we have to be careful
    to remove the target register from the live set of these blocks
-   only if they do not contain other live ranges for the same register. */
+   only if they do not contain other live ranges for the same register.  */
 static void
 clear_btr_from_live_range (btr_def def)
 {
@@ -840,8 +838,7 @@ augment_live_range (bitmap live_range, HARD_REG_SET *btrs_live_in_range,
 {
   basic_block *worklist, *tos;
 
-  tos = worklist =
-    (basic_block *) xmalloc (sizeof (basic_block) * (n_basic_blocks + 1));
+  tos = worklist = xmalloc (sizeof (basic_block) * (n_basic_blocks + 1));
 
   if (dominated_by_p (dom, new_bb, head_bb))
     *tos++ = new_bb;
@@ -980,9 +977,9 @@ combine_btr_defs (btr_def def, HARD_REG_SET *btrs_live_in_range)
          && dominated_by_p (dom, other_def->bb, def->bb))
        {
          /* def->bb dominates the other def, so def and other_def could
-            be combined. */
+            be combined.  */
          /* Merge their live ranges, and get the set of
-            target registers live over the merged range. */
+            target registers live over the merged range.  */
          int btr;
          HARD_REG_SET combined_btrs_live;
          bitmap combined_live_range = BITMAP_XMALLOC ();
@@ -1003,7 +1000,7 @@ combine_btr_defs (btr_def def, HARD_REG_SET *btrs_live_in_range)
          btr = choose_btr (combined_btrs_live);
          if (btr != -1)
            {
-             /* We can combine them */
+             /* We can combine them */
              if (rtl_dump_file)
                fprintf (rtl_dump_file,
                         "Combining def in insn %d with def in insn %d\n",
@@ -1024,7 +1021,7 @@ combine_btr_defs (btr_def def, HARD_REG_SET *btrs_live_in_range)
                 some REG_DEAD notes may no longer be correct.  We could
                 be more precise about this if we looked at the combined
                 live range, but here I just delete any REG_DEAD notes
-                in case they are no longer correct. */
+                in case they are no longer correct.  */
              for (user = def->uses; user != NULL; user = user->next)
                remove_note (user->insn,
                             find_regno_note (user->insn, REG_DEAD,
@@ -1036,7 +1033,7 @@ combine_btr_defs (btr_def def, HARD_REG_SET *btrs_live_in_range)
                def->other_btr_uses_after_use = 1;
              COPY_HARD_REG_SET (*btrs_live_in_range, combined_btrs_live);
 
-             /* Delete the old target register initialization */
+             /* Delete the old target register initialization */
              delete_insn (other_def->insn);
 
            }
@@ -1059,7 +1056,7 @@ move_btr_def (basic_block new_def_bb, int btr, btr_def def, bitmap live_range,
      Set a target register in block NEW_DEF_BB to the value
      needed for this target register definition.
      Replace all uses of the old target register definition by
-     uses of the new definition.  Delete the old definition. */
+     uses of the new definition.  Delete the old definition.  */
   basic_block b = new_def_bb;
   rtx insp = b->head;
   rtx old_insn = def->insn;
@@ -1098,7 +1095,7 @@ move_btr_def (basic_block new_def_bb, int btr, btr_def def, bitmap live_range,
 
   new_insn = gen_move_insn (btr_rtx, src);
 
-  /* Insert target register initialization at head of basic block. */
+  /* Insert target register initialization at head of basic block.  */
   def->insn = emit_insn_after (new_insn, insp);
 
   regs_ever_live[btr] = 1;
@@ -1107,17 +1104,17 @@ move_btr_def (basic_block new_def_bb, int btr, btr_def def, bitmap live_range,
     fprintf (rtl_dump_file, "New pt is insn %d, inserted after insn %d\n",
             INSN_UID (def->insn), INSN_UID (insp));
 
-  /* Delete the old target register initialization */
+  /* Delete the old target register initialization */
   delete_insn (old_insn);
 
   /* Replace each use of the old target register by a use of the new target
-     register. */
+     register.  */
   for (user = def->uses; user != NULL; user = user->next)
     {
       /* Some extra work here to ensure consistent modes, because
         it seems that a target register REG rtx can be given a different
         mode depending on the context (surely that should not be
-        the case?). */
+        the case?).  */
       rtx replacement_rtx;
       if (GET_MODE (user->use) == GET_MODE (btr_rtx)
          || GET_MODE (user->use) == VOIDmode)
@@ -1156,7 +1153,7 @@ can_move_up (basic_block bb, rtx insn, int n_insns)
    MIN_COST is the lower bound on the cost of the DEF after migration.
    If we migrate DEF so that its cost falls below MIN_COST,
    then we do not attempt to migrate further.  The idea is that
-   we migrate defintions in a priority order based on their cost,
+   we migrate definitions in a priority order based on their cost,
    when the cost of this definition falls below MIN_COST, then
    there is another definition with cost == MIN_COST which now
    has a higher priority than this definition.
@@ -1164,7 +1161,7 @@ can_move_up (basic_block bb, rtx insn, int n_insns)
    Return nonzero if there may be benefit from attempting to
    migrate this DEF further (i.e. we have reduced the cost below
    MIN_COST, but we may be able to reduce it further).
-   Return zero if no further migration is possible. */
+   Return zero if no further migration is possible.  */
 static int
 migrate_btr_def (btr_def def, int min_cost)
 {
@@ -1184,7 +1181,7 @@ migrate_btr_def (btr_def def, int min_cost)
             INSN_UID (def->insn), def->cost, min_cost);
 
   if (!def->group || def->has_ambiguous_use)
-    /* These defs are not migratable */
+    /* These defs are not migratable */
     {
       if (rtl_dump_file)
        fprintf (rtl_dump_file, "it's not migratable\n");
@@ -1234,7 +1231,7 @@ migrate_btr_def (btr_def def, int min_cost)
        try = get_immediate_dominator (dom, try))
     {
       /* Try to move the instruction that sets the target register into
-        basic block TRY. */
+        basic block TRY.  */
       int try_freq = basic_block_freq (try);
 
       if (rtl_dump_file)
@@ -1283,7 +1280,7 @@ migrate_btr_def (btr_def def, int min_cost)
 }
 
 /* Attempt to move instructions that set target registers earlier
-   in the flowgraph, away from their corresponding uses. */
+   in the flowgraph, away from their corresponding uses.  */
 static void
 migrate_btr_defs (enum reg_class btr_class, int allow_callee_save)
 {
@@ -1317,8 +1314,7 @@ migrate_btr_defs (enum reg_class btr_class, int allow_callee_save)
          first_btr = reg;
       }
 
-  btrs_live =
-    (HARD_REG_SET *) xcalloc (n_basic_blocks, sizeof (HARD_REG_SET));
+  btrs_live = xcalloc (n_basic_blocks, sizeof (HARD_REG_SET));
 
   build_btr_def_use_webs (all_btr_defs);
 
@@ -1361,16 +1357,16 @@ branch_target_load_optimize (rtx insns, bool after_prologue_epilogue_gen)
       else
        issue_rate = 1;
 
-      /* Build the CFG for migrate_btr_defs. */
+      /* Build the CFG for migrate_btr_defs.  */
 #if 1
       /* This may or may not be needed, depending on where we
-        run this phase. */
+        run this phase.  */
       cleanup_cfg (optimize ? CLEANUP_EXPENSIVE : 0);
 #endif
 
       life_analysis (insns, NULL, 0);
 
-      /* Dominator info is also needed for migrate_btr_def. */
+      /* Dominator info is also needed for migrate_btr_def.  */
       dom = calculate_dominance_info (CDI_DOMINATORS);
       migrate_btr_defs (class,
                       ((*targetm.branch_target_register_callee_saved)