integrate.c: Remove.
[platform/upstream/gcc.git] / gcc / postreload.c
index 8994366..e1ec874 100644 (file)
@@ -64,7 +64,8 @@ static void move2add_note_store (rtx, const_rtx, void *);
 
 /* Call cse / combine like post-reload optimization phases.
    FIRST is the first instruction.  */
-void
+
+static void
 reload_cse_regs (rtx first ATTRIBUTE_UNUSED)
 {
   bool moves_converted;
@@ -112,8 +113,8 @@ reload_cse_simplify (rtx insn, rtx testreg)
          if (REG_P (value)
              && ! REG_FUNCTION_VALUE_P (value))
            value = 0;
-         check_for_inc_dec (insn);
-         delete_insn_and_edges (insn);
+         if (check_for_inc_dec (insn))
+           delete_insn_and_edges (insn);
          return;
        }
 
@@ -164,8 +165,8 @@ reload_cse_simplify (rtx insn, rtx testreg)
 
       if (i < 0)
        {
-         check_for_inc_dec (insn);
-         delete_insn_and_edges (insn);
+         if (check_for_inc_dec (insn))
+           delete_insn_and_edges (insn);
          /* We're done with this insn.  */
          return;
        }
@@ -682,7 +683,7 @@ struct reg_use
   /* Points to the memory reference enclosing the use, if any, NULL_RTX
      otherwise.  */
   rtx containing_mem;
-  /* Location of the register withing INSN.  */
+  /* Location of the register within INSN.  */
   rtx *usep;
   /* The reverse uid of the insn.  */
   int ruid;
@@ -1312,11 +1313,21 @@ reload_combine (void)
         is and then later disable any optimization that would cross it.  */
       if (LABEL_P (insn))
        last_label_ruid = reload_combine_ruid;
-      else if (BARRIER_P (insn)
-              || (INSN_P (insn) && volatile_insn_p (PATTERN (insn))))
-       for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
-         if (! fixed_regs[r])
+      else if (BARRIER_P (insn))
+       {
+         /* Crossing a barrier resets all the use information.  */
+         for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
+           if (! fixed_regs[r])
              reg_state[r].use_index = RELOAD_COMBINE_MAX_USES;
+       }
+      else if (INSN_P (insn) && volatile_insn_p (PATTERN (insn)))
+       /* Optimizations across insns being marked as volatile must be
+          prevented.  All the usage information is invalidated
+          here.  */
+       for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
+         if (! fixed_regs[r]
+             && reg_state[r].use_index != RELOAD_COMBINE_MAX_USES)
+           reg_state[r].use_index = -1;
 
       if (! NONDEBUG_INSN_P (insn))
        continue;
@@ -1347,8 +1358,10 @@ reload_combine (void)
          for (link = CALL_INSN_FUNCTION_USAGE (insn); link;
               link = XEXP (link, 1))
            {
-             rtx usage_rtx = XEXP (XEXP (link, 0), 0);
-             if (REG_P (usage_rtx))
+             rtx setuse = XEXP (link, 0);
+             rtx usage_rtx = XEXP (setuse, 0);
+             if ((GET_CODE (setuse) == USE || GET_CODE (setuse) == CLOBBER)
+                 && REG_P (usage_rtx))
                {
                  unsigned int i;
                  unsigned int start_reg = REGNO (usage_rtx);