OSDN Git Service

* config/i386/i386.c (override_options): Define c3-2 as a 686 with SSE.
[pf3gnuchains/gcc-fork.git] / gcc / flow.c
index cdfbee5..24f8691 100644 (file)
@@ -120,6 +120,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 \f
 #include "config.h"
 #include "system.h"
+#include "coretypes.h"
+#include "tm.h"
 #include "tree.h"
 #include "rtl.h"
 #include "tm_p.h"
@@ -140,9 +142,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "obstack.h"
 #include "splay-tree.h"
 
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
    the stack pointer does not matter.  The value is tested only in
    functions that have frame pointers.
@@ -272,10 +271,10 @@ struct propagate_block_info
   /* The length of mem_set_list.  */
   int mem_set_list_len;
 
-  /* Non-zero if the value of CC0 is live.  */
+  /* Nonzero if the value of CC0 is live.  */
   int cc0_live;
 
-  /* Flags controling the set of information propagate_block collects.  */
+  /* Flags controlling the set of information propagate_block collects.  */
   int flags;
 };
 
@@ -373,10 +372,14 @@ check_function_return_warnings ()
         is no longer in the chain.  */
       if (INSN_UID (cfun->x_clobber_return_insn) < max_uid)
        {
-         /* Recompute insn->block mapping, since the initial mapping is
-            set before we delete unreachable blocks.  */
-         if (BLOCK_FOR_INSN (cfun->x_clobber_return_insn) != NULL)
-           warning ("control reaches end of non-void function");
+         rtx insn;
+
+         for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+           if (insn == cfun->x_clobber_return_insn)
+             {
+               warning ("control reaches end of non-void function");
+               break;
+             }
        }
     }
 }
@@ -430,6 +433,16 @@ life_analysis (f, file, flags)
   SET_HARD_REG_BIT (elim_reg_set, FRAME_POINTER_REGNUM);
 #endif
 
+
+#ifdef CANNOT_CHANGE_MODE_CLASS
+  if (flags & PROP_REG_INFO)
+    {
+      int j;
+      for (j=0; j < NUM_MACHINE_MODES; ++j)
+       INIT_REG_SET (&subregs_of_mode[j]);
+    }
+#endif
+
   if (! optimize)
     flags &= ~(PROP_LOG_LINKS | PROP_AUTOINC | PROP_ALLOW_CFG_CHANGES);
 
@@ -447,7 +460,7 @@ life_analysis (f, file, flags)
     flags &= ~(PROP_REG_INFO | PROP_AUTOINC);
 
   /* We want alias analysis information for local dead store elimination.  */
-  if (optimize && (flags & PROP_SCAN_DEAD_CODE))
+  if (optimize && (flags & PROP_SCAN_DEAD_STORES))
     init_alias_analysis ();
 
   /* Always remove no-op moves.  Do this before other processing so
@@ -477,7 +490,7 @@ life_analysis (f, file, flags)
   update_life_info (NULL, UPDATE_LIFE_GLOBAL, flags);
 
   /* Clean up.  */
-  if (optimize && (flags & PROP_SCAN_DEAD_CODE))
+  if (optimize && (flags & PROP_SCAN_DEAD_STORES))
     end_alias_analysis ();
 
   if (file)
@@ -485,20 +498,6 @@ life_analysis (f, file, flags)
 
   free_basic_block_vars (1);
 
-#ifdef ENABLE_CHECKING
-  {
-    rtx insn;
-
-    /* Search for any REG_LABEL notes which reference deleted labels.  */
-    for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
-      {
-       rtx inote = find_reg_note (insn, REG_LABEL, NULL_RTX);
-
-       if (inote && GET_CODE (inote) == NOTE_INSN_DELETED_LABEL)
-         abort ();
-      }
-  }
-#endif
   /* Removing dead insns should've made jumptables really dead.  */
   delete_dead_jumptables ();
 }
@@ -575,7 +574,7 @@ verify_local_live_at_start (new_live_at_start, bb)
            {
              fprintf (rtl_dump_file,
                       "live_at_start mismatch in bb %d, aborting\nNew:\n",
-                      bb->sindex);
+                      bb->index);
              debug_bitmap_file (rtl_dump_file, new_live_at_start);
              fputs ("Old:\n", rtl_dump_file);
              dump_bb (bb, rtl_dump_file);
@@ -592,7 +591,7 @@ verify_local_live_at_start (new_live_at_start, bb)
 
       EXECUTE_IF_SET_IN_REG_SET (new_live_at_start, 0, i,
        {
-          /* No registers should die.  */
+         /* No registers should die.  */
          if (REGNO_REG_SET_P (bb->global_live_at_start, i))
            {
              if (rtl_dump_file)
@@ -604,7 +603,7 @@ verify_local_live_at_start (new_live_at_start, bb)
              abort ();
            }
 
-          /* Verify that the now-live register is wider than word_mode.  */
+         /* Verify that the now-live register is wider than word_mode.  */
          verify_wide_reg (i, bb);
        });
     }
@@ -637,6 +636,7 @@ update_life_info (blocks, extent, prop_flags)
   regset_head tmp_head;
   int i;
   int stabilized_prop_flags = prop_flags;
+  basic_block bb;
 
   tmp = INITIALIZE_REG_SET (tmp_head);
   ndead = 0;
@@ -656,10 +656,10 @@ update_life_info (blocks, extent, prop_flags)
       for ( ; ; )
        {
          int changed = 0;
-         basic_block bb;
 
          calculate_global_regs_live (blocks, blocks,
                                prop_flags & (PROP_SCAN_DEAD_CODE
+                                             | PROP_SCAN_DEAD_STORES
                                              | PROP_ALLOW_CFG_CHANGES));
 
          if ((prop_flags & (PROP_KILL_DEAD_CODE | PROP_ALLOW_CFG_CHANGES))
@@ -668,12 +668,12 @@ update_life_info (blocks, extent, prop_flags)
 
          /* Removing dead code may allow the CFG to be simplified which
             in turn may allow for further dead code detection / removal.  */
-         FOR_ALL_BB_REVERSE (bb)
+         FOR_EACH_BB_REVERSE (bb)
            {
-
              COPY_REG_SET (tmp, bb->global_live_at_end);
              changed |= propagate_block (bb, tmp, NULL, NULL,
                                prop_flags & (PROP_SCAN_DEAD_CODE
+                                             | PROP_SCAN_DEAD_STORES
                                              | PROP_KILL_DEAD_CODE));
            }
 
@@ -682,7 +682,8 @@ update_life_info (blocks, extent, prop_flags)
             removing dead code can affect global register liveness, which
             is supposed to be finalized for this call after this loop.  */
          stabilized_prop_flags
-           &= ~(PROP_SCAN_DEAD_CODE | PROP_KILL_DEAD_CODE);
+           &= ~(PROP_SCAN_DEAD_CODE | PROP_SCAN_DEAD_STORES
+                | PROP_KILL_DEAD_CODE);
 
          if (! changed)
            break;
@@ -692,6 +693,16 @@ update_life_info (blocks, extent, prop_flags)
             partial improvement (see MAX_MEM_SET_LIST_LEN usage).
             Further improvement may be possible.  */
          cleanup_cfg (CLEANUP_EXPENSIVE);
+
+         /* Zap the life information from the last round.  If we don't 
+            do this, we can wind up with registers that no longer appear
+            in the code being marked live at entry, which twiggs bogus
+            warnings from regno_uninitialized.  */
+         FOR_EACH_BB (bb)
+           {
+             CLEAR_REG_SET (bb->global_live_at_start);
+             CLEAR_REG_SET (bb->global_live_at_end);
+           }
        }
 
       /* If asked, remove notes from the blocks we'll update.  */
@@ -707,7 +718,7 @@ update_life_info (blocks, extent, prop_flags)
     {
       EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
        {
-         basic_block bb = BASIC_BLOCK (i);
+         bb = BASIC_BLOCK (i);
 
          COPY_REG_SET (tmp, bb->global_live_at_end);
          propagate_block (bb, tmp, NULL, NULL, stabilized_prop_flags);
@@ -718,9 +729,7 @@ update_life_info (blocks, extent, prop_flags)
     }
   else
     {
-      basic_block bb;
-
-      FOR_ALL_BB_REVERSE (bb)
+      FOR_EACH_BB_REVERSE (bb)
        {
          COPY_REG_SET (tmp, bb->global_live_at_end);
 
@@ -781,12 +790,25 @@ update_life_info_in_dirty_blocks (extent, prop_flags)
   int retval = 0;
 
   sbitmap_zero (update_life_blocks);
-  FOR_ALL_BB (bb)
-    if (bb->flags & BB_DIRTY)
-      {
-       SET_BIT (update_life_blocks, bb->sindex);
-       n++;
-      }
+  FOR_EACH_BB (bb)
+    {
+      if (extent == UPDATE_LIFE_LOCAL)
+       {
+         if (bb->flags & BB_DIRTY)
+           {
+             SET_BIT (update_life_blocks, bb->index);
+             n++;
+           }
+       }
+      else
+       {
+         /* ??? Bootstrap with -march=pentium4 fails to terminate
+            with only a partial life update.  */
+         SET_BIT (update_life_blocks, bb->index);
+         if (bb->flags & BB_DIRTY)
+           n++;
+       }
+    }
 
   if (n)
     retval = update_life_info (update_life_blocks, extent, prop_flags);
@@ -797,7 +819,7 @@ update_life_info_in_dirty_blocks (extent, prop_flags)
 
 /* Free the variables allocated by find_basic_blocks.
 
-   KEEP_HEAD_END_P is non-zero if basic_block_info is not to be freed.  */
+   KEEP_HEAD_END_P is nonzero if basic_block_info is not to be freed.  */
 
 void
 free_basic_block_vars (keep_head_end_p)
@@ -810,7 +832,7 @@ free_basic_block_vars (keep_head_end_p)
          clear_edges ();
          VARRAY_FREE (basic_block_info);
        }
-      num_basic_blocks = 0;
+      n_basic_blocks = 0;
       last_basic_block = 0;
 
       ENTRY_BLOCK_PTR->aux = NULL;
@@ -830,7 +852,7 @@ delete_noop_moves (f)
   basic_block bb;
   int nnoops = 0;
 
-  FOR_ALL_BB (bb)
+  FOR_EACH_BB (bb)
     {
       for (insn = bb->head; insn != NEXT_INSN (bb->end); insn = next)
        {
@@ -988,7 +1010,7 @@ mark_regs_live_at_end (set)
 #if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
       /* If they are different, also mark the hard frame pointer as live.  */
       if (! LOCAL_REGNO (HARD_FRAME_POINTER_REGNUM))
-        SET_REGNO_REG_SET (set, HARD_FRAME_POINTER_REGNUM);
+       SET_REGNO_REG_SET (set, HARD_FRAME_POINTER_REGNUM);
 #endif
     }
 
@@ -996,7 +1018,7 @@ mark_regs_live_at_end (set)
   /* Many architectures have a GP register even without flag_pic.
      Assume the pic register is not in use, or will be handled by
      other means, if it is not fixed.  */
-  if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
+  if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
       && fixed_regs[PIC_OFFSET_TABLE_REGNUM])
     SET_REGNO_REG_SET (set, PIC_OFFSET_TABLE_REGNUM);
 #endif
@@ -1079,13 +1101,13 @@ calculate_global_regs_live (blocks_in, blocks_out, flags)
      int flags;
 {
   basic_block *queue, *qhead, *qtail, *qend, bb;
-  regset tmp, new_live_at_end, call_used;
-  regset_head tmp_head, call_used_head;
+  regset tmp, new_live_at_end, invalidated_by_call;
+  regset_head tmp_head, invalidated_by_call_head;
   regset_head new_live_at_end_head;
   int i;
 
   /* Some passes used to forget clear aux field of basic block causing
-     sick behaviour here.  */
+     sick behavior here.  */
 #ifdef ENABLE_CHECKING
   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
     if (bb->aux)
@@ -1094,39 +1116,35 @@ calculate_global_regs_live (blocks_in, blocks_out, flags)
 
   tmp = INITIALIZE_REG_SET (tmp_head);
   new_live_at_end = INITIALIZE_REG_SET (new_live_at_end_head);
-  call_used = INITIALIZE_REG_SET (call_used_head);
+  invalidated_by_call = INITIALIZE_REG_SET (invalidated_by_call_head);
 
   /* Inconveniently, this is only readily available in hard reg set form.  */
   for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
-    if (call_used_regs[i])
-      SET_REGNO_REG_SET (call_used, i);
+    if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
+      SET_REGNO_REG_SET (invalidated_by_call, i);
 
   /* Create a worklist.  Allocate an extra slot for ENTRY_BLOCK, and one
      because the `head == tail' style test for an empty queue doesn't
      work with a full queue.  */
-  queue = (basic_block *) xmalloc ((num_basic_blocks + 2) * sizeof (*queue));
+  queue = (basic_block *) xmalloc ((n_basic_blocks + 2) * sizeof (*queue));
   qtail = queue;
-  qhead = qend = queue + num_basic_blocks + 2;
+  qhead = qend = queue + n_basic_blocks + 2;
 
   /* Queue the blocks set in the initial mask.  Do this in reverse block
      number order so that we are more likely for the first round to do
      useful work.  We use AUX non-null to flag that the block is queued.  */
   if (blocks_in)
     {
-      /* Clear out the garbage that might be hanging out in bb->aux.  */
-      FOR_ALL_BB (bb)
-       bb->aux = NULL;
-
-      EXECUTE_IF_SET_IN_SBITMAP (blocks_in, 0, i,
-       {
-         bb = BASIC_BLOCK (i);
-         *--qhead = bb;
-         bb->aux = bb;
-       });
+      FOR_EACH_BB (bb)
+       if (TEST_BIT (blocks_in, bb->index))
+         {
+           *--qhead = bb;
+           bb->aux = bb;
+         }
     }
   else
     {
-      FOR_ALL_BB (bb)
+      FOR_EACH_BB (bb)
        {
          *--qhead = bb;
          bb->aux = bb;
@@ -1185,7 +1203,7 @@ calculate_global_regs_live (blocks_in, blocks_out, flags)
            if (e->flags & EDGE_EH)
              {
                bitmap_operation (tmp, sb->global_live_at_start,
-                                 call_used, BITMAP_AND_COMPL);
+                                 invalidated_by_call, BITMAP_AND_COMPL);
                IOR_REG_SET (new_live_at_end, tmp);
              }
            else
@@ -1229,7 +1247,7 @@ calculate_global_regs_live (blocks_in, blocks_out, flags)
 
          /* Any constant, or pseudo with constant equivalences, may
             require reloading from memory using the pic register.  */
-         if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
+         if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
              && fixed_regs[PIC_OFFSET_TABLE_REGNUM])
            SET_REGNO_REG_SET (new_live_at_end, PIC_OFFSET_TABLE_REGNUM);
        }
@@ -1303,7 +1321,7 @@ calculate_global_regs_live (blocks_in, blocks_out, flags)
       /* Let our caller know that BB changed enough to require its
         death notes updated.  */
       if (blocks_out)
-       SET_BIT (blocks_out, bb->sindex);
+       SET_BIT (blocks_out, bb->index);
 
       if (! rescan)
        {
@@ -1353,20 +1371,20 @@ calculate_global_regs_live (blocks_in, blocks_out, flags)
 
   FREE_REG_SET (tmp);
   FREE_REG_SET (new_live_at_end);
-  FREE_REG_SET (call_used);
+  FREE_REG_SET (invalidated_by_call);
 
   if (blocks_out)
     {
       EXECUTE_IF_SET_IN_SBITMAP (blocks_out, 0, i,
        {
-         bb = BASIC_BLOCK (i);
+         basic_block bb = BASIC_BLOCK (i);
          FREE_REG_SET (bb->local_set);
          FREE_REG_SET (bb->cond_local_set);
        });
     }
   else
     {
-      FOR_ALL_BB (bb)
+      FOR_EACH_BB (bb)
        {
          FREE_REG_SET (bb->local_set);
          FREE_REG_SET (bb->cond_local_set);
@@ -1377,7 +1395,7 @@ calculate_global_regs_live (blocks_in, blocks_out, flags)
 }
 
 \f
-/* This structure is used to pass parameters to an from the
+/* This structure is used to pass parameters to and from the
    the function find_regno_partial(). It is used to pass in the
    register number we are looking, as well as to return any rtx
    we find.  */
@@ -1495,17 +1513,12 @@ allocate_bb_life_data ()
 {
   basic_block bb;
 
-  FOR_ALL_BB (bb)
+  FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
     {
       bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack);
       bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack);
     }
 
-  ENTRY_BLOCK_PTR->global_live_at_end
-    = OBSTACK_ALLOC_REG_SET (&flow_obstack);
-  EXIT_BLOCK_PTR->global_live_at_start
-    = OBSTACK_ALLOC_REG_SET (&flow_obstack);
-
   regs_live_at_setjmp = OBSTACK_ALLOC_REG_SET (&flow_obstack);
 }
 
@@ -1529,6 +1542,7 @@ allocate_reg_life_data ()
       REG_N_DEATHS (i) = 0;
       REG_N_CALLS_CROSSED (i) = 0;
       REG_LIVE_LENGTH (i) = 0;
+      REG_FREQ (i) = 0;
       REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN;
     }
 }
@@ -1549,11 +1563,7 @@ propagate_block_delete_insn (insn)
      INSN may reference a deleted label, particularly when a jump
      table has been optimized into a direct jump.  There's no
      real good way to fix up the reference to the deleted label
-     when the label is deleted, so we just allow it here.
-
-     After dead code elimination is complete, we do search for
-     any REG_LABEL notes which reference deleted labels as a
-     sanity check.  */
+     when the label is deleted, so we just allow it here.  */
 
   if (inote && GET_CODE (inote) == CODE_LABEL)
     {
@@ -1658,7 +1668,42 @@ propagate_one_insn (pbi, insn)
       if (libcall_is_dead)
        prev = propagate_block_delete_libcall ( insn, note);
       else
-       propagate_block_delete_insn (insn);
+       {
+
+       /* If INSN contains a RETVAL note and is dead, but the libcall
+          as a whole is not dead, then we want to remove INSN, but
+          not the whole libcall sequence.
+
+          However, we need to also remove the dangling REG_LIBCALL     
+          note so that we do not have mis-matched LIBCALL/RETVAL
+          notes.  In theory we could find a new location for the
+          REG_RETVAL note, but it hardly seems worth the effort. 
+
+          NOTE at this point will be the RETVAL note if it exists.  */
+         if (note)
+           {
+             rtx libcall_note;
+        
+             libcall_note
+               = find_reg_note (XEXP (note, 0), REG_LIBCALL, NULL_RTX);
+             remove_note (XEXP (note, 0), libcall_note);
+           }
+
+         /* Similarly if INSN contains a LIBCALL note, remove the
+            dangling REG_RETVAL note.  */
+         note = find_reg_note (insn, REG_LIBCALL, NULL_RTX);
+         if (note)
+           {
+             rtx retval_note;
+
+             retval_note
+               = find_reg_note (XEXP (note, 0), REG_RETVAL, NULL_RTX);
+             remove_note (XEXP (note, 0), retval_note);
+           }
+
+         /* Now delete INSN.  */
+         propagate_block_delete_insn (insn);
+       }
 
       return prev;
     }
@@ -1742,7 +1787,7 @@ propagate_one_insn (pbi, insn)
              free_EXPR_LIST_list (&pbi->mem_set_list);
              pbi->mem_set_list_len = 0;
            }
-          else
+         else
            invalidate_mems_from_set (pbi, stack_pointer_rtx);
 
          /* There may be extra registers to be clobbered.  */
@@ -1758,8 +1803,7 @@ propagate_one_insn (pbi, insn)
            if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
              {
                /* We do not want REG_UNUSED notes for these registers.  */
-               mark_set_1 (pbi, CLOBBER, gen_rtx_REG (reg_raw_mode[i], i),
-                           cond, insn,
+               mark_set_1 (pbi, CLOBBER, regno_reg_rtx[i], cond, insn,
                            pbi->flags & ~(PROP_DEATH_NOTES | PROP_REG_INFO));
              }
        }
@@ -1807,8 +1851,7 @@ propagate_one_insn (pbi, insn)
             so they are made live.  */
          for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
            if (global_regs[i])
-             mark_used_reg (pbi, gen_rtx_REG (reg_raw_mode[i], i),
-                            cond, insn);
+             mark_used_reg (pbi, regno_reg_rtx[i], cond, insn);
        }
     }
 
@@ -1952,7 +1995,7 @@ init_propagate_block_info (bb, live, local_set, cond_local_set, flags)
       && ! (TREE_CODE (TREE_TYPE (current_function_decl)) == FUNCTION_TYPE
            && (TYPE_RETURNS_STACK_DEPRESSED
                (TREE_TYPE (current_function_decl))))
-      && (flags & PROP_SCAN_DEAD_CODE)
+      && (flags & PROP_SCAN_DEAD_STORES)
       && (bb->succ == NULL
          || (bb->succ->succ_next == NULL
              && bb->succ->dest == EXIT_BLOCK_PTR
@@ -2022,7 +2065,7 @@ free_propagate_block_info (pbi)
    case, the resulting set will be equal to the union of the two sets that
    would otherwise be computed.
 
-   Return non-zero if an INSN is deleted (i.e. by dead code removal).  */
+   Return nonzero if an INSN is deleted (i.e. by dead code removal).  */
 
 int
 propagate_block (bb, live, local_set, cond_local_set, flags)
@@ -2076,7 +2119,7 @@ propagate_block (bb, live, local_set, cond_local_set, flags)
    (SET expressions whose destinations are registers dead after the insn).
    NEEDED is the regset that says which regs are alive after the insn.
 
-   Unless CALL_OK is non-zero, an insn is needed if it contains a CALL.
+   Unless CALL_OK is nonzero, an insn is needed if it contains a CALL.
 
    If X is the entire body of an insn, NOTES contains the reg notes
    pertaining to the insn.  */
@@ -2090,6 +2133,10 @@ insn_dead_p (pbi, x, call_ok, notes)
 {
   enum rtx_code code = GET_CODE (x);
 
+  /* Don't eliminate insns that may trap.  */
+  if (flag_non_call_exceptions && may_trap_p (x))
+    return 0;
+
 #ifdef AUTO_INC_DEC
   /* As flow is invoked after combine, we must take existing AUTO_INC
      expressions into account.  */
@@ -2335,14 +2382,14 @@ int
 regno_uninitialized (regno)
      unsigned int regno;
 {
-  if (num_basic_blocks == 0
+  if (n_basic_blocks == 0
       || (regno < FIRST_PSEUDO_REGISTER
          && (global_regs[regno]
              || fixed_regs[regno]
              || FUNCTION_ARG_REGNO_P (regno))))
     return 0;
 
-  return REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno);
+  return REGNO_REG_SET_P (ENTRY_BLOCK_PTR->global_live_at_end, regno);
 }
 
 /* 1 if register REGNO was alive at a place where `setjmp' was called
@@ -2353,11 +2400,11 @@ int
 regno_clobbered_at_setjmp (regno)
      int regno;
 {
-  if (num_basic_blocks == 0)
+  if (n_basic_blocks == 0)
     return 0;
 
   return ((REG_N_SETS (regno) > 1
-          || REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno))
+          || REGNO_REG_SET_P (ENTRY_BLOCK_PTR->global_live_at_end, regno))
          && REGNO_REG_SET_P (regs_live_at_setjmp, regno));
 }
 \f
@@ -2639,7 +2686,7 @@ mark_set_1 (pbi, code, reg, cond, insn, flags)
 
   /* If this set is a MEM, then it kills any aliased writes.
      If this set is a REG, then it kills any MEMs which use the reg.  */
-  if (optimize && (flags & PROP_SCAN_DEAD_CODE))
+  if (optimize && (flags & PROP_SCAN_DEAD_STORES))
     {
       if (GET_CODE (reg) == REG)
        invalidate_mems_from_set (pbi, reg);
@@ -2653,7 +2700,7 @@ mark_set_1 (pbi, code, reg, cond, insn, flags)
       if (GET_CODE (reg) == MEM && ! side_effects_p (reg)
          /* ??? With more effort we could track conditional memory life.  */
          && ! cond)
-        add_to_mem_set_list (pbi, canon_rtx (reg));
+       add_to_mem_set_list (pbi, canon_rtx (reg));
     }
 
   if (GET_CODE (reg) == REG
@@ -2712,7 +2759,7 @@ mark_set_1 (pbi, code, reg, cond, insn, flags)
                   | PROP_DEATH_NOTES | PROP_AUTOINC))
        {
          rtx y;
-         int blocknum = pbi->bb->sindex;
+         int blocknum = pbi->bb->index;
 
          y = NULL_RTX;
          if (flags & (PROP_LOG_LINKS | PROP_AUTOINC))
@@ -2808,7 +2855,7 @@ mark_set_1 (pbi, code, reg, cond, insn, flags)
                    if (! REGNO_REG_SET_P (pbi->reg_live, i))
                      REG_NOTES (insn)
                        = alloc_EXPR_LIST (REG_UNUSED,
-                                          gen_rtx_REG (reg_raw_mode[i], i),
+                                          regno_reg_rtx[i],
                                           REG_NOTES (insn));
                }
            }
@@ -3338,7 +3385,7 @@ attempt_auto_inc (pbi, inc, insn, mem, incr, incr_reg)
 
       /* We now know we'll be doing this change, so emit the
         new insn(s) and do the updates.  */
-      emit_insns_before (insns, insn);
+      emit_insn_before (insns, insn);
 
       if (pbi->bb->head == insn)
        pbi->bb->head = insns;
@@ -3491,6 +3538,12 @@ find_auto_inc (pbi, x, insn)
                                                                  addr,
                                                                  inc_val)),
                          insn, x, incr, addr);
+      else if (HAVE_PRE_MODIFY_DISP && offset == INTVAL (inc_val))
+       attempt_auto_inc (pbi, gen_rtx_PRE_MODIFY (Pmode, addr,
+                                                   gen_rtx_PLUS (Pmode,
+                                                                 addr,
+                                                                 inc_val)),
+                         insn, x, incr, addr);
     }
   else if (GET_CODE (inc_val) == REG
           && ! reg_set_between_p (inc_val, PREV_INSN (insn),
@@ -3569,7 +3622,7 @@ mark_used_reg (pbi, reg, cond, insn)
        {
          /* Keep track of which basic block each reg appears in.  */
 
-         int blocknum = pbi->bb->sindex;
+         int blocknum = pbi->bb->index;
          if (REG_BASIC_BLOCK (regno_first) == REG_BLOCK_UNKNOWN)
            REG_BASIC_BLOCK (regno_first) = blocknum;
          else if (REG_BASIC_BLOCK (regno_first) != blocknum)
@@ -3616,7 +3669,7 @@ mark_used_reg (pbi, reg, cond, insn)
                && ! dead_or_set_regno_p (insn, i))
              REG_NOTES (insn)
                = alloc_EXPR_LIST (REG_DEAD,
-                                  gen_rtx_REG (reg_raw_mode[i], i),
+                                  regno_reg_rtx[i],
                                   REG_NOTES (insn));
        }
     }
@@ -3742,7 +3795,7 @@ mark_used_regs (pbi, x, cond, insn)
     case MEM:
       /* Don't bother watching stores to mems if this is not the
         final pass.  We'll not be deleting dead stores this round.  */
-      if (optimize && (flags & PROP_SCAN_DEAD_CODE))
+      if (optimize && (flags & PROP_SCAN_DEAD_STORES))
        {
          /* Invalidate the data for the last MEM stored, but only if MEM is
             something that can be stored into.  */
@@ -3784,17 +3837,16 @@ mark_used_regs (pbi, x, cond, insn)
 
 #ifdef AUTO_INC_DEC
       if (flags & PROP_AUTOINC)
-        find_auto_inc (pbi, x, insn);
+       find_auto_inc (pbi, x, insn);
 #endif
       break;
 
     case SUBREG:
-#ifdef CLASS_CANNOT_CHANGE_MODE
+#ifdef CANNOT_CHANGE_MODE_CLASS
       if (GET_CODE (SUBREG_REG (x)) == REG
-         && REGNO (SUBREG_REG (x)) >= FIRST_PSEUDO_REGISTER
-         && CLASS_CANNOT_CHANGE_MODE_P (GET_MODE (x),
-                                        GET_MODE (SUBREG_REG (x))))
-       REG_CHANGES_MODE (REGNO (SUBREG_REG (x))) = 1;
+         && REGNO (SUBREG_REG (x)) >= FIRST_PSEUDO_REGISTER)
+       SET_REGNO_REG_SET (&subregs_of_mode[GET_MODE (x)],
+                          REGNO (SUBREG_REG (x)));
 #endif
 
       /* While we're here, optimize this case.  */
@@ -3838,13 +3890,12 @@ mark_used_regs (pbi, x, cond, insn)
               || GET_CODE (testreg) == SIGN_EXTRACT
               || GET_CODE (testreg) == SUBREG)
          {
-#ifdef CLASS_CANNOT_CHANGE_MODE
+#ifdef CANNOT_CHANGE_MODE_CLASS
            if (GET_CODE (testreg) == SUBREG
                && GET_CODE (SUBREG_REG (testreg)) == REG
-               && REGNO (SUBREG_REG (testreg)) >= FIRST_PSEUDO_REGISTER
-               && CLASS_CANNOT_CHANGE_MODE_P (GET_MODE (SUBREG_REG (testreg)),
-                                              GET_MODE (testreg)))
-             REG_CHANGES_MODE (REGNO (SUBREG_REG (testreg))) = 1;
+               && REGNO (SUBREG_REG (testreg)) >= FIRST_PSEUDO_REGISTER)
+             SET_REGNO_REG_SET (&subregs_of_mode[GET_MODE (testreg)],
+                                REGNO (SUBREG_REG (testreg)));
 #endif
 
            /* Modifying a single register in an alternate mode
@@ -4190,7 +4241,7 @@ dump_regset (r, outf)
     });
 }
 
-/* Print a human-reaable representation of R on the standard error
+/* Print a human-readable representation of R on the standard error
    stream.  This function is designed to be used from within the
    debugger.  */
 
@@ -4242,11 +4293,11 @@ count_or_remove_death_notes (blocks, kill)
   int count = 0;
   basic_block bb;
 
-  FOR_ALL_BB_REVERSE (bb)
+  FOR_EACH_BB_REVERSE (bb)
     {
       rtx insn;
 
-      if (blocks && ! TEST_BIT (blocks, bb->sindex))
+      if (blocks && ! TEST_BIT (blocks, bb->index))
        continue;
 
       for (insn = bb->head;; insn = NEXT_INSN (insn))