OSDN Git Service

* Makefile.in (INSTALL_CPP, UNINSTALL_CPP): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / unroll.c
index 9a0cfcf..ceec66e 100644 (file)
@@ -147,6 +147,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "hard-reg-set.h"
 #include "basic-block.h"
 #include "predict.h"
+#include "params.h"
 
 /* The prime factors looked for when trying to unroll a loop by some
    number which is modulo the total number of iterations.  Just checking
@@ -169,13 +170,6 @@ enum unroll_types
   UNROLL_NAIVE
 };
 
-/* This controls which loops are unrolled, and by how much we unroll
-   them.  */
-
-#ifndef MAX_UNROLLED_INSNS
-#define MAX_UNROLLED_INSNS 100
-#endif
-
 /* Indexed by register number, if non-zero, then it contains a pointer
    to a struct induction for a DEST_REG giv which has been combined with
    one of more address givs.  This is needed because whenever such a DEST_REG
@@ -727,8 +721,7 @@ unroll_loop (loop, insn_count, strength_reduce_p)
 
   if (max_labelno > 0)
     {
-      map->label_map = (rtx *) xmalloc (max_labelno * sizeof (rtx));
-
+      map->label_map = (rtx *) xcalloc (max_labelno, sizeof (rtx));
       local_label = (char *) xcalloc (max_labelno, sizeof (char));
     }
 
@@ -1642,7 +1635,7 @@ calculate_giv_inc (pattern, src_insn, regno)
          rtx second_part = XEXP (increment, 1);
          enum rtx_code code = GET_CODE (increment);
 
-         increment = find_last_value (XEXP (increment, 0), 
+         increment = find_last_value (XEXP (increment, 0),
                                       &src_insn, NULL_RTX, 0);
          /* Don't need the last insn anymore.  */
          delete_related_insns (get_last_insn ());
@@ -1739,7 +1732,7 @@ final_reg_note_copy (notesp, map)
   while (*notesp)
     {
       rtx note = *notesp;
-      
+
       if (GET_CODE (note) == INSN_LIST)
        {
          /* Sometimes, we have a REG_WAS_0 note that points to a
@@ -2222,6 +2215,7 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration,
          pattern = copy_rtx_and_substitute (PATTERN (insn), map, 0);
          copy = emit_call_insn (pattern);
          REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map);
+         SIBLING_CALL_P (copy) = SIBLING_CALL_P (insn);
 
          /* Because the USAGE information potentially contains objects other
             than hard registers, we need to copy it.  */
@@ -2585,7 +2579,7 @@ find_splittable_regs (loop, unroll_type, unroll_number)
                  rtx tem = gen_reg_rtx (bl->biv->mode);
 
                  record_base_value (REGNO (tem), bl->biv->add_val, 0);
-                 loop_insn_hoist (loop, 
+                 loop_insn_hoist (loop,
                                   gen_move_insn (tem, bl->biv->src_reg));
 
                  if (loop_dump_stream)
@@ -3600,7 +3594,7 @@ loop_iterations (loop)
                  && INSN_LUID (JUMP_LABEL (temp)) < INSN_LUID (loop->cont))
                {
                  if (loop_dump_stream)
-                   fprintf 
+                   fprintf
                      (loop_dump_stream,
                       "Loop iterations: Loop has multiple back edges.\n");
                  return 0;
@@ -3744,7 +3738,18 @@ loop_iterations (loop)
          for (biv_inc = bl->biv; biv_inc; biv_inc = biv_inc->next_iv)
            {
              if (loop_insn_first_p (v->insn, biv_inc->insn))
-               offset -= INTVAL (biv_inc->add_val);
+               {
+                 if (REG_P (biv_inc->add_val))
+                   {
+                     if (loop_dump_stream)
+                       fprintf (loop_dump_stream,
+                                "Loop iterations: Basic induction var add_val is REG %d.\n",
+                                REGNO (biv_inc->add_val));
+                       return 0;
+                   }
+
+                 offset -= INTVAL (biv_inc->add_val);
+               }
            }
        }
       if (loop_dump_stream)