OSDN Git Service

* mn10300.c (mn10300_builtin_saveregs): Use get_varargs_alias_set
[pf3gnuchains/gcc-fork.git] / gcc / integrate.c
index f04f8b4..33a96c4 100644 (file)
@@ -1,5 +1,5 @@
 /* Procedure integration for GNU CC.
-   Copyright (C) 1988, 1991, 1993, 1994, 1995 Free Software Foundation, Inc.
+   Copyright (C) 1988, 91, 93-98, 1999 Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com)
 
 This file is part of GNU CC.
@@ -20,20 +20,24 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
 
-#include <stdio.h>
-
 #include "config.h"
+#include "system.h"
+
 #include "rtl.h"
 #include "tree.h"
+#include "regs.h"
 #include "flags.h"
 #include "insn-config.h"
 #include "insn-flags.h"
 #include "expr.h"
 #include "output.h"
+#include "recog.h"
 #include "integrate.h"
 #include "real.h"
+#include "except.h"
 #include "function.h"
-#include "bytecode.h"
+#include "toplev.h"
+#include "intl.h"
 
 #include "obstack.h"
 #define        obstack_chunk_alloc     xmalloc
@@ -41,9 +45,6 @@ Boston, MA 02111-1307, USA.  */
 
 extern struct obstack *function_maybepermanent_obstack;
 
-extern tree pushdecl ();
-extern tree poplevel ();
-
 /* Similar, but round to the next highest integer that meets the
    alignment.  */
 #define CEIL_ROUND(VALUE,ALIGN)        (((VALUE) + (ALIGN) - 1) & ~((ALIGN)- 1))
@@ -51,68 +52,111 @@ extern tree poplevel ();
 /* Default max number of insns a function can have and still be inline.
    This is overridden on RISC machines.  */
 #ifndef INTEGRATE_THRESHOLD
+/* Inlining small functions might save more space then not inlining at
+   all.  Assume 1 instruction for the call and 1.5 insns per argument.  */
 #define INTEGRATE_THRESHOLD(DECL) \
-  (8 * (8 + list_length (DECL_ARGUMENTS (DECL))))
+  (optimize_size \
+   ? (1 + (3 * list_length (DECL_ARGUMENTS (DECL))) / 2) \
+   : (8 * (8 + list_length (DECL_ARGUMENTS (DECL)))))
 #endif
 \f
-static rtx initialize_for_inline PROTO((tree, int, int, int, int));
-static void finish_inline      PROTO((tree, rtx));
-static void adjust_copied_decl_tree PROTO((tree));
-static tree copy_decl_list     PROTO((tree));
-static tree copy_decl_tree     PROTO((tree));
-static void copy_decl_rtls     PROTO((tree));
-static void save_constants     PROTO((rtx *));
-static void note_modified_parmregs PROTO((rtx, rtx));
-static rtx copy_for_inline     PROTO((rtx));
-static void integrate_parm_decls PROTO((tree, struct inline_remap *, rtvec));
-static void integrate_decl_tree        PROTO((tree, int, struct inline_remap *));
-static void subst_constants    PROTO((rtx *, rtx, struct inline_remap *));
-static void restore_constants  PROTO((rtx *));
-static void set_block_origin_self PROTO((tree));
-static void set_decl_origin_self PROTO((tree));
-static void set_block_abstract_flags PROTO((tree, int));
-
-void set_decl_abstract_flags   PROTO((tree, int));
+static rtx initialize_for_inline       PROTO((tree, int, int, int, int));
+static void finish_inline              PROTO((tree, rtx));
+static void adjust_copied_decl_tree    PROTO((tree));
+static tree copy_decl_list             PROTO((tree));
+static tree copy_decl_tree             PROTO((tree));
+static void copy_decl_rtls             PROTO((tree));
+static void save_constants             PROTO((rtx *));
+static void note_modified_parmregs     PROTO((rtx, rtx));
+static rtx copy_for_inline             PROTO((rtx));
+static void integrate_parm_decls       PROTO((tree, struct inline_remap *,
+                                              rtvec));
+static void integrate_decl_tree                PROTO((tree, int,
+                                              struct inline_remap *));
+static void save_constants_in_decl_trees PROTO ((tree));
+static void subst_constants            PROTO((rtx *, rtx,
+                                              struct inline_remap *));
+static void restore_constants          PROTO((rtx *));
+static void set_block_origin_self      PROTO((tree));
+static void set_decl_origin_self       PROTO((tree));
+static void set_block_abstract_flags   PROTO((tree, int));
+static void process_reg_param          PROTO((struct inline_remap *, rtx,
+                                              rtx));
+
+
+void set_decl_abstract_flags           PROTO((tree, int));
+static tree copy_and_set_decl_abstract_origin PROTO((tree));
+
+/* The maximum number of instructions accepted for inlining a
+   function.  Increasing values mean more agressive inlining.
+   This affects currently only functions explicitly marked as
+   inline (or methods defined within the class definition for C++).
+   The default value of 10000 is arbitrary but high to match the
+   previously unlimited gcc capabilities.  */
+
+int inline_max_insns = 10000;
+
 \f
+/* Returns the Ith entry in the label_map contained in MAP.  If the
+   Ith entry has not yet been set, return a fresh label.  This function
+   performs a lazy initialization of label_map, thereby avoiding huge memory
+   explosions when the label_map gets very large.  */
+
+rtx
+get_label_from_map (map, i)
+     struct inline_remap *map;
+     int i;
+{
+  rtx x = map->label_map[i];
+
+  if (x == NULL_RTX)
+    x = map->label_map[i] = gen_label_rtx();
+
+  return x;
+}
+
 /* Zero if the current function (whose FUNCTION_DECL is FNDECL)
    is safe and reasonable to integrate into other functions.
-   Nonzero means value is a warning message with a single %s
+   Nonzero means value is a warning msgid with a single %s
    for the function's name.  */
 
-char *
+const char *
 function_cannot_inline_p (fndecl)
      register tree fndecl;
 {
   register rtx insn;
   tree last = tree_last (TYPE_ARG_TYPES (TREE_TYPE (fndecl)));
-  int max_insns = INTEGRATE_THRESHOLD (fndecl);
+
+  /* For functions marked as inline increase the maximum size to
+     inline_max_insns (-finline-limit-<n>).  For regular functions
+     use the limit given by INTEGRATE_THRESHOLD.  */
+
+  int max_insns = (DECL_INLINE (fndecl))
+                  ? (inline_max_insns
+                     + 8 * list_length (DECL_ARGUMENTS (fndecl)))
+                  : INTEGRATE_THRESHOLD (fndecl);
+
   register int ninsns = 0;
   register tree parms;
+  rtx result;
 
-  /* No inlines with varargs.  `grokdeclarator' gives a warning
-     message about that if `inline' is specified.  This code
-     it put in to catch the volunteers.  */
+  /* No inlines with varargs.  */
   if ((last && TREE_VALUE (last) != void_type_node)
       || current_function_varargs)
-    return "varargs function cannot be inline";
+    return N_("varargs function cannot be inline");
 
   if (current_function_calls_alloca)
-    return "function using alloca cannot be inline";
+    return N_("function using alloca cannot be inline");
 
   if (current_function_contains_functions)
-    return "function with nested functions cannot be inline";
+    return N_("function with nested functions cannot be inline");
 
-  /* If its not even close, don't even look.  */
-  if (!DECL_INLINE (fndecl) && get_max_uid () > 3 * max_insns)
-    return "function too large to be inline";
+  if (current_function_cannot_inline)
+    return current_function_cannot_inline;
 
-#if 0
-  /* Large stacks are OK now that inlined functions can share them.  */
-  /* Don't inline functions with large stack usage,
-     since they can make other recursive functions burn up stack.  */
-  if (!DECL_INLINE (fndecl) && get_frame_size () > 100)
-    return "function stack frame for inlining";
-#endif
+  /* If its not even close, don't even look.  */
+  if (get_max_uid () > 3 * max_insns)
+    return N_("function too large to be inline");
 
 #if 0
   /* Don't inline functions which do not specify a function prototype and
@@ -122,60 +166,68 @@ function_cannot_inline_p (fndecl)
       if (TYPE_MODE (TREE_TYPE (parms)) == BLKmode)
        TREE_ADDRESSABLE (parms) = 1;
       if (last == NULL_TREE && TREE_ADDRESSABLE (parms))
-       return "no prototype, and parameter address used; cannot be inline";
+       return N_("no prototype, and parameter address used; cannot be inline");
     }
 #endif
 
   /* We can't inline functions that return structures
      the old-fashioned PCC way, copying into a static block.  */
   if (current_function_returns_pcc_struct)
-    return "inline functions not supported for this return value type";
-
-  /* We can't inline functions that return BLKmode structures in registers.  */
-  if (TYPE_MODE (TREE_TYPE (TREE_TYPE (fndecl))) == BLKmode
-      && ! aggregate_value_p (TREE_TYPE (TREE_TYPE (fndecl))))
-    return "inline functions not supported for this return value type";
+    return N_("inline functions not supported for this return value type");
 
   /* We can't inline functions that return structures of varying size.  */
   if (int_size_in_bytes (TREE_TYPE (TREE_TYPE (fndecl))) < 0)
-    return "function with varying-size return value cannot be inline";
+    return N_("function with varying-size return value cannot be inline");
 
   /* Cannot inline a function with a varying size argument or one that
      receives a transparent union.  */
   for (parms = DECL_ARGUMENTS (fndecl); parms; parms = TREE_CHAIN (parms))
     {
       if (int_size_in_bytes (TREE_TYPE (parms)) < 0)
-       return "function with varying-size parameter cannot be inline";
+       return N_("function with varying-size parameter cannot be inline");
       else if (TYPE_TRANSPARENT_UNION (TREE_TYPE (parms)))
-       return "function with transparent unit parameter cannot be inline";
+       return N_("function with transparent unit parameter cannot be inline");
     }
 
-  if (!DECL_INLINE (fndecl) && get_max_uid () > max_insns)
+  if (get_max_uid () > max_insns)
     {
-      for (ninsns = 0, insn = get_first_nonparm_insn (); insn && ninsns < max_insns;
+      for (ninsns = 0, insn = get_first_nonparm_insn ();
+          insn && ninsns < max_insns;
           insn = NEXT_INSN (insn))
-       {
-         if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
-           ninsns++;
-       }
+       if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
+         ninsns++;
 
       if (ninsns >= max_insns)
-       return "function too large to be inline";
+       return N_("function too large to be inline");
     }
 
-  /* We cannot inline this function if forced_labels is non-zero.  This
-     implies that a label in this function was used as an initializer.
-     Because labels can not be duplicated, all labels in the function
-     will be renamed when it is inlined.  However, there is no way to find
-     and fix all variables initialized with addresses of labels in this
-     function, hence inlining is impossible.  */
-
-  if (forced_labels)
-    return "function with label addresses used in initializers cannot inline";
+  /* We will not inline a function which uses computed goto.  The addresses of
+     its local labels, which may be tucked into global storage, are of course
+     not constant across instantiations, which causes unexpected behaviour.  */
+  if (current_function_has_computed_jump)
+    return N_("function with computed jump cannot inline");
 
   /* We cannot inline a nested function that jumps to a nonlocal label.  */
   if (current_function_has_nonlocal_goto)
-    return "function with nonlocal goto cannot be inline";
+    return N_("function with nonlocal goto cannot be inline");
+
+  /* This is a hack, until the inliner is taught about eh regions at
+     the start of the function.  */
+  for (insn = get_insns ();
+       insn
+        && ! (GET_CODE (insn) == NOTE
+              && NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG);
+       insn = NEXT_INSN (insn))
+    {
+      if (insn && GET_CODE (insn) == NOTE
+         && NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
+       return N_("function with complex parameters cannot be inline");
+    }
+
+  /* We can't inline functions that return a PARALLEL rtx.  */
+  result = DECL_RTL (DECL_RESULT (fndecl));
+  if (result && GET_CODE (result) == PARALLEL)
+    return N_("inline functions not supported for this return value type");
 
   return 0;
 }
@@ -205,7 +257,8 @@ static rtx *insn_map;
 static tree *parmdecl_map;
 
 /* Keep track of first pseudo-register beyond those that are parms.  */
-static int max_parm_reg;
+extern int max_parm_reg;
+extern rtx *parm_reg_stack_loc;
 
 /* When an insn is being copied by copy_for_inline,
    this is nonzero if we have copied an ASM_OPERANDS.
@@ -223,6 +276,16 @@ static rtvec copy_asm_constraints_vector;
 /* In save_for_inline, nonzero if past the parm-initialization insns.  */
 static int in_nonparm_insns;
 \f
+/* subroutines passed to duplicate_eh_handlers to map exception labels */
+
+static rtx 
+save_for_inline_eh_labelmap (label)
+     rtx label;
+{
+  int index = CODE_LABEL_NUMBER (label);
+  return label_map[index];
+}
+
 /* Subroutine for `save_for_inline{copying,nocopy}'.  Performs initialization
    needed to save FNDECL's insns and info for future inline expansion.  */
    
@@ -245,12 +308,16 @@ initialize_for_inline (fndecl, min_labelno, max_labelno, max_reg, copy)
        + current_function_calls_setjmp * FUNCTION_FLAGS_CALLS_SETJMP
        + current_function_calls_longjmp * FUNCTION_FLAGS_CALLS_LONGJMP
        + current_function_returns_struct * FUNCTION_FLAGS_RETURNS_STRUCT
-       + current_function_returns_pcc_struct * FUNCTION_FLAGS_RETURNS_PCC_STRUCT
+       + (current_function_returns_pcc_struct
+         * FUNCTION_FLAGS_RETURNS_PCC_STRUCT)
        + current_function_needs_context * FUNCTION_FLAGS_NEEDS_CONTEXT
-       + current_function_has_nonlocal_label * FUNCTION_FLAGS_HAS_NONLOCAL_LABEL
+       + (current_function_has_nonlocal_label
+         * FUNCTION_FLAGS_HAS_NONLOCAL_LABEL)
        + current_function_returns_pointer * FUNCTION_FLAGS_RETURNS_POINTER
        + current_function_uses_const_pool * FUNCTION_FLAGS_USES_CONST_POOL
-       + current_function_uses_pic_offset_table * FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE);
+       + (current_function_uses_pic_offset_table
+         * FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE)
+       + current_function_has_computed_jump * FUNCTION_FLAGS_HAS_COMPUTED_JUMP);
 
   /* Clear out PARMDECL_MAP.  It was allocated in the caller's frame.  */
   bzero ((char *) parmdecl_map, max_parm_reg * sizeof (tree));
@@ -261,6 +328,14 @@ initialize_for_inline (fndecl, min_labelno, max_labelno, max_reg, copy)
        parms = TREE_CHAIN (parms), i++)
     {
       rtx p = DECL_RTL (parms);
+      int copied_incoming = 0;
+
+      /* If we have (mem (addressof (mem ...))), use the inner MEM since
+        otherwise the copy_rtx call below will not unshare the MEM since
+        it shares ADDRESSOF.  */
+      if (GET_CODE (p) == MEM && GET_CODE (XEXP (p, 0)) == ADDRESSOF
+         && GET_CODE (XEXP (XEXP (p, 0), 0)) == MEM)
+       p = XEXP (XEXP (p, 0), 0);
 
       if (GET_CODE (p) == MEM && copy)
        {
@@ -276,7 +351,8 @@ initialize_for_inline (fndecl, min_labelno, max_labelno, max_reg, copy)
                  && GET_CODE (DECL_INCOMING_RTL (parms)) == MEM
                  && (XEXP (DECL_RTL (parms), 0)
                      == XEXP (DECL_INCOMING_RTL (parms), 0))))
-           DECL_INCOMING_RTL (parms) = new;
+           DECL_INCOMING_RTL (parms) = new, copied_incoming = 1;
+
          DECL_RTL (parms) = new;
        }
 
@@ -298,6 +374,23 @@ initialize_for_inline (fndecl, min_labelno, max_labelno, max_reg, copy)
       /* This flag is cleared later
         if the function ever modifies the value of the parm.  */
       TREE_READONLY (parms) = 1;
+
+      /* Copy DECL_INCOMING_RTL if not done already.  This can
+        happen if DECL_RTL is a reg.  */
+      if (copy && ! copied_incoming)
+       {
+         p = DECL_INCOMING_RTL (parms);
+
+         /* If we have (mem (addressof (mem ...))), use the inner MEM since
+            otherwise the copy_rtx call below will not unshare the MEM since
+            it shares ADDRESSOF.  */
+         if (GET_CODE (p) == MEM && GET_CODE (XEXP (p, 0)) == ADDRESSOF
+             && GET_CODE (XEXP (XEXP (p, 0), 0)) == MEM)
+           p = XEXP (XEXP (p, 0), 0);
+
+         if (GET_CODE (p) == MEM)
+           DECL_INCOMING_RTL (parms) = copy_rtx (p);
+       }
     }
 
   /* Assume we start out in the insns that set up the parameters.  */
@@ -316,10 +409,12 @@ initialize_for_inline (fndecl, min_labelno, max_labelno, max_reg, copy)
      the size of the incoming stack area for parameters,
      the number of bytes popped on return,
      the stack slot list,
+     the labels that are forced to exist,
      some flags that are used to restore compiler globals,
      the value of current_function_outgoing_args_size,
      the original argument vector,
-     and the original DECL_INITIAL.  */
+     the original DECL_INITIAL,
+     and pointers to the table of pseudo regs, pointer flags, and alignment. */
 
   return gen_inline_header_rtx (NULL_RTX, NULL_RTX, min_labelno, max_labelno,
                                max_parm_reg, max_reg,
@@ -327,7 +422,10 @@ initialize_for_inline (fndecl, min_labelno, max_labelno, max_reg, copy)
                                current_function_pops_args,
                                stack_slot_list, forced_labels, function_flags,
                                current_function_outgoing_args_size,
-                               arg_vector, (rtx) DECL_INITIAL (fndecl));
+                               arg_vector, (rtx) DECL_INITIAL (fndecl),
+                               (rtvec) regno_reg_rtx, regno_pointer_flag,
+                               regno_pointer_align,
+                               (rtvec) parm_reg_stack_loc);
 }
 
 /* Subroutine for `save_for_inline{copying,nocopy}'.  Finishes up the
@@ -339,7 +437,7 @@ finish_inline (fndecl, head)
      tree fndecl;
      rtx head;
 {
-  NEXT_INSN (head) = get_first_nonparm_insn ();
+  FIRST_FUNCTION_INSN (head) = get_first_nonparm_insn ();
   FIRST_PARM_INSN (head) = get_insns ();
   DECL_SAVED_INSNS (fndecl) = head;
   DECL_FRAME_SIZE (fndecl) = get_frame_size ();
@@ -395,9 +493,12 @@ save_for_inline_copying (fndecl)
   int max_reg;
   int max_uid;
   rtx first_nonparm_insn;
+  char *new, *new1;
+  rtx *new_parm_reg_stack_loc;
+  rtx *new2;
 
   /* Make and emit a return-label if we have not already done so. 
-     Do this before recording the bounds on label numbers. */
+     Do this before recording the bounds on label numbers.  */
 
   if (return_label == 0)
     {
@@ -417,7 +518,6 @@ save_for_inline_copying (fndecl)
      for the parms, prior to elimination of virtual registers.
      These values are needed for substituting parms properly.  */
 
-  max_parm_reg = max_parm_reg_num ();
   parmdecl_map = (tree *) alloca (max_parm_reg * sizeof (tree));
 
   head = initialize_for_inline (fndecl, min_labelno, max_labelno, max_reg, 1);
@@ -434,6 +534,10 @@ save_for_inline_copying (fndecl)
              save_constants (&REG_NOTES (insn));
          }
 
+      /* Also scan all decls, and replace any constant pool references with the
+        actual constant.  */
+      save_constants_in_decl_trees (DECL_INITIAL (fndecl));
+
       /* Clear out the constant pool so that we can recreate it with the
         copied constants below.  */
       init_const_rtx_hash_table ();
@@ -473,25 +577,35 @@ save_for_inline_copying (fndecl)
      Make these new rtx's now, and install them in regno_reg_rtx, so they
      will be the official pseudo-reg rtx's for the rest of compilation.  */
 
-  reg_map = (rtx *) alloca ((max_reg + 1) * sizeof (rtx));
+  reg_map = (rtx *) savealloc (regno_pointer_flag_length * sizeof (rtx));
 
   len = sizeof (struct rtx_def) + (GET_RTX_LENGTH (REG) - 1) * sizeof (rtunion);
   for (i = max_reg - 1; i > LAST_VIRTUAL_REGISTER; i--)
     reg_map[i] = (rtx)obstack_copy (function_maybepermanent_obstack,
                                    regno_reg_rtx[i], len);
 
-  bcopy ((char *) (reg_map + LAST_VIRTUAL_REGISTER + 1),
-        (char *) (regno_reg_rtx + LAST_VIRTUAL_REGISTER + 1),
-        (max_reg - (LAST_VIRTUAL_REGISTER + 1)) * sizeof (rtx));
+  regno_reg_rtx = reg_map;
+
+  /* Put copies of all the virtual register rtx into the new regno_reg_rtx.  */
+  init_virtual_regs ();
 
   /* Likewise each label rtx must have a unique rtx as its copy.  */
 
-  label_map = (rtx *)alloca ((max_labelno - min_labelno) * sizeof (rtx));
-  label_map -= min_labelno;
+  /* We used to use alloca here, but the size of what it would try to
+     allocate would occasionally cause it to exceed the stack limit and
+     cause unpredictable core dumps.  Some examples were > 2Mb in size.  */
+  label_map = (rtx *) xmalloc ((max_labelno) * sizeof (rtx));
 
   for (i = min_labelno; i < max_labelno; i++)
     label_map[i] = gen_label_rtx ();
 
+  /* Likewise for parm_reg_stack_slot.  */
+  new_parm_reg_stack_loc = (rtx *) savealloc (max_parm_reg * sizeof (rtx));
+  for (i = 0; i < max_parm_reg; i++)
+    new_parm_reg_stack_loc[i] = copy_for_inline (parm_reg_stack_loc[i]);
+
+  parm_reg_stack_loc = new_parm_reg_stack_loc;
+
   /* Record the mapping of old insns to copied insns.  */
 
   insn_map = (rtx *) alloca (max_uid * sizeof (rtx));
@@ -510,6 +624,16 @@ save_for_inline_copying (fndecl)
       XEXP (regno_reg_rtx[i], 0)
        = copy_for_inline (XEXP (regno_reg_rtx[i], 0));
 
+  /* Copy the parm_reg_stack_loc array, and substitute for all of the rtx
+     contained in it.  */
+  new2 = (rtx *) savealloc (max_parm_reg * sizeof (rtx));
+  bcopy ((char *) parm_reg_stack_loc, (char *) new2,
+        max_parm_reg * sizeof (rtx));
+  parm_reg_stack_loc = new2;
+  for (i = LAST_VIRTUAL_REGISTER + 1; i < max_parm_reg; ++i)
+    if (parm_reg_stack_loc[i])
+      parm_reg_stack_loc[i] = copy_for_inline (parm_reg_stack_loc[i]);
+
   /* Copy the tree of subblocks of the function, and the decls in them.
      We will use the copy for compiling this function, then restore the original
      subblocks and decls for use when inlining this function.
@@ -560,6 +684,23 @@ save_for_inline_copying (fndecl)
              NOTE_SOURCE_FILE (insn) = (char *) copy;
              NOTE_SOURCE_FILE (copy) = 0;
            }
+         if (NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_BEG
+             || NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_END)
+           {
+              int new_region = CODE_LABEL_NUMBER 
+                                        (label_map[NOTE_BLOCK_NUMBER (copy)]);
+
+              /* we have to duplicate the handlers for the original */
+              if (NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_BEG) 
+                duplicate_eh_handlers (NOTE_BLOCK_NUMBER (copy), new_region,
+                                       save_for_inline_eh_labelmap);
+                
+             /* We have to forward these both to match the new exception
+                region.  */
+             NOTE_BLOCK_NUMBER (copy) = new_region;
+             
+           }
+         RTX_INTEGRATED_P (copy) = RTX_INTEGRATED_P (insn);
          break;
 
        case INSN:
@@ -568,8 +709,8 @@ save_for_inline_copying (fndecl)
          copy = rtx_alloc (GET_CODE (insn));
 
          if (GET_CODE (insn) == CALL_INSN)
-           CALL_INSN_FUNCTION_USAGE (copy) =
-                  copy_for_inline (CALL_INSN_FUNCTION_USAGE (insn));
+           CALL_INSN_FUNCTION_USAGE (copy)
+             = copy_for_inline (CALL_INSN_FUNCTION_USAGE (insn));
 
          PATTERN (copy) = copy_for_inline (PATTERN (insn));
          INSN_CODE (copy) = -1;
@@ -609,14 +750,45 @@ save_for_inline_copying (fndecl)
 
   finish_inline (fndecl, head);
 
+  /* Make new versions of the register tables.  */
+  new = (char *) savealloc (regno_pointer_flag_length);
+  bcopy (regno_pointer_flag, new, regno_pointer_flag_length);
+  new1 = (char *) savealloc (regno_pointer_flag_length);
+  bcopy (regno_pointer_align, new1, regno_pointer_flag_length);
+
+  regno_pointer_flag = new;
+  regno_pointer_align = new1;
+
   set_new_first_and_last_insn (first_insn, last_insn);
+
+  if (label_map)
+    free (label_map);
+}
+
+/* Copy NODE (as with copy_node).  NODE must be a DECL.  Set the
+   DECL_ABSTRACT_ORIGIN for the new accordinly.  */
+
+static tree
+copy_and_set_decl_abstract_origin (node)
+     tree node;
+{
+  tree copy = copy_node (node);
+  if (DECL_ABSTRACT_ORIGIN (copy) != NULL_TREE)
+    /* That means that NODE already had a DECL_ABSTRACT_ORIGIN.  (This
+       situation occurs if we inline a function which itself made
+       calls to inline functions.)  Since DECL_ABSTRACT_ORIGIN is the
+       most distant ancestor, we don't have to do anything here.  */
+    ;
+  else
+    /* The most distant ancestor must be NODE.  */
+    DECL_ABSTRACT_ORIGIN (copy) = node;
+
+  return copy;
 }
 
 /* Return a copy of a chain of nodes, chained through the TREE_CHAIN field.
    For example, this can copy a list made of TREE_LIST nodes.  While copying,
-   for each node copied which doesn't already have is DECL_ABSTRACT_ORIGIN
-   set to some non-zero value, set the DECL_ABSTRACT_ORIGIN of the copy to
-   point to the corresponding (abstract) original node.  */
+   set DECL_ABSTRACT_ORIGIN appropriately.  */
 
 static tree
 copy_decl_list (list)
@@ -628,17 +800,13 @@ copy_decl_list (list)
   if (list == 0)
     return 0;
 
-  head = prev = copy_node (list);
-  if (DECL_ABSTRACT_ORIGIN (head) == NULL_TREE)
-    DECL_ABSTRACT_ORIGIN (head) = list;
+  head = prev = copy_and_set_decl_abstract_origin (list);
   next = TREE_CHAIN (list);
   while (next)
     {
       register tree copy;
 
-      copy = copy_node (next);
-      if (DECL_ABSTRACT_ORIGIN (copy) == NULL_TREE)
-       DECL_ABSTRACT_ORIGIN (copy) = next;
+      copy = copy_and_set_decl_abstract_origin (next);
       TREE_CHAIN (prev) = copy;
       prev = copy;
       next = TREE_CHAIN (next);
@@ -707,10 +875,10 @@ copy_decl_rtls (block)
    modified.  In the second case, FNDECL is used for the last time,
    so modifying the rtl is not a problem.
 
-   ??? Actually, we do not verify that FNDECL is not inline expanded
-   by other functions which must also be written down at the end
-   of compilation.  We could set flag_no_inline to nonzero when
-   the time comes to write down such functions.  */
+   We don't have to worry about FNDECL being inline expanded by
+   other functions which are written at the end of compilation
+   because flag_no_inline is turned on when we begin writing
+   functions at the end of compilation.  */
 
 void
 save_for_inline_nocopy (fndecl)
@@ -726,7 +894,6 @@ save_for_inline_nocopy (fndecl)
      for the parms, prior to elimination of virtual registers.
      These values are needed for substituting parms properly.  */
 
-  max_parm_reg = max_parm_reg_num ();
   parmdecl_map = (tree *) alloca (max_parm_reg * sizeof (tree));
 
   /* Make and emit a return-label if we have not already done so.  */
@@ -780,6 +947,10 @@ save_for_inline_nocopy (fndecl)
        }
     }
 
+  /* Also scan all decls, and replace any constant pool references with the
+     actual constant.  */
+  save_constants_in_decl_trees (DECL_INITIAL (fndecl));
+
   /* We have now allocated all that needs to be allocated permanently
      on the rtx obstack.  Set our high-water mark, so that we
      can free the rest of this when the time comes.  */
@@ -793,8 +964,8 @@ save_for_inline_nocopy (fndecl)
    pool.  Replace each with a CONST that has the mode of the original
    constant, contains the constant, and has RTX_INTEGRATED_P set.
    Similarly, constant pool addresses not enclosed in a MEM are replaced
-   with an ADDRESS rtx which also gives the constant, mode, and has
-   RTX_INTEGRATED_P set.  */
+   with an ADDRESS and CONST rtx which also gives the constant, its
+   mode, the mode of the address, and has RTX_INTEGRATED_P set.  */
 
 static void
 save_constants (px)
@@ -814,7 +985,7 @@ save_constants (px)
           && CONSTANT_POOL_ADDRESS_P (XEXP (x,0)))
     {
       enum machine_mode const_mode = get_pool_mode (XEXP (x, 0));
-      rtx new = gen_rtx (CONST, const_mode, get_pool_constant (XEXP (x, 0)));
+      rtx new = gen_rtx_CONST (const_mode, get_pool_constant (XEXP (x, 0)));
       RTX_INTEGRATED_P (new) = 1;
 
       /* If the MEM was in a different mode than the constant (perhaps we
@@ -823,7 +994,7 @@ save_constants (px)
 
       if (GET_MODE (x) != const_mode)
        {
-         new = gen_rtx (SUBREG, GET_MODE (x), new, 0);
+         new = gen_rtx_SUBREG (GET_MODE (x), new, 0);
          RTX_INTEGRATED_P (new) = 1;
        }
 
@@ -833,7 +1004,9 @@ save_constants (px)
   else if (GET_CODE (x) == SYMBOL_REF
           && CONSTANT_POOL_ADDRESS_P (x))
     {
-      *px = gen_rtx (ADDRESS, get_pool_mode (x), get_pool_constant (x));
+      *px = gen_rtx_ADDRESS (GET_MODE (x),
+                            gen_rtx_CONST (get_pool_mode (x),
+                                           get_pool_constant (x)));
       save_constants (&XEXP (*px, 0));
       RTX_INTEGRATED_P (*px) = 1;
     }
@@ -873,7 +1046,7 @@ save_constants (px)
 static void
 note_modified_parmregs (reg, x)
      rtx reg;
-     rtx x;
+     rtx x ATTRIBUTE_UNUSED;
 {
   if (GET_CODE (reg) == REG && in_nonparm_insns
       && REGNO (reg) < max_parm_reg
@@ -900,6 +1073,7 @@ copy_for_inline (orig)
      rtx orig;
 {
   register rtx x = orig;
+  register rtx new;
   register int i;
   register enum rtx_code code;
   register char *format_ptr;
@@ -915,11 +1089,15 @@ copy_for_inline (orig)
     {
     case QUEUED:
     case CONST_INT:
-    case SYMBOL_REF:
     case PC:
     case CC0:
       return x;
 
+    case SYMBOL_REF:
+      if (! SYMBOL_REF_NEED_ADJUST (x))
+        return x;
+      return rethrow_symbol_map (x, save_for_inline_eh_labelmap);
+
     case CONST_DOUBLE:
       /* We have to make a new CONST_DOUBLE to ensure that we account for
         it correctly.  Using the old CONST_DOUBLE_MEM data is wrong.  */
@@ -945,9 +1123,8 @@ copy_for_inline (orig)
       /* Get constant pool entry, but access in different mode.  */
       if (RTX_INTEGRATED_P (x))
        {
-         rtx new
-           = force_const_mem (GET_MODE (SUBREG_REG (x)),
-                              copy_for_inline (XEXP (SUBREG_REG (x), 0)));
+         new = force_const_mem (GET_MODE (SUBREG_REG (x)),
+                                copy_for_inline (XEXP (SUBREG_REG (x), 0)));
 
          PUT_MODE (new, GET_MODE (x));
          return validize_mem (new);
@@ -960,8 +1137,16 @@ copy_for_inline (orig)
       if (! RTX_INTEGRATED_P (x))
        abort ();
 
-      return XEXP (force_const_mem (GET_MODE (x),
-                                   copy_for_inline (XEXP (x, 0))), 0);
+      new = force_const_mem (GET_MODE (XEXP (x, 0)),
+                            copy_for_inline (XEXP (XEXP (x, 0), 0)));
+      new = XEXP (new, 0);
+
+#ifdef POINTERS_EXTEND_UNSIGNED
+      if (GET_MODE (new) != GET_MODE (x))
+       new = convert_memory_address (GET_MODE (x), new);
+#endif
+
+      return new;
 
     case ASM_OPERANDS:
       /* If a single asm insn contains multiple output operands
@@ -1019,9 +1204,9 @@ copy_for_inline (orig)
     case LABEL_REF:
       /* If this is a non-local label, just make a new LABEL_REF.
         Otherwise, use the new label as well.  */
-      x = gen_rtx (LABEL_REF, GET_MODE (orig),
-                  LABEL_REF_NONLOCAL_P (orig) ? XEXP (orig, 0)
-                  : label_map[CODE_LABEL_NUMBER (XEXP (orig, 0))]);
+      x = gen_rtx_LABEL_REF (GET_MODE (orig),
+                            LABEL_REF_NONLOCAL_P (orig) ? XEXP (orig, 0)
+                            : label_map[CODE_LABEL_NUMBER (XEXP (orig, 0))]);
       LABEL_REF_NONLOCAL_P (x) = LABEL_REF_NONLOCAL_P (orig);
       LABEL_OUTSIDE_LOOP_P (x) = LABEL_OUTSIDE_LOOP_P (orig);
       return x;
@@ -1070,6 +1255,8 @@ copy_for_inline (orig)
        }
       break;
 #endif
+    default:
+      break;
     }
 
   /* Replace this rtx with a copy of itself.  */
@@ -1105,7 +1292,7 @@ copy_for_inline (orig)
            {
              register int j;
 
-             XVEC (x, i) = gen_rtvec_v (XVECLEN (x, i), &XVECEXP (x, i, 0));
+             XVEC (x, i) = gen_rtvec_vv (XVECLEN (x, i), XVEC (x, i)->elem);
              for (j = 0; j < XVECLEN (x, i); j++)
                XVECEXP (x, i, j)
                  = copy_for_inline (XVECEXP (x, i, j));
@@ -1128,8 +1315,7 @@ copy_for_inline (orig)
    with a function called from note_stores.  Be *very* careful that this
    is used properly in the presence of recursion.  */
 
-rtx *global_const_equiv_map;
-int global_const_equiv_map_size;
+varray_type global_const_equiv_varray;
 \f
 #define FIXED_BASE_PLUS_P(X) \
   (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == CONST_INT \
@@ -1137,6 +1323,46 @@ int global_const_equiv_map_size;
    && REGNO (XEXP (X, 0)) >= FIRST_VIRTUAL_REGISTER            \
    && REGNO (XEXP (X, 0)) <= LAST_VIRTUAL_REGISTER)
 
+/* Called to set up a mapping for the case where a parameter is in a
+   register.  If it is read-only and our argument is a constant, set up the
+   constant equivalence.
+
+   If LOC is REG_USERVAR_P, the usual case, COPY must also have that flag set
+   if it is a register.
+
+   Also, don't allow hard registers here; they might not be valid when
+   substituted into insns.  */
+static void
+process_reg_param (map, loc, copy)
+     struct inline_remap *map;
+     rtx loc, copy;
+{
+  if ((GET_CODE (copy) != REG && GET_CODE (copy) != SUBREG)
+      || (GET_CODE (copy) == REG && REG_USERVAR_P (loc)
+         && ! REG_USERVAR_P (copy))
+      || (GET_CODE (copy) == REG
+         && REGNO (copy) < FIRST_PSEUDO_REGISTER))
+    {
+      rtx temp = copy_to_mode_reg (GET_MODE (loc), copy);
+      REG_USERVAR_P (temp) = REG_USERVAR_P (loc);
+      if (CONSTANT_P (copy) || FIXED_BASE_PLUS_P (copy))
+       SET_CONST_EQUIV_DATA (map, temp, copy, CONST_AGE_PARM);
+      copy = temp;
+    }
+  map->reg_map[REGNO (loc)] = copy;
+}
+
+/* Used by duplicate_eh_handlers to map labels for the exception table */
+static struct inline_remap *eif_eh_map;
+
+static rtx 
+expand_inline_function_eh_labelmap (label)
+   rtx label;
+{
+  int index = CODE_LABEL_NUMBER (label);
+  return get_label_from_map (eif_eh_map, index);
+}
+
 /* Integrate the procedure defined by FNDECL.  Note that this function
    may wind up calling itself.  Since the static variables are not
    reentrant, we do not assign them until after the possibility
@@ -1151,7 +1377,8 @@ int global_const_equiv_map_size;
    else an rtx for where the value is stored.  */
 
 rtx
-expand_inline_function (fndecl, parms, target, ignore, type, structure_value_addr)
+expand_inline_function (fndecl, parms, target, ignore, type,
+                       structure_value_addr)
      tree fndecl, parms;
      rtx target;
      int ignore;
@@ -1174,11 +1401,17 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
   rtx loc;
   rtx stack_save = 0;
   rtx temp;
-  struct inline_remap *map;
+  struct inline_remap *map = 0;
+#ifdef HAVE_cc0
   rtx cc0_insn = 0;
+#endif
   rtvec arg_vector = ORIGINAL_ARG_VECTOR (header);
   rtx static_chain_value = 0;
 
+  /* The pointer used to track the true location of the memory used
+     for MAP->LABEL_MAP.  */
+  rtx *real_label_map = 0;
+
   /* Allow for equivalences of the pseudos we make for virtual fp and ap.  */
   max_regno = MAX_REGNUM (header) + 3;
   if (max_regno < FIRST_PSEUDO_REGISTER)
@@ -1190,11 +1423,9 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
      passed.  Since the appropriate conversions or default promotions have
      already been applied, the machine modes should match exactly.  */
 
-  for (formal = DECL_ARGUMENTS (fndecl),
-       actual = parms;
+  for (formal = DECL_ARGUMENTS (fndecl), actual = parms;
        formal;
-       formal = TREE_CHAIN (formal),
-       actual = TREE_CHAIN (actual))
+       formal = TREE_CHAIN (formal), actual = TREE_CHAIN (actual))
     {
       tree arg;
       enum machine_mode mode;
@@ -1203,13 +1434,15 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
        return (rtx) (HOST_WIDE_INT) -1;
 
       arg = TREE_VALUE (actual);
-      mode= TYPE_MODE (DECL_ARG_TYPE (formal));
+      mode = TYPE_MODE (DECL_ARG_TYPE (formal));
 
       if (mode != TYPE_MODE (TREE_TYPE (arg))
          /* If they are block mode, the types should match exactly.
             They don't match exactly if TREE_TYPE (FORMAL) == ERROR_MARK_NODE,
             which could happen if the parameter has incomplete type.  */
-         || (mode == BLKmode && TREE_TYPE (arg) != TREE_TYPE (formal)))
+         || (mode == BLKmode
+             && (TYPE_MAIN_VARIANT (TREE_TYPE (arg))
+                 != TYPE_MAIN_VARIANT (TREE_TYPE (formal)))))
        return (rtx) (HOST_WIDE_INT) -1;
     }
 
@@ -1224,10 +1457,6 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
      parameter declarations.  */
   pushlevel (0);
 
-  /* Make a fresh binding contour that we can easily remove.  */
-  pushlevel (0);
-  expand_start_bindings (0);
-
   /* Expand the function arguments.  Do this first so that any
      new registers get created before we allocate the maps.  */
 
@@ -1258,7 +1487,8 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
          rtx stack_slot
            = assign_stack_temp (TYPE_MODE (TREE_TYPE (arg)),
                                 int_size_in_bytes (TREE_TYPE (arg)), 1);
-         MEM_IN_STRUCT_P (stack_slot) = AGGREGATE_TYPE_P (TREE_TYPE (arg));
+         MEM_SET_IN_STRUCT_P (stack_slot,
+                              AGGREGATE_TYPE_P (TREE_TYPE (arg)));
 
          store_expr (arg, stack_slot, 0);
 
@@ -1303,6 +1533,12 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
                 handle SUBREGs in addresses.  */
              || (GET_CODE (arg_vals[i]) == SUBREG)))
        arg_vals[i] = copy_to_mode_reg (GET_MODE (loc), arg_vals[i]);
+
+      if (arg_vals[i] != 0 && GET_CODE (arg_vals[i]) == REG
+         && POINTER_TYPE_P (TREE_TYPE (formal)))
+       mark_reg_pointer (arg_vals[i],
+                         (TYPE_ALIGN (TREE_TYPE (TREE_TYPE (formal)))
+                          / BITS_PER_UNIT));
     }
        
   /* Allocate the structures we use to remap things.  */
@@ -1313,8 +1549,12 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
   map->reg_map = (rtx *) alloca (max_regno * sizeof (rtx));
   bzero ((char *) map->reg_map, max_regno * sizeof (rtx));
 
-  map->label_map = (rtx *)alloca ((max_labelno - min_labelno) * sizeof (rtx));
-  map->label_map -= min_labelno;
+  /* We used to use alloca here, but the size of what it would try to
+     allocate would occasionally cause it to exceed the stack limit and
+     cause unpredictable core dumps.  */
+  real_label_map
+    = (rtx *) xmalloc ((max_labelno) * sizeof (rtx));
+  map->label_map = real_label_map;
 
   map->insn_map = (rtx *) alloca (INSN_UID (header) * sizeof (rtx));
   bzero ((char *) map->insn_map, INSN_UID (header) * sizeof (rtx));
@@ -1323,35 +1563,36 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
 
   map->integrating = 1;
 
-  /* const_equiv_map maps pseudos in our routine to constants, so it needs to
-     be large enough for all our pseudos.  This is the number we are currently
-     using plus the number in the called routine, plus 15 for each arg,
-     five to compute the virtual frame pointer, and five for the return value.
-     This should be enough for most cases.  We do not reference entries
-     outside the range of the map.
+  /* const_equiv_varray maps pseudos in our routine to constants, so
+     it needs to be large enough for all our pseudos.  This is the
+     number we are currently using plus the number in the called
+     routine, plus 15 for each arg, five to compute the virtual frame
+     pointer, and five for the return value.  This should be enough
+     for most cases.  We do not reference entries outside the range of
+     the map.
 
      ??? These numbers are quite arbitrary and were obtained by
      experimentation.  At some point, we should try to allocate the
      table after all the parameters are set up so we an more accurately
      estimate the number of pseudos we will need.  */
 
-  map->const_equiv_map_size
-    = max_reg_num () + (max_regno - FIRST_PSEUDO_REGISTER) + 15 * nargs + 10;
-
-  map->const_equiv_map
-    = (rtx *)alloca (map->const_equiv_map_size * sizeof (rtx));
-  bzero ((char *) map->const_equiv_map,
-        map->const_equiv_map_size * sizeof (rtx));
-
-  map->const_age_map
-    = (unsigned *)alloca (map->const_equiv_map_size * sizeof (unsigned));
-  bzero ((char *) map->const_age_map,
-        map->const_equiv_map_size * sizeof (unsigned));
+  VARRAY_CONST_EQUIV_INIT (map->const_equiv_varray,
+                          (max_reg_num ()
+                           + (max_regno - FIRST_PSEUDO_REGISTER)
+                           + 15 * nargs
+                           + 10),
+                          "expand_inline_function");
   map->const_age = 0;
 
   /* Record the current insn in case we have to set up pointers to frame
-     and argument memory blocks.  */
+     and argument memory blocks.  If there are no insns yet, add a dummy
+     insn that can be used as an insertion point.  */
   map->insns_at_start = get_last_insn ();
+  if (map->insns_at_start == 0)
+    map->insns_at_start = emit_note (NULL_PTR, NOTE_INSN_DELETED);
+
+  map->regno_pointer_flag = INLINE_REGNO_POINTER_FLAG (header);
+  map->regno_pointer_align = INLINE_REGNO_POINTER_ALIGN (header);
 
   /* Update the outgoing argument size to allow for those in the inlined
      function.  */
@@ -1409,12 +1650,8 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
          if (GET_CODE (copy) != REG)
            {
              temp = copy_addr_to_reg (copy);
-             if ((CONSTANT_P (copy) || FIXED_BASE_PLUS_P (copy))
-                 && REGNO (temp) < map->const_equiv_map_size)
-               {
-                 map->const_equiv_map[REGNO (temp)] = copy;
-                 map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
-               }
+             if (CONSTANT_P (copy) || FIXED_BASE_PLUS_P (copy))
+               SET_CONST_EQUIV_DATA (map, temp, copy, CONST_AGE_PARM);
              copy = temp;
            }
          map->reg_map[REGNO (XEXP (loc, 0))] = copy;
@@ -1428,87 +1665,16 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
          ;
        }
       else if (GET_CODE (loc) == REG)
-       {
-         /* This is the good case where the parameter is in a register.
-            If it is read-only and our argument is a constant, set up the
-            constant equivalence.
-
-            If LOC is REG_USERVAR_P, the usual case, COPY must also have
-            that flag set if it is a register.
-
-            Also, don't allow hard registers here; they might not be valid
-            when substituted into insns. */
-
-         if ((GET_CODE (copy) != REG && GET_CODE (copy) != SUBREG)
-             || (GET_CODE (copy) == REG && REG_USERVAR_P (loc)
-                 && ! REG_USERVAR_P (copy))
-             || (GET_CODE (copy) == REG
-                 && REGNO (copy) < FIRST_PSEUDO_REGISTER))
-           {
-             temp = copy_to_mode_reg (GET_MODE (loc), copy);
-             REG_USERVAR_P (temp) = REG_USERVAR_P (loc);
-             if ((CONSTANT_P (copy) || FIXED_BASE_PLUS_P (copy))
-                 && REGNO (temp) < map->const_equiv_map_size)
-               {
-                 map->const_equiv_map[REGNO (temp)] = copy;
-                 map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
-               }
-             copy = temp;
-           }
-         map->reg_map[REGNO (loc)] = copy;
-       }
+       process_reg_param (map, loc, copy);
       else if (GET_CODE (loc) == CONCAT)
        {
-         /* This is the good case where the parameter is in a
-            pair of separate pseudos.
-            If it is read-only and our argument is a constant, set up the
-            constant equivalence.
-
-            If LOC is REG_USERVAR_P, the usual case, COPY must also have
-            that flag set if it is a register.
-
-            Also, don't allow hard registers here; they might not be valid
-            when substituted into insns. */
          rtx locreal = gen_realpart (GET_MODE (XEXP (loc, 0)), loc);
          rtx locimag = gen_imagpart (GET_MODE (XEXP (loc, 0)), loc);
          rtx copyreal = gen_realpart (GET_MODE (locreal), copy);
          rtx copyimag = gen_imagpart (GET_MODE (locimag), copy);
 
-         if ((GET_CODE (copyreal) != REG && GET_CODE (copyreal) != SUBREG)
-             || (GET_CODE (copyreal) == REG && REG_USERVAR_P (locreal)
-                 && ! REG_USERVAR_P (copyreal))
-             || (GET_CODE (copyreal) == REG
-                 && REGNO (copyreal) < FIRST_PSEUDO_REGISTER))
-           {
-             temp = copy_to_mode_reg (GET_MODE (locreal), copyreal);
-             REG_USERVAR_P (temp) = REG_USERVAR_P (locreal);
-             if ((CONSTANT_P (copyreal) || FIXED_BASE_PLUS_P (copyreal))
-                 && REGNO (temp) < map->const_equiv_map_size)
-               {
-                 map->const_equiv_map[REGNO (temp)] = copyreal;
-                 map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
-               }
-             copyreal = temp;
-           }
-         map->reg_map[REGNO (locreal)] = copyreal;
-
-         if ((GET_CODE (copyimag) != REG && GET_CODE (copyimag) != SUBREG)
-             || (GET_CODE (copyimag) == REG && REG_USERVAR_P (locimag)
-                 && ! REG_USERVAR_P (copyimag))
-             || (GET_CODE (copyimag) == REG
-                 && REGNO (copyimag) < FIRST_PSEUDO_REGISTER))
-           {
-             temp = copy_to_mode_reg (GET_MODE (locimag), copyimag);
-             REG_USERVAR_P (temp) = REG_USERVAR_P (locimag);
-             if ((CONSTANT_P (copyimag) || FIXED_BASE_PLUS_P (copyimag))
-                 && REGNO (temp) < map->const_equiv_map_size)
-               {
-                 map->const_equiv_map[REGNO (temp)] = copyimag;
-                 map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
-               }
-             copyimag = temp;
-           }
-         map->reg_map[REGNO (locimag)] = copyimag;
+         process_reg_param (map, locreal, copyreal);
+         process_reg_param (map, locimag, copyimag);
        }
       else
        abort ();
@@ -1550,44 +1716,60 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
 
   map->inline_target = 0;
   loc = DECL_RTL (DECL_RESULT (fndecl));
+
   if (TYPE_MODE (type) == VOIDmode)
     /* There is no return value to worry about.  */
     ;
   else if (GET_CODE (loc) == MEM)
     {
-      if (! structure_value_addr || ! aggregate_value_p (DECL_RESULT (fndecl)))
-       abort ();
+      if (GET_CODE (XEXP (loc, 0)) == ADDRESSOF)
+       {
+         temp = copy_rtx_and_substitute (loc, map);
+         subst_constants (&temp, NULL_RTX, map);
+         apply_change_group ();
+         target = temp;
+       }
+      else
+       {
+         if (! structure_value_addr
+             || ! aggregate_value_p (DECL_RESULT (fndecl)))
+           abort ();
   
-      /* Pass the function the address in which to return a structure value.
-        Note that a constructor can cause someone to call us with
-        STRUCTURE_VALUE_ADDR, but the initialization takes place
-        via the first parameter, rather than the struct return address.
+         /* Pass the function the address in which to return a structure
+            value.  Note that a constructor can cause someone to call us
+            with STRUCTURE_VALUE_ADDR, but the initialization takes place
+            via the first parameter, rather than the struct return address.
 
-        We have two cases:  If the address is a simple register indirect,
-        use the mapping mechanism to point that register to our structure
-        return address.  Otherwise, store the structure return value into
-        the place that it will be referenced from.  */
+            We have two cases: If the address is a simple register
+            indirect, use the mapping mechanism to point that register to
+            our structure return address.  Otherwise, store the structure
+            return value into the place that it will be referenced from.  */
 
-      if (GET_CODE (XEXP (loc, 0)) == REG)
-       {
-         temp = force_reg (Pmode, structure_value_addr);
-         map->reg_map[REGNO (XEXP (loc, 0))] = temp;
-         if ((CONSTANT_P (structure_value_addr)
-              || (GET_CODE (structure_value_addr) == PLUS
-                  && XEXP (structure_value_addr, 0) == virtual_stack_vars_rtx
-                  && GET_CODE (XEXP (structure_value_addr, 1)) == CONST_INT))
-             && REGNO (temp) < map->const_equiv_map_size)
+         if (GET_CODE (XEXP (loc, 0)) == REG)
            {
-             map->const_equiv_map[REGNO (temp)] = structure_value_addr;
-             map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
+             temp = force_operand (structure_value_addr, NULL_RTX);
+             temp = force_reg (Pmode, temp);
+             map->reg_map[REGNO (XEXP (loc, 0))] = temp;
+
+             if (CONSTANT_P (structure_value_addr)
+                 || GET_CODE (structure_value_addr) == ADDRESSOF
+                 || (GET_CODE (structure_value_addr) == PLUS
+                     && (XEXP (structure_value_addr, 0)
+                         == virtual_stack_vars_rtx)
+                     && (GET_CODE (XEXP (structure_value_addr, 1))
+                         == CONST_INT)))
+               {
+                 SET_CONST_EQUIV_DATA (map, temp, structure_value_addr,
+                                       CONST_AGE_PARM);
+               }
+           }
+         else
+           {
+             temp = copy_rtx_and_substitute (loc, map);
+             subst_constants (&temp, NULL_RTX, map);
+             apply_change_group ();
+             emit_move_insn (temp, structure_value_addr);
            }
-       }
-      else
-       {
-         temp = copy_rtx_and_substitute (loc, map);
-         subst_constants (&temp, NULL_RTX, map);
-         apply_change_group ();
-         emit_move_insn (temp, structure_value_addr);
        }
     }
   else if (ignore)
@@ -1603,9 +1785,11 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
       /* Machine mode function was declared to return.   */
       enum machine_mode departing_mode = TYPE_MODE (type);
       /* (Possibly wider) machine mode it actually computes
-        (for the sake of callers that fail to declare it right).  */
+        (for the sake of callers that fail to declare it right).
+        We have to use the mode of the result's RTL, rather than
+        its type, since expand_function_start may have promoted it.  */
       enum machine_mode arriving_mode
-       = TYPE_MODE (TREE_TYPE (DECL_RESULT (fndecl)));
+       = GET_MODE (DECL_RTL (DECL_RESULT (fndecl)));
       rtx reg_to_map;
 
       /* Don't use MEMs as direct targets because on some machines
@@ -1613,13 +1797,43 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
         Let the combiner substitute the MEM if that is valid.  */
       if (target == 0 || GET_CODE (target) != REG
          || GET_MODE (target) != departing_mode)
+       {
+         /* Don't make BLKmode registers.  If this looks like
+            a BLKmode object being returned in a register, get
+            the mode from that, otherwise abort. */
+         if (departing_mode == BLKmode)
+           {
+             if (REG == GET_CODE (DECL_RTL (DECL_RESULT (fndecl))))
+               {
+                 departing_mode = GET_MODE (DECL_RTL (DECL_RESULT (fndecl)));
+                 arriving_mode = departing_mode;
+               }
+             else
+               abort();
+           }
+             
        target = gen_reg_rtx (departing_mode);
+       }
 
       /* If function's value was promoted before return,
         avoid machine mode mismatch when we substitute INLINE_TARGET.
         But TARGET is what we will return to the caller.  */
       if (arriving_mode != departing_mode)
-       reg_to_map = gen_rtx (SUBREG, arriving_mode, target, 0);
+       {
+         /* Avoid creating a paradoxical subreg wider than
+            BITS_PER_WORD, since that is illegal.  */
+         if (GET_MODE_BITSIZE (arriving_mode) > BITS_PER_WORD)
+           {
+             if (!TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (departing_mode),
+                                         GET_MODE_BITSIZE (arriving_mode)))
+               /* Maybe could be handled by using convert_move () ?  */
+               abort ();
+             reg_to_map = gen_reg_rtx (arriving_mode);
+             target = gen_lowpart (departing_mode, reg_to_map);
+           }
+         else
+           reg_to_map = gen_rtx_SUBREG (arriving_mode, target, 0);
+       }
       else
        reg_to_map = target;
 
@@ -1630,10 +1844,18 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
       else
        map->reg_map[REGNO (loc)] = reg_to_map;
     }
+  else
+    abort ();
 
-  /* Make new label equivalences for the labels in the called function.  */
-  for (i = min_labelno; i < max_labelno; i++)
-    map->label_map[i] = gen_label_rtx ();
+  /* Make a fresh binding contour that we can easily remove.  Do this after
+     expanding our arguments so cleanups are properly scoped.  */
+  pushlevel (0);
+  expand_start_bindings (0);
+
+  /* Initialize label_map.  get_label_from_map will actually make
+     the labels.  */
+  bzero ((char *) &map->label_map [min_labelno],
+        (max_labelno - min_labelno) * sizeof (rtx));
 
   /* Perform postincrements before actually calling the function.  */
   emit_queue ();
@@ -1641,10 +1863,9 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
   /* Clean up stack so that variables might have smaller offsets.  */
   do_pending_stack_adjust ();
 
-  /* Save a copy of the location of const_equiv_map for mark_stores, called
-     via note_stores.  */
-  global_const_equiv_map = map->const_equiv_map;
-  global_const_equiv_map_size = map->const_equiv_map_size;
+  /* Save a copy of the location of const_equiv_varray for
+     mark_stores, called via note_stores.  */
+  global_const_equiv_varray = map->const_equiv_varray;
 
   /* If the called function does an alloca, save and restore the
      stack pointer around the call.  This saves stack space, but
@@ -1678,6 +1899,12 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
               inline_target.  */
            break;
 
+         /* If the inline fn needs eh context, make sure that
+            the current fn has one. */
+         if (GET_CODE (pattern) == USE
+             && find_reg_note (insn, REG_EH_CONTEXT, 0) != 0)
+           get_eh_context ();
+
          /* Ignore setting a function value that we don't want to use.  */
          if (map->inline_target == 0
              && set != 0
@@ -1761,7 +1988,9 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
          break;
 
        case JUMP_INSN:
-         if (GET_CODE (PATTERN (insn)) == RETURN)
+         if (GET_CODE (PATTERN (insn)) == RETURN
+             || (GET_CODE (PATTERN (insn)) == PARALLEL
+                 && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == RETURN))
            {
              if (local_return_label == 0)
                local_return_label = gen_label_rtx ();
@@ -1808,8 +2037,8 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
 
          /* Because the USAGE information potentially contains objects other
             than hard registers, we need to copy it.  */
-         CALL_INSN_FUNCTION_USAGE (copy) =
-            copy_rtx_and_substitute (CALL_INSN_FUNCTION_USAGE (insn), map);
+         CALL_INSN_FUNCTION_USAGE (copy)
+           = copy_rtx_and_substitute (CALL_INSN_FUNCTION_USAGE (insn), map);
 
 #ifdef HAVE_cc0
          if (cc0_insn)
@@ -1820,11 +2049,12 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
 
          /* Be lazy and assume CALL_INSNs clobber all hard registers.  */
          for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-           map->const_equiv_map[i] = 0;
+           VARRAY_CONST_EQUIV (map->const_equiv_varray, i).rtx = 0;
          break;
 
        case CODE_LABEL:
-         copy = emit_label (map->label_map[CODE_LABEL_NUMBER (insn)]);
+         copy = emit_label (get_label_from_map (map,
+                                                CODE_LABEL_NUMBER (insn)));
          LABEL_NAME (copy) = LABEL_NAME (insn);
          map->const_age++;
          break;
@@ -1842,7 +2072,32 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
          if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_END
              && NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_BEG
              && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED)
-           copy = emit_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn));
+           {
+             copy = emit_note (NOTE_SOURCE_FILE (insn),
+                               NOTE_LINE_NUMBER (insn));
+             if (copy
+                 && (NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_BEG
+                     || NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_END))
+               {
+                 rtx label
+                   = get_label_from_map (map, NOTE_BLOCK_NUMBER (copy));
+
+                  /* we have to duplicate the handlers for the original */
+                  if (NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_BEG)
+                    {
+                      /* We need to duplicate the handlers for the EH region
+                         and we need to indicate where the label map is */
+                      eif_eh_map = map;
+                      duplicate_eh_handlers (NOTE_BLOCK_NUMBER (copy), 
+                                             CODE_LABEL_NUMBER (label),
+                                             expand_inline_function_eh_labelmap);
+                    }
+
+                 /* We have to forward these both to match the new exception
+                    region.  */
+                 NOTE_BLOCK_NUMBER (copy) = CODE_LABEL_NUMBER (label);
+               }
+           }
          else
            copy = 0;
          break;
@@ -1900,14 +2155,38 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
   BLOCK_ABSTRACT_ORIGIN (block) = (DECL_ABSTRACT_ORIGIN (fndecl) == NULL
                                   ? fndecl : DECL_ABSTRACT_ORIGIN (fndecl));
   poplevel (0, 0, 0);
+
+  /* Must mark the line number note after inlined functions as a repeat, so
+     that the test coverage code can avoid counting the call twice.  This
+     just tells the code to ignore the immediately following line note, since
+     there already exists a copy of this note before the expanded inline call.
+     This line number note is still needed for debugging though, so we can't
+     delete it.  */
+  if (flag_test_coverage)
+    emit_note (0, NOTE_REPEATED_LINE_NUMBER);
+
   emit_line_note (input_filename, lineno);
 
+  /* If the function returns a BLKmode object in a register, copy it
+     out of the temp register into a BLKmode memory object. */
+  if (TYPE_MODE (TREE_TYPE (TREE_TYPE (fndecl))) == BLKmode
+      && ! aggregate_value_p (TREE_TYPE (TREE_TYPE (fndecl))))
+    target = copy_blkmode_from_reg (0, target, TREE_TYPE (TREE_TYPE (fndecl)));
+  
   if (structure_value_addr)
     {
-      target = gen_rtx (MEM, TYPE_MODE (type),
-                       memory_address (TYPE_MODE (type), structure_value_addr));
-      MEM_IN_STRUCT_P (target) = 1;
+      target = gen_rtx_MEM (TYPE_MODE (type),
+                           memory_address (TYPE_MODE (type),
+                                           structure_value_addr));
+      MEM_SET_IN_STRUCT_P (target, 1);
     }
+
+  /* Make sure we free the things we explicitly allocated with xmalloc.  */
+  if (real_label_map)
+    free (real_label_map);
+  if (map)
+    VARRAY_FREE (map->const_equiv_varray);
+
   return target;
 }
 \f
@@ -1937,7 +2216,7 @@ integrate_parm_decls (args, map, arg_vector)
       /* These args would always appear unused, if not for this.  */
       TREE_USED (decl) = 1;
       /* Prevent warning for shadowing with these.  */
-      DECL_ABSTRACT_ORIGIN (decl) = tail;
+      DECL_ABSTRACT_ORIGIN (decl) = DECL_ORIGIN (tail);
       pushdecl (decl);
       /* Fully instantiate the address with the equivalent form so that the
         debugging information contains the actual register, instead of the
@@ -1973,11 +2252,10 @@ integrate_decl_tree (let, level, map)
   for (t = BLOCK_VARS (let); t; t = TREE_CHAIN (t))
     {
       tree d;
-      tree newd;
 
       push_obstacks_nochange ();
       saveable_allocation ();
-      d = copy_node (t);
+      d = copy_and_set_decl_abstract_origin (t);
       pop_obstacks ();
 
       if (DECL_RTL (t) != 0)
@@ -1996,24 +2274,7 @@ integrate_decl_tree (let, level, map)
       if (DECL_LANG_SPECIFIC (d))
        copy_lang_decl (d);
 
-      /* Must set DECL_ABSTRACT_ORIGIN here for local variables, to ensure
-        that we don't get -Wshadow warnings.  But don't set it here if
-        pushdecl might return a duplicate decl, as that will result in
-        incorrect DWARF debug info.  */
-      if (! DECL_EXTERNAL (d) || ! TREE_PUBLIC (d))
-       /* Prevent warning for shadowing with these.  */
-       DECL_ABSTRACT_ORIGIN (d) = t;
-
-      newd = pushdecl (d);
-
-      /* If we didn't set DECL_ABSTRACT_ORIGIN above, then set it now.
-        Simpler to just set it always rather than checking.
-        If the decl we get back is the copy of 't' that we started with,
-        then set the DECL_ABSTRACT_ORIGIN.  Otherwise, we must have a
-        duplicate decl, and we got the older one back.  In that case, setting
-        DECL_ABSTRACT_ORIGIN is not appropriate.  */
-      if (newd == d)
-       DECL_ABSTRACT_ORIGIN (d) = t;
+      pushdecl (d);
     }
 
   for (t = BLOCK_SUBBLOCKS (let); t; t = TREE_CHAIN (t))
@@ -2029,6 +2290,23 @@ integrate_decl_tree (let, level, map)
        }
     }
 }
+
+/* Given a BLOCK node LET, search for all DECL_RTL fields, and pass them
+   through save_constants.  */
+
+static void
+save_constants_in_decl_trees (let)
+     tree let;
+{
+  tree t;
+
+  for (t = BLOCK_VARS (let); t; t = TREE_CHAIN (t))
+    if (DECL_RTL (t) != 0)
+      save_constants (&DECL_RTL (t));
+
+  for (t = BLOCK_SUBBLOCKS (let); t; t = TREE_CHAIN (t))
+    save_constants_in_decl_trees (t);
+}
 \f
 /* Create a new copy of an rtx.
    Recursively copies the operands of the rtx,
@@ -2086,27 +2364,32 @@ copy_rtx_and_substitute (orig, map)
            {
              rtx loc, seq;
              int size = DECL_FRAME_SIZE (map->fndecl);
-             int rounded;
 
+#ifdef FRAME_GROWS_DOWNWARD
+             /* In this case, virtual_stack_vars_rtx points to one byte
+                higher than the top of the frame area.  So make sure we
+                allocate a big enough chunk to keep the frame pointer
+                aligned like a real one.  */
+             size = CEIL_ROUND (size, BIGGEST_ALIGNMENT / BITS_PER_UNIT);
+#endif
              start_sequence ();
              loc = assign_stack_temp (BLKmode, size, 1);
              loc = XEXP (loc, 0);
 #ifdef FRAME_GROWS_DOWNWARD
              /* In this case, virtual_stack_vars_rtx points to one byte
                 higher than the top of the frame area.  So compute the offset
-                to one byte higher than our substitute frame.
-                Keep the fake frame pointer aligned like a real one.  */
-             rounded = CEIL_ROUND (size, BIGGEST_ALIGNMENT / BITS_PER_UNIT);
-             loc = plus_constant (loc, rounded);
+                to one byte higher than our substitute frame.  */
+             loc = plus_constant (loc, size);
 #endif
              map->reg_map[regno] = temp
                = force_reg (Pmode, force_operand (loc, NULL_RTX));
 
-             if (REGNO (temp) < map->const_equiv_map_size)
-               {
-                 map->const_equiv_map[REGNO (temp)] = loc;
-                 map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
-               }
+#ifdef STACK_BOUNDARY
+             mark_reg_pointer (map->reg_map[regno],
+                               STACK_BOUNDARY / BITS_PER_UNIT);
+#endif
+
+             SET_CONST_EQUIV_DATA (map, temp, loc, CONST_AGE_PARM);
 
              seq = gen_sequence ();
              end_sequence ();
@@ -2116,7 +2399,7 @@ copy_rtx_and_substitute (orig, map)
          else if (regno == VIRTUAL_INCOMING_ARGS_REGNUM)
            {
              /* Do the same for a block to contain any arguments referenced
-                in memory. */
+                in memory.  */
              rtx loc, seq;
              int size = FUNCTION_ARGS_SIZE (DECL_SAVED_INSNS (map->fndecl));
 
@@ -2125,18 +2408,19 @@ copy_rtx_and_substitute (orig, map)
              loc = XEXP (loc, 0);
              /* When arguments grow downward, the virtual incoming 
                 args pointer points to the top of the argument block,
-                so the remapped location better do the same. */
+                so the remapped location better do the same.  */
 #ifdef ARGS_GROW_DOWNWARD
              loc = plus_constant (loc, size);
 #endif
              map->reg_map[regno] = temp
                = force_reg (Pmode, force_operand (loc, NULL_RTX));
 
-             if (REGNO (temp) < map->const_equiv_map_size)
-               {
-                 map->const_equiv_map[REGNO (temp)] = loc;
-                 map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
-               }
+#ifdef STACK_BOUNDARY
+             mark_reg_pointer (map->reg_map[regno],
+                               STACK_BOUNDARY / BITS_PER_UNIT);
+#endif
+
+             SET_CONST_EQUIV_DATA (map, temp, loc, CONST_AGE_PARM);
 
              seq = gen_sequence ();
              end_sequence ();
@@ -2147,12 +2431,13 @@ copy_rtx_and_substitute (orig, map)
            {
              /* This is a reference to the function return value.  If
                 the function doesn't have a return value, error.  If the
-                mode doesn't agree, make a SUBREG.  */
+                mode doesn't agree, and it ain't BLKmode, make a SUBREG.  */
              if (map->inline_target == 0)
                /* Must be unrolling loops or replicating code if we
                   reach here, so return the register unchanged.  */
                return orig;
-             else if (mode != GET_MODE (map->inline_target))
+             else if (GET_MODE (map->inline_target) != BLKmode
+                      && mode != GET_MODE (map->inline_target))
                return gen_lowpart (mode, map->inline_target);
              else
                return map->inline_target;
@@ -2166,6 +2451,10 @@ copy_rtx_and_substitute (orig, map)
          REG_LOOP_TEST_P (map->reg_map[regno]) = REG_LOOP_TEST_P (orig);
          RTX_UNCHANGING_P (map->reg_map[regno]) = RTX_UNCHANGING_P (orig);
          /* A reg with REG_FUNCTION_VALUE_P true will never reach here.  */
+
+         if (map->regno_pointer_flag[regno])
+           mark_reg_pointer (map->reg_map[regno],
+                             map->regno_pointer_align[regno]);
        }
       return map->reg_map[regno];
 
@@ -2173,13 +2462,47 @@ copy_rtx_and_substitute (orig, map)
       copy = copy_rtx_and_substitute (SUBREG_REG (orig), map);
       /* SUBREG is ordinary, but don't make nested SUBREGs.  */
       if (GET_CODE (copy) == SUBREG)
-       return gen_rtx (SUBREG, GET_MODE (orig), SUBREG_REG (copy),
-                       SUBREG_WORD (orig) + SUBREG_WORD (copy));
+       return gen_rtx_SUBREG (GET_MODE (orig), SUBREG_REG (copy),
+                              SUBREG_WORD (orig) + SUBREG_WORD (copy));
       else if (GET_CODE (copy) == CONCAT)
-       return (subreg_realpart_p (orig) ? XEXP (copy, 0) : XEXP (copy, 1));
+       {
+         rtx retval = subreg_realpart_p (orig) ? XEXP (copy, 0) : XEXP (copy, 1);
+
+         if (GET_MODE (retval) == GET_MODE (orig))
+           return retval;
+         else
+           return gen_rtx_SUBREG (GET_MODE (orig), retval,
+                                  (SUBREG_WORD (orig) %
+                                   (GET_MODE_UNIT_SIZE (GET_MODE (SUBREG_REG (orig)))
+                                    / (unsigned) UNITS_PER_WORD)));
+       }
       else
-       return gen_rtx (SUBREG, GET_MODE (orig), copy,
-                       SUBREG_WORD (orig));
+       return gen_rtx_SUBREG (GET_MODE (orig), copy,
+                              SUBREG_WORD (orig));
+
+    case ADDRESSOF:
+      copy = gen_rtx_ADDRESSOF (mode,
+                       copy_rtx_and_substitute (XEXP (orig, 0), map), 0);
+      SET_ADDRESSOF_DECL (copy, ADDRESSOF_DECL (orig));
+      regno = ADDRESSOF_REGNO (orig);
+      if (map->reg_map[regno])
+       regno = REGNO (map->reg_map[regno]);
+      else if (regno > LAST_VIRTUAL_REGISTER)
+       {
+         temp = XEXP (orig, 0);
+         map->reg_map[regno] = gen_reg_rtx (GET_MODE (temp));
+         REG_USERVAR_P (map->reg_map[regno]) = REG_USERVAR_P (temp);
+         REG_LOOP_TEST_P (map->reg_map[regno]) = REG_LOOP_TEST_P (temp);
+         RTX_UNCHANGING_P (map->reg_map[regno]) = RTX_UNCHANGING_P (temp);
+         /* A reg with REG_FUNCTION_VALUE_P true will never reach here.  */
+
+         if (map->regno_pointer_flag[regno])
+           mark_reg_pointer (map->reg_map[regno],
+                             map->regno_pointer_align[regno]);
+         regno = REGNO (map->reg_map[regno]);
+       }
+      ADDRESSOF_REGNO (copy) = regno;
+      return copy;
 
     case USE:
     case CLOBBER:
@@ -2190,17 +2513,18 @@ copy_rtx_and_substitute (orig, map)
       copy = copy_rtx_and_substitute (XEXP (orig, 0), map);
       if (GET_CODE (copy) == SUBREG && GET_CODE (XEXP (orig, 0)) != SUBREG)
        copy = SUBREG_REG (copy);
-      return gen_rtx (code, VOIDmode, copy);
+      return gen_rtx_fmt_e (code, VOIDmode, copy);
 
     case CODE_LABEL:
-      LABEL_PRESERVE_P (map->label_map[CODE_LABEL_NUMBER (orig)])
+      LABEL_PRESERVE_P (get_label_from_map (map, CODE_LABEL_NUMBER (orig)))
        = LABEL_PRESERVE_P (orig);
-      return map->label_map[CODE_LABEL_NUMBER (orig)];
+      return get_label_from_map (map, CODE_LABEL_NUMBER (orig));
 
     case LABEL_REF:
-      copy = gen_rtx (LABEL_REF, mode,
-                     LABEL_REF_NONLOCAL_P (orig) ? XEXP (orig, 0)
-                     : map->label_map[CODE_LABEL_NUMBER (XEXP (orig, 0))]);
+      copy = gen_rtx_LABEL_REF (mode,
+                               LABEL_REF_NONLOCAL_P (orig) ? XEXP (orig, 0)
+                               : get_label_from_map (map, 
+                                                     CODE_LABEL_NUMBER (XEXP (orig, 0))));
       LABEL_OUTSIDE_LOOP_P (copy) = LABEL_OUTSIDE_LOOP_P (orig);
 
       /* The fact that this label was previously nonlocal does not mean
@@ -2233,11 +2557,18 @@ copy_rtx_and_substitute (orig, map)
        {
          rtx constant = get_pool_constant (orig);
          if (GET_CODE (constant) == LABEL_REF)
-           return XEXP (force_const_mem (Pmode, 
+           return XEXP (force_const_mem (GET_MODE (orig),
                                          copy_rtx_and_substitute (constant,
                                                                   map)),
                         0);
        }
+      else
+        if (SYMBOL_REF_NEED_ADJUST (orig)) 
+          {
+            eif_eh_map = map;
+            return rethrow_symbol_map (orig, 
+                                       expand_inline_function_eh_labelmap);
+          }
 
       return orig;
 
@@ -2280,8 +2611,10 @@ copy_rtx_and_substitute (orig, map)
       if (! RTX_INTEGRATED_P (orig))
        abort ();
 
-      temp = force_const_mem (GET_MODE (orig),
-                             copy_rtx_and_substitute (XEXP (orig, 0), map));
+      temp
+       = force_const_mem (GET_MODE (XEXP (orig, 0)),
+                          copy_rtx_and_substitute (XEXP (XEXP (orig, 0), 0),
+                                                   map));
 
 #if 0
       /* Legitimizing the address here is incorrect.
@@ -2300,13 +2633,20 @@ copy_rtx_and_substitute (orig, map)
         will not have valid reg_map entries.  This can cause try_constants()
         to fail because assumes that all registers in the rtx have valid
         reg_map entries, and it may end up replacing one of these new
-        registers with junk. */
+        registers with junk.  */
 
       if (! memory_address_p (GET_MODE (temp), XEXP (temp, 0)))
        temp = change_address (temp, GET_MODE (temp), XEXP (temp, 0));
 #endif
 
-      return XEXP (temp, 0);
+      temp = XEXP (temp, 0);
+
+#ifdef POINTERS_EXTEND_UNSIGNED
+      if (GET_MODE (temp) != GET_MODE (orig))
+       temp = convert_memory_address (GET_MODE (orig), temp);
+#endif
+
+      return temp;
 
     case ASM_OPERANDS:
       /* If a single asm insn contains multiple output operands
@@ -2335,9 +2675,9 @@ copy_rtx_and_substitute (orig, map)
 #ifndef NO_FUNCTION_CSE
       if (! (optimize && ! flag_no_function_cse))
 #endif
-       return gen_rtx (CALL, GET_MODE (orig),
-                       gen_rtx (MEM, GET_MODE (XEXP (orig, 0)),
-                                copy_rtx_and_substitute (XEXP (XEXP (orig, 0), 0), map)),
+       return gen_rtx_CALL (GET_MODE (orig),
+                            gen_rtx_MEM (GET_MODE (XEXP (orig, 0)),
+                                         copy_rtx_and_substitute (XEXP (XEXP (orig, 0), 0), map)),
                        copy_rtx_and_substitute (XEXP (orig, 1), map));
       break;
 
@@ -2349,21 +2689,37 @@ copy_rtx_and_substitute (orig, map)
 
     case SET:
       /* If this is setting fp or ap, it means that we have a nonlocal goto.
-        Don't alter that.
+        Adjust the setting by the offset of the area we made.
         If the nonlocal goto is into the current function,
         this will result in unnecessarily bad code, but should work.  */
       if (SET_DEST (orig) == virtual_stack_vars_rtx
          || SET_DEST (orig) == virtual_incoming_args_rtx)
-       return gen_rtx (SET, VOIDmode, SET_DEST (orig),
-                       copy_rtx_and_substitute (SET_SRC (orig), map));
+       {
+         /* In case a translation hasn't occurred already, make one now. */
+         rtx equiv_reg;
+         rtx equiv_loc;
+         HOST_WIDE_INT loc_offset;
+
+         copy_rtx_and_substitute (SET_DEST (orig), map);
+         equiv_reg = map->reg_map[REGNO (SET_DEST (orig))];
+         equiv_loc = VARRAY_CONST_EQUIV (map->const_equiv_varray, REGNO (equiv_reg)).rtx;
+         loc_offset
+           = GET_CODE (equiv_loc) == REG ? 0 : INTVAL (XEXP (equiv_loc, 1));
+         return gen_rtx_SET (VOIDmode, SET_DEST (orig),
+                             force_operand
+                             (plus_constant
+                              (copy_rtx_and_substitute (SET_SRC (orig), map),
+                               - loc_offset),
+                              NULL_RTX));
+       }
       break;
 
     case MEM:
       copy = rtx_alloc (MEM);
       PUT_MODE (copy, mode);
       XEXP (copy, 0) = copy_rtx_and_substitute (XEXP (orig, 0), map);
-      MEM_IN_STRUCT_P (copy) = MEM_IN_STRUCT_P (orig);
-      MEM_VOLATILE_P (copy) = MEM_VOLATILE_P (orig);
+      MEM_COPY_ATTRIBUTES (copy, orig);
+      MEM_ALIAS_SET (copy) = MEM_ALIAS_SET (orig);
 
       /* If doing function inlining, this MEM might not be const in the
         function that it is being inlined into, and thus may not be
@@ -2374,6 +2730,9 @@ copy_rtx_and_substitute (orig, map)
        RTX_UNCHANGING_P (copy) = RTX_UNCHANGING_P (orig);
 
       return copy;
+      
+    default:
+      break;
     }
 
   copy = rtx_alloc (code);
@@ -2389,6 +2748,7 @@ copy_rtx_and_substitute (orig, map)
       switch (*format_ptr++)
        {
        case '0':
+         XEXP (copy, i) = XEXP (orig, i);
          break;
 
        case 'e':
@@ -2468,16 +2828,15 @@ try_constants (insn, map)
        {
          int regno = REGNO (map->equiv_sets[i].dest);
 
-         if (regno < map->const_equiv_map_size
-             && (map->const_equiv_map[regno] == 0
-                 /* Following clause is a hack to make case work where GNU C++
-                    reassigns a variable to make cse work right.  */
-                 || ! rtx_equal_p (map->const_equiv_map[regno],
-                                   map->equiv_sets[i].equiv)))
-           {
-             map->const_equiv_map[regno] = map->equiv_sets[i].equiv;
-             map->const_age_map[regno] = map->const_age;
-           }
+         MAYBE_EXTEND_CONST_EQUIV_VARRAY (map, regno);
+         if (VARRAY_CONST_EQUIV (map->const_equiv_varray, regno).rtx == 0
+             /* Following clause is a hack to make case work where GNU C++
+                reassigns a variable to make cse work right.  */
+             || ! rtx_equal_p (VARRAY_CONST_EQUIV (map->const_equiv_varray,
+                                                   regno).rtx,
+                               map->equiv_sets[i].equiv))
+           SET_CONST_EQUIV_DATA (map, map->equiv_sets[i].dest,
+                                 map->equiv_sets[i].equiv, map->const_age);
        }
       else if (map->equiv_sets[i].dest == pc_rtx)
        map->last_pc_value = map->equiv_sets[i].equiv;
@@ -2513,7 +2872,7 @@ subst_constants (loc, insn, map)
   register char *format_ptr;
   int num_changes = num_validated_changes ();
   rtx new = 0;
-  enum machine_mode op0_mode;
+  enum machine_mode op0_mode = MAX_MACHINE_MODE;
 
   code = GET_CODE (x);
 
@@ -2547,12 +2906,14 @@ subst_constants (loc, insn, map)
         hard regs used as user variables with constants.  */
       {
        int regno = REGNO (x);
+       struct const_equiv_data *p;
 
        if (! (regno < FIRST_PSEUDO_REGISTER && REG_USERVAR_P (x))
-           && regno < map->const_equiv_map_size
-           && map->const_equiv_map[regno] != 0
-           && map->const_age_map[regno] >= map->const_age)
-         validate_change (insn, loc, map->const_equiv_map[regno], 1);
+           && regno < VARRAY_SIZE (map->const_equiv_varray)
+           && (p = &VARRAY_CONST_EQUIV (map->const_equiv_varray, regno),
+               p->rtx != 0)
+           && p->age >= map->const_age)
+         validate_change (insn, loc, p->rtx, 1);
        return;
       }
 
@@ -2580,6 +2941,7 @@ subst_constants (loc, insn, map)
            new = operand_subword (inner, SUBREG_WORD (x), 0,
                                   GET_MODE (SUBREG_REG (x)));
 
+         cancel_changes (num_changes);
          if (new == 0 && subreg_lowpart_p (x))
            new = gen_lowpart_common (GET_MODE (x), inner);
 
@@ -2612,8 +2974,6 @@ subst_constants (loc, insn, map)
        src = SET_SRC (x);
 
        while (GET_CODE (*dest_loc) == ZERO_EXTRACT
-              /* By convention, we always use ZERO_EXTRACT in the dest.  */
-/*            || GET_CODE (*dest_loc) == SIGN_EXTRACT */
               || GET_CODE (*dest_loc) == SUBREG
               || GET_CODE (*dest_loc) == STRICT_LOW_PART)
          {
@@ -2667,9 +3027,11 @@ subst_constants (loc, insn, map)
            map->equiv_sets[map->num_sets].equiv = copy_rtx (src);
            map->equiv_sets[map->num_sets++].dest = dest;
          }
-
-       return;
       }
+      return;
+
+    default:
+      break;
     }
 
   format_ptr = GET_RTX_FORMAT (code);
@@ -2724,6 +3086,8 @@ subst_constants (loc, insn, map)
   switch (GET_RTX_CLASS (code))
     {
     case '1':
+      if (op0_mode == MAX_MACHINE_MODE)
+       abort ();
       new = simplify_unary_operation (code, GET_MODE (x),
                                      XEXP (x, 0), op0_mode);
       break;
@@ -2752,6 +3116,8 @@ subst_constants (loc, insn, map)
 
     case 'b':
     case '3':
+      if (op0_mode == MAX_MACHINE_MODE)
+       abort ();
       new = simplify_ternary_operation (code, GET_MODE (x), op0_mode,
                                        XEXP (x, 0), XEXP (x, 1), XEXP (x, 2));
       break;
@@ -2767,7 +3133,7 @@ subst_constants (loc, insn, map)
 void
 mark_stores (dest, x)
      rtx dest;
-     rtx x;
+     rtx x ATTRIBUTE_UNUSED;
 {
   int regno = -1;
   enum machine_mode mode;
@@ -2789,9 +3155,13 @@ mark_stores (dest, x)
                      : regno + HARD_REGNO_NREGS (regno, mode) - 1);
       int i;
 
-      for (i = regno; i <= last_reg; i++)
-       if (i < global_const_equiv_map_size)
-         global_const_equiv_map[i] = 0;
+      /* Ignore virtual stack var or virtual arg register since those
+        are handled separately.  */
+      if (regno != VIRTUAL_INCOMING_ARGS_REGNUM
+         && regno != VIRTUAL_STACK_VARS_REGNUM)
+       for (i = regno; i <= last_reg; i++)
+         if (i < VARRAY_SIZE (global_const_equiv_varray))
+           VARRAY_CONST_EQUIV (global_const_equiv_varray, i).rtx = 0;
     }
 }
 \f
@@ -2846,8 +3216,16 @@ restore_constants (px)
     }
   else if (RTX_INTEGRATED_P (x) && GET_CODE (x) == ADDRESS)
     {
-      restore_constants (&XEXP (x, 0));
-      *px = XEXP (force_const_mem (GET_MODE (x), XEXP (x, 0)), 0);
+      rtx new = XEXP (force_const_mem (GET_MODE (XEXP (x, 0)),
+                                      XEXP (XEXP (x, 0), 0)),
+                     0);
+
+#ifdef POINTERS_EXTEND_UNSIGNED
+      if (GET_MODE (new) != GET_MODE (x))
+       new = convert_memory_address (GET_MODE (x), new);
+#endif
+
+      *px = new;
     }
   else
     {
@@ -2948,25 +3326,20 @@ set_block_abstract_flags (stmt, setting)
      register tree stmt;
      register int setting;
 {
-  BLOCK_ABSTRACT (stmt) = setting;
-
-  {
-    register tree local_decl;
+  register tree local_decl;
+  register tree subblock;
 
-    for (local_decl = BLOCK_VARS (stmt);
-        local_decl != NULL_TREE;
-        local_decl = TREE_CHAIN (local_decl))
-      set_decl_abstract_flags (local_decl, setting);
-  }
+  BLOCK_ABSTRACT (stmt) = setting;
 
-  {
-    register tree subblock;
+  for (local_decl = BLOCK_VARS (stmt);
+       local_decl != NULL_TREE;
+       local_decl = TREE_CHAIN (local_decl))
+    set_decl_abstract_flags (local_decl, setting);
 
-    for (subblock = BLOCK_SUBBLOCKS (stmt);
-        subblock != NULL_TREE;
-        subblock = BLOCK_CHAIN (subblock))
-      set_block_abstract_flags (subblock, setting);
-  }
+  for (subblock = BLOCK_SUBBLOCKS (stmt);
+       subblock != NULL_TREE;
+       subblock = BLOCK_CHAIN (subblock))
+    set_block_abstract_flags (subblock, setting);
 }
 
 /* Given a pointer to some ..._DECL node, and a boolean value to set the
@@ -3004,12 +3377,6 @@ output_inline_function (fndecl)
   rtx head;
   rtx last;
 
-  if (output_bytecode)
-    {
-      warning ("`inline' ignored for bytecode output");
-      return;
-    }
-
   /* Things we allocate from here on are part of this function, not
      permanent.  */
   temporary_allocation ();
@@ -3027,11 +3394,21 @@ output_inline_function (fndecl)
   /* Set stack frame size.  */
   assign_stack_local (BLKmode, DECL_FRAME_SIZE (fndecl), 0);
 
-  restore_reg_data (FIRST_PARM_INSN (head));
-
+  /* The first is a bit of a lie (the array may be larger), but doesn't
+     matter too much and it isn't worth saving the actual bound.  */
+  reg_rtx_no = regno_pointer_flag_length = MAX_REGNUM (head);
+  regno_reg_rtx = (rtx *) INLINE_REGNO_REG_RTX (head);
+  regno_pointer_flag = INLINE_REGNO_POINTER_FLAG (head);
+  regno_pointer_align = INLINE_REGNO_POINTER_ALIGN (head);
+  max_parm_reg = MAX_PARMREG (head);
+  parm_reg_stack_loc = (rtx *) PARMREG_STACK_LOC (head);
+  
   stack_slot_list = STACK_SLOT_LIST (head);
   forced_labels = FORCED_LABELS (head);
 
+  if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_HAS_COMPUTED_JUMP)
+    current_function_has_computed_jump = 1;
+
   if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_CALLS_ALLOCA)
     current_function_calls_alloca = 1;
 
@@ -3097,6 +3474,9 @@ output_inline_function (fndecl)
   /* We're not deferring this any longer.  */
   DECL_DEFER_OUTPUT (fndecl) = 0;
 
+  /* We can't inline this anymore.  */
+  DECL_INLINE (fndecl) = 0;
+
   /* Compile this function all the way down to assembly code.  */
   rest_of_compilation (fndecl);