OSDN Git Service

* config/h8300/h8300.md (*movsf_h8300h): Change to
[pf3gnuchains/gcc-fork.git] / gcc / regrename.c
index 719db58..b22e56e 100644 (file)
@@ -194,7 +194,7 @@ regrename_optimize (void)
   memset (tick, 0, sizeof tick);
 
   gcc_obstack_init (&rename_obstack);
-  first_obj = (char *) obstack_alloc (&rename_obstack, 0);
+  first_obj = obstack_alloc (&rename_obstack, 0);
 
   FOR_EACH_BB (bb)
     {
@@ -230,7 +230,7 @@ regrename_optimize (void)
       CLEAR_HARD_REG_SET (regs_seen);
       while (all_chains)
        {
-         int new_reg, best_new_reg = -1;
+         int new_reg, best_new_reg;
          int n_uses;
          struct du_chain *this = all_chains;
          struct du_chain *tmp, *last;
@@ -240,6 +240,8 @@ regrename_optimize (void)
 
          all_chains = this->next_chain;
 
+         best_new_reg = reg;
+
 #if 0 /* This just disables optimization opportunities.  */
          /* Only rename once we've seen the reg more than once.  */
          if (! TEST_HARD_REG_BIT (regs_seen, reg))
@@ -320,8 +322,7 @@ regrename_optimize (void)
                  break;
              if (! tmp)
                {
-                 if (best_new_reg == -1
-                     || tick[best_new_reg] > tick[new_reg])
+                 if (tick[best_new_reg] > tick[new_reg])
                    best_new_reg = new_reg;
                }
            }
@@ -334,15 +335,16 @@ regrename_optimize (void)
                fprintf (rtl_dump_file, " crosses a call");
            }
 
-         if (best_new_reg == -1)
+         if (best_new_reg == reg)
            {
+             tick[reg] = ++this_tick;
              if (rtl_dump_file)
-               fprintf (rtl_dump_file, "; no available registers\n");
+               fprintf (rtl_dump_file, "; no available better choice\n");
              continue;
            }
 
          do_replace (this, best_new_reg);
-         tick[best_new_reg] = this_tick++;
+         tick[best_new_reg] = ++this_tick;
 
          if (rtl_dump_file)
            fprintf (rtl_dump_file, ", renamed as %s\n", reg_names[best_new_reg]);
@@ -395,8 +397,8 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class class,
     {
       if (type == OP_OUT)
        {
-         struct du_chain *this = (struct du_chain *)
-           obstack_alloc (&rename_obstack, sizeof (struct du_chain));
+         struct du_chain *this
+           obstack_alloc (&rename_obstack, sizeof (struct du_chain));
          this->next_use = 0;
          this->next_chain = open_chains;
          this->loc = loc;
@@ -450,8 +452,7 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class class,
                 be replaced with, terminate the chain.  */
              if (class != NO_REGS)
                {
-                 this = (struct du_chain *)
-                   obstack_alloc (&rename_obstack, sizeof (struct du_chain));
+                 this = obstack_alloc (&rename_obstack, sizeof (struct du_chain));
                  this->next_use = 0;
                  this->next_chain = (*p)->next_chain;
                  this->loc = loc;
@@ -1733,7 +1734,7 @@ copyprop_hardreg_forward (void)
       /* If a block has a single predecessor, that we've already
         processed, begin with the value data that was live at
         the end of the predecessor block.  */
-      /* ??? Ought to use more intelligent queueing of blocks.  */
+      /* ??? Ought to use more intelligent queuing of blocks.  */
       if (bb->pred)
        for (bbp = bb; bbp && bbp != bb->pred->src; bbp = bbp->prev_bb);
       if (bb->pred