OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / dwarf2out.c
index c2926c3..237c4a4 100644 (file)
@@ -1,5 +1,6 @@
 /* Output Dwarf2 format symbol table information from the GNU C compiler.
-   Copyright (C) 1992, 93, 95-98, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000
+   Free Software Foundation, Inc.
    Contributed by Gary Funck (gary@intrepid.com).
    Derived from DWARF 1 implementation of Ron Guilmette (rfg@monkeys.com).
    Extensively modified by Jason Merrill (jason@cygnus.com).
@@ -53,8 +54,9 @@ Boston, MA 02111-1307, USA.  */
 #include "dwarf2.h"
 #include "dwarf2out.h"
 #include "toplev.h"
-#include "dyn-string.h"
+#include "varray.h"
 #include "ggc.h"
+#include "tm_p.h"
 
 /* We cannot use <assert.h> in GCC source, since that would include
    GCC's assert.h, which may not be compatible with the host compiler.  */
@@ -65,10 +67,6 @@ Boston, MA 02111-1307, USA.  */
 # define assert(e) do { if (! (e)) abort (); } while (0)
 #endif
 
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
-
 /* Decide whether we want to emit frame unwind information for the current
    translation unit.  */
 
@@ -106,7 +104,8 @@ typedef union dw_cfi_oprnd_struct
 {
   unsigned long dw_cfi_reg_num;
   long int dw_cfi_offset;
-  char *dw_cfi_addr;
+  const char *dw_cfi_addr;
+  struct dw_loc_descr_struct *dw_cfi_loc;
 }
 dw_cfi_oprnd;
 
@@ -119,6 +118,19 @@ typedef struct dw_cfi_struct
 }
 dw_cfi_node;
 
+/* This is how we define the location of the CFA. We use to handle it
+   as REG + OFFSET all the time,  but now it can be more complex.
+   It can now be either REG + CFA_OFFSET or *(REG + BASE_OFFSET) + CFA_OFFSET.
+   Instead of passing around REG and OFFSET, we pass a copy 
+   of this structure.  */
+typedef struct cfa_loc
+{
+  unsigned long reg;  
+  long offset;
+  long base_offset;
+  int indirect;            /* 1 if CFA is accessed via a dereference.  */
+} dw_cfa_location;
+
 /* All call frame descriptions (FDE's) in the GCC generated DWARF
    refer to a single Common Information Entry (CIE), defined at
    the beginning of the .debug_frame section.  This used of a single
@@ -127,10 +139,11 @@ dw_cfi_node;
 
 typedef struct dw_fde_struct
 {
-  char *dw_fde_begin;
-  char *dw_fde_current_label;
-  char *dw_fde_end;
+  const char *dw_fde_begin;
+  const char *dw_fde_current_label;
+  const char *dw_fde_end;
   dw_cfi_ref dw_fde_cfi;
+  int nothrow;
 }
 dw_fde_node;
 
@@ -145,13 +158,25 @@ dw_fde_node;
 #ifndef CHAR_TYPE_SIZE
 #define CHAR_TYPE_SIZE BITS_PER_UNIT
 #endif
+
+/* The size of the target's pointer type.  */
 #ifndef PTR_SIZE
 #define PTR_SIZE (POINTER_SIZE / BITS_PER_UNIT)
 #endif
 
+/* The size of addresses as they appear in the Dwarf 2 data.
+   Some architectures use word addresses to refer to code locations,
+   but Dwarf 2 info always uses byte addresses.  On such machines,
+   Dwarf 2 addresses need to be larger than the architecture's
+   pointers.  */
+#ifndef DWARF2_ADDR_SIZE
+#define DWARF2_ADDR_SIZE (POINTER_SIZE / BITS_PER_UNIT)
+#endif
+
 /* The size in bytes of a DWARF field indicating an offset or length
-   relative to a debug info section, specified to be 4 bytes in the DWARF-2
-   specification.  The SGI/MIPS ABI defines it to be the same as PTR_SIZE.  */
+   relative to a debug info section, specified to be 4 bytes in the
+   DWARF-2 specification.  The SGI/MIPS ABI defines it to be the same
+   as PTR_SIZE.  */
 
 #ifndef DWARF_OFFSET_SIZE
 #define DWARF_OFFSET_SIZE 4
@@ -161,13 +186,13 @@ dw_fde_node;
 
 /* Round SIZE up to the nearest BOUNDARY.  */
 #define DWARF_ROUND(SIZE,BOUNDARY) \
-  (((SIZE) + (BOUNDARY) - 1) & ~((BOUNDARY) - 1))
+  ((((SIZE) + (BOUNDARY) - 1) / (BOUNDARY)) * (BOUNDARY))
 
 /* Offsets recorded in opcodes are a multiple of this alignment factor.  */
 #ifdef STACK_GROWS_DOWNWARD
-#define DWARF_CIE_DATA_ALIGNMENT (-UNITS_PER_WORD)
+#define DWARF_CIE_DATA_ALIGNMENT (-((int) UNITS_PER_WORD))
 #else
-#define DWARF_CIE_DATA_ALIGNMENT UNITS_PER_WORD
+#define DWARF_CIE_DATA_ALIGNMENT ((int) UNITS_PER_WORD)
 #endif
 
 /* A pointer to the base of a table that contains frame description
@@ -202,26 +227,32 @@ static unsigned current_funcdef_fde;
 
 /* Forward declarations for functions defined in this file.  */
 
-static char *stripattributes           PROTO((const char *));
-static const char *dwarf_cfi_name      PROTO((unsigned));
-static dw_cfi_ref new_cfi              PROTO((void));
-static void add_cfi                    PROTO((dw_cfi_ref *, dw_cfi_ref));
-static unsigned long size_of_uleb128   PROTO((unsigned long));
-static unsigned long size_of_sleb128   PROTO((long));
-static void output_uleb128             PROTO((unsigned long));
-static void output_sleb128             PROTO((long));
-static void add_fde_cfi                        PROTO((char *, dw_cfi_ref));
-static void lookup_cfa_1               PROTO((dw_cfi_ref, unsigned long *,
-                                              long *));
-static void lookup_cfa                 PROTO((unsigned long *, long *));
-static void reg_save                   PROTO((char *, unsigned, unsigned,
-                                              long));
-static void initial_return_save                PROTO((rtx));
-static void output_cfi                 PROTO((dw_cfi_ref, dw_fde_ref));
-static void output_call_frame_info     PROTO((int));
-static unsigned reg_number             PROTO((rtx));
-static void dwarf2out_stack_adjust     PROTO((rtx));
-static void dwarf2out_frame_debug_expr PROTO((rtx, char *));
+static char *stripattributes           PARAMS ((const char *));
+static const char *dwarf_cfi_name      PARAMS ((unsigned));
+static dw_cfi_ref new_cfi              PARAMS ((void));
+static void add_cfi                    PARAMS ((dw_cfi_ref *, dw_cfi_ref));
+static unsigned long size_of_uleb128   PARAMS ((unsigned long));
+static unsigned long size_of_sleb128   PARAMS ((long));
+static void output_uleb128             PARAMS ((unsigned long));
+static void output_sleb128             PARAMS ((long));
+static void add_fde_cfi                        PARAMS ((const char *, dw_cfi_ref));
+static void lookup_cfa_1               PARAMS ((dw_cfi_ref, dw_cfa_location *));
+static void lookup_cfa                 PARAMS ((dw_cfa_location *));
+static void reg_save                   PARAMS ((const char *, unsigned,
+                                                unsigned, long));
+static void initial_return_save                PARAMS ((rtx));
+static void output_cfi                 PARAMS ((dw_cfi_ref, dw_fde_ref));
+static void output_call_frame_info     PARAMS ((int));
+static void dwarf2out_stack_adjust     PARAMS ((rtx));
+static void dwarf2out_frame_debug_expr PARAMS ((rtx, const char *));
+
+/* Support for complex CFA locations.  */
+static void output_cfa_loc             PARAMS ((dw_cfi_ref));
+static void get_cfa_from_loc_descr     PARAMS ((dw_cfa_location *, 
+                                               struct dw_loc_descr_struct *));
+static struct dw_loc_descr_struct *build_cfa_loc
+                                       PARAMS ((dw_cfa_location *));
+static void def_cfa_1                  PARAMS ((const char *, dw_cfa_location *));
 
 /* Definitions of defaults for assembler-dependent names of various
    pseudo-ops and section names.
@@ -313,8 +344,10 @@ static void dwarf2out_frame_debug_expr     PROTO((rtx, char *));
 #endif
 
 #ifndef UNALIGNED_WORD_ASM_OP
-#define UNALIGNED_WORD_ASM_OP \
-  (PTR_SIZE == 8 ? UNALIGNED_DOUBLE_INT_ASM_OP : UNALIGNED_INT_ASM_OP)
+#define UNALIGNED_WORD_ASM_OP                                          \
+  ((DWARF2_ADDR_SIZE) == 8 ? UNALIGNED_DOUBLE_INT_ASM_OP               \
+   : (DWARF2_ADDR_SIZE) == 2 ? UNALIGNED_SHORT_ASM_OP                  \
+   : UNALIGNED_INT_ASM_OP)
 #endif
 
 #ifndef ASM_OUTPUT_DWARF_DELTA2
@@ -360,19 +393,12 @@ static void dwarf2out_frame_debug_expr    PROTO((rtx, char *));
   } while (0)
 #endif
 
-/* ??? This macro takes an RTX in dwarfout.c and a string in dwarf2out.c.
-   We resolve the conflict by creating a new macro ASM_OUTPUT_DWARF2_ADDR_CONST
-   for ports that want to support both DWARF1 and DWARF2.  This needs a better
-   solution.  See also the comments in sparc/sp64-elf.h.  */
-#ifdef ASM_OUTPUT_DWARF2_ADDR_CONST
-#undef ASM_OUTPUT_DWARF_ADDR_CONST
-#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,ADDR) \
-  ASM_OUTPUT_DWARF2_ADDR_CONST (FILE, ADDR)
-#endif
-
 #ifndef ASM_OUTPUT_DWARF_ADDR_CONST
-#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,ADDR)                         \
-  fprintf ((FILE), "\t%s\t%s", UNALIGNED_WORD_ASM_OP, (ADDR))
+#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX)                          \
+  do {                                                                 \
+    fprintf ((FILE), "\t%s\t", UNALIGNED_WORD_ASM_OP);                 \
+    output_addr_const ((FILE), (RTX));                                 \
+  } while (0)
 #endif
 
 #ifndef ASM_OUTPUT_DWARF_OFFSET4
@@ -399,6 +425,12 @@ static void dwarf2out_frame_debug_expr     PROTO((rtx, char *));
   fprintf ((FILE), "\t%s\t0x%x", UNALIGNED_INT_ASM_OP, (unsigned) (VALUE))
 #endif
 
+#ifndef ASM_OUTPUT_DWARF_DATA8
+#define ASM_OUTPUT_DWARF_DATA8(FILE,VALUE) \
+  fprintf ((FILE), "\t%s\t0x%lx", UNALIGNED_DOUBLE_INT_ASM_OP, \
+          (unsigned long) (VALUE))
+#endif
+
 #ifndef ASM_OUTPUT_DWARF_DATA
 #define ASM_OUTPUT_DWARF_DATA(FILE,VALUE) \
   fprintf ((FILE), "\t%s\t0x%lx", UNALIGNED_OFFSET_ASM_OP, \
@@ -411,8 +443,8 @@ static void dwarf2out_frame_debug_expr      PROTO((rtx, char *));
           (unsigned long) (VALUE))
 #endif
 
-#ifndef ASM_OUTPUT_DWARF_DATA8
-#define ASM_OUTPUT_DWARF_DATA8(FILE,HIGH_VALUE,LOW_VALUE)              \
+#ifndef ASM_OUTPUT_DWARF_CONST_DOUBLE
+#define ASM_OUTPUT_DWARF_CONST_DOUBLE(FILE,HIGH_VALUE,LOW_VALUE)       \
   do {                                                                 \
     if (WORDS_BIG_ENDIAN)                                              \
       {                                                                        \
@@ -432,38 +464,63 @@ static void dwarf2out_frame_debug_expr    PROTO((rtx, char *));
 /* We don't have unaligned support, let's hope the normal output works for
    .debug_frame.  */
 
+#ifndef ASM_OUTPUT_DWARF_ADDR
 #define ASM_OUTPUT_DWARF_ADDR(FILE,LABEL) \
-  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, LABEL), PTR_SIZE, 1)
+  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, LABEL), DWARF2_ADDR_SIZE, 1)
+#endif
+
+#ifndef ASM_OUTPUT_DWARF_ADDR_CONST
+#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX) ASM_OUTPUT_DWARF_ADDR (FILE,RTX)
+#endif
 
+#ifndef ASM_OUTPUT_DWARF_OFFSET4
 #define ASM_OUTPUT_DWARF_OFFSET4(FILE,LABEL) \
   assemble_integer (gen_rtx_SYMBOL_REF (SImode, LABEL), 4, 1)
+#endif
 
+#ifndef ASM_OUTPUT_DWARF_OFFSET
 #define ASM_OUTPUT_DWARF_OFFSET(FILE,LABEL) \
   assemble_integer (gen_rtx_SYMBOL_REF (SImode, LABEL), 4, 1)
+#endif
 
+#ifndef ASM_OUTPUT_DWARF_DELTA2
 #define ASM_OUTPUT_DWARF_DELTA2(FILE,LABEL1,LABEL2)                    \
   assemble_integer (gen_rtx_MINUS (HImode,                             \
                                   gen_rtx_SYMBOL_REF (Pmode, LABEL1),  \
                                   gen_rtx_SYMBOL_REF (Pmode, LABEL2)), \
                    2, 1)
+#endif
   
+#ifndef ASM_OUTPUT_DWARF_DELTA4
 #define ASM_OUTPUT_DWARF_DELTA4(FILE,LABEL1,LABEL2)                    \
   assemble_integer (gen_rtx_MINUS (SImode,                             \
                                   gen_rtx_SYMBOL_REF (Pmode, LABEL1),  \
                                   gen_rtx_SYMBOL_REF (Pmode, LABEL2)), \
                    4, 1)
+#endif
 
+#ifndef ASM_OUTPUT_DWARF_ADDR_DELTA
 #define ASM_OUTPUT_DWARF_ADDR_DELTA(FILE,LABEL1,LABEL2)                        \
   assemble_integer (gen_rtx_MINUS (Pmode,                              \
                                   gen_rtx_SYMBOL_REF (Pmode, LABEL1),  \
                                   gen_rtx_SYMBOL_REF (Pmode, LABEL2)), \
-                   PTR_SIZE, 1)
+                   DWARF2_ADDR_SIZE, 1)
+#endif
 
+#ifndef ASM_OUTPUT_DWARF_DELTA
 #define ASM_OUTPUT_DWARF_DELTA(FILE,LABEL1,LABEL2) \
   ASM_OUTPUT_DWARF_DELTA4 (FILE,LABEL1,LABEL2)
+#endif
+
+#ifndef ASM_OUTPUT_DWARF_DATA2
+#define ASM_OUTPUT_DWARF_DATA2(FILE,VALUE) \
+  assemble_integer (GEN_INT (VALUE), 2, 1)
+#endif
 
+#ifndef ASM_OUTPUT_DWARF_DATA4
 #define ASM_OUTPUT_DWARF_DATA4(FILE,VALUE) \
   assemble_integer (GEN_INT (VALUE), 4, 1)
+#endif
 
 #endif /* UNALIGNED_INT_ASM_OP */
 
@@ -515,7 +572,7 @@ static void dwarf2out_frame_debug_expr      PROTO((rtx, char *));
 #ifdef PC_REGNUM
 #define DWARF_FRAME_RETURN_COLUMN      DWARF_FRAME_REGNUM (PC_REGNUM)
 #else
-#define DWARF_FRAME_RETURN_COLUMN      FIRST_PSEUDO_REGISTER
+#define DWARF_FRAME_RETURN_COLUMN      DWARF_FRAME_REGISTERS
 #endif
 #endif
 
@@ -558,24 +615,6 @@ stripattributes (s)
   return stripped;
 }
 
-/* Return the register number described by a given RTL node.  */
-
-static unsigned
-reg_number (rtl)
-     register rtx rtl;
-{
-  register unsigned regno = REGNO (rtl);
-
-  if (regno >= FIRST_PSEUDO_REGISTER)
-    {
-      warning ("internal regno botch: regno = %d\n", regno);
-      regno = 0;
-    }
-
-  regno = DBX_REGISTER_NUMBER (regno);
-  return regno;
-}
-
 /* Generate code to initialize the register size table.  */
 
 void
@@ -587,11 +626,14 @@ expand_builtin_init_dwarf_reg_sizes (address)
   rtx addr = expand_expr (address, NULL_RTX, VOIDmode, 0);
   rtx mem = gen_rtx_MEM (mode, addr);
 
-  for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
+  for (i = 0; i < DWARF_FRAME_REGISTERS; ++i)
     {
-      int offset = i * GET_MODE_SIZE (mode);
+      int offset = DWARF_FRAME_REGNUM (i) * GET_MODE_SIZE (mode);
       int size = GET_MODE_SIZE (reg_raw_mode[i]);
 
+      if (offset < 0)
+       continue;
+
       emit_move_insn (change_address (mem, mode,
                                      plus_constant (addr, offset)),
                      GEN_INT (size));
@@ -642,6 +684,8 @@ dwarf_cfi_name (cfi_opc)
       return "DW_CFA_def_cfa_register";
     case DW_CFA_def_cfa_offset:
       return "DW_CFA_def_cfa_offset";
+    case DW_CFA_def_cfa_expression:
+      return "DW_CFA_def_cfa_expression";
 
     /* SGI/MIPS specific */
     case DW_CFA_MIPS_advance_loc8:
@@ -652,6 +696,8 @@ dwarf_cfi_name (cfi_opc)
       return "DW_CFA_GNU_window_save";
     case DW_CFA_GNU_args_size:
       return "DW_CFA_GNU_args_size";
+    case DW_CFA_GNU_negative_offset_extended:
+      return "DW_CFA_GNU_negative_offset_extended";
 
     default:
       return "DW_CFA_<unknown>";
@@ -707,7 +753,7 @@ dwarf2out_cfi_label ()
 
 static void
 add_fde_cfi (label, cfi)
-     register char *label;
+     register const char *label;
      register dw_cfi_ref cfi;
 {
   if (label)
@@ -741,22 +787,24 @@ add_fde_cfi (label, cfi)
 /* Subroutine of lookup_cfa.  */
 
 static inline void
-lookup_cfa_1 (cfi, regp, offsetp)
+lookup_cfa_1 (cfi, loc)
      register dw_cfi_ref cfi;
-     register unsigned long *regp;
-     register long *offsetp;
+     register dw_cfa_location *loc;
 {
   switch (cfi->dw_cfi_opc)
     {
     case DW_CFA_def_cfa_offset:
-      *offsetp = cfi->dw_cfi_oprnd1.dw_cfi_offset;
+      loc->offset = cfi->dw_cfi_oprnd1.dw_cfi_offset;
       break;
     case DW_CFA_def_cfa_register:
-      *regp = cfi->dw_cfi_oprnd1.dw_cfi_reg_num;
+      loc->reg = cfi->dw_cfi_oprnd1.dw_cfi_reg_num;
       break;
     case DW_CFA_def_cfa:
-      *regp = cfi->dw_cfi_oprnd1.dw_cfi_reg_num;
-      *offsetp = cfi->dw_cfi_oprnd2.dw_cfi_offset;
+      loc->reg = cfi->dw_cfi_oprnd1.dw_cfi_reg_num;
+      loc->offset = cfi->dw_cfi_oprnd2.dw_cfi_offset;
+      break;
+    case DW_CFA_def_cfa_expression:
+      get_cfa_from_loc_descr (loc, cfi->dw_cfi_oprnd1.dw_cfi_loc);
       break;
     default:
       break;
@@ -766,34 +814,33 @@ lookup_cfa_1 (cfi, regp, offsetp)
 /* Find the previous value for the CFA.  */
 
 static void
-lookup_cfa (regp, offsetp)
-     register unsigned long *regp;
-     register long *offsetp;
+lookup_cfa (loc)
+     register dw_cfa_location *loc;
 {
   register dw_cfi_ref cfi;
 
-  *regp = (unsigned long) -1;
-  *offsetp = 0;
+  loc->reg = (unsigned long) -1;
+  loc->offset = 0;
+  loc->indirect = 0;
+  loc->base_offset = 0;
 
   for (cfi = cie_cfi_head; cfi; cfi = cfi->dw_cfi_next)
-    lookup_cfa_1 (cfi, regp, offsetp);
+    lookup_cfa_1 (cfi, loc);
 
   if (fde_table_in_use)
     {
       register dw_fde_ref fde = &fde_table[fde_table_in_use - 1];
       for (cfi = fde->dw_fde_cfi; cfi; cfi = cfi->dw_cfi_next)
-       lookup_cfa_1 (cfi, regp, offsetp);
+       lookup_cfa_1 (cfi, loc);
     }
 }
 
 /* The current rule for calculating the DWARF2 canonical frame address.  */
-static unsigned long cfa_reg;
-static long cfa_offset;
+dw_cfa_location cfa;
 
 /* The register used for saving registers to the stack, and its offset
    from the CFA.  */
-static unsigned cfa_store_reg;
-static long cfa_store_offset;
+dw_cfa_location cfa_store;
 
 /* The running total of the size of arguments pushed onto the stack.  */
 static long args_size;
@@ -807,46 +854,76 @@ static long old_args_size;
 
 void
 dwarf2out_def_cfa (label, reg, offset)
-     register char *label;
-     register unsigned reg;
-     register long offset;
+     register const char *label;
+     unsigned reg;
+     long offset;
+{
+  dw_cfa_location loc;
+  loc.indirect = 0;
+  loc.base_offset = 0;
+  loc.reg = reg;
+  loc.offset = offset;
+  def_cfa_1 (label, &loc);
+}
+
+/* This routine does the actual work. The CFA is now calculated from
+   the dw_cfa_location structure.  */
+static void
+def_cfa_1 (label, loc_p)
+     register const char *label;
+     dw_cfa_location *loc_p;
 {
   register dw_cfi_ref cfi;
-  unsigned long old_reg;
-  long old_offset;
+  dw_cfa_location old_cfa, loc;
 
-  cfa_reg = reg;
-  cfa_offset = offset;
-  if (cfa_store_reg == reg)
-    cfa_store_offset = offset;
+  cfa = *loc_p;
+  loc = *loc_p;
 
-  reg = DWARF_FRAME_REGNUM (reg);
-  lookup_cfa (&old_reg, &old_offset);
+  if (cfa_store.reg == loc.reg && loc.indirect == 0)
+    cfa_store.offset = loc.offset;
 
-  if (reg == old_reg && offset == old_offset)
-    return;
+  loc.reg = DWARF_FRAME_REGNUM (loc.reg);
+  lookup_cfa (&old_cfa);
+
+  if (loc.reg == old_cfa.reg && loc.offset == old_cfa.offset &&
+      loc.indirect == old_cfa.indirect)
+    {
+      if (loc.indirect == 0)
+       return;
+      else 
+        if (loc.base_offset == old_cfa.base_offset)
+         return;
+    }
 
   cfi = new_cfi ();
 
-  if (reg == old_reg)
+  if (loc.reg == old_cfa.reg && loc.indirect == old_cfa.indirect)
     {
       cfi->dw_cfi_opc = DW_CFA_def_cfa_offset;
-      cfi->dw_cfi_oprnd1.dw_cfi_offset = offset;
+      cfi->dw_cfi_oprnd1.dw_cfi_offset = loc.offset;
     }
 
 #ifndef MIPS_DEBUGGING_INFO  /* SGI dbx thinks this means no offset.  */
-  else if (offset == old_offset && old_reg != (unsigned long) -1)
+  else if (loc.offset == old_cfa.offset && old_cfa.reg != (unsigned long) -1
+          && loc.indirect == old_cfa.indirect)
     {
       cfi->dw_cfi_opc = DW_CFA_def_cfa_register;
-      cfi->dw_cfi_oprnd1.dw_cfi_reg_num = reg;
+      cfi->dw_cfi_oprnd1.dw_cfi_reg_num = loc.reg;
     }
 #endif
 
-  else
+  else if (loc.indirect == 0)
     {
       cfi->dw_cfi_opc = DW_CFA_def_cfa;
-      cfi->dw_cfi_oprnd1.dw_cfi_reg_num = reg;
-      cfi->dw_cfi_oprnd2.dw_cfi_offset = offset;
+      cfi->dw_cfi_oprnd1.dw_cfi_reg_num = loc.reg;
+      cfi->dw_cfi_oprnd2.dw_cfi_offset = loc.offset;
+    }
+  else
+    {
+      struct dw_loc_descr_struct * loc_list;
+      cfi->dw_cfi_opc = DW_CFA_def_cfa_expression;
+      loc_list = build_cfa_loc (&loc);
+      cfi->dw_cfi_oprnd1.dw_cfi_loc = loc_list;
     }
 
   add_fde_cfi (label, cfi);
@@ -859,7 +936,7 @@ dwarf2out_def_cfa (label, reg, offset)
 
 static void
 reg_save (label, reg, sreg, offset)
-     register char * label;
+     register const char *label;
      register unsigned reg;
      register unsigned sreg;
      register long offset;
@@ -881,9 +958,15 @@ reg_save (label, reg, sreg, offset)
 
       offset /= DWARF_CIE_DATA_ALIGNMENT;
       if (offset < 0)
-       abort ();
+       {
+         cfi->dw_cfi_opc = DW_CFA_GNU_negative_offset_extended;
+         offset = -offset;
+       }
       cfi->dw_cfi_oprnd2.dw_cfi_offset = offset;
     }
+  else if (sreg == reg)
+    /* We could emit a DW_CFA_same_value in this case, but don't bother.  */
+    return;
   else
     {
       cfi->dw_cfi_opc = DW_CFA_register;
@@ -902,7 +985,7 @@ reg_save (label, reg, sreg, offset)
 
 void
 dwarf2out_window_save (label)
-     register char * label;
+     register const char *label;
 {
   register dw_cfi_ref cfi = new_cfi ();
   cfi->dw_cfi_opc = DW_CFA_GNU_window_save;
@@ -914,7 +997,7 @@ dwarf2out_window_save (label)
 
 void
 dwarf2out_args_size (label, size)
-     char *label;
+     const char *label;
      long size;
 {
   register dw_cfi_ref cfi;
@@ -934,7 +1017,7 @@ dwarf2out_args_size (label, size)
 
 void
 dwarf2out_reg_save (label, reg, offset)
-     register char * label;
+     register const char *label;
      register unsigned reg;
      register long offset;
 {
@@ -946,7 +1029,7 @@ dwarf2out_reg_save (label, reg, offset)
 
 void
 dwarf2out_return_save (label, offset)
-     register char * label;
+     register const char *label;
      register long offset;
 {
   reg_save (label, DWARF_FRAME_RETURN_COLUMN, -1, offset);
@@ -957,7 +1040,7 @@ dwarf2out_return_save (label, offset)
 
 void
 dwarf2out_return_reg (label, sreg)
-     register char * label;
+     register const char *label;
      register unsigned sreg;
 {
   reg_save (label, DWARF_FRAME_RETURN_COLUMN, sreg, 0);
@@ -977,7 +1060,7 @@ initial_return_save (rtl)
     {
     case REG:
       /* RA is in a register.  */
-      reg = reg_number (rtl);
+      reg = DWARF_FRAME_REGNUM (REGNO (rtl));
       break;
     case MEM:
       /* RA is on the stack.  */
@@ -1015,7 +1098,7 @@ initial_return_save (rtl)
       abort ();
     }
 
-  reg_save (NULL, DWARF_FRAME_RETURN_COLUMN, reg, offset - cfa_offset);
+  reg_save (NULL, DWARF_FRAME_RETURN_COLUMN, reg, offset - cfa.offset);
 }
 
 /* Check INSN to see if it looks like a push or a stack adjustment, and
@@ -1027,7 +1110,7 @@ dwarf2out_stack_adjust (insn)
      rtx insn;
 {
   long offset;
-  char *label;
+  const char *label;
 
   if (! asynchronous_exceptions && GET_CODE (insn) == CALL_INSN)
     {
@@ -1046,7 +1129,7 @@ dwarf2out_stack_adjust (insn)
   /* If only calls can throw, and we have a frame pointer,
      save up adjustments until we see the CALL_INSN.  */
   else if (! asynchronous_exceptions
-          && cfa_reg != STACK_POINTER_REGNUM)
+          && cfa.reg != STACK_POINTER_REGNUM)
     return;
 
   if (GET_CODE (insn) == BARRIER)
@@ -1104,8 +1187,8 @@ dwarf2out_stack_adjust (insn)
   if (offset == 0)
     return;
 
-  if (cfa_reg == STACK_POINTER_REGNUM)
-    cfa_offset += offset;
+  if (cfa.reg == STACK_POINTER_REGNUM)
+    cfa.offset += offset;
 
 #ifndef STACK_GROWS_DOWNWARD
   offset = -offset;
@@ -1115,7 +1198,7 @@ dwarf2out_stack_adjust (insn)
     args_size = 0;
 
   label = dwarf2out_cfi_label ();
-  dwarf2out_def_cfa (label, cfa_reg, cfa_offset);
+  def_cfa_1 (label, &cfa);
   dwarf2out_args_size (label, args_size);
 }
 
@@ -1125,6 +1208,11 @@ static unsigned cfa_temp_reg;
 /* A temporary value used in adjusting SP or setting up the store_reg.  */
 static long cfa_temp_value;
 
+/* If we see a store of the CFA register, remember it in case we later also
+   copy it into another register.  The ARM saves the old SP in the stack,
+   but it also has a usable FP.  */
+static unsigned cfa_old_reg;
+
 /* Record call frame debugging information for an expression, which either
    sets SP or FP (adjusting how we calculate the frame address) or saves a
    register to the stack. */
@@ -1132,7 +1220,7 @@ static long cfa_temp_value;
 static void
 dwarf2out_frame_debug_expr (expr, label)
      rtx expr;
-     char *label;
+     const char *label;
 {
   rtx src, dest;
   long offset;
@@ -1174,13 +1262,18 @@ dwarf2out_frame_debug_expr (expr, label)
         {
           /* Setting FP from SP.  */
         case REG:
-          if (cfa_reg != (unsigned) REGNO (src))
-            abort ();
-          if (REGNO (dest) != STACK_POINTER_REGNUM
-             && !(frame_pointer_needed
-                  && REGNO (dest) == HARD_FRAME_POINTER_REGNUM))
+          if (cfa.reg == (unsigned) REGNO (src)
+             || (cfa.indirect && cfa_old_reg == (unsigned) REGNO (src)))
+           /* OK */;
+         else
             abort ();
-          cfa_reg = REGNO (dest);
+
+         /* We used to require that dest be either SP or FP, but the
+            ARM copies SP to a temporary register, and from there to
+            FP.  So we just rely on the backends to only set
+            RTX_FRAME_RELATED_P on appropriate insns.  */
+          cfa.reg = REGNO (dest);
+         cfa.indirect = 0;
           break;
 
         case PLUS:
@@ -1205,50 +1298,37 @@ dwarf2out_frame_debug_expr (expr, label)
              if (XEXP (src, 0) == hard_frame_pointer_rtx)
                {
                  /* Restoring SP from FP in the epilogue.  */
-                 if (cfa_reg != (unsigned) HARD_FRAME_POINTER_REGNUM)
+                 if (cfa.reg != (unsigned) HARD_FRAME_POINTER_REGNUM)
                    abort ();
-                 cfa_reg = STACK_POINTER_REGNUM;
+                 cfa.reg = STACK_POINTER_REGNUM;
                }
              else if (XEXP (src, 0) != stack_pointer_rtx)
                abort ();
 
              if (GET_CODE (src) == PLUS)
                offset = -offset;
-             if (cfa_reg == STACK_POINTER_REGNUM)
-               cfa_offset += offset;
-             if (cfa_store_reg == STACK_POINTER_REGNUM)
-               cfa_store_offset += offset;
+             if (cfa.reg == STACK_POINTER_REGNUM)
+               cfa.offset += offset;
+             if (cfa_store.reg == STACK_POINTER_REGNUM)
+               cfa_store.offset += offset;
             }
           else if (dest == hard_frame_pointer_rtx)
             {
              /* Either setting the FP from an offset of the SP,
                 or adjusting the FP */
-             if (! frame_pointer_needed
-                 || REGNO (dest) != HARD_FRAME_POINTER_REGNUM)
+             if (! frame_pointer_needed)
                abort ();
 
-             if (XEXP (src, 0) == stack_pointer_rtx
+             if (GET_CODE (XEXP (src, 0)) == REG
+                 && (unsigned) REGNO (XEXP (src, 0)) == cfa.reg
                  && GET_CODE (XEXP (src, 1)) == CONST_INT)
                {
-                 if (cfa_reg != STACK_POINTER_REGNUM)
-                   abort ();
-                 offset = INTVAL (XEXP (src, 1));
-                 if (GET_CODE (src) == PLUS)
-                   offset = -offset;
-                 cfa_offset += offset;
-                 cfa_reg = HARD_FRAME_POINTER_REGNUM;
-               }
-             else if (XEXP (src, 0) == hard_frame_pointer_rtx
-                      && GET_CODE (XEXP (src, 1)) == CONST_INT)
-               {
-                 if (cfa_reg != (unsigned) HARD_FRAME_POINTER_REGNUM)
-                   abort ();
                  offset = INTVAL (XEXP (src, 1));
                  if (GET_CODE (src) == PLUS)
                    offset = -offset;
-                 cfa_offset += offset;
+                 cfa.offset += offset;
+                 cfa.reg = HARD_FRAME_POINTER_REGNUM;
                }
-
              else 
                abort();
             }
@@ -1260,10 +1340,10 @@ dwarf2out_frame_debug_expr (expr, label)
              if (GET_CODE (XEXP (src, 0)) != REG
                  || (unsigned) REGNO (XEXP (src, 0)) != cfa_temp_reg)
                abort ();
-             if (cfa_reg != STACK_POINTER_REGNUM)
+             if (cfa.reg != STACK_POINTER_REGNUM)
                abort ();
-             cfa_store_reg = REGNO (dest);
-             cfa_store_offset = cfa_offset - cfa_temp_value;
+             cfa_store.reg = REGNO (dest);
+             cfa_store.offset = cfa.offset - cfa_temp_value;
             }
           break;
 
@@ -1284,14 +1364,53 @@ dwarf2out_frame_debug_expr (expr, label)
         default:
           abort ();
         }
-      dwarf2out_def_cfa (label, cfa_reg, cfa_offset);
+      def_cfa_1 (label, &cfa);
+      break;
+
+      /* Skip over HIGH, assuming it will be followed by a LO_SUM, which
+        will fill in all of the bits.  */
+    case HIGH:
+      break;
+
+    case LO_SUM:
+      cfa_temp_reg = REGNO (dest);
+      cfa_temp_value = INTVAL (XEXP (src, 1));
       break;
 
     case MEM:
-      /* Saving a register to the stack.  Make sure dest is relative to the
-        CFA register.  */
       if (GET_CODE (src) != REG)
        abort ();
+
+      /* If the src is our current CFA, and it isn't the SP or FP, then we're
+         going to have to use an indrect mechanism.  */
+      if (REGNO (src) != STACK_POINTER_REGNUM 
+         && REGNO (src) != HARD_FRAME_POINTER_REGNUM 
+         && (unsigned) REGNO (src) == cfa.reg
+         /* Temporary KLUDGE to make ARM work.  */
+         && GET_CODE (XEXP (dest, 0)) != PRE_DEC)
+       {
+         /* We currently allow this to be ONLY a MEM or MEM + offset.  */
+         rtx x = XEXP (dest, 0);
+         int offset = 0;
+         if (GET_CODE (x) == PLUS || GET_CODE (x) ==  MINUS)
+           {
+             offset = INTVAL (XEXP (x, 1));
+             if (GET_CODE (x) == MINUS)
+               offset = -offset;
+             x = XEXP (x, 0);
+           }
+         if (GET_CODE (x) != REG)
+           abort ();
+         cfa_old_reg = cfa.reg;
+         cfa.reg = (unsigned) REGNO (x);
+         cfa.base_offset = offset;
+         cfa.indirect = 1;
+         def_cfa_1 (label, &cfa);
+         break;
+       }
+
+      /* Saving a register to the stack.  Make sure dest is relative to the
+        CFA register.  */
       switch (GET_CODE (XEXP (dest, 0)))
        {
          /* With a push.  */
@@ -1302,13 +1421,13 @@ dwarf2out_frame_debug_expr (expr, label)
            offset = -offset;
 
          if (REGNO (XEXP (XEXP (dest, 0), 0)) != STACK_POINTER_REGNUM
-             || cfa_store_reg != STACK_POINTER_REGNUM)
+             || cfa_store.reg != STACK_POINTER_REGNUM)
            abort ();
-         cfa_store_offset += offset;
-         if (cfa_reg == STACK_POINTER_REGNUM)
-           cfa_offset = cfa_store_offset;
+         cfa_store.offset += offset;
+         if (cfa.reg == STACK_POINTER_REGNUM)
+           cfa.offset = cfa_store.offset;
 
-         offset = -cfa_store_offset;
+         offset = -cfa_store.offset;
          break;
 
          /* With an offset.  */
@@ -1318,22 +1437,22 @@ dwarf2out_frame_debug_expr (expr, label)
          if (GET_CODE (XEXP (dest, 0)) == MINUS)
            offset = -offset;
 
-         if (cfa_store_reg != (unsigned) REGNO (XEXP (XEXP (dest, 0), 0)))
+         if (cfa_store.reg != (unsigned) REGNO (XEXP (XEXP (dest, 0), 0)))
            abort ();
-         offset -= cfa_store_offset;
+         offset -= cfa_store.offset;
          break;
 
          /* Without an offset.  */
        case REG:
-         if (cfa_store_reg != (unsigned) REGNO (XEXP (dest, 0)))
+         if (cfa_store.reg != (unsigned) REGNO (XEXP (dest, 0)))
            abort();
-         offset = -cfa_store_offset;
+         offset = -cfa_store.offset;
          break;
 
        default:
          abort ();
        }
-      dwarf2out_def_cfa (label, cfa_reg, cfa_offset);
+      def_cfa_1 (label, &cfa);
       dwarf2out_reg_save (label, REGNO (src), offset);
       break;
 
@@ -1351,18 +1470,17 @@ void
 dwarf2out_frame_debug (insn)
      rtx insn;
 {
-  char *label;
+  const char *label;
   rtx src;
 
   if (insn == NULL_RTX)
     {
       /* Set up state for generating call frame debug info.  */
-      lookup_cfa (&cfa_reg, &cfa_offset);
-      if (cfa_reg != DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM))
+      lookup_cfa (&cfa);
+      if (cfa.reg != (unsigned long) DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM))
        abort ();
-      cfa_reg = STACK_POINTER_REGNUM;
-      cfa_store_reg = cfa_reg;
-      cfa_store_offset = cfa_offset;
+      cfa.reg = STACK_POINTER_REGNUM;
+      cfa_store = cfa;
       cfa_temp_reg = -1;
       cfa_temp_value = 0;
       return;
@@ -1568,6 +1686,7 @@ output_cfi (cfi, fde)
          break;
 #endif
        case DW_CFA_offset_extended:
+       case DW_CFA_GNU_negative_offset_extended:
        case DW_CFA_def_cfa:
          output_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
           fputc ('\n', asm_out_file);
@@ -1600,6 +1719,9 @@ output_cfi (cfi, fde)
          output_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_offset);
           fputc ('\n', asm_out_file);
          break;
+       case DW_CFA_def_cfa_expression:
+         output_cfa_loc (cfi);
+         break;
        default:
          break;
        }
@@ -1625,6 +1747,17 @@ output_call_frame_info (for_eh)
   /* Do we want to include a pointer to the exception table?  */
   int eh_ptr = for_eh && exception_table_p ();
 
+  /* If we don't have any functions we'll want to unwind out of, don't
+     emit any EH unwind information.  */
+  if (for_eh)
+    {
+      for (i = 0; i < fde_table_in_use; ++i)
+       if (! fde_table[i].nothrow)
+         goto found;
+      return;
+    found:;
+    }
+
   fputc ('\n', asm_out_file);
 
   /* We're going to be generating comments, so turn on app.  */
@@ -1639,7 +1772,7 @@ output_call_frame_info (for_eh)
       tree label = get_file_function_name ('F');
 
       force_data_section ();
-      ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
+      ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (DWARF2_ADDR_SIZE));
       ASM_GLOBALIZE_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
       ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
 #endif
@@ -1743,7 +1876,7 @@ output_call_frame_info (for_eh)
     output_cfi (cfi, NULL);
 
   /* Pad the CIE out to an address sized boundary.  */
-  ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
+  ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (DWARF2_ADDR_SIZE));
   ASM_OUTPUT_LABEL (asm_out_file, l2);
 #ifdef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL
   ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL (asm_out_file, ld, l2, l1);
@@ -1757,6 +1890,10 @@ output_call_frame_info (for_eh)
     {
       fde = &fde_table[i];
 
+      /* Don't emit EH unwind info for leaf functions.  */
+      if (for_eh && fde->nothrow)
+       continue;
+
       ASM_GENERATE_INTERNAL_LABEL (l1, FDE_AFTER_SIZE_LABEL, for_eh + i*2);
       ASM_GENERATE_INTERNAL_LABEL (l2, FDE_END_LABEL, for_eh + i*2);
 #ifdef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL
@@ -1811,7 +1948,7 @@ output_call_frame_info (for_eh)
        output_cfi (cfi, fde);
 
       /* Pad the FDE out to an address sized boundary.  */
-      ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
+      ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (DWARF2_ADDR_SIZE));
       ASM_OUTPUT_LABEL (asm_out_file, l2);
 #ifdef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL
       ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL (asm_out_file, ld, l2, l1);
@@ -1854,6 +1991,7 @@ dwarf2out_begin_prologue ()
   ASM_GENERATE_INTERNAL_LABEL (label, FUNC_BEGIN_LABEL,
                               current_funcdef_number);
   ASM_OUTPUT_LABEL (asm_out_file, label);
+  current_function_func_begin_label = get_identifier (label);
 
   /* Expand the fde table if necessary.  */
   if (fde_table_in_use == fde_table_allocated)
@@ -1873,6 +2011,7 @@ dwarf2out_begin_prologue ()
   fde->dw_fde_current_label = NULL;
   fde->dw_fde_end = NULL;
   fde->dw_fde_cfi = NULL;
+  fde->nothrow = current_function_nothrow;
 
   args_size = old_args_size = 0;
 }
@@ -1928,20 +2067,13 @@ dwarf2out_frame_finish ()
     output_call_frame_info (1);  
 #endif
 }  
+\f
+/* And now, the subset of the debugging information support code necessary
+   for emitting location expressions.  */
 
-#endif /* .debug_frame support */
-
-/* And now, the support for symbolic debugging information.  */
-#ifdef DWARF2_DEBUGGING_INFO
-
-/* NOTE: In the comments in this file, many references are made to
-   "Debugging Information Entries".  This term is abbreviated as `DIE'
-   throughout the remainder of this file.  */
-
-/* An internal representation of the DWARF output is built, and then
-   walked to generate the DWARF debugging info.  The walk of the internal
-   representation is done after the entire program has been compiled.
-   The types below are used to describe the internal representation.  */
+typedef struct dw_val_struct *dw_val_ref;
+typedef struct die_struct *dw_die_ref;
+typedef struct dw_loc_descr_struct *dw_loc_descr_ref;
 
 /* Each DIE may have a series of attribute/value pairs.  Values
    can take on several forms.  The forms that are used in this
@@ -1964,23 +2096,8 @@ typedef enum
 }
 dw_val_class;
 
-/* Various DIE's use offsets relative to the beginning of the
-   .debug_info section to refer to each other.  */
-
-typedef long int dw_offset;
-
-/* Define typedefs here to avoid circular dependencies.  */
-
-typedef struct die_struct *dw_die_ref;
-typedef struct dw_attr_struct *dw_attr_ref;
-typedef struct dw_val_struct *dw_val_ref;
-typedef struct dw_line_info_struct *dw_line_info_ref;
-typedef struct dw_separate_line_info_struct *dw_separate_line_info_ref;
-typedef struct dw_loc_descr_struct *dw_loc_descr_ref;
-typedef struct pubname_struct *pubname_ref;
-typedef dw_die_ref *arange_ref;
-
 /* Describe a double word constant value.  */
+/* ??? Every instance of long_long in the code really means CONST_DOUBLE.  */
 
 typedef struct dw_long_long_struct
 {
@@ -1998,28 +2115,6 @@ typedef struct dw_fp_struct
 }
 dw_float_const;
 
-/* Each entry in the line_info_table maintains the file and
-   line number associated with the label generated for that
-   entry.  The label gives the PC value associated with
-   the line number entry.  */
-
-typedef struct dw_line_info_struct
-{
-  unsigned long dw_file_num;
-  unsigned long dw_line_num;
-}
-dw_line_info_entry;
-
-/* Line information for functions in separate sections; each one gets its
-   own sequence.  */
-typedef struct dw_separate_line_info_struct
-{
-  unsigned long dw_file_num;
-  unsigned long dw_line_num;
-  unsigned long function;
-}
-dw_separate_line_info_entry;
-
 /* The dw_val_node describes an attribute's value, as it is
    represented internally.  */
 
@@ -2028,7 +2123,7 @@ typedef struct dw_val_struct
   dw_val_class val_class;
   union
     {
-      char *val_addr;
+      rtx val_addr;
       dw_loc_descr_ref val_loc;
       long int val_int;
       long unsigned val_unsigned;
@@ -2056,1448 +2151,1818 @@ typedef struct dw_loc_descr_struct
 }
 dw_loc_descr_node;
 
-/* Each DIE attribute has a field specifying the attribute kind,
-   a link to the next attribute in the chain, and an attribute value.
-   Attributes are typically linked below the DIE they modify.  */
-
-typedef struct dw_attr_struct
-{
-  enum dwarf_attribute dw_attr;
-  dw_attr_ref dw_attr_next;
-  dw_val_node dw_attr_val;
-}
-dw_attr_node;
-
-/* The Debugging Information Entry (DIE) structure */
-
-typedef struct die_struct
-{
-  enum dwarf_tag die_tag;
-  dw_attr_ref die_attr;
-  dw_die_ref die_parent;
-  dw_die_ref die_child;
-  dw_die_ref die_sib;
-  dw_offset die_offset;
-  unsigned long die_abbrev;
-}
-die_node;
-
-/* The pubname structure */
+static const char *dwarf_stack_op_name PARAMS ((unsigned));
+static dw_loc_descr_ref new_loc_descr  PARAMS ((enum dwarf_location_atom,
+                                                unsigned long,
+                                                unsigned long));
+static void add_loc_descr              PARAMS ((dw_loc_descr_ref *,
+                                                dw_loc_descr_ref));
+static unsigned long size_of_loc_descr PARAMS ((dw_loc_descr_ref));
+static unsigned long size_of_locs      PARAMS ((dw_loc_descr_ref));
+static void output_loc_operands                PARAMS ((dw_loc_descr_ref));
+static void output_loc_sequence                PARAMS ((dw_loc_descr_ref));
 
-typedef struct pubname_struct
-{
-  dw_die_ref die;
-  char * name;
-}
-pubname_entry;
+/* Convert a DWARF stack opcode into its string name.  */
 
-/* The limbo die list structure.  */
-typedef struct limbo_die_struct
+static const char *
+dwarf_stack_op_name (op)
+     register unsigned op;
 {
-  dw_die_ref die;
-  struct limbo_die_struct *next;
-}
-limbo_die_node;
-
-/* How to start an assembler comment.  */
-#ifndef ASM_COMMENT_START
-#define ASM_COMMENT_START ";#"
-#endif
-
-/* Define a macro which returns non-zero for a TYPE_DECL which was
-   implicitly generated for a tagged type.
-
-   Note that unlike the gcc front end (which generates a NULL named
-   TYPE_DECL node for each complete tagged type, each array type, and
-   each function type node created) the g++ front end generates a
-   _named_ TYPE_DECL node for each tagged type node created.
-   These TYPE_DECLs have DECL_ARTIFICIAL set, so we know not to
-   generate a DW_TAG_typedef DIE for them.  */
-
-#define TYPE_DECL_IS_STUB(decl)                                \
-  (DECL_NAME (decl) == NULL_TREE                       \
-   || (DECL_ARTIFICIAL (decl)                          \
-       && is_tagged_type (TREE_TYPE (decl))            \
-       && ((decl == TYPE_STUB_DECL (TREE_TYPE (decl))) \
-          /* This is necessary for stub decls that     \
-             appear in nested inline functions.  */    \
-          || (DECL_ABSTRACT_ORIGIN (decl) != NULL_TREE \
-              && (decl_ultimate_origin (decl)          \
-                  == TYPE_STUB_DECL (TREE_TYPE (decl)))))))
-
-/* Information concerning the compilation unit's programming
-   language, and compiler version.  */
-
-extern int flag_traditional;
-extern char *version_string;
-
-/* Fixed size portion of the DWARF compilation unit header.  */
-#define DWARF_COMPILE_UNIT_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 3)
-
-/* Fixed size portion of debugging line information prolog.  */
-#define DWARF_LINE_PROLOG_HEADER_SIZE 5
-
-/* Fixed size portion of public names info.  */
-#define DWARF_PUBNAMES_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 2)
-
-/* Fixed size portion of the address range info.  */
-#define DWARF_ARANGES_HEADER_SIZE \
-  (DWARF_ROUND (2 * DWARF_OFFSET_SIZE + 4, PTR_SIZE * 2) - DWARF_OFFSET_SIZE)
-
-/* The default is to have gcc emit the line number tables.  */
-#ifndef DWARF2_ASM_LINE_DEBUG_INFO
-#define DWARF2_ASM_LINE_DEBUG_INFO 0
-#endif
-
-/* Define the architecture-dependent minimum instruction length (in bytes).
-   In this implementation of DWARF, this field is used for information
-   purposes only.  Since GCC generates assembly language, we have
-   no a priori knowledge of how many instruction bytes are generated
-   for each source line, and therefore can use only the  DW_LNE_set_address
-   and DW_LNS_fixed_advance_pc line information commands.  */
-
-#ifndef DWARF_LINE_MIN_INSTR_LENGTH
-#define DWARF_LINE_MIN_INSTR_LENGTH 4
-#endif
-
-/* Minimum line offset in a special line info. opcode.
-   This value was chosen to give a reasonable range of values.  */
-#define DWARF_LINE_BASE  -10
-
-/* First special line opcde - leave room for the standard opcodes.  */
-#define DWARF_LINE_OPCODE_BASE  10
-
-/* Range of line offsets in a special line info. opcode.  */
-#define DWARF_LINE_RANGE  (254-DWARF_LINE_OPCODE_BASE+1)
-
-/* Flag that indicates the initial value of the is_stmt_start flag.
-   In the present implementation, we do not mark any lines as
-   the beginning of a source statement, because that information
-   is not made available by the GCC front-end.  */
-#define        DWARF_LINE_DEFAULT_IS_STMT_START 1
-
-/* This location is used by calc_die_sizes() to keep track
-   the offset of each DIE within the .debug_info section.  */
-static unsigned long next_die_offset;
-
-/* Record the root of the DIE's built for the current compilation unit.  */
-static dw_die_ref comp_unit_die;
-
-/* A list of DIEs with a NULL parent waiting to be relocated.  */
-static limbo_die_node *limbo_die_list = 0;
-
-/* Pointer to an array of filenames referenced by this compilation unit.  */
-static char **file_table;
-
-/* Total number of entries in the table (i.e. array) pointed to by
-   `file_table'.  This is the *total* and includes both used and unused
-   slots.  */
-static unsigned file_table_allocated;
-
-/* Number of entries in the file_table which are actually in use.  */
-static unsigned file_table_in_use;
-
-/* Size (in elements) of increments by which we may expand the filename
-   table.  */
-#define FILE_TABLE_INCREMENT 64
-
-/* Local pointer to the name of the main input file.  Initialized in
-   dwarf2out_init.  */
-static char *primary_filename;
-
-/* For Dwarf output, we must assign lexical-blocks id numbers in the order in
-   which their beginnings are encountered. We output Dwarf debugging info
-   that refers to the beginnings and ends of the ranges of code for each
-   lexical block.  The labels themselves are generated in final.c, which
-   assigns numbers to the blocks in the same way.  */
-static unsigned next_block_number = 2;
-
-/* A pointer to the base of a table of references to DIE's that describe
-   declarations.  The table is indexed by DECL_UID() which is a unique
-   number identifying each decl.  */
-static dw_die_ref *decl_die_table;
-
-/* Number of elements currently allocated for the decl_die_table.  */
-static unsigned decl_die_table_allocated;
-
-/* Number of elements in decl_die_table currently in use.  */
-static unsigned decl_die_table_in_use;
-
-/* Size (in elements) of increments by which we may expand the
-   decl_die_table.  */
-#define DECL_DIE_TABLE_INCREMENT 256
-
-/* Structure used for the decl_scope table.  scope is the current declaration
-   scope, and previous is the entry that is the parent of this scope.  This
-   is usually but not always the immediately preceeding entry.  */
-
-typedef struct decl_scope_struct
-{
-  tree scope;
-  int previous;
-}
-decl_scope_node;
-
-/* A pointer to the base of a table of references to declaration
-   scopes.  This table is a display which tracks the nesting
-   of declaration scopes at the current scope and containing
-   scopes.  This table is used to find the proper place to
-   define type declaration DIE's.  */
-static decl_scope_node *decl_scope_table;
-
-/* Number of elements currently allocated for the decl_scope_table.  */
-static int decl_scope_table_allocated;
-
-/* Current level of nesting of declaration scopes.  */
-static int decl_scope_depth;
-
-/* Size (in elements) of increments by which we may expand the
-   decl_scope_table.  */
-#define DECL_SCOPE_TABLE_INCREMENT 64
-
-/* A pointer to the base of a list of references to DIE's that
-   are uniquely identified by their tag, presence/absence of
-   children DIE's, and list of attribute/value pairs.  */
-static dw_die_ref *abbrev_die_table;
-
-/* Number of elements currently allocated for abbrev_die_table.  */
-static unsigned abbrev_die_table_allocated;
-
-/* Number of elements in type_die_table currently in use.  */
-static unsigned abbrev_die_table_in_use;
-
-/* Size (in elements) of increments by which we may expand the
-   abbrev_die_table.  */
-#define ABBREV_DIE_TABLE_INCREMENT 256
-
-/* A pointer to the base of a table that contains line information
-   for each source code line in .text in the compilation unit.  */
-static dw_line_info_ref line_info_table;
-
-/* Number of elements currently allocated for line_info_table.  */
-static unsigned line_info_table_allocated;
-
-/* Number of elements in separate_line_info_table currently in use.  */
-static unsigned separate_line_info_table_in_use;
-
-/* A pointer to the base of a table that contains line information
-   for each source code line outside of .text in the compilation unit.  */
-static dw_separate_line_info_ref separate_line_info_table;
-
-/* Number of elements currently allocated for separate_line_info_table.  */
-static unsigned separate_line_info_table_allocated;
-
-/* Number of elements in line_info_table currently in use.  */
-static unsigned line_info_table_in_use;
-
-/* Size (in elements) of increments by which we may expand the
-   line_info_table.  */
-#define LINE_INFO_TABLE_INCREMENT 1024
-
-/* A pointer to the base of a table that contains a list of publicly
-   accessible names.  */
-static pubname_ref pubname_table;
-
-/* Number of elements currently allocated for pubname_table.  */
-static unsigned pubname_table_allocated;
-
-/* Number of elements in pubname_table currently in use.  */
-static unsigned pubname_table_in_use;
-
-/* Size (in elements) of increments by which we may expand the
-   pubname_table.  */
-#define PUBNAME_TABLE_INCREMENT 64
-
-/* A pointer to the base of a table that contains a list of publicly
-   accessible names.  */
-static arange_ref arange_table;
-
-/* Number of elements currently allocated for arange_table.  */
-static unsigned arange_table_allocated;
-
-/* Number of elements in arange_table currently in use.  */
-static unsigned arange_table_in_use;
-
-/* Size (in elements) of increments by which we may expand the
-   arange_table.  */
-#define ARANGE_TABLE_INCREMENT 64
-
-/* A pointer to the base of a list of pending types which we haven't
-   generated DIEs for yet, but which we will have to come back to
-   later on.  */
-
-static tree *pending_types_list;
-
-/* Number of elements currently allocated for the pending_types_list.  */
-static unsigned pending_types_allocated;
-
-/* Number of elements of pending_types_list currently in use.  */
-static unsigned pending_types;
-
-/* Size (in elements) of increments by which we may expand the pending
-   types list.  Actually, a single hunk of space of this size should
-   be enough for most typical programs.         */
-#define PENDING_TYPES_INCREMENT 64
-
-/* A pointer to the base of a list of incomplete types which might be
-   completed at some later time.  */
-
-static tree *incomplete_types_list;
-
-/* Number of elements currently allocated for the incomplete_types_list.  */
-static unsigned incomplete_types_allocated;
-
-/* Number of elements of incomplete_types_list currently in use.  */
-static unsigned incomplete_types;
-
-/* Size (in elements) of increments by which we may expand the incomplete
-   types list.  Actually, a single hunk of space of this size should
-   be enough for most typical programs.         */
-#define INCOMPLETE_TYPES_INCREMENT 64
-
-/* Record whether the function being analyzed contains inlined functions.  */
-static int current_function_has_inlines;
-#if 0 && defined (MIPS_DEBUGGING_INFO)
-static int comp_unit_has_inlines;
-#endif
-
-/* Forward declarations for functions defined in this file.  */
-
-static void addr_const_to_string       PROTO((dyn_string_t, rtx));
-static char *addr_to_string            PROTO((rtx));
-static int is_pseudo_reg               PROTO((rtx));
-static tree type_main_variant          PROTO((tree));
-static int is_tagged_type              PROTO((tree));
-static const char *dwarf_tag_name      PROTO((unsigned));
-static const char *dwarf_attr_name     PROTO((unsigned));
-static const char *dwarf_form_name     PROTO((unsigned));
-static const char *dwarf_stack_op_name PROTO((unsigned));
-#if 0
-static const char *dwarf_type_encoding_name PROTO((unsigned));
-#endif
-static tree decl_ultimate_origin       PROTO((tree));
-static tree block_ultimate_origin      PROTO((tree));
-static tree decl_class_context         PROTO((tree));
-static void add_dwarf_attr             PROTO((dw_die_ref, dw_attr_ref));
-static void add_AT_flag                        PROTO((dw_die_ref,
-                                              enum dwarf_attribute,
-                                              unsigned));
-static void add_AT_int                 PROTO((dw_die_ref,
-                                              enum dwarf_attribute, long));
-static void add_AT_unsigned            PROTO((dw_die_ref,
-                                              enum dwarf_attribute,
-                                              unsigned long));
-static void add_AT_long_long           PROTO((dw_die_ref,
-                                              enum dwarf_attribute,
-                                              unsigned long, unsigned long));
-static void add_AT_float               PROTO((dw_die_ref,
-                                              enum dwarf_attribute,
-                                              unsigned, long *));
-static void add_AT_string              PROTO((dw_die_ref,
-                                              enum dwarf_attribute,
-                                              const char *));
-static void add_AT_die_ref             PROTO((dw_die_ref,
-                                              enum dwarf_attribute,
-                                              dw_die_ref));
-static void add_AT_fde_ref             PROTO((dw_die_ref,
-                                              enum dwarf_attribute,
-                                              unsigned));
-static void add_AT_loc                 PROTO((dw_die_ref,
-                                              enum dwarf_attribute,
-                                              dw_loc_descr_ref));
-static void add_AT_addr                        PROTO((dw_die_ref,
-                                              enum dwarf_attribute, char *));
-static void add_AT_lbl_id              PROTO((dw_die_ref,
-                                              enum dwarf_attribute, char *));
-static void add_AT_lbl_offset          PROTO((dw_die_ref,
-                                              enum dwarf_attribute, char *));
-static dw_attr_ref get_AT              PROTO((dw_die_ref,
-                                              enum dwarf_attribute));
-static const char *get_AT_low_pc       PROTO((dw_die_ref));
-static const char *get_AT_hi_pc                PROTO((dw_die_ref));
-static const char *get_AT_string       PROTO((dw_die_ref,
-                                              enum dwarf_attribute));
-static int get_AT_flag                 PROTO((dw_die_ref,
-                                              enum dwarf_attribute));
-static unsigned get_AT_unsigned                PROTO((dw_die_ref,
-                                              enum dwarf_attribute));
-static int is_c_family                 PROTO((void));
-static int is_fortran                  PROTO((void));
-static void remove_AT                  PROTO((dw_die_ref,
-                                              enum dwarf_attribute));
-static void remove_children            PROTO((dw_die_ref));
-static void add_child_die              PROTO((dw_die_ref, dw_die_ref));
-static dw_die_ref new_die              PROTO((enum dwarf_tag, dw_die_ref));
-static dw_die_ref lookup_type_die      PROTO((tree));
-static void equate_type_number_to_die  PROTO((tree, dw_die_ref));
-static dw_die_ref lookup_decl_die      PROTO((tree));
-static void equate_decl_number_to_die  PROTO((tree, dw_die_ref));
-static dw_loc_descr_ref new_loc_descr  PROTO((enum dwarf_location_atom,
-                                              unsigned long, unsigned long));
-static void add_loc_descr              PROTO((dw_loc_descr_ref *,
-                                              dw_loc_descr_ref));
-static void print_spaces               PROTO((FILE *));
-static void print_die                  PROTO((dw_die_ref, FILE *));
-static void print_dwarf_line_table     PROTO((FILE *));
-static void add_sibling_attributes     PROTO((dw_die_ref));
-static void build_abbrev_table         PROTO((dw_die_ref));
-static unsigned long size_of_string    PROTO((const char *));
-static unsigned long size_of_loc_descr PROTO((dw_loc_descr_ref));
-static unsigned long size_of_locs      PROTO((dw_loc_descr_ref));
-static int constant_size               PROTO((long unsigned));
-static unsigned long size_of_die       PROTO((dw_die_ref));
-static void calc_die_sizes             PROTO((dw_die_ref));
-static unsigned long size_of_line_prolog       PROTO((void));
-static unsigned long size_of_pubnames  PROTO((void));
-static unsigned long size_of_aranges   PROTO((void));
-static enum dwarf_form value_format    PROTO((dw_attr_ref));
-static void output_value_format                PROTO((dw_attr_ref));
-static void output_abbrev_section      PROTO((void));
-static void output_loc_operands                PROTO((dw_loc_descr_ref));
-static void output_die                 PROTO((dw_die_ref));
-static void output_compilation_unit_header PROTO((void));
-static const char *dwarf2_name         PROTO((tree, int));
-static void add_pubname                        PROTO((tree, dw_die_ref));
-static void output_pubnames            PROTO((void));
-static void add_arange                 PROTO((tree, dw_die_ref));
-static void output_aranges             PROTO((void));
-static void output_line_info           PROTO((void));
-static int is_body_block               PROTO((tree));
-static dw_die_ref base_type_die                PROTO((tree));
-static tree root_type                  PROTO((tree));
-static int is_base_type                        PROTO((tree));
-static dw_die_ref modified_type_die    PROTO((tree, int, int, dw_die_ref));
-static int type_is_enum                        PROTO((tree));
-static dw_loc_descr_ref reg_loc_descriptor PROTO((rtx));
-static dw_loc_descr_ref based_loc_descr        PROTO((unsigned, long));
-static int is_based_loc                        PROTO((rtx));
-static dw_loc_descr_ref mem_loc_descriptor PROTO((rtx, enum machine_mode mode));
-static dw_loc_descr_ref concat_loc_descriptor PROTO((rtx, rtx));
-static dw_loc_descr_ref loc_descriptor PROTO((rtx));
-static unsigned ceiling                        PROTO((unsigned, unsigned));
-static tree field_type                 PROTO((tree));
-static unsigned simple_type_align_in_bits PROTO((tree));
-static unsigned simple_type_size_in_bits PROTO((tree));
-static unsigned field_byte_offset              PROTO((tree));
-static void add_AT_location_description        PROTO((dw_die_ref,
-                                              enum dwarf_attribute, rtx));
-static void add_data_member_location_attribute PROTO((dw_die_ref, tree));
-static void add_const_value_attribute  PROTO((dw_die_ref, rtx));
-static void add_location_or_const_value_attribute PROTO((dw_die_ref, tree));
-static void add_name_attribute         PROTO((dw_die_ref, const char *));
-static void add_bound_info             PROTO((dw_die_ref,
-                                              enum dwarf_attribute, tree));
-static void add_subscript_info         PROTO((dw_die_ref, tree));
-static void add_byte_size_attribute    PROTO((dw_die_ref, tree));
-static void add_bit_offset_attribute   PROTO((dw_die_ref, tree));
-static void add_bit_size_attribute     PROTO((dw_die_ref, tree));
-static void add_prototyped_attribute   PROTO((dw_die_ref, tree));
-static void add_abstract_origin_attribute PROTO((dw_die_ref, tree));
-static void add_pure_or_virtual_attribute PROTO((dw_die_ref, tree));
-static void add_src_coords_attributes  PROTO((dw_die_ref, tree));
-static void add_name_and_src_coords_attributes PROTO((dw_die_ref, tree));
-static void push_decl_scope            PROTO((tree));
-static dw_die_ref scope_die_for                PROTO((tree, dw_die_ref));
-static void pop_decl_scope             PROTO((void));
-static void add_type_attribute         PROTO((dw_die_ref, tree, int, int,
-                                              dw_die_ref));
-static char *type_tag                  PROTO((tree));
-static tree member_declared_type       PROTO((tree));
-#if 0
-static char *decl_start_label          PROTO((tree));
-#endif
-static void gen_array_type_die         PROTO((tree, dw_die_ref));
-static void gen_set_type_die           PROTO((tree, dw_die_ref));
-#if 0
-static void gen_entry_point_die                PROTO((tree, dw_die_ref));
-#endif
-static void pend_type                  PROTO((tree));
-static void output_pending_types_for_scope PROTO((dw_die_ref));
-static void gen_inlined_enumeration_type_die PROTO((tree, dw_die_ref));
-static void gen_inlined_structure_type_die PROTO((tree, dw_die_ref));
-static void gen_inlined_union_type_die PROTO((tree, dw_die_ref));
-static void gen_enumeration_type_die   PROTO((tree, dw_die_ref));
-static dw_die_ref gen_formal_parameter_die PROTO((tree, dw_die_ref));
-static void gen_unspecified_parameters_die PROTO((tree, dw_die_ref));
-static void gen_formal_types_die       PROTO((tree, dw_die_ref));
-static void gen_subprogram_die         PROTO((tree, dw_die_ref));
-static void gen_variable_die           PROTO((tree, dw_die_ref));
-static void gen_label_die              PROTO((tree, dw_die_ref));
-static void gen_lexical_block_die      PROTO((tree, dw_die_ref, int));
-static void gen_inlined_subroutine_die PROTO((tree, dw_die_ref, int));
-static void gen_field_die              PROTO((tree, dw_die_ref));
-static void gen_ptr_to_mbr_type_die    PROTO((tree, dw_die_ref));
-static dw_die_ref gen_compile_unit_die PROTO((const char *));
-static void gen_string_type_die                PROTO((tree, dw_die_ref));
-static void gen_inheritance_die                PROTO((tree, dw_die_ref));
-static void gen_member_die             PROTO((tree, dw_die_ref));
-static void gen_struct_or_union_type_die PROTO((tree, dw_die_ref));
-static void gen_subroutine_type_die    PROTO((tree, dw_die_ref));
-static void gen_typedef_die            PROTO((tree, dw_die_ref));
-static void gen_type_die               PROTO((tree, dw_die_ref));
-static void gen_tagged_type_instantiation_die PROTO((tree, dw_die_ref));
-static void gen_block_die              PROTO((tree, dw_die_ref, int));
-static void decls_for_scope            PROTO((tree, dw_die_ref, int));
-static int is_redundant_typedef                PROTO((tree));
-static void gen_decl_die               PROTO((tree, dw_die_ref));
-static unsigned lookup_filename                PROTO((const char *));
-static void add_incomplete_type                PROTO((tree));
-static void retry_incomplete_types     PROTO((void));
-
-/* Section names used to hold DWARF debugging information.  */
-#ifndef DEBUG_INFO_SECTION
-#define DEBUG_INFO_SECTION     ".debug_info"
-#endif
-#ifndef ABBREV_SECTION
-#define ABBREV_SECTION         ".debug_abbrev"
-#endif
-#ifndef ARANGES_SECTION
-#define ARANGES_SECTION                ".debug_aranges"
-#endif
-#ifndef DW_MACINFO_SECTION
-#define DW_MACINFO_SECTION     ".debug_macinfo"
-#endif
-#ifndef DEBUG_LINE_SECTION
-#define DEBUG_LINE_SECTION     ".debug_line"
-#endif
-#ifndef LOC_SECTION
-#define LOC_SECTION            ".debug_loc"
-#endif
-#ifndef PUBNAMES_SECTION
-#define PUBNAMES_SECTION       ".debug_pubnames"
-#endif
-#ifndef STR_SECTION
-#define STR_SECTION            ".debug_str"
-#endif
-
-/* Standard ELF section names for compiled code and data.  */
-#ifndef TEXT_SECTION
-#define TEXT_SECTION           ".text"
-#endif
-#ifndef DATA_SECTION
-#define DATA_SECTION           ".data"
-#endif
-#ifndef BSS_SECTION
-#define BSS_SECTION            ".bss"
-#endif
-
-/* Labels we insert at beginning sections we can reference instead of
-   the section names themselves. */
-
-#ifndef TEXT_SECTION_LABEL
-#define TEXT_SECTION_LABEL      "Ltext"
-#endif
-#ifndef DEBUG_LINE_SECTION_LABEL
-#define DEBUG_LINE_SECTION_LABEL "Ldebug_line"
-#endif
-#ifndef DEBUG_INFO_SECTION_LABEL
-#define DEBUG_INFO_SECTION_LABEL "Ldebug_info"
-#endif
-#ifndef ABBREV_SECTION_LABEL
-#define ABBREV_SECTION_LABEL     "Ldebug_abbrev"
-#endif
-
-
-/* Definitions of defaults for formats and names of various special
-   (artificial) labels which may be generated within this file (when the -g
-   options is used and DWARF_DEBUGGING_INFO is in effect.
-   If necessary, these may be overridden from within the tm.h file, but
-   typically, overriding these defaults is unnecessary.  */
-
-static char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES];
-static char text_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
-static char abbrev_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
-static char debug_info_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
-static char debug_line_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
-#ifndef TEXT_END_LABEL
-#define TEXT_END_LABEL         "Letext"
-#endif
-#ifndef DATA_END_LABEL
-#define DATA_END_LABEL         "Ledata"
-#endif
-#ifndef BSS_END_LABEL
-#define BSS_END_LABEL           "Lebss"
-#endif
-#ifndef INSN_LABEL_FMT
-#define INSN_LABEL_FMT         "LI%u_"
-#endif
-#ifndef BLOCK_BEGIN_LABEL
-#define BLOCK_BEGIN_LABEL      "LBB"
-#endif
-#ifndef BLOCK_END_LABEL
-#define BLOCK_END_LABEL                "LBE"
-#endif
-#ifndef BODY_BEGIN_LABEL
-#define BODY_BEGIN_LABEL       "Lbb"
-#endif
-#ifndef BODY_END_LABEL
-#define BODY_END_LABEL         "Lbe"
-#endif
-#ifndef LINE_CODE_LABEL
-#define LINE_CODE_LABEL                "LM"
-#endif
-#ifndef SEPARATE_LINE_CODE_LABEL
-#define SEPARATE_LINE_CODE_LABEL       "LSM"
-#endif
-
-/* Convert a reference to the assembler name of a C-level name.  This
-   macro has the same effect as ASM_OUTPUT_LABELREF, but copies to
-   a string rather than writing to a file.  */
-#ifndef ASM_NAME_TO_STRING
-#define ASM_NAME_TO_STRING(STR, NAME)                  \
-  do {                                                 \
-      if ((NAME)[0] == '*')                            \
-       dyn_string_append (STR, NAME + 1);              \
-      else                                             \
-       {                                               \
-         const char *newstr;                           \
-         STRIP_NAME_ENCODING (newstr, NAME);           \
-         dyn_string_append (STR, user_label_prefix);   \
-         dyn_string_append (STR, newstr);              \
-       }                                               \
-  }                                                    \
-  while (0)
-#endif
-\f
-/* We allow a language front-end to designate a function that is to be
-   called to "demangle" any name before it it put into a DIE.  */
-
-static const char *(*demangle_name_func) PROTO((const char *));
-
-void
-dwarf2out_set_demangle_name_func (func)
-     const char *(*func) PROTO((const char *));
-{
-  demangle_name_func = func;
-}
-\f
-/* Convert an integer constant expression into assembler syntax.  Addition
-   and subtraction are the only arithmetic that may appear in these
-   expressions.   This is an adaptation of output_addr_const in final.c.
-   Here, the target of the conversion is a string buffer.  We can't use
-   output_addr_const directly, because it writes to a file.  */
-
-static void
-addr_const_to_string (str, x)
-     dyn_string_t str;
-     rtx x;
-{
-  char buf1[256];
-
-restart:
-  switch (GET_CODE (x))
-    {
-    case PC:
-      if (flag_pic)
-       dyn_string_append (str, ",");
-      else
-       abort ();
-      break;
-
-    case SYMBOL_REF:
-      ASM_NAME_TO_STRING (str, XSTR (x, 0));
-      break;
-
-    case LABEL_REF:
-      ASM_GENERATE_INTERNAL_LABEL (buf1, "L", CODE_LABEL_NUMBER (XEXP (x, 0)));
-      ASM_NAME_TO_STRING (str, buf1);
-      break;
-
-    case CODE_LABEL:
-      ASM_GENERATE_INTERNAL_LABEL (buf1, "L", CODE_LABEL_NUMBER (x));
-      ASM_NAME_TO_STRING (str, buf1);
-      break;
-
-    case CONST_INT:
-      sprintf (buf1, HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
-      dyn_string_append (str, buf1);
-      break;
-
-    case CONST:
-      /* This used to output parentheses around the expression, but that does 
-         not work on the 386 (either ATT or BSD assembler).  */
-      addr_const_to_string (str, XEXP (x, 0));
-      break;
-
-    case CONST_DOUBLE:
-      if (GET_MODE (x) == VOIDmode)
-       {
-         /* We can use %d if the number is one word and positive.  */
-         if (CONST_DOUBLE_HIGH (x))
-           sprintf (buf1, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
-                    CONST_DOUBLE_HIGH (x), CONST_DOUBLE_LOW (x));
-         else if (CONST_DOUBLE_LOW (x) < 0)
-           sprintf (buf1, HOST_WIDE_INT_PRINT_HEX, CONST_DOUBLE_LOW (x));
-         else
-           sprintf (buf1, HOST_WIDE_INT_PRINT_DEC,
-                    CONST_DOUBLE_LOW (x));
-         dyn_string_append (str, buf1);
-       }
-      else
-       /* We can't handle floating point constants; PRINT_OPERAND must
-          handle them.  */
-       output_operand_lossage ("floating constant misused");
-      break;
-
-    case PLUS:
-      /* Some assemblers need integer constants to appear last (eg masm).  */
-      if (GET_CODE (XEXP (x, 0)) == CONST_INT)
-       {
-         addr_const_to_string (str, XEXP (x, 1));
-         if (INTVAL (XEXP (x, 0)) >= 0)
-           dyn_string_append (str, "+");
-
-         addr_const_to_string (str, XEXP (x, 0));
-       }
-      else
-       {
-         addr_const_to_string (str, XEXP (x, 0));
-         if (INTVAL (XEXP (x, 1)) >= 0)
-           dyn_string_append (str, "+");
-
-         addr_const_to_string (str, XEXP (x, 1));
-       }
-      break;
-
-    case MINUS:
-      /* Avoid outputting things like x-x or x+5-x, since some assemblers
-         can't handle that.  */
-      x = simplify_subtraction (x);
-      if (GET_CODE (x) != MINUS)
-       goto restart;
-
-      addr_const_to_string (str, XEXP (x, 0));
-      dyn_string_append (str, "-");
-      if (GET_CODE (XEXP (x, 1)) == CONST_INT
-         && INTVAL (XEXP (x, 1)) < 0)
-       {
-         dyn_string_append (str, ASM_OPEN_PAREN);
-         addr_const_to_string (str, XEXP (x, 1));
-         dyn_string_append (str, ASM_CLOSE_PAREN);
-       }
-      else
-       addr_const_to_string (str, XEXP (x, 1));
-      break;
-
-    case ZERO_EXTEND:
-    case SIGN_EXTEND:
-      addr_const_to_string (str, XEXP (x, 0));
-      break;
-
-    default:
-      output_operand_lossage ("invalid expression as operand");
-    }
-}
-
-/* Convert an address constant to a string, and return a pointer to
-   a copy of the result, located on the heap.  */
-
-static char *
-addr_to_string (x)
-     rtx x;
-{
-  dyn_string_t ds = dyn_string_new (256);
-  char *s;
-
-  addr_const_to_string (ds, x);
-  
-  /* Return the dynamically allocated string, but free the
-     dyn_string_t itself.  */
-  s = ds->s;
-  free (ds);
-  return s;
-}
-
-/* Test if rtl node points to a pseudo register.  */
-
-static inline int
-is_pseudo_reg (rtl)
-     register rtx rtl;
-{
-  return (((GET_CODE (rtl) == REG) && (REGNO (rtl) >= FIRST_PSEUDO_REGISTER))
-         || ((GET_CODE (rtl) == SUBREG)
-             && (REGNO (XEXP (rtl, 0)) >= FIRST_PSEUDO_REGISTER)));
-}
-
-/* Return a reference to a type, with its const and volatile qualifiers
-   removed.  */
-
-static inline tree
-type_main_variant (type)
-     register tree type;
-{
-  type = TYPE_MAIN_VARIANT (type);
-
-  /* There really should be only one main variant among any group of variants 
-     of a given type (and all of the MAIN_VARIANT values for all members of
-     the group should point to that one type) but sometimes the C front-end
-     messes this up for array types, so we work around that bug here.  */
-
-  if (TREE_CODE (type) == ARRAY_TYPE)
-    while (type != TYPE_MAIN_VARIANT (type))
-      type = TYPE_MAIN_VARIANT (type);
-
-  return type;
-}
-
-/* Return non-zero if the given type node represents a tagged type.  */
-
-static inline int
-is_tagged_type (type)
-     register tree type;
-{
-  register enum tree_code code = TREE_CODE (type);
-
-  return (code == RECORD_TYPE || code == UNION_TYPE
-         || code == QUAL_UNION_TYPE || code == ENUMERAL_TYPE);
-}
-
-/* Convert a DIE tag into its string name.  */
-
-static const char *
-dwarf_tag_name (tag)
-     register unsigned tag;
-{
-  switch (tag)
-    {
-    case DW_TAG_padding:
-      return "DW_TAG_padding";
-    case DW_TAG_array_type:
-      return "DW_TAG_array_type";
-    case DW_TAG_class_type:
-      return "DW_TAG_class_type";
-    case DW_TAG_entry_point:
-      return "DW_TAG_entry_point";
-    case DW_TAG_enumeration_type:
-      return "DW_TAG_enumeration_type";
-    case DW_TAG_formal_parameter:
-      return "DW_TAG_formal_parameter";
-    case DW_TAG_imported_declaration:
-      return "DW_TAG_imported_declaration";
-    case DW_TAG_label:
-      return "DW_TAG_label";
-    case DW_TAG_lexical_block:
-      return "DW_TAG_lexical_block";
-    case DW_TAG_member:
-      return "DW_TAG_member";
-    case DW_TAG_pointer_type:
-      return "DW_TAG_pointer_type";
-    case DW_TAG_reference_type:
-      return "DW_TAG_reference_type";
-    case DW_TAG_compile_unit:
-      return "DW_TAG_compile_unit";
-    case DW_TAG_string_type:
-      return "DW_TAG_string_type";
-    case DW_TAG_structure_type:
-      return "DW_TAG_structure_type";
-    case DW_TAG_subroutine_type:
-      return "DW_TAG_subroutine_type";
-    case DW_TAG_typedef:
-      return "DW_TAG_typedef";
-    case DW_TAG_union_type:
-      return "DW_TAG_union_type";
-    case DW_TAG_unspecified_parameters:
-      return "DW_TAG_unspecified_parameters";
-    case DW_TAG_variant:
-      return "DW_TAG_variant";
-    case DW_TAG_common_block:
-      return "DW_TAG_common_block";
-    case DW_TAG_common_inclusion:
-      return "DW_TAG_common_inclusion";
-    case DW_TAG_inheritance:
-      return "DW_TAG_inheritance";
-    case DW_TAG_inlined_subroutine:
-      return "DW_TAG_inlined_subroutine";
-    case DW_TAG_module:
-      return "DW_TAG_module";
-    case DW_TAG_ptr_to_member_type:
-      return "DW_TAG_ptr_to_member_type";
-    case DW_TAG_set_type:
-      return "DW_TAG_set_type";
-    case DW_TAG_subrange_type:
-      return "DW_TAG_subrange_type";
-    case DW_TAG_with_stmt:
-      return "DW_TAG_with_stmt";
-    case DW_TAG_access_declaration:
-      return "DW_TAG_access_declaration";
-    case DW_TAG_base_type:
-      return "DW_TAG_base_type";
-    case DW_TAG_catch_block:
-      return "DW_TAG_catch_block";
-    case DW_TAG_const_type:
-      return "DW_TAG_const_type";
-    case DW_TAG_constant:
-      return "DW_TAG_constant";
-    case DW_TAG_enumerator:
-      return "DW_TAG_enumerator";
-    case DW_TAG_file_type:
-      return "DW_TAG_file_type";
-    case DW_TAG_friend:
-      return "DW_TAG_friend";
-    case DW_TAG_namelist:
-      return "DW_TAG_namelist";
-    case DW_TAG_namelist_item:
-      return "DW_TAG_namelist_item";
-    case DW_TAG_packed_type:
-      return "DW_TAG_packed_type";
-    case DW_TAG_subprogram:
-      return "DW_TAG_subprogram";
-    case DW_TAG_template_type_param:
-      return "DW_TAG_template_type_param";
-    case DW_TAG_template_value_param:
-      return "DW_TAG_template_value_param";
-    case DW_TAG_thrown_type:
-      return "DW_TAG_thrown_type";
-    case DW_TAG_try_block:
-      return "DW_TAG_try_block";
-    case DW_TAG_variant_part:
-      return "DW_TAG_variant_part";
-    case DW_TAG_variable:
-      return "DW_TAG_variable";
-    case DW_TAG_volatile_type:
-      return "DW_TAG_volatile_type";
-    case DW_TAG_MIPS_loop:
-      return "DW_TAG_MIPS_loop";
-    case DW_TAG_format_label:
-      return "DW_TAG_format_label";
-    case DW_TAG_function_template:
-      return "DW_TAG_function_template";
-    case DW_TAG_class_template:
-      return "DW_TAG_class_template";
-    default:
-      return "DW_TAG_<unknown>";
-    }
-}
-
-/* Convert a DWARF attribute code into its string name.  */
-
-static const char *
-dwarf_attr_name (attr)
-     register unsigned attr;
-{
-  switch (attr)
-    {
-    case DW_AT_sibling:
-      return "DW_AT_sibling";
-    case DW_AT_location:
-      return "DW_AT_location";
-    case DW_AT_name:
-      return "DW_AT_name";
-    case DW_AT_ordering:
-      return "DW_AT_ordering";
-    case DW_AT_subscr_data:
-      return "DW_AT_subscr_data";
-    case DW_AT_byte_size:
-      return "DW_AT_byte_size";
-    case DW_AT_bit_offset:
-      return "DW_AT_bit_offset";
-    case DW_AT_bit_size:
-      return "DW_AT_bit_size";
-    case DW_AT_element_list:
-      return "DW_AT_element_list";
-    case DW_AT_stmt_list:
-      return "DW_AT_stmt_list";
-    case DW_AT_low_pc:
-      return "DW_AT_low_pc";
-    case DW_AT_high_pc:
-      return "DW_AT_high_pc";
-    case DW_AT_language:
-      return "DW_AT_language";
-    case DW_AT_member:
-      return "DW_AT_member";
-    case DW_AT_discr:
-      return "DW_AT_discr";
-    case DW_AT_discr_value:
-      return "DW_AT_discr_value";
-    case DW_AT_visibility:
-      return "DW_AT_visibility";
-    case DW_AT_import:
-      return "DW_AT_import";
-    case DW_AT_string_length:
-      return "DW_AT_string_length";
-    case DW_AT_common_reference:
-      return "DW_AT_common_reference";
-    case DW_AT_comp_dir:
-      return "DW_AT_comp_dir";
-    case DW_AT_const_value:
-      return "DW_AT_const_value";
-    case DW_AT_containing_type:
-      return "DW_AT_containing_type";
-    case DW_AT_default_value:
-      return "DW_AT_default_value";
-    case DW_AT_inline:
-      return "DW_AT_inline";
-    case DW_AT_is_optional:
-      return "DW_AT_is_optional";
-    case DW_AT_lower_bound:
-      return "DW_AT_lower_bound";
-    case DW_AT_producer:
-      return "DW_AT_producer";
-    case DW_AT_prototyped:
-      return "DW_AT_prototyped";
-    case DW_AT_return_addr:
-      return "DW_AT_return_addr";
-    case DW_AT_start_scope:
-      return "DW_AT_start_scope";
-    case DW_AT_stride_size:
-      return "DW_AT_stride_size";
-    case DW_AT_upper_bound:
-      return "DW_AT_upper_bound";
-    case DW_AT_abstract_origin:
-      return "DW_AT_abstract_origin";
-    case DW_AT_accessibility:
-      return "DW_AT_accessibility";
-    case DW_AT_address_class:
-      return "DW_AT_address_class";
-    case DW_AT_artificial:
-      return "DW_AT_artificial";
-    case DW_AT_base_types:
-      return "DW_AT_base_types";
-    case DW_AT_calling_convention:
-      return "DW_AT_calling_convention";
-    case DW_AT_count:
-      return "DW_AT_count";
-    case DW_AT_data_member_location:
-      return "DW_AT_data_member_location";
-    case DW_AT_decl_column:
-      return "DW_AT_decl_column";
-    case DW_AT_decl_file:
-      return "DW_AT_decl_file";
-    case DW_AT_decl_line:
-      return "DW_AT_decl_line";
-    case DW_AT_declaration:
-      return "DW_AT_declaration";
-    case DW_AT_discr_list:
-      return "DW_AT_discr_list";
-    case DW_AT_encoding:
-      return "DW_AT_encoding";
-    case DW_AT_external:
-      return "DW_AT_external";
-    case DW_AT_frame_base:
-      return "DW_AT_frame_base";
-    case DW_AT_friend:
-      return "DW_AT_friend";
-    case DW_AT_identifier_case:
-      return "DW_AT_identifier_case";
-    case DW_AT_macro_info:
-      return "DW_AT_macro_info";
-    case DW_AT_namelist_items:
-      return "DW_AT_namelist_items";
-    case DW_AT_priority:
-      return "DW_AT_priority";
-    case DW_AT_segment:
-      return "DW_AT_segment";
-    case DW_AT_specification:
-      return "DW_AT_specification";
-    case DW_AT_static_link:
-      return "DW_AT_static_link";
-    case DW_AT_type:
-      return "DW_AT_type";
-    case DW_AT_use_location:
-      return "DW_AT_use_location";
-    case DW_AT_variable_parameter:
-      return "DW_AT_variable_parameter";
-    case DW_AT_virtuality:
-      return "DW_AT_virtuality";
-    case DW_AT_vtable_elem_location:
-      return "DW_AT_vtable_elem_location";
-
-    case DW_AT_MIPS_fde:
-      return "DW_AT_MIPS_fde";
-    case DW_AT_MIPS_loop_begin:
-      return "DW_AT_MIPS_loop_begin";
-    case DW_AT_MIPS_tail_loop_begin:
-      return "DW_AT_MIPS_tail_loop_begin";
-    case DW_AT_MIPS_epilog_begin:
-      return "DW_AT_MIPS_epilog_begin";
-    case DW_AT_MIPS_loop_unroll_factor:
-      return "DW_AT_MIPS_loop_unroll_factor";
-    case DW_AT_MIPS_software_pipeline_depth:
-      return "DW_AT_MIPS_software_pipeline_depth";
-    case DW_AT_MIPS_linkage_name:
-      return "DW_AT_MIPS_linkage_name";
-    case DW_AT_MIPS_stride:
-      return "DW_AT_MIPS_stride";
-    case DW_AT_MIPS_abstract_name:
-      return "DW_AT_MIPS_abstract_name";
-    case DW_AT_MIPS_clone_origin:
-      return "DW_AT_MIPS_clone_origin";
-    case DW_AT_MIPS_has_inlines:
-      return "DW_AT_MIPS_has_inlines";
-
-    case DW_AT_sf_names:
-      return "DW_AT_sf_names";
-    case DW_AT_src_info:
-      return "DW_AT_src_info";
-    case DW_AT_mac_info:
-      return "DW_AT_mac_info";
-    case DW_AT_src_coords:
-      return "DW_AT_src_coords";
-    case DW_AT_body_begin:
-      return "DW_AT_body_begin";
-    case DW_AT_body_end:
-      return "DW_AT_body_end";
+  switch (op)
+    {
+    case DW_OP_addr:
+      return "DW_OP_addr";
+    case DW_OP_deref:
+      return "DW_OP_deref";
+    case DW_OP_const1u:
+      return "DW_OP_const1u";
+    case DW_OP_const1s:
+      return "DW_OP_const1s";
+    case DW_OP_const2u:
+      return "DW_OP_const2u";
+    case DW_OP_const2s:
+      return "DW_OP_const2s";
+    case DW_OP_const4u:
+      return "DW_OP_const4u";
+    case DW_OP_const4s:
+      return "DW_OP_const4s";
+    case DW_OP_const8u:
+      return "DW_OP_const8u";
+    case DW_OP_const8s:
+      return "DW_OP_const8s";
+    case DW_OP_constu:
+      return "DW_OP_constu";
+    case DW_OP_consts:
+      return "DW_OP_consts";
+    case DW_OP_dup:
+      return "DW_OP_dup";
+    case DW_OP_drop:
+      return "DW_OP_drop";
+    case DW_OP_over:
+      return "DW_OP_over";
+    case DW_OP_pick:
+      return "DW_OP_pick";
+    case DW_OP_swap:
+      return "DW_OP_swap";
+    case DW_OP_rot:
+      return "DW_OP_rot";
+    case DW_OP_xderef:
+      return "DW_OP_xderef";
+    case DW_OP_abs:
+      return "DW_OP_abs";
+    case DW_OP_and:
+      return "DW_OP_and";
+    case DW_OP_div:
+      return "DW_OP_div";
+    case DW_OP_minus:
+      return "DW_OP_minus";
+    case DW_OP_mod:
+      return "DW_OP_mod";
+    case DW_OP_mul:
+      return "DW_OP_mul";
+    case DW_OP_neg:
+      return "DW_OP_neg";
+    case DW_OP_not:
+      return "DW_OP_not";
+    case DW_OP_or:
+      return "DW_OP_or";
+    case DW_OP_plus:
+      return "DW_OP_plus";
+    case DW_OP_plus_uconst:
+      return "DW_OP_plus_uconst";
+    case DW_OP_shl:
+      return "DW_OP_shl";
+    case DW_OP_shr:
+      return "DW_OP_shr";
+    case DW_OP_shra:
+      return "DW_OP_shra";
+    case DW_OP_xor:
+      return "DW_OP_xor";
+    case DW_OP_bra:
+      return "DW_OP_bra";
+    case DW_OP_eq:
+      return "DW_OP_eq";
+    case DW_OP_ge:
+      return "DW_OP_ge";
+    case DW_OP_gt:
+      return "DW_OP_gt";
+    case DW_OP_le:
+      return "DW_OP_le";
+    case DW_OP_lt:
+      return "DW_OP_lt";
+    case DW_OP_ne:
+      return "DW_OP_ne";
+    case DW_OP_skip:
+      return "DW_OP_skip";
+    case DW_OP_lit0:
+      return "DW_OP_lit0";
+    case DW_OP_lit1:
+      return "DW_OP_lit1";
+    case DW_OP_lit2:
+      return "DW_OP_lit2";
+    case DW_OP_lit3:
+      return "DW_OP_lit3";
+    case DW_OP_lit4:
+      return "DW_OP_lit4";
+    case DW_OP_lit5:
+      return "DW_OP_lit5";
+    case DW_OP_lit6:
+      return "DW_OP_lit6";
+    case DW_OP_lit7:
+      return "DW_OP_lit7";
+    case DW_OP_lit8:
+      return "DW_OP_lit8";
+    case DW_OP_lit9:
+      return "DW_OP_lit9";
+    case DW_OP_lit10:
+      return "DW_OP_lit10";
+    case DW_OP_lit11:
+      return "DW_OP_lit11";
+    case DW_OP_lit12:
+      return "DW_OP_lit12";
+    case DW_OP_lit13:
+      return "DW_OP_lit13";
+    case DW_OP_lit14:
+      return "DW_OP_lit14";
+    case DW_OP_lit15:
+      return "DW_OP_lit15";
+    case DW_OP_lit16:
+      return "DW_OP_lit16";
+    case DW_OP_lit17:
+      return "DW_OP_lit17";
+    case DW_OP_lit18:
+      return "DW_OP_lit18";
+    case DW_OP_lit19:
+      return "DW_OP_lit19";
+    case DW_OP_lit20:
+      return "DW_OP_lit20";
+    case DW_OP_lit21:
+      return "DW_OP_lit21";
+    case DW_OP_lit22:
+      return "DW_OP_lit22";
+    case DW_OP_lit23:
+      return "DW_OP_lit23";
+    case DW_OP_lit24:
+      return "DW_OP_lit24";
+    case DW_OP_lit25:
+      return "DW_OP_lit25";
+    case DW_OP_lit26:
+      return "DW_OP_lit26";
+    case DW_OP_lit27:
+      return "DW_OP_lit27";
+    case DW_OP_lit28:
+      return "DW_OP_lit28";
+    case DW_OP_lit29:
+      return "DW_OP_lit29";
+    case DW_OP_lit30:
+      return "DW_OP_lit30";
+    case DW_OP_lit31:
+      return "DW_OP_lit31";
+    case DW_OP_reg0:
+      return "DW_OP_reg0";
+    case DW_OP_reg1:
+      return "DW_OP_reg1";
+    case DW_OP_reg2:
+      return "DW_OP_reg2";
+    case DW_OP_reg3:
+      return "DW_OP_reg3";
+    case DW_OP_reg4:
+      return "DW_OP_reg4";
+    case DW_OP_reg5:
+      return "DW_OP_reg5";
+    case DW_OP_reg6:
+      return "DW_OP_reg6";
+    case DW_OP_reg7:
+      return "DW_OP_reg7";
+    case DW_OP_reg8:
+      return "DW_OP_reg8";
+    case DW_OP_reg9:
+      return "DW_OP_reg9";
+    case DW_OP_reg10:
+      return "DW_OP_reg10";
+    case DW_OP_reg11:
+      return "DW_OP_reg11";
+    case DW_OP_reg12:
+      return "DW_OP_reg12";
+    case DW_OP_reg13:
+      return "DW_OP_reg13";
+    case DW_OP_reg14:
+      return "DW_OP_reg14";
+    case DW_OP_reg15:
+      return "DW_OP_reg15";
+    case DW_OP_reg16:
+      return "DW_OP_reg16";
+    case DW_OP_reg17:
+      return "DW_OP_reg17";
+    case DW_OP_reg18:
+      return "DW_OP_reg18";
+    case DW_OP_reg19:
+      return "DW_OP_reg19";
+    case DW_OP_reg20:
+      return "DW_OP_reg20";
+    case DW_OP_reg21:
+      return "DW_OP_reg21";
+    case DW_OP_reg22:
+      return "DW_OP_reg22";
+    case DW_OP_reg23:
+      return "DW_OP_reg23";
+    case DW_OP_reg24:
+      return "DW_OP_reg24";
+    case DW_OP_reg25:
+      return "DW_OP_reg25";
+    case DW_OP_reg26:
+      return "DW_OP_reg26";
+    case DW_OP_reg27:
+      return "DW_OP_reg27";
+    case DW_OP_reg28:
+      return "DW_OP_reg28";
+    case DW_OP_reg29:
+      return "DW_OP_reg29";
+    case DW_OP_reg30:
+      return "DW_OP_reg30";
+    case DW_OP_reg31:
+      return "DW_OP_reg31";
+    case DW_OP_breg0:
+      return "DW_OP_breg0";
+    case DW_OP_breg1:
+      return "DW_OP_breg1";
+    case DW_OP_breg2:
+      return "DW_OP_breg2";
+    case DW_OP_breg3:
+      return "DW_OP_breg3";
+    case DW_OP_breg4:
+      return "DW_OP_breg4";
+    case DW_OP_breg5:
+      return "DW_OP_breg5";
+    case DW_OP_breg6:
+      return "DW_OP_breg6";
+    case DW_OP_breg7:
+      return "DW_OP_breg7";
+    case DW_OP_breg8:
+      return "DW_OP_breg8";
+    case DW_OP_breg9:
+      return "DW_OP_breg9";
+    case DW_OP_breg10:
+      return "DW_OP_breg10";
+    case DW_OP_breg11:
+      return "DW_OP_breg11";
+    case DW_OP_breg12:
+      return "DW_OP_breg12";
+    case DW_OP_breg13:
+      return "DW_OP_breg13";
+    case DW_OP_breg14:
+      return "DW_OP_breg14";
+    case DW_OP_breg15:
+      return "DW_OP_breg15";
+    case DW_OP_breg16:
+      return "DW_OP_breg16";
+    case DW_OP_breg17:
+      return "DW_OP_breg17";
+    case DW_OP_breg18:
+      return "DW_OP_breg18";
+    case DW_OP_breg19:
+      return "DW_OP_breg19";
+    case DW_OP_breg20:
+      return "DW_OP_breg20";
+    case DW_OP_breg21:
+      return "DW_OP_breg21";
+    case DW_OP_breg22:
+      return "DW_OP_breg22";
+    case DW_OP_breg23:
+      return "DW_OP_breg23";
+    case DW_OP_breg24:
+      return "DW_OP_breg24";
+    case DW_OP_breg25:
+      return "DW_OP_breg25";
+    case DW_OP_breg26:
+      return "DW_OP_breg26";
+    case DW_OP_breg27:
+      return "DW_OP_breg27";
+    case DW_OP_breg28:
+      return "DW_OP_breg28";
+    case DW_OP_breg29:
+      return "DW_OP_breg29";
+    case DW_OP_breg30:
+      return "DW_OP_breg30";
+    case DW_OP_breg31:
+      return "DW_OP_breg31";
+    case DW_OP_regx:
+      return "DW_OP_regx";
+    case DW_OP_fbreg:
+      return "DW_OP_fbreg";
+    case DW_OP_bregx:
+      return "DW_OP_bregx";
+    case DW_OP_piece:
+      return "DW_OP_piece";
+    case DW_OP_deref_size:
+      return "DW_OP_deref_size";
+    case DW_OP_xderef_size:
+      return "DW_OP_xderef_size";
+    case DW_OP_nop:
+      return "DW_OP_nop";
     default:
-      return "DW_AT_<unknown>";
+      return "OP_<unknown>";
     }
 }
 
-/* Convert a DWARF value form code into its string name.  */
 
-static const char *
-dwarf_form_name (form)
-     register unsigned form;
+/* Return a pointer to a newly allocated location description.  Location
+   descriptions are simple expression terms that can be strung
+   together to form more complicated location (address) descriptions.  */
+
+static inline dw_loc_descr_ref
+new_loc_descr (op, oprnd1, oprnd2)
+     register enum dwarf_location_atom op;
+     register unsigned long oprnd1;
+     register unsigned long oprnd2;
 {
-  switch (form)
+  register dw_loc_descr_ref descr
+    = (dw_loc_descr_ref) xmalloc (sizeof (dw_loc_descr_node));
+
+  descr->dw_loc_next = NULL;
+  descr->dw_loc_opc = op;
+  descr->dw_loc_oprnd1.val_class = dw_val_class_unsigned_const;
+  descr->dw_loc_oprnd1.v.val_unsigned = oprnd1;
+  descr->dw_loc_oprnd2.val_class = dw_val_class_unsigned_const;
+  descr->dw_loc_oprnd2.v.val_unsigned = oprnd2;
+
+  return descr;
+}
+
+/* Add a location description term to a location description expression.  */
+
+static inline void
+add_loc_descr (list_head, descr)
+     register dw_loc_descr_ref *list_head;
+     register dw_loc_descr_ref descr;
+{
+  register dw_loc_descr_ref *d;
+
+  /* Find the end of the chain.  */
+  for (d = list_head; (*d) != NULL; d = &(*d)->dw_loc_next)
+    ;
+
+  *d = descr;
+}
+
+/* Return the size of a location descriptor.  */
+
+static unsigned long
+size_of_loc_descr (loc)
+     register dw_loc_descr_ref loc;
+{
+  register unsigned long size = 1;
+
+  switch (loc->dw_loc_opc)
     {
-    case DW_FORM_addr:
-      return "DW_FORM_addr";
-    case DW_FORM_block2:
-      return "DW_FORM_block2";
-    case DW_FORM_block4:
-      return "DW_FORM_block4";
-    case DW_FORM_data2:
-      return "DW_FORM_data2";
-    case DW_FORM_data4:
-      return "DW_FORM_data4";
-    case DW_FORM_data8:
-      return "DW_FORM_data8";
-    case DW_FORM_string:
-      return "DW_FORM_string";
-    case DW_FORM_block:
-      return "DW_FORM_block";
-    case DW_FORM_block1:
-      return "DW_FORM_block1";
-    case DW_FORM_data1:
-      return "DW_FORM_data1";
-    case DW_FORM_flag:
-      return "DW_FORM_flag";
-    case DW_FORM_sdata:
-      return "DW_FORM_sdata";
-    case DW_FORM_strp:
-      return "DW_FORM_strp";
-    case DW_FORM_udata:
-      return "DW_FORM_udata";
-    case DW_FORM_ref_addr:
-      return "DW_FORM_ref_addr";
-    case DW_FORM_ref1:
-      return "DW_FORM_ref1";
-    case DW_FORM_ref2:
-      return "DW_FORM_ref2";
-    case DW_FORM_ref4:
-      return "DW_FORM_ref4";
-    case DW_FORM_ref8:
-      return "DW_FORM_ref8";
-    case DW_FORM_ref_udata:
-      return "DW_FORM_ref_udata";
-    case DW_FORM_indirect:
-      return "DW_FORM_indirect";
+    case DW_OP_addr:
+      size += DWARF2_ADDR_SIZE;
+      break;
+    case DW_OP_const1u:
+    case DW_OP_const1s:
+      size += 1;
+      break;
+    case DW_OP_const2u:
+    case DW_OP_const2s:
+      size += 2;
+      break;
+    case DW_OP_const4u:
+    case DW_OP_const4s:
+      size += 4;
+      break;
+    case DW_OP_const8u:
+    case DW_OP_const8s:
+      size += 8;
+      break;
+    case DW_OP_constu:
+      size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
+      break;
+    case DW_OP_consts:
+      size += size_of_sleb128 (loc->dw_loc_oprnd1.v.val_int);
+      break;
+    case DW_OP_pick:
+      size += 1;
+      break;
+    case DW_OP_plus_uconst:
+      size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
+      break;
+    case DW_OP_skip:
+    case DW_OP_bra:
+      size += 2;
+      break;
+    case DW_OP_breg0:
+    case DW_OP_breg1:
+    case DW_OP_breg2:
+    case DW_OP_breg3:
+    case DW_OP_breg4:
+    case DW_OP_breg5:
+    case DW_OP_breg6:
+    case DW_OP_breg7:
+    case DW_OP_breg8:
+    case DW_OP_breg9:
+    case DW_OP_breg10:
+    case DW_OP_breg11:
+    case DW_OP_breg12:
+    case DW_OP_breg13:
+    case DW_OP_breg14:
+    case DW_OP_breg15:
+    case DW_OP_breg16:
+    case DW_OP_breg17:
+    case DW_OP_breg18:
+    case DW_OP_breg19:
+    case DW_OP_breg20:
+    case DW_OP_breg21:
+    case DW_OP_breg22:
+    case DW_OP_breg23:
+    case DW_OP_breg24:
+    case DW_OP_breg25:
+    case DW_OP_breg26:
+    case DW_OP_breg27:
+    case DW_OP_breg28:
+    case DW_OP_breg29:
+    case DW_OP_breg30:
+    case DW_OP_breg31:
+      size += size_of_sleb128 (loc->dw_loc_oprnd1.v.val_int);
+      break;
+    case DW_OP_regx:
+      size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
+      break;
+    case DW_OP_fbreg:
+      size += size_of_sleb128 (loc->dw_loc_oprnd1.v.val_int);
+      break;
+    case DW_OP_bregx:
+      size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
+      size += size_of_sleb128 (loc->dw_loc_oprnd2.v.val_int);
+      break;
+    case DW_OP_piece:
+      size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
+      break;
+    case DW_OP_deref_size:
+    case DW_OP_xderef_size:
+      size += 1;
+      break;
     default:
-      return "DW_FORM_<unknown>";
+      break;
     }
+
+  return size;
 }
 
-/* Convert a DWARF stack opcode into its string name.  */
+/* Return the size of a series of location descriptors.  */
 
-static const char *
-dwarf_stack_op_name (op)
-     register unsigned op;
+static unsigned long
+size_of_locs (loc)
+     register dw_loc_descr_ref loc;
 {
-  switch (op)
+  register unsigned long size = 0;
+
+  for (; loc != NULL; loc = loc->dw_loc_next)
+    size += size_of_loc_descr (loc);
+
+  return size;
+}
+
+/* Output location description stack opcode's operands (if any).  */
+
+static void
+output_loc_operands (loc)
+     register dw_loc_descr_ref loc;
+{
+  register dw_val_ref val1 = &loc->dw_loc_oprnd1;
+  register dw_val_ref val2 = &loc->dw_loc_oprnd2;
+
+  switch (loc->dw_loc_opc)
     {
+#ifdef DWARF2_DEBUGGING_INFO
     case DW_OP_addr:
-      return "DW_OP_addr";
-    case DW_OP_deref:
-      return "DW_OP_deref";
-    case DW_OP_const1u:
-      return "DW_OP_const1u";
-    case DW_OP_const1s:
-      return "DW_OP_const1s";
+      ASM_OUTPUT_DWARF_ADDR_CONST (asm_out_file, val1->v.val_addr);
+      fputc ('\n', asm_out_file);
+      break;
     case DW_OP_const2u:
-      return "DW_OP_const2u";
     case DW_OP_const2s:
-      return "DW_OP_const2s";
+      ASM_OUTPUT_DWARF_DATA2 (asm_out_file, val1->v.val_int);
+      fputc ('\n', asm_out_file);
+      break;
     case DW_OP_const4u:
-      return "DW_OP_const4u";
     case DW_OP_const4s:
-      return "DW_OP_const4s";
+      ASM_OUTPUT_DWARF_DATA4 (asm_out_file, val1->v.val_int);
+      fputc ('\n', asm_out_file);
+      break;
     case DW_OP_const8u:
-      return "DW_OP_const8u";
     case DW_OP_const8s:
-      return "DW_OP_const8s";
+      abort ();
+      fputc ('\n', asm_out_file);
+      break;
+    case DW_OP_skip:
+    case DW_OP_bra:
+      ASM_OUTPUT_DWARF_DATA2 (asm_out_file, val1->v.val_int);
+      fputc ('\n', asm_out_file);
+      break;
+#else
+    case DW_OP_addr:
+    case DW_OP_const2u:
+    case DW_OP_const2s:
+    case DW_OP_const4u:
+    case DW_OP_const4s:
+    case DW_OP_const8u:
+    case DW_OP_const8s:
+    case DW_OP_skip:
+    case DW_OP_bra:
+      /* We currently don't make any attempt to make sure these are
+         aligned properly like we do for the main unwind info, so
+         don't support emitting things larger than a byte if we're
+         only doing unwinding.  */
+      abort ();
+#endif
+    case DW_OP_const1u:
+    case DW_OP_const1s:
+      ASM_OUTPUT_DWARF_DATA1 (asm_out_file, val1->v.val_flag);
+      fputc ('\n', asm_out_file);
+      break;
     case DW_OP_constu:
-      return "DW_OP_constu";
+      output_uleb128 (val1->v.val_unsigned);
+      fputc ('\n', asm_out_file);
+      break;
     case DW_OP_consts:
-      return "DW_OP_consts";
-    case DW_OP_dup:
-      return "DW_OP_dup";
-    case DW_OP_drop:
-      return "DW_OP_drop";
-    case DW_OP_over:
-      return "DW_OP_over";
+      output_sleb128 (val1->v.val_int);
+      fputc ('\n', asm_out_file);
+      break;
     case DW_OP_pick:
-      return "DW_OP_pick";
-    case DW_OP_swap:
-      return "DW_OP_swap";
-    case DW_OP_rot:
-      return "DW_OP_rot";
-    case DW_OP_xderef:
-      return "DW_OP_xderef";
-    case DW_OP_abs:
-      return "DW_OP_abs";
-    case DW_OP_and:
-      return "DW_OP_and";
-    case DW_OP_div:
-      return "DW_OP_div";
-    case DW_OP_minus:
-      return "DW_OP_minus";
-    case DW_OP_mod:
-      return "DW_OP_mod";
-    case DW_OP_mul:
-      return "DW_OP_mul";
-    case DW_OP_neg:
-      return "DW_OP_neg";
-    case DW_OP_not:
-      return "DW_OP_not";
-    case DW_OP_or:
-      return "DW_OP_or";
-    case DW_OP_plus:
-      return "DW_OP_plus";
+      ASM_OUTPUT_DWARF_DATA1 (asm_out_file, val1->v.val_int);
+      fputc ('\n', asm_out_file);
+      break;
     case DW_OP_plus_uconst:
-      return "DW_OP_plus_uconst";
-    case DW_OP_shl:
-      return "DW_OP_shl";
-    case DW_OP_shr:
-      return "DW_OP_shr";
-    case DW_OP_shra:
-      return "DW_OP_shra";
-    case DW_OP_xor:
-      return "DW_OP_xor";
-    case DW_OP_bra:
-      return "DW_OP_bra";
-    case DW_OP_eq:
-      return "DW_OP_eq";
-    case DW_OP_ge:
-      return "DW_OP_ge";
-    case DW_OP_gt:
-      return "DW_OP_gt";
-    case DW_OP_le:
-      return "DW_OP_le";
-    case DW_OP_lt:
-      return "DW_OP_lt";
-    case DW_OP_ne:
-      return "DW_OP_ne";
-    case DW_OP_skip:
-      return "DW_OP_skip";
-    case DW_OP_lit0:
-      return "DW_OP_lit0";
-    case DW_OP_lit1:
-      return "DW_OP_lit1";
-    case DW_OP_lit2:
-      return "DW_OP_lit2";
-    case DW_OP_lit3:
-      return "DW_OP_lit3";
-    case DW_OP_lit4:
-      return "DW_OP_lit4";
-    case DW_OP_lit5:
-      return "DW_OP_lit5";
-    case DW_OP_lit6:
-      return "DW_OP_lit6";
-    case DW_OP_lit7:
-      return "DW_OP_lit7";
-    case DW_OP_lit8:
-      return "DW_OP_lit8";
-    case DW_OP_lit9:
-      return "DW_OP_lit9";
-    case DW_OP_lit10:
-      return "DW_OP_lit10";
-    case DW_OP_lit11:
-      return "DW_OP_lit11";
-    case DW_OP_lit12:
-      return "DW_OP_lit12";
-    case DW_OP_lit13:
-      return "DW_OP_lit13";
-    case DW_OP_lit14:
-      return "DW_OP_lit14";
-    case DW_OP_lit15:
-      return "DW_OP_lit15";
-    case DW_OP_lit16:
-      return "DW_OP_lit16";
-    case DW_OP_lit17:
-      return "DW_OP_lit17";
-    case DW_OP_lit18:
-      return "DW_OP_lit18";
-    case DW_OP_lit19:
-      return "DW_OP_lit19";
-    case DW_OP_lit20:
-      return "DW_OP_lit20";
-    case DW_OP_lit21:
-      return "DW_OP_lit21";
-    case DW_OP_lit22:
-      return "DW_OP_lit22";
-    case DW_OP_lit23:
-      return "DW_OP_lit23";
-    case DW_OP_lit24:
-      return "DW_OP_lit24";
-    case DW_OP_lit25:
-      return "DW_OP_lit25";
-    case DW_OP_lit26:
-      return "DW_OP_lit26";
-    case DW_OP_lit27:
-      return "DW_OP_lit27";
-    case DW_OP_lit28:
-      return "DW_OP_lit28";
-    case DW_OP_lit29:
-      return "DW_OP_lit29";
-    case DW_OP_lit30:
-      return "DW_OP_lit30";
-    case DW_OP_lit31:
-      return "DW_OP_lit31";
-    case DW_OP_reg0:
-      return "DW_OP_reg0";
-    case DW_OP_reg1:
-      return "DW_OP_reg1";
-    case DW_OP_reg2:
-      return "DW_OP_reg2";
-    case DW_OP_reg3:
-      return "DW_OP_reg3";
-    case DW_OP_reg4:
-      return "DW_OP_reg4";
-    case DW_OP_reg5:
-      return "DW_OP_reg5";
-    case DW_OP_reg6:
-      return "DW_OP_reg6";
-    case DW_OP_reg7:
-      return "DW_OP_reg7";
-    case DW_OP_reg8:
-      return "DW_OP_reg8";
-    case DW_OP_reg9:
-      return "DW_OP_reg9";
-    case DW_OP_reg10:
-      return "DW_OP_reg10";
-    case DW_OP_reg11:
-      return "DW_OP_reg11";
-    case DW_OP_reg12:
-      return "DW_OP_reg12";
-    case DW_OP_reg13:
-      return "DW_OP_reg13";
-    case DW_OP_reg14:
-      return "DW_OP_reg14";
-    case DW_OP_reg15:
-      return "DW_OP_reg15";
-    case DW_OP_reg16:
-      return "DW_OP_reg16";
-    case DW_OP_reg17:
-      return "DW_OP_reg17";
-    case DW_OP_reg18:
-      return "DW_OP_reg18";
-    case DW_OP_reg19:
-      return "DW_OP_reg19";
-    case DW_OP_reg20:
-      return "DW_OP_reg20";
-    case DW_OP_reg21:
-      return "DW_OP_reg21";
-    case DW_OP_reg22:
-      return "DW_OP_reg22";
-    case DW_OP_reg23:
-      return "DW_OP_reg23";
-    case DW_OP_reg24:
-      return "DW_OP_reg24";
-    case DW_OP_reg25:
-      return "DW_OP_reg25";
-    case DW_OP_reg26:
-      return "DW_OP_reg26";
-    case DW_OP_reg27:
-      return "DW_OP_reg27";
-    case DW_OP_reg28:
-      return "DW_OP_reg28";
-    case DW_OP_reg29:
-      return "DW_OP_reg29";
-    case DW_OP_reg30:
-      return "DW_OP_reg30";
-    case DW_OP_reg31:
-      return "DW_OP_reg31";
+      output_uleb128 (val1->v.val_unsigned);
+      fputc ('\n', asm_out_file);
+      break;
     case DW_OP_breg0:
-      return "DW_OP_breg0";
     case DW_OP_breg1:
-      return "DW_OP_breg1";
     case DW_OP_breg2:
-      return "DW_OP_breg2";
     case DW_OP_breg3:
-      return "DW_OP_breg3";
     case DW_OP_breg4:
-      return "DW_OP_breg4";
     case DW_OP_breg5:
-      return "DW_OP_breg5";
     case DW_OP_breg6:
-      return "DW_OP_breg6";
     case DW_OP_breg7:
-      return "DW_OP_breg7";
     case DW_OP_breg8:
-      return "DW_OP_breg8";
     case DW_OP_breg9:
-      return "DW_OP_breg9";
     case DW_OP_breg10:
-      return "DW_OP_breg10";
     case DW_OP_breg11:
-      return "DW_OP_breg11";
     case DW_OP_breg12:
-      return "DW_OP_breg12";
     case DW_OP_breg13:
-      return "DW_OP_breg13";
     case DW_OP_breg14:
-      return "DW_OP_breg14";
     case DW_OP_breg15:
-      return "DW_OP_breg15";
     case DW_OP_breg16:
-      return "DW_OP_breg16";
     case DW_OP_breg17:
-      return "DW_OP_breg17";
     case DW_OP_breg18:
-      return "DW_OP_breg18";
     case DW_OP_breg19:
-      return "DW_OP_breg19";
     case DW_OP_breg20:
-      return "DW_OP_breg20";
     case DW_OP_breg21:
-      return "DW_OP_breg21";
     case DW_OP_breg22:
-      return "DW_OP_breg22";
     case DW_OP_breg23:
-      return "DW_OP_breg23";
     case DW_OP_breg24:
-      return "DW_OP_breg24";
     case DW_OP_breg25:
-      return "DW_OP_breg25";
     case DW_OP_breg26:
-      return "DW_OP_breg26";
     case DW_OP_breg27:
-      return "DW_OP_breg27";
     case DW_OP_breg28:
-      return "DW_OP_breg28";
     case DW_OP_breg29:
-      return "DW_OP_breg29";
     case DW_OP_breg30:
-      return "DW_OP_breg30";
     case DW_OP_breg31:
-      return "DW_OP_breg31";
+      output_sleb128 (val1->v.val_int);
+      fputc ('\n', asm_out_file);
+      break;
     case DW_OP_regx:
-      return "DW_OP_regx";
+      output_uleb128 (val1->v.val_unsigned);
+      fputc ('\n', asm_out_file);
+      break;
     case DW_OP_fbreg:
-      return "DW_OP_fbreg";
+      output_sleb128 (val1->v.val_int);
+      fputc ('\n', asm_out_file);
+      break;
     case DW_OP_bregx:
-      return "DW_OP_bregx";
+      output_uleb128 (val1->v.val_unsigned);
+      fputc ('\n', asm_out_file);
+      output_sleb128 (val2->v.val_int);
+      fputc ('\n', asm_out_file);
+      break;
     case DW_OP_piece:
-      return "DW_OP_piece";
+      output_uleb128 (val1->v.val_unsigned);
+      fputc ('\n', asm_out_file);
+      break;
     case DW_OP_deref_size:
-      return "DW_OP_deref_size";
     case DW_OP_xderef_size:
-      return "DW_OP_xderef_size";
-    case DW_OP_nop:
-      return "DW_OP_nop";
+      ASM_OUTPUT_DWARF_DATA1 (asm_out_file, val1->v.val_flag);
+      fputc ('\n', asm_out_file);
+      break;
+    default:
+      /* Other codes have no operands.  */
+      break;
+    }
+}
+
+/* Output a sequence of location operations.  */
+
+static void
+output_loc_sequence (loc)
+     dw_loc_descr_ref loc;
+{
+  for (; loc != NULL; loc = loc->dw_loc_next)
+    {
+      /* Output the opcode.  */
+      ASM_OUTPUT_DWARF_DATA1 (asm_out_file, loc->dw_loc_opc);
+      if (flag_debug_asm)
+       fprintf (asm_out_file, "\t%s %s", ASM_COMMENT_START,
+                dwarf_stack_op_name (loc->dw_loc_opc));
+
+      fputc ('\n', asm_out_file);
+
+      /* Output the operand(s) (if any).  */
+      output_loc_operands (loc);
+    }
+}
+
+/* This routine will generate the correct assembly data for a location
+   description based on a cfi entry with a complex address.  */
+
+static void
+output_cfa_loc (cfi)
+     dw_cfi_ref cfi;
+{
+  dw_loc_descr_ref loc;
+  unsigned long size;
+
+  /* Output the size of the block.  */
+  loc = cfi->dw_cfi_oprnd1.dw_cfi_loc;
+  size = size_of_locs (loc);
+  output_uleb128 (size);
+  fputc ('\n', asm_out_file);
+
+  /* Now output the operations themselves.  */
+  output_loc_sequence (loc);
+}
+
+/* This function builds a dwarf location descriptor seqeunce from 
+   a dw_cfa_location. */
+
+static struct dw_loc_descr_struct *
+build_cfa_loc (cfa)
+     dw_cfa_location *cfa;
+{
+  struct dw_loc_descr_struct *head, *tmp;
+
+  if (cfa->indirect == 0)
+    abort ();
+
+  if (cfa->base_offset)
+    head = new_loc_descr (DW_OP_breg0 + cfa->reg, cfa->base_offset, 0);
+  else
+    head = new_loc_descr (DW_OP_reg0 + cfa->reg, 0, 0);
+  head->dw_loc_oprnd1.val_class = dw_val_class_const;
+  tmp = new_loc_descr (DW_OP_deref, 0, 0);
+  add_loc_descr (&head, tmp);
+  if (cfa->offset != 0)
+    {
+      tmp = new_loc_descr (DW_OP_plus_uconst, cfa->offset, 0);
+      add_loc_descr (&head, tmp);
+    }
+  return head;
+}
+
+/* This function fills in aa dw_cfa_location structure from a 
+   dwarf location descriptor sequence.  */
+
+static void
+get_cfa_from_loc_descr (cfa, loc)
+     dw_cfa_location *cfa;
+     struct dw_loc_descr_struct * loc;
+{
+  struct dw_loc_descr_struct * ptr;
+  cfa->offset = 0;
+  cfa->base_offset = 0;
+  cfa->indirect = 0;
+  cfa->reg = -1;
+
+  for (ptr = loc; ptr != NULL; ptr = ptr->dw_loc_next)
+    {
+      enum dwarf_location_atom op = ptr->dw_loc_opc;
+      switch (op)
+        {
+       case DW_OP_reg0:
+       case DW_OP_reg1:
+       case DW_OP_reg2:
+       case DW_OP_reg3:
+       case DW_OP_reg4:
+       case DW_OP_reg5:
+       case DW_OP_reg6:
+       case DW_OP_reg7:
+       case DW_OP_reg8:
+       case DW_OP_reg9:
+       case DW_OP_reg10:
+       case DW_OP_reg11:
+       case DW_OP_reg12:
+       case DW_OP_reg13:
+       case DW_OP_reg14:
+       case DW_OP_reg15:
+       case DW_OP_reg16:
+       case DW_OP_reg17:
+       case DW_OP_reg18:
+       case DW_OP_reg19:
+       case DW_OP_reg20:
+       case DW_OP_reg21:
+       case DW_OP_reg22:
+       case DW_OP_reg23:
+       case DW_OP_reg24:
+       case DW_OP_reg25:
+       case DW_OP_reg26:
+       case DW_OP_reg27:
+       case DW_OP_reg28:
+       case DW_OP_reg29:
+       case DW_OP_reg30:
+       case DW_OP_reg31:
+         cfa->reg = op - DW_OP_reg0;
+         break;
+       case DW_OP_regx:
+         cfa->reg = ptr->dw_loc_oprnd1.v.val_int;
+         break;
+       case DW_OP_breg0:
+       case DW_OP_breg1:
+       case DW_OP_breg2:
+       case DW_OP_breg3:
+       case DW_OP_breg4:
+       case DW_OP_breg5:
+       case DW_OP_breg6:
+       case DW_OP_breg7:
+       case DW_OP_breg8:
+       case DW_OP_breg9:
+       case DW_OP_breg10:
+       case DW_OP_breg11:
+       case DW_OP_breg12:
+       case DW_OP_breg13:
+       case DW_OP_breg14:
+       case DW_OP_breg15:
+       case DW_OP_breg16:
+       case DW_OP_breg17:
+       case DW_OP_breg18:
+       case DW_OP_breg19:
+       case DW_OP_breg20:
+       case DW_OP_breg21:
+       case DW_OP_breg22:
+       case DW_OP_breg23:
+       case DW_OP_breg24:
+       case DW_OP_breg25:
+       case DW_OP_breg26:
+       case DW_OP_breg27:
+       case DW_OP_breg28:
+       case DW_OP_breg29:
+       case DW_OP_breg30:
+       case DW_OP_breg31:
+         cfa->reg = op - DW_OP_breg0;
+         cfa->base_offset = ptr->dw_loc_oprnd1.v.val_int;
+         break;
+       case DW_OP_bregx:
+         cfa->reg = ptr->dw_loc_oprnd1.v.val_int;
+         cfa->base_offset = ptr->dw_loc_oprnd2.v.val_int;
+         break;
+       case DW_OP_deref:
+         cfa->indirect = 1;
+         break;
+       case DW_OP_plus_uconst:
+         cfa->offset =  ptr->dw_loc_oprnd1.v.val_unsigned;
+         break;
+       default:
+         fatal ("DW_LOC_OP %s not implememnted yet.\n",
+                dwarf_stack_op_name (ptr->dw_loc_opc));
+       }
+    }
+}
+#endif /* .debug_frame support */
+\f
+/* And now, the support for symbolic debugging information.  */
+#ifdef DWARF2_DEBUGGING_INFO
+
+/* NOTE: In the comments in this file, many references are made to
+   "Debugging Information Entries".  This term is abbreviated as `DIE'
+   throughout the remainder of this file.  */
+
+/* An internal representation of the DWARF output is built, and then
+   walked to generate the DWARF debugging info.  The walk of the internal
+   representation is done after the entire program has been compiled.
+   The types below are used to describe the internal representation.  */
+
+/* Various DIE's use offsets relative to the beginning of the
+   .debug_info section to refer to each other.  */
+
+typedef long int dw_offset;
+
+/* Define typedefs here to avoid circular dependencies.  */
+
+typedef struct dw_attr_struct *dw_attr_ref;
+typedef struct dw_line_info_struct *dw_line_info_ref;
+typedef struct dw_separate_line_info_struct *dw_separate_line_info_ref;
+typedef struct pubname_struct *pubname_ref;
+typedef dw_die_ref *arange_ref;
+
+/* Each entry in the line_info_table maintains the file and
+   line number associated with the label generated for that
+   entry.  The label gives the PC value associated with
+   the line number entry.  */
+
+typedef struct dw_line_info_struct
+{
+  unsigned long dw_file_num;
+  unsigned long dw_line_num;
+}
+dw_line_info_entry;
+
+/* Line information for functions in separate sections; each one gets its
+   own sequence.  */
+typedef struct dw_separate_line_info_struct
+{
+  unsigned long dw_file_num;
+  unsigned long dw_line_num;
+  unsigned long function;
+}
+dw_separate_line_info_entry;
+
+/* Each DIE attribute has a field specifying the attribute kind,
+   a link to the next attribute in the chain, and an attribute value.
+   Attributes are typically linked below the DIE they modify.  */
+
+typedef struct dw_attr_struct
+{
+  enum dwarf_attribute dw_attr;
+  dw_attr_ref dw_attr_next;
+  dw_val_node dw_attr_val;
+}
+dw_attr_node;
+
+/* The Debugging Information Entry (DIE) structure */
+
+typedef struct die_struct
+{
+  enum dwarf_tag die_tag;
+  dw_attr_ref die_attr;
+  dw_die_ref die_parent;
+  dw_die_ref die_child;
+  dw_die_ref die_sib;
+  dw_offset die_offset;
+  unsigned long die_abbrev;
+}
+die_node;
+
+/* The pubname structure */
+
+typedef struct pubname_struct
+{
+  dw_die_ref die;
+  char * name;
+}
+pubname_entry;
+
+/* The limbo die list structure.  */
+typedef struct limbo_die_struct
+{
+  dw_die_ref die;
+  struct limbo_die_struct *next;
+}
+limbo_die_node;
+
+/* How to start an assembler comment.  */
+#ifndef ASM_COMMENT_START
+#define ASM_COMMENT_START ";#"
+#endif
+
+/* Define a macro which returns non-zero for a TYPE_DECL which was
+   implicitly generated for a tagged type.
+
+   Note that unlike the gcc front end (which generates a NULL named
+   TYPE_DECL node for each complete tagged type, each array type, and
+   each function type node created) the g++ front end generates a
+   _named_ TYPE_DECL node for each tagged type node created.
+   These TYPE_DECLs have DECL_ARTIFICIAL set, so we know not to
+   generate a DW_TAG_typedef DIE for them.  */
+
+#define TYPE_DECL_IS_STUB(decl)                                \
+  (DECL_NAME (decl) == NULL_TREE                       \
+   || (DECL_ARTIFICIAL (decl)                          \
+       && is_tagged_type (TREE_TYPE (decl))            \
+       && ((decl == TYPE_STUB_DECL (TREE_TYPE (decl))) \
+          /* This is necessary for stub decls that     \
+             appear in nested inline functions.  */    \
+          || (DECL_ABSTRACT_ORIGIN (decl) != NULL_TREE \
+              && (decl_ultimate_origin (decl)          \
+                  == TYPE_STUB_DECL (TREE_TYPE (decl)))))))
+
+/* Information concerning the compilation unit's programming
+   language, and compiler version.  */
+
+extern int flag_traditional;
+
+/* Fixed size portion of the DWARF compilation unit header.  */
+#define DWARF_COMPILE_UNIT_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 3)
+
+/* Fixed size portion of debugging line information prolog.  */
+#define DWARF_LINE_PROLOG_HEADER_SIZE 5
+
+/* Fixed size portion of public names info.  */
+#define DWARF_PUBNAMES_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 2)
+
+/* Fixed size portion of the address range info.  */
+#define DWARF_ARANGES_HEADER_SIZE                                      \
+  (DWARF_ROUND (2 * DWARF_OFFSET_SIZE + 4, DWARF2_ADDR_SIZE * 2)       \
+   - DWARF_OFFSET_SIZE)
+
+/* Size of padding portion in the address range info.  It must be
+   aligned to twice the pointer size.  */
+#define DWARF_ARANGES_PAD_SIZE \
+  (DWARF_ROUND (2 * DWARF_OFFSET_SIZE + 4, DWARF2_ADDR_SIZE * 2) \
+   - (2 * DWARF_OFFSET_SIZE + 4))
+
+/* The default is to have gcc emit the line number tables.  */
+#ifndef DWARF2_ASM_LINE_DEBUG_INFO
+#define DWARF2_ASM_LINE_DEBUG_INFO 0
+#endif
+
+/* Define the architecture-dependent minimum instruction length (in bytes).
+   In this implementation of DWARF, this field is used for information
+   purposes only.  Since GCC generates assembly language, we have
+   no a priori knowledge of how many instruction bytes are generated
+   for each source line, and therefore can use only the  DW_LNE_set_address
+   and DW_LNS_fixed_advance_pc line information commands.  */
+
+#ifndef DWARF_LINE_MIN_INSTR_LENGTH
+#define DWARF_LINE_MIN_INSTR_LENGTH 4
+#endif
+
+/* Minimum line offset in a special line info. opcode.
+   This value was chosen to give a reasonable range of values.  */
+#define DWARF_LINE_BASE  -10
+
+/* First special line opcde - leave room for the standard opcodes.  */
+#define DWARF_LINE_OPCODE_BASE  10
+
+/* Range of line offsets in a special line info. opcode.  */
+#define DWARF_LINE_RANGE  (254-DWARF_LINE_OPCODE_BASE+1)
+
+/* Flag that indicates the initial value of the is_stmt_start flag.
+   In the present implementation, we do not mark any lines as
+   the beginning of a source statement, because that information
+   is not made available by the GCC front-end.  */
+#define        DWARF_LINE_DEFAULT_IS_STMT_START 1
+
+/* This location is used by calc_die_sizes() to keep track
+   the offset of each DIE within the .debug_info section.  */
+static unsigned long next_die_offset;
+
+/* Record the root of the DIE's built for the current compilation unit.  */
+static dw_die_ref comp_unit_die;
+
+/* A list of DIEs with a NULL parent waiting to be relocated.  */
+static limbo_die_node *limbo_die_list = 0;
+
+/* Pointer to an array of filenames referenced by this compilation unit.  */
+static char **file_table;
+
+/* Total number of entries in the table (i.e. array) pointed to by
+   `file_table'.  This is the *total* and includes both used and unused
+   slots.  */
+static unsigned file_table_allocated;
+
+/* Number of entries in the file_table which are actually in use.  */
+static unsigned file_table_in_use;
+
+/* Size (in elements) of increments by which we may expand the filename
+   table.  */
+#define FILE_TABLE_INCREMENT 64
+
+/* Local pointer to the name of the main input file.  Initialized in
+   dwarf2out_init.  */
+static const char *primary_filename;
+
+/* A pointer to the base of a table of references to DIE's that describe
+   declarations.  The table is indexed by DECL_UID() which is a unique
+   number identifying each decl.  */
+static dw_die_ref *decl_die_table;
+
+/* Number of elements currently allocated for the decl_die_table.  */
+static unsigned decl_die_table_allocated;
+
+/* Number of elements in decl_die_table currently in use.  */
+static unsigned decl_die_table_in_use;
+
+/* Size (in elements) of increments by which we may expand the
+   decl_die_table.  */
+#define DECL_DIE_TABLE_INCREMENT 256
+
+/* A pointer to the base of a table of references to declaration
+   scopes.  This table is a display which tracks the nesting
+   of declaration scopes at the current scope and containing
+   scopes.  This table is used to find the proper place to
+   define type declaration DIE's.  */
+static tree *decl_scope_table;
+
+/* Number of elements currently allocated for the decl_scope_table.  */
+static int decl_scope_table_allocated;
+
+/* Current level of nesting of declaration scopes.  */
+static int decl_scope_depth;
+
+/* Size (in elements) of increments by which we may expand the
+   decl_scope_table.  */
+#define DECL_SCOPE_TABLE_INCREMENT 64
+
+/* A pointer to the base of a list of references to DIE's that
+   are uniquely identified by their tag, presence/absence of
+   children DIE's, and list of attribute/value pairs.  */
+static dw_die_ref *abbrev_die_table;
+
+/* Number of elements currently allocated for abbrev_die_table.  */
+static unsigned abbrev_die_table_allocated;
+
+/* Number of elements in type_die_table currently in use.  */
+static unsigned abbrev_die_table_in_use;
+
+/* Size (in elements) of increments by which we may expand the
+   abbrev_die_table.  */
+#define ABBREV_DIE_TABLE_INCREMENT 256
+
+/* A pointer to the base of a table that contains line information
+   for each source code line in .text in the compilation unit.  */
+static dw_line_info_ref line_info_table;
+
+/* Number of elements currently allocated for line_info_table.  */
+static unsigned line_info_table_allocated;
+
+/* Number of elements in separate_line_info_table currently in use.  */
+static unsigned separate_line_info_table_in_use;
+
+/* A pointer to the base of a table that contains line information
+   for each source code line outside of .text in the compilation unit.  */
+static dw_separate_line_info_ref separate_line_info_table;
+
+/* Number of elements currently allocated for separate_line_info_table.  */
+static unsigned separate_line_info_table_allocated;
+
+/* Number of elements in line_info_table currently in use.  */
+static unsigned line_info_table_in_use;
+
+/* Size (in elements) of increments by which we may expand the
+   line_info_table.  */
+#define LINE_INFO_TABLE_INCREMENT 1024
+
+/* A pointer to the base of a table that contains a list of publicly
+   accessible names.  */
+static pubname_ref pubname_table;
+
+/* Number of elements currently allocated for pubname_table.  */
+static unsigned pubname_table_allocated;
+
+/* Number of elements in pubname_table currently in use.  */
+static unsigned pubname_table_in_use;
+
+/* Size (in elements) of increments by which we may expand the
+   pubname_table.  */
+#define PUBNAME_TABLE_INCREMENT 64
+
+/* A pointer to the base of a table that contains a list of publicly
+   accessible names.  */
+static arange_ref arange_table;
+
+/* Number of elements currently allocated for arange_table.  */
+static unsigned arange_table_allocated;
+
+/* Number of elements in arange_table currently in use.  */
+static unsigned arange_table_in_use;
+
+/* Size (in elements) of increments by which we may expand the
+   arange_table.  */
+#define ARANGE_TABLE_INCREMENT 64
+
+/* A pointer to the base of a list of incomplete types which might be
+   completed at some later time.  */
+
+static tree *incomplete_types_list;
+
+/* Number of elements currently allocated for the incomplete_types_list.  */
+static unsigned incomplete_types_allocated;
+
+/* Number of elements of incomplete_types_list currently in use.  */
+static unsigned incomplete_types;
+
+/* Size (in elements) of increments by which we may expand the incomplete
+   types list.  Actually, a single hunk of space of this size should
+   be enough for most typical programs.         */
+#define INCOMPLETE_TYPES_INCREMENT 64
+
+/* Record whether the function being analyzed contains inlined functions.  */
+static int current_function_has_inlines;
+#if 0 && defined (MIPS_DEBUGGING_INFO)
+static int comp_unit_has_inlines;
+#endif
+
+/* Array of RTXes referenced by the debugging information, which therefore
+   must be kept around forever.  We do this rather than perform GC on
+   the dwarf info because almost all of the dwarf info lives forever, and
+   it's easier to support non-GC frontends this way.  */
+static varray_type used_rtx_varray;
+
+/* Forward declarations for functions defined in this file.  */
+
+static int is_pseudo_reg               PARAMS ((rtx));
+static tree type_main_variant          PARAMS ((tree));
+static int is_tagged_type              PARAMS ((tree));
+static const char *dwarf_tag_name      PARAMS ((unsigned));
+static const char *dwarf_attr_name     PARAMS ((unsigned));
+static const char *dwarf_form_name     PARAMS ((unsigned));
+#if 0
+static const char *dwarf_type_encoding_name PARAMS ((unsigned));
+#endif
+static tree decl_ultimate_origin       PARAMS ((tree));
+static tree block_ultimate_origin      PARAMS ((tree));
+static tree decl_class_context         PARAMS ((tree));
+static void add_dwarf_attr             PARAMS ((dw_die_ref, dw_attr_ref));
+static void add_AT_flag                        PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute,
+                                                unsigned));
+static void add_AT_int                 PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute, long));
+static void add_AT_unsigned            PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute,
+                                                unsigned long));
+static void add_AT_long_long           PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute,
+                                                unsigned long,
+                                                unsigned long));
+static void add_AT_float               PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute,
+                                                unsigned, long *));
+static void add_AT_string              PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute,
+                                                const char *));
+static void add_AT_die_ref             PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute,
+                                                dw_die_ref));
+static void add_AT_fde_ref             PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute,
+                                                unsigned));
+static void add_AT_loc                 PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute,
+                                                dw_loc_descr_ref));
+static void add_AT_addr                        PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute,
+                                                rtx));
+static void add_AT_lbl_id              PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute,
+                                                const char *));
+static void add_AT_lbl_offset          PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute,
+                                                const char *));
+static dw_attr_ref get_AT              PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute));
+static const char *get_AT_low_pc       PARAMS ((dw_die_ref));
+static const char *get_AT_hi_pc                PARAMS ((dw_die_ref));
+static const char *get_AT_string       PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute));
+static int get_AT_flag                 PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute));
+static unsigned get_AT_unsigned                PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute));
+static inline dw_die_ref get_AT_ref    PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute));
+static int is_c_family                 PARAMS ((void));
+static int is_fortran                  PARAMS ((void));
+static void remove_AT                  PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute));
+static void remove_children            PARAMS ((dw_die_ref));
+static void add_child_die              PARAMS ((dw_die_ref, dw_die_ref));
+static dw_die_ref new_die              PARAMS ((enum dwarf_tag, dw_die_ref));
+static dw_die_ref lookup_type_die      PARAMS ((tree));
+static void equate_type_number_to_die  PARAMS ((tree, dw_die_ref));
+static dw_die_ref lookup_decl_die      PARAMS ((tree));
+static void equate_decl_number_to_die  PARAMS ((tree, dw_die_ref));
+static void print_spaces               PARAMS ((FILE *));
+static void print_die                  PARAMS ((dw_die_ref, FILE *));
+static void print_dwarf_line_table     PARAMS ((FILE *));
+static void add_sibling_attributes     PARAMS ((dw_die_ref));
+static void build_abbrev_table         PARAMS ((dw_die_ref));
+static unsigned long size_of_string    PARAMS ((const char *));
+static int constant_size               PARAMS ((long unsigned));
+static unsigned long size_of_die       PARAMS ((dw_die_ref));
+static void calc_die_sizes             PARAMS ((dw_die_ref));
+static unsigned long size_of_line_prolog PARAMS ((void));
+static unsigned long size_of_pubnames  PARAMS ((void));
+static unsigned long size_of_aranges   PARAMS ((void));
+static enum dwarf_form value_format    PARAMS ((dw_attr_ref));
+static void output_value_format                PARAMS ((dw_attr_ref));
+static void output_abbrev_section      PARAMS ((void));
+static void output_die                 PARAMS ((dw_die_ref));
+static void output_compilation_unit_header PARAMS ((void));
+static const char *dwarf2_name         PARAMS ((tree, int));
+static void add_pubname                        PARAMS ((tree, dw_die_ref));
+static void output_pubnames            PARAMS ((void));
+static void add_arange                 PARAMS ((tree, dw_die_ref));
+static void output_aranges             PARAMS ((void));
+static void output_line_info           PARAMS ((void));
+static dw_die_ref base_type_die                PARAMS ((tree));
+static tree root_type                  PARAMS ((tree));
+static int is_base_type                        PARAMS ((tree));
+static dw_die_ref modified_type_die    PARAMS ((tree, int, int, dw_die_ref));
+static int type_is_enum                        PARAMS ((tree));
+static unsigned int reg_number         PARAMS ((rtx));
+static dw_loc_descr_ref reg_loc_descriptor PARAMS ((rtx));
+static dw_loc_descr_ref based_loc_descr        PARAMS ((unsigned, long));
+static int is_based_loc                        PARAMS ((rtx));
+static dw_loc_descr_ref mem_loc_descriptor PARAMS ((rtx, enum machine_mode mode));
+static dw_loc_descr_ref concat_loc_descriptor PARAMS ((rtx, rtx));
+static dw_loc_descr_ref loc_descriptor PARAMS ((rtx));
+static HOST_WIDE_INT ceiling           PARAMS ((HOST_WIDE_INT, unsigned int));
+static tree field_type                 PARAMS ((tree));
+static unsigned int simple_type_align_in_bits PARAMS ((tree));
+static unsigned HOST_WIDE_INT simple_type_size_in_bits PARAMS ((tree));
+static HOST_WIDE_INT field_byte_offset PARAMS ((tree));
+static void add_AT_location_description        PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute, rtx));
+static void add_data_member_location_attribute PARAMS ((dw_die_ref, tree));
+static void add_const_value_attribute  PARAMS ((dw_die_ref, rtx));
+static void add_location_or_const_value_attribute PARAMS ((dw_die_ref, tree));
+static void add_name_attribute         PARAMS ((dw_die_ref, const char *));
+static void add_bound_info             PARAMS ((dw_die_ref,
+                                                enum dwarf_attribute, tree));
+static void add_subscript_info         PARAMS ((dw_die_ref, tree));
+static void add_byte_size_attribute    PARAMS ((dw_die_ref, tree));
+static void add_bit_offset_attribute   PARAMS ((dw_die_ref, tree));
+static void add_bit_size_attribute     PARAMS ((dw_die_ref, tree));
+static void add_prototyped_attribute   PARAMS ((dw_die_ref, tree));
+static void add_abstract_origin_attribute PARAMS ((dw_die_ref, tree));
+static void add_pure_or_virtual_attribute PARAMS ((dw_die_ref, tree));
+static void add_src_coords_attributes  PARAMS ((dw_die_ref, tree));
+static void add_name_and_src_coords_attributes PARAMS ((dw_die_ref, tree));
+static void push_decl_scope            PARAMS ((tree));
+static dw_die_ref scope_die_for                PARAMS ((tree, dw_die_ref));
+static void pop_decl_scope             PARAMS ((void));
+static void add_type_attribute         PARAMS ((dw_die_ref, tree, int, int,
+                                                dw_die_ref));
+static const char *type_tag            PARAMS ((tree));
+static tree member_declared_type       PARAMS ((tree));
+#if 0
+static const char *decl_start_label    PARAMS ((tree));
+#endif
+static void gen_array_type_die         PARAMS ((tree, dw_die_ref));
+static void gen_set_type_die           PARAMS ((tree, dw_die_ref));
+#if 0
+static void gen_entry_point_die                PARAMS ((tree, dw_die_ref));
+#endif
+static void gen_inlined_enumeration_type_die PARAMS ((tree, dw_die_ref));
+static void gen_inlined_structure_type_die PARAMS ((tree, dw_die_ref));
+static void gen_inlined_union_type_die PARAMS ((tree, dw_die_ref));
+static void gen_enumeration_type_die   PARAMS ((tree, dw_die_ref));
+static dw_die_ref gen_formal_parameter_die PARAMS ((tree, dw_die_ref));
+static void gen_unspecified_parameters_die PARAMS ((tree, dw_die_ref));
+static void gen_formal_types_die       PARAMS ((tree, dw_die_ref));
+static void gen_subprogram_die         PARAMS ((tree, dw_die_ref));
+static void gen_variable_die           PARAMS ((tree, dw_die_ref));
+static void gen_label_die              PARAMS ((tree, dw_die_ref));
+static void gen_lexical_block_die      PARAMS ((tree, dw_die_ref, int));
+static void gen_inlined_subroutine_die PARAMS ((tree, dw_die_ref, int));
+static void gen_field_die              PARAMS ((tree, dw_die_ref));
+static void gen_ptr_to_mbr_type_die    PARAMS ((tree, dw_die_ref));
+static dw_die_ref gen_compile_unit_die PARAMS ((const char *));
+static void gen_string_type_die                PARAMS ((tree, dw_die_ref));
+static void gen_inheritance_die                PARAMS ((tree, dw_die_ref));
+static void gen_member_die             PARAMS ((tree, dw_die_ref));
+static void gen_struct_or_union_type_die PARAMS ((tree, dw_die_ref));
+static void gen_subroutine_type_die    PARAMS ((tree, dw_die_ref));
+static void gen_typedef_die            PARAMS ((tree, dw_die_ref));
+static void gen_type_die               PARAMS ((tree, dw_die_ref));
+static void gen_tagged_type_instantiation_die PARAMS ((tree, dw_die_ref));
+static void gen_block_die              PARAMS ((tree, dw_die_ref, int));
+static void decls_for_scope            PARAMS ((tree, dw_die_ref, int));
+static int is_redundant_typedef                PARAMS ((tree));
+static void gen_decl_die               PARAMS ((tree, dw_die_ref));
+static unsigned lookup_filename                PARAMS ((const char *));
+static void add_incomplete_type                PARAMS ((tree));
+static void retry_incomplete_types     PARAMS ((void));
+static void gen_type_die_for_member    PARAMS ((tree, tree, dw_die_ref));
+static void gen_abstract_function      PARAMS ((tree));
+static rtx save_rtx                    PARAMS ((rtx));
+static void splice_child_die           PARAMS ((dw_die_ref, dw_die_ref));
+static void reverse_die_lists          PARAMS ((dw_die_ref));
+
+/* Section names used to hold DWARF debugging information.  */
+#ifndef DEBUG_INFO_SECTION
+#define DEBUG_INFO_SECTION     ".debug_info"
+#endif
+#ifndef ABBREV_SECTION
+#define ABBREV_SECTION         ".debug_abbrev"
+#endif
+#ifndef ARANGES_SECTION
+#define ARANGES_SECTION                ".debug_aranges"
+#endif
+#ifndef DW_MACINFO_SECTION
+#define DW_MACINFO_SECTION     ".debug_macinfo"
+#endif
+#ifndef DEBUG_LINE_SECTION
+#define DEBUG_LINE_SECTION     ".debug_line"
+#endif
+#ifndef LOC_SECTION
+#define LOC_SECTION            ".debug_loc"
+#endif
+#ifndef PUBNAMES_SECTION
+#define PUBNAMES_SECTION       ".debug_pubnames"
+#endif
+#ifndef STR_SECTION
+#define STR_SECTION            ".debug_str"
+#endif
+
+/* Standard ELF section names for compiled code and data.  */
+#ifndef TEXT_SECTION
+#define TEXT_SECTION           ".text"
+#endif
+#ifndef DATA_SECTION
+#define DATA_SECTION           ".data"
+#endif
+#ifndef BSS_SECTION
+#define BSS_SECTION            ".bss"
+#endif
+
+/* Labels we insert at beginning sections we can reference instead of
+   the section names themselves. */
+
+#ifndef TEXT_SECTION_LABEL
+#define TEXT_SECTION_LABEL      "Ltext"
+#endif
+#ifndef DEBUG_LINE_SECTION_LABEL
+#define DEBUG_LINE_SECTION_LABEL "Ldebug_line"
+#endif
+#ifndef DEBUG_INFO_SECTION_LABEL
+#define DEBUG_INFO_SECTION_LABEL "Ldebug_info"
+#endif
+#ifndef ABBREV_SECTION_LABEL
+#define ABBREV_SECTION_LABEL     "Ldebug_abbrev"
+#endif
+
+
+/* Definitions of defaults for formats and names of various special
+   (artificial) labels which may be generated within this file (when the -g
+   options is used and DWARF_DEBUGGING_INFO is in effect.
+   If necessary, these may be overridden from within the tm.h file, but
+   typically, overriding these defaults is unnecessary.  */
+
+static char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES];
+static char text_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
+static char abbrev_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
+static char debug_info_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
+static char debug_line_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
+
+#ifndef TEXT_END_LABEL
+#define TEXT_END_LABEL         "Letext"
+#endif
+#ifndef DATA_END_LABEL
+#define DATA_END_LABEL         "Ledata"
+#endif
+#ifndef BSS_END_LABEL
+#define BSS_END_LABEL           "Lebss"
+#endif
+#ifndef INSN_LABEL_FMT
+#define INSN_LABEL_FMT         "LI%u_"
+#endif
+#ifndef BLOCK_BEGIN_LABEL
+#define BLOCK_BEGIN_LABEL      "LBB"
+#endif
+#ifndef BLOCK_END_LABEL
+#define BLOCK_END_LABEL                "LBE"
+#endif
+#ifndef BODY_BEGIN_LABEL
+#define BODY_BEGIN_LABEL       "Lbb"
+#endif
+#ifndef BODY_END_LABEL
+#define BODY_END_LABEL         "Lbe"
+#endif
+#ifndef LINE_CODE_LABEL
+#define LINE_CODE_LABEL                "LM"
+#endif
+#ifndef SEPARATE_LINE_CODE_LABEL
+#define SEPARATE_LINE_CODE_LABEL       "LSM"
+#endif
+\f
+/* We allow a language front-end to designate a function that is to be
+   called to "demangle" any name before it it put into a DIE.  */
+
+static const char *(*demangle_name_func) PARAMS ((const char *));
+
+void
+dwarf2out_set_demangle_name_func (func)
+     const char *(*func) PARAMS ((const char *));
+{
+  demangle_name_func = func;
+}
+\f
+/* Return an rtx like ORIG which lives forever.  If we're doing GC,
+   that means adding it to used_rtx_varray.  If not, that means making
+   a copy on the permanent_obstack.  */
+
+static rtx
+save_rtx (orig)
+     register rtx orig;
+{
+  if (ggc_p)
+    VARRAY_PUSH_RTX (used_rtx_varray, orig);
+  else
+    {
+      push_obstacks_nochange ();
+      end_temporary_allocation ();
+      orig = copy_rtx (orig);
+      pop_obstacks ();
+    }
+
+  return orig;
+}
+
+/* Test if rtl node points to a pseudo register.  */
+
+static inline int
+is_pseudo_reg (rtl)
+     register rtx rtl;
+{
+  return ((GET_CODE (rtl) == REG && REGNO (rtl) >= FIRST_PSEUDO_REGISTER)
+         || (GET_CODE (rtl) == SUBREG
+             && REGNO (XEXP (rtl, 0)) >= FIRST_PSEUDO_REGISTER));
+}
+
+/* Return a reference to a type, with its const and volatile qualifiers
+   removed.  */
+
+static inline tree
+type_main_variant (type)
+     register tree type;
+{
+  type = TYPE_MAIN_VARIANT (type);
+
+  /* There really should be only one main variant among any group of variants 
+     of a given type (and all of the MAIN_VARIANT values for all members of
+     the group should point to that one type) but sometimes the C front-end
+     messes this up for array types, so we work around that bug here.  */
+
+  if (TREE_CODE (type) == ARRAY_TYPE)
+    while (type != TYPE_MAIN_VARIANT (type))
+      type = TYPE_MAIN_VARIANT (type);
+
+  return type;
+}
+
+/* Return non-zero if the given type node represents a tagged type.  */
+
+static inline int
+is_tagged_type (type)
+     register tree type;
+{
+  register enum tree_code code = TREE_CODE (type);
+
+  return (code == RECORD_TYPE || code == UNION_TYPE
+         || code == QUAL_UNION_TYPE || code == ENUMERAL_TYPE);
+}
+
+/* Convert a DIE tag into its string name.  */
+
+static const char *
+dwarf_tag_name (tag)
+     register unsigned tag;
+{
+  switch (tag)
+    {
+    case DW_TAG_padding:
+      return "DW_TAG_padding";
+    case DW_TAG_array_type:
+      return "DW_TAG_array_type";
+    case DW_TAG_class_type:
+      return "DW_TAG_class_type";
+    case DW_TAG_entry_point:
+      return "DW_TAG_entry_point";
+    case DW_TAG_enumeration_type:
+      return "DW_TAG_enumeration_type";
+    case DW_TAG_formal_parameter:
+      return "DW_TAG_formal_parameter";
+    case DW_TAG_imported_declaration:
+      return "DW_TAG_imported_declaration";
+    case DW_TAG_label:
+      return "DW_TAG_label";
+    case DW_TAG_lexical_block:
+      return "DW_TAG_lexical_block";
+    case DW_TAG_member:
+      return "DW_TAG_member";
+    case DW_TAG_pointer_type:
+      return "DW_TAG_pointer_type";
+    case DW_TAG_reference_type:
+      return "DW_TAG_reference_type";
+    case DW_TAG_compile_unit:
+      return "DW_TAG_compile_unit";
+    case DW_TAG_string_type:
+      return "DW_TAG_string_type";
+    case DW_TAG_structure_type:
+      return "DW_TAG_structure_type";
+    case DW_TAG_subroutine_type:
+      return "DW_TAG_subroutine_type";
+    case DW_TAG_typedef:
+      return "DW_TAG_typedef";
+    case DW_TAG_union_type:
+      return "DW_TAG_union_type";
+    case DW_TAG_unspecified_parameters:
+      return "DW_TAG_unspecified_parameters";
+    case DW_TAG_variant:
+      return "DW_TAG_variant";
+    case DW_TAG_common_block:
+      return "DW_TAG_common_block";
+    case DW_TAG_common_inclusion:
+      return "DW_TAG_common_inclusion";
+    case DW_TAG_inheritance:
+      return "DW_TAG_inheritance";
+    case DW_TAG_inlined_subroutine:
+      return "DW_TAG_inlined_subroutine";
+    case DW_TAG_module:
+      return "DW_TAG_module";
+    case DW_TAG_ptr_to_member_type:
+      return "DW_TAG_ptr_to_member_type";
+    case DW_TAG_set_type:
+      return "DW_TAG_set_type";
+    case DW_TAG_subrange_type:
+      return "DW_TAG_subrange_type";
+    case DW_TAG_with_stmt:
+      return "DW_TAG_with_stmt";
+    case DW_TAG_access_declaration:
+      return "DW_TAG_access_declaration";
+    case DW_TAG_base_type:
+      return "DW_TAG_base_type";
+    case DW_TAG_catch_block:
+      return "DW_TAG_catch_block";
+    case DW_TAG_const_type:
+      return "DW_TAG_const_type";
+    case DW_TAG_constant:
+      return "DW_TAG_constant";
+    case DW_TAG_enumerator:
+      return "DW_TAG_enumerator";
+    case DW_TAG_file_type:
+      return "DW_TAG_file_type";
+    case DW_TAG_friend:
+      return "DW_TAG_friend";
+    case DW_TAG_namelist:
+      return "DW_TAG_namelist";
+    case DW_TAG_namelist_item:
+      return "DW_TAG_namelist_item";
+    case DW_TAG_packed_type:
+      return "DW_TAG_packed_type";
+    case DW_TAG_subprogram:
+      return "DW_TAG_subprogram";
+    case DW_TAG_template_type_param:
+      return "DW_TAG_template_type_param";
+    case DW_TAG_template_value_param:
+      return "DW_TAG_template_value_param";
+    case DW_TAG_thrown_type:
+      return "DW_TAG_thrown_type";
+    case DW_TAG_try_block:
+      return "DW_TAG_try_block";
+    case DW_TAG_variant_part:
+      return "DW_TAG_variant_part";
+    case DW_TAG_variable:
+      return "DW_TAG_variable";
+    case DW_TAG_volatile_type:
+      return "DW_TAG_volatile_type";
+    case DW_TAG_MIPS_loop:
+      return "DW_TAG_MIPS_loop";
+    case DW_TAG_format_label:
+      return "DW_TAG_format_label";
+    case DW_TAG_function_template:
+      return "DW_TAG_function_template";
+    case DW_TAG_class_template:
+      return "DW_TAG_class_template";
+    default:
+      return "DW_TAG_<unknown>";
+    }
+}
+
+/* Convert a DWARF attribute code into its string name.  */
+
+static const char *
+dwarf_attr_name (attr)
+     register unsigned attr;
+{
+  switch (attr)
+    {
+    case DW_AT_sibling:
+      return "DW_AT_sibling";
+    case DW_AT_location:
+      return "DW_AT_location";
+    case DW_AT_name:
+      return "DW_AT_name";
+    case DW_AT_ordering:
+      return "DW_AT_ordering";
+    case DW_AT_subscr_data:
+      return "DW_AT_subscr_data";
+    case DW_AT_byte_size:
+      return "DW_AT_byte_size";
+    case DW_AT_bit_offset:
+      return "DW_AT_bit_offset";
+    case DW_AT_bit_size:
+      return "DW_AT_bit_size";
+    case DW_AT_element_list:
+      return "DW_AT_element_list";
+    case DW_AT_stmt_list:
+      return "DW_AT_stmt_list";
+    case DW_AT_low_pc:
+      return "DW_AT_low_pc";
+    case DW_AT_high_pc:
+      return "DW_AT_high_pc";
+    case DW_AT_language:
+      return "DW_AT_language";
+    case DW_AT_member:
+      return "DW_AT_member";
+    case DW_AT_discr:
+      return "DW_AT_discr";
+    case DW_AT_discr_value:
+      return "DW_AT_discr_value";
+    case DW_AT_visibility:
+      return "DW_AT_visibility";
+    case DW_AT_import:
+      return "DW_AT_import";
+    case DW_AT_string_length:
+      return "DW_AT_string_length";
+    case DW_AT_common_reference:
+      return "DW_AT_common_reference";
+    case DW_AT_comp_dir:
+      return "DW_AT_comp_dir";
+    case DW_AT_const_value:
+      return "DW_AT_const_value";
+    case DW_AT_containing_type:
+      return "DW_AT_containing_type";
+    case DW_AT_default_value:
+      return "DW_AT_default_value";
+    case DW_AT_inline:
+      return "DW_AT_inline";
+    case DW_AT_is_optional:
+      return "DW_AT_is_optional";
+    case DW_AT_lower_bound:
+      return "DW_AT_lower_bound";
+    case DW_AT_producer:
+      return "DW_AT_producer";
+    case DW_AT_prototyped:
+      return "DW_AT_prototyped";
+    case DW_AT_return_addr:
+      return "DW_AT_return_addr";
+    case DW_AT_start_scope:
+      return "DW_AT_start_scope";
+    case DW_AT_stride_size:
+      return "DW_AT_stride_size";
+    case DW_AT_upper_bound:
+      return "DW_AT_upper_bound";
+    case DW_AT_abstract_origin:
+      return "DW_AT_abstract_origin";
+    case DW_AT_accessibility:
+      return "DW_AT_accessibility";
+    case DW_AT_address_class:
+      return "DW_AT_address_class";
+    case DW_AT_artificial:
+      return "DW_AT_artificial";
+    case DW_AT_base_types:
+      return "DW_AT_base_types";
+    case DW_AT_calling_convention:
+      return "DW_AT_calling_convention";
+    case DW_AT_count:
+      return "DW_AT_count";
+    case DW_AT_data_member_location:
+      return "DW_AT_data_member_location";
+    case DW_AT_decl_column:
+      return "DW_AT_decl_column";
+    case DW_AT_decl_file:
+      return "DW_AT_decl_file";
+    case DW_AT_decl_line:
+      return "DW_AT_decl_line";
+    case DW_AT_declaration:
+      return "DW_AT_declaration";
+    case DW_AT_discr_list:
+      return "DW_AT_discr_list";
+    case DW_AT_encoding:
+      return "DW_AT_encoding";
+    case DW_AT_external:
+      return "DW_AT_external";
+    case DW_AT_frame_base:
+      return "DW_AT_frame_base";
+    case DW_AT_friend:
+      return "DW_AT_friend";
+    case DW_AT_identifier_case:
+      return "DW_AT_identifier_case";
+    case DW_AT_macro_info:
+      return "DW_AT_macro_info";
+    case DW_AT_namelist_items:
+      return "DW_AT_namelist_items";
+    case DW_AT_priority:
+      return "DW_AT_priority";
+    case DW_AT_segment:
+      return "DW_AT_segment";
+    case DW_AT_specification:
+      return "DW_AT_specification";
+    case DW_AT_static_link:
+      return "DW_AT_static_link";
+    case DW_AT_type:
+      return "DW_AT_type";
+    case DW_AT_use_location:
+      return "DW_AT_use_location";
+    case DW_AT_variable_parameter:
+      return "DW_AT_variable_parameter";
+    case DW_AT_virtuality:
+      return "DW_AT_virtuality";
+    case DW_AT_vtable_elem_location:
+      return "DW_AT_vtable_elem_location";
+
+    case DW_AT_MIPS_fde:
+      return "DW_AT_MIPS_fde";
+    case DW_AT_MIPS_loop_begin:
+      return "DW_AT_MIPS_loop_begin";
+    case DW_AT_MIPS_tail_loop_begin:
+      return "DW_AT_MIPS_tail_loop_begin";
+    case DW_AT_MIPS_epilog_begin:
+      return "DW_AT_MIPS_epilog_begin";
+    case DW_AT_MIPS_loop_unroll_factor:
+      return "DW_AT_MIPS_loop_unroll_factor";
+    case DW_AT_MIPS_software_pipeline_depth:
+      return "DW_AT_MIPS_software_pipeline_depth";
+    case DW_AT_MIPS_linkage_name:
+      return "DW_AT_MIPS_linkage_name";
+    case DW_AT_MIPS_stride:
+      return "DW_AT_MIPS_stride";
+    case DW_AT_MIPS_abstract_name:
+      return "DW_AT_MIPS_abstract_name";
+    case DW_AT_MIPS_clone_origin:
+      return "DW_AT_MIPS_clone_origin";
+    case DW_AT_MIPS_has_inlines:
+      return "DW_AT_MIPS_has_inlines";
+
+    case DW_AT_sf_names:
+      return "DW_AT_sf_names";
+    case DW_AT_src_info:
+      return "DW_AT_src_info";
+    case DW_AT_mac_info:
+      return "DW_AT_mac_info";
+    case DW_AT_src_coords:
+      return "DW_AT_src_coords";
+    case DW_AT_body_begin:
+      return "DW_AT_body_begin";
+    case DW_AT_body_end:
+      return "DW_AT_body_end";
     default:
-      return "OP_<unknown>";
+      return "DW_AT_<unknown>";
+    }
+}
+
+/* Convert a DWARF value form code into its string name.  */
+
+static const char *
+dwarf_form_name (form)
+     register unsigned form;
+{
+  switch (form)
+    {
+    case DW_FORM_addr:
+      return "DW_FORM_addr";
+    case DW_FORM_block2:
+      return "DW_FORM_block2";
+    case DW_FORM_block4:
+      return "DW_FORM_block4";
+    case DW_FORM_data2:
+      return "DW_FORM_data2";
+    case DW_FORM_data4:
+      return "DW_FORM_data4";
+    case DW_FORM_data8:
+      return "DW_FORM_data8";
+    case DW_FORM_string:
+      return "DW_FORM_string";
+    case DW_FORM_block:
+      return "DW_FORM_block";
+    case DW_FORM_block1:
+      return "DW_FORM_block1";
+    case DW_FORM_data1:
+      return "DW_FORM_data1";
+    case DW_FORM_flag:
+      return "DW_FORM_flag";
+    case DW_FORM_sdata:
+      return "DW_FORM_sdata";
+    case DW_FORM_strp:
+      return "DW_FORM_strp";
+    case DW_FORM_udata:
+      return "DW_FORM_udata";
+    case DW_FORM_ref_addr:
+      return "DW_FORM_ref_addr";
+    case DW_FORM_ref1:
+      return "DW_FORM_ref1";
+    case DW_FORM_ref2:
+      return "DW_FORM_ref2";
+    case DW_FORM_ref4:
+      return "DW_FORM_ref4";
+    case DW_FORM_ref8:
+      return "DW_FORM_ref8";
+    case DW_FORM_ref_udata:
+      return "DW_FORM_ref_udata";
+    case DW_FORM_indirect:
+      return "DW_FORM_indirect";
+    default:
+      return "DW_FORM_<unknown>";
     }
 }
 
@@ -3542,6 +4007,12 @@ static tree
 decl_ultimate_origin (decl)
      register tree decl;
 {
+  /* output_inline_function sets DECL_ABSTRACT_ORIGIN for all the
+     nodes in the function to point to themselves; ignore that if
+     we're trying to output the abstract instance of this function.  */
+  if (DECL_ABSTRACT (decl) && DECL_ABSTRACT_ORIGIN (decl) == decl)
+    return NULL_TREE;
+
 #ifdef ENABLE_CHECKING 
   if (DECL_FROM_INLINE (DECL_ORIGIN (decl)))
     /* Since the DECL_ABSTRACT_ORIGIN for a DECL is supposed to be the
@@ -3564,6 +4035,12 @@ block_ultimate_origin (block)
 {
   register tree immediate_origin = BLOCK_ABSTRACT_ORIGIN (block);
 
+  /* output_inline_function sets BLOCK_ABSTRACT_ORIGIN for all the
+     nodes in the function to point to themselves; ignore that if
+     we're trying to output the abstract instance of this function.  */
+  if (BLOCK_ABSTRACT (block) && immediate_origin == block)
+    return NULL_TREE;
+
   if (immediate_origin == NULL_TREE)
     return NULL_TREE;
   else
@@ -3600,7 +4077,7 @@ decl_class_context (decl)
     context = TYPE_MAIN_VARIANT
       (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)))));
 
-  if (context && TREE_CODE_CLASS (TREE_CODE (context)) != 't')
+  if (context && !TYPE_P (context))
     context = NULL_TREE;
 
   return context;
@@ -3621,6 +4098,7 @@ add_dwarf_attr (die, attr)
     }
 }
 
+static inline dw_val_class AT_class PARAMS ((dw_attr_ref));
 static inline dw_val_class
 AT_class (a)
      dw_attr_ref a;
@@ -3645,6 +4123,7 @@ add_AT_flag (die, attr_kind, flag)
   add_dwarf_attr (die, attr);
 }
 
+static inline unsigned AT_flag PARAMS ((dw_attr_ref));
 static inline unsigned
 AT_flag (a)
      register dw_attr_ref a;
@@ -3672,6 +4151,7 @@ add_AT_int (die, attr_kind, int_val)
   add_dwarf_attr (die, attr);
 }
 
+static inline long int AT_int PARAMS ((dw_attr_ref));
 static inline long int
 AT_int (a)
      register dw_attr_ref a;
@@ -3699,6 +4179,7 @@ add_AT_unsigned (die, attr_kind, unsigned_val)
   add_dwarf_attr (die, attr);
 }
 
+static inline unsigned long AT_unsigned PARAMS ((dw_attr_ref));
 static inline unsigned long
 AT_unsigned (a)
      register dw_attr_ref a;
@@ -3764,6 +4245,7 @@ add_AT_string (die, attr_kind, str)
   add_dwarf_attr (die, attr);
 }
 
+static inline const char *AT_string PARAMS ((dw_attr_ref));
 static inline const char *
 AT_string (a)
      register dw_attr_ref a;
@@ -3791,6 +4273,7 @@ add_AT_die_ref (die, attr_kind, targ_die)
   add_dwarf_attr (die, attr);
 }
 
+static inline dw_die_ref AT_ref PARAMS ((dw_attr_ref));
 static inline dw_die_ref
 AT_ref (a)
      register dw_attr_ref a;
@@ -3835,6 +4318,7 @@ add_AT_loc (die, attr_kind, loc)
   add_dwarf_attr (die, attr);
 }
 
+static inline dw_loc_descr_ref AT_loc PARAMS ((dw_attr_ref));
 static inline dw_loc_descr_ref
 AT_loc (a)
      register dw_attr_ref a;
@@ -3851,7 +4335,7 @@ static inline void
 add_AT_addr (die, attr_kind, addr)
      register dw_die_ref die;
      register enum dwarf_attribute attr_kind;
-     char *addr;
+     rtx addr;
 {
   register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
 
@@ -3862,7 +4346,8 @@ add_AT_addr (die, attr_kind, addr)
   add_dwarf_attr (die, attr);
 }
 
-static inline const char *
+static inline rtx AT_addr PARAMS ((dw_attr_ref));
+static inline rtx
 AT_addr (a)
      register dw_attr_ref a;
 {
@@ -3878,7 +4363,7 @@ static inline void
 add_AT_lbl_id (die, attr_kind, lbl_id)
      register dw_die_ref die;
      register enum dwarf_attribute attr_kind;
-     register char *lbl_id;
+     register const char *lbl_id;
 {
   register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
 
@@ -3895,7 +4380,7 @@ static inline void
 add_AT_lbl_offset (die, attr_kind, label)
      register dw_die_ref die;
      register enum dwarf_attribute attr_kind;
-     register char *label;
+     register const char *label;
 {
   register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
 
@@ -3907,6 +4392,7 @@ add_AT_lbl_offset (die, attr_kind, label)
   
 }
 
+static inline const char *AT_lbl PARAMS ((dw_attr_ref));
 static inline const char *
 AT_lbl (a)
      register dw_attr_ref a;
@@ -4035,9 +4521,31 @@ is_fortran ()
   return (lang == DW_LANG_Fortran77 || lang == DW_LANG_Fortran90);
 } 
 
-/* Remove the specified attribute if present.  */
+/* Free up the memory used by A.  */
 
+static inline void free_AT PARAMS ((dw_attr_ref));
 static inline void
+free_AT (a)
+     dw_attr_ref a;
+{
+  switch (AT_class (a))
+    {
+    case dw_val_class_str:
+    case dw_val_class_lbl_id:
+    case dw_val_class_lbl_offset:
+      free (a->dw_attr_val.v.val_str);
+      break;
+
+    default:
+      break;
+    }
+
+  free (a);
+}  
+
+/* Remove the specified attribute if present.  */
+
+static void
 remove_AT (die, attr_kind)
      register dw_die_ref die;
      register enum dwarf_attribute attr_kind;
@@ -4056,28 +4564,24 @@ remove_AT (die, attr_kind)
          }
 
       if (removed != 0)
-       {
-         switch (AT_class (removed))
-           {
-           case dw_val_class_addr:
-           case dw_val_class_str:
-           case dw_val_class_lbl_id:
-           case dw_val_class_lbl_offset:
-             free (removed->dw_attr_val.v.val_str);
-             break;
+       free_AT (removed);
+    }
+}
 
-           default:
-             break;
-           }
+/* Free up the memory used by DIE.  */
 
-         free (removed);
-       }
-    }
+static inline void free_die PARAMS ((dw_die_ref));
+static inline void
+free_die (die)
+     dw_die_ref die;
+{
+  remove_children (die);
+  free (die);
 }
 
 /* Discard the children of this DIE.  */
 
-static inline void
+static void
 remove_children (die)
      register dw_die_ref die;
 {
@@ -4097,10 +4601,10 @@ remove_children (die)
          register dw_attr_ref tmp_a = a;
 
          a = a->dw_attr_next;
-         free (tmp_a);
+         free_AT (tmp_a);
        }
 
-      free (tmp_die);
+      free_die (tmp_die);
     }
 }
 
@@ -4122,6 +4626,39 @@ add_child_die (die, child_die)
     }
 }
 
+/* Move CHILD, which must be a child of PARENT or the DIE for which PARENT
+   is the specification, to the front of PARENT's list of children.  */
+
+static void
+splice_child_die (parent, child)
+     dw_die_ref parent, child;
+{
+  dw_die_ref *p;
+
+  /* We want the declaration DIE from inside the class, not the
+     specification DIE at toplevel.  */
+  if (child->die_parent != parent)
+    {
+      dw_die_ref tmp = get_AT_ref (child, DW_AT_specification);
+      if (tmp)
+       child = tmp;
+    }
+
+  if (child->die_parent != parent
+      && child->die_parent != get_AT_ref (parent, DW_AT_specification))
+    abort ();
+
+  for (p = &(parent->die_child); *p; p = &((*p)->die_sib))
+    if (*p == child)
+      {
+       *p = child->die_sib;
+       break;
+      }
+
+  child->die_sib = parent->die_child;
+  parent->die_child = child;
+}
+
 /* Return a pointer to a newly created DIE node.  */
 
 static inline dw_die_ref
@@ -4160,12 +4697,14 @@ static inline dw_die_ref
 lookup_type_die (type)
      register tree type;
 {
+  if (TREE_CODE (type) == VECTOR_TYPE)
+    type = TYPE_DEBUG_REPRESENTATION_TYPE (type);
   return (dw_die_ref) TYPE_SYMTAB_POINTER (type);
 }
 
 /* Equate a DIE to a given type specifier.  */
 
-static void
+static inline void
 equate_type_number_to_die (type, type_die)
      register tree type;
      register dw_die_ref type_die;
@@ -4211,49 +4750,10 @@ equate_decl_number_to_die (decl, decl_die)
       decl_die_table_allocated = num_allocated;
     }
 
-  if (decl_id >= decl_die_table_in_use)
-    decl_die_table_in_use = (decl_id + 1);
-
-  decl_die_table[decl_id] = decl_die;
-}
-
-/* Return a pointer to a newly allocated location description.  Location
-   descriptions are simple expression terms that can be strung
-   together to form more complicated location (address) descriptions.  */
-
-static inline dw_loc_descr_ref
-new_loc_descr (op, oprnd1, oprnd2)
-     register enum dwarf_location_atom op;
-     register unsigned long oprnd1;
-     register unsigned long oprnd2;
-{
-  register dw_loc_descr_ref descr
-    = (dw_loc_descr_ref) xmalloc (sizeof (dw_loc_descr_node));
-
-  descr->dw_loc_next = NULL;
-  descr->dw_loc_opc = op;
-  descr->dw_loc_oprnd1.val_class = dw_val_class_unsigned_const;
-  descr->dw_loc_oprnd1.v.val_unsigned = oprnd1;
-  descr->dw_loc_oprnd2.val_class = dw_val_class_unsigned_const;
-  descr->dw_loc_oprnd2.v.val_unsigned = oprnd2;
-
-  return descr;
-}
-
-/* Add a location description term to a location description expression.  */
-
-static inline void
-add_loc_descr (list_head, descr)
-     register dw_loc_descr_ref *list_head;
-     register dw_loc_descr_ref descr;
-{
-  register dw_loc_descr_ref *d;
-
-  /* Find the end of the chain.  */
-  for (d = list_head; (*d) != NULL; d = &(*d)->dw_loc_next)
-    ;
+  if (decl_id >= decl_die_table_in_use)
+    decl_die_table_in_use = (decl_id + 1);
 
-  *d = descr;
+  decl_die_table[decl_id] = decl_die;
 }
 \f
 /* Keep track of the number of spaces used to indent the
@@ -4522,123 +5022,6 @@ size_of_string (str)
   return strlen (str) + 1;
 }
 
-/* Return the size of a location descriptor.  */
-
-static unsigned long
-size_of_loc_descr (loc)
-     register dw_loc_descr_ref loc;
-{
-  register unsigned long size = 1;
-
-  switch (loc->dw_loc_opc)
-    {
-    case DW_OP_addr:
-      size += PTR_SIZE;
-      break;
-    case DW_OP_const1u:
-    case DW_OP_const1s:
-      size += 1;
-      break;
-    case DW_OP_const2u:
-    case DW_OP_const2s:
-      size += 2;
-      break;
-    case DW_OP_const4u:
-    case DW_OP_const4s:
-      size += 4;
-      break;
-    case DW_OP_const8u:
-    case DW_OP_const8s:
-      size += 8;
-      break;
-    case DW_OP_constu:
-      size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
-      break;
-    case DW_OP_consts:
-      size += size_of_sleb128 (loc->dw_loc_oprnd1.v.val_int);
-      break;
-    case DW_OP_pick:
-      size += 1;
-      break;
-    case DW_OP_plus_uconst:
-      size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
-      break;
-    case DW_OP_skip:
-    case DW_OP_bra:
-      size += 2;
-      break;
-    case DW_OP_breg0:
-    case DW_OP_breg1:
-    case DW_OP_breg2:
-    case DW_OP_breg3:
-    case DW_OP_breg4:
-    case DW_OP_breg5:
-    case DW_OP_breg6:
-    case DW_OP_breg7:
-    case DW_OP_breg8:
-    case DW_OP_breg9:
-    case DW_OP_breg10:
-    case DW_OP_breg11:
-    case DW_OP_breg12:
-    case DW_OP_breg13:
-    case DW_OP_breg14:
-    case DW_OP_breg15:
-    case DW_OP_breg16:
-    case DW_OP_breg17:
-    case DW_OP_breg18:
-    case DW_OP_breg19:
-    case DW_OP_breg20:
-    case DW_OP_breg21:
-    case DW_OP_breg22:
-    case DW_OP_breg23:
-    case DW_OP_breg24:
-    case DW_OP_breg25:
-    case DW_OP_breg26:
-    case DW_OP_breg27:
-    case DW_OP_breg28:
-    case DW_OP_breg29:
-    case DW_OP_breg30:
-    case DW_OP_breg31:
-      size += size_of_sleb128 (loc->dw_loc_oprnd1.v.val_int);
-      break;
-    case DW_OP_regx:
-      size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
-      break;
-    case DW_OP_fbreg:
-      size += size_of_sleb128 (loc->dw_loc_oprnd1.v.val_int);
-      break;
-    case DW_OP_bregx:
-      size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
-      size += size_of_sleb128 (loc->dw_loc_oprnd2.v.val_int);
-      break;
-    case DW_OP_piece:
-      size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
-      break;
-    case DW_OP_deref_size:
-    case DW_OP_xderef_size:
-      size += 1;
-      break;
-    default:
-      break;
-    }
-
-  return size;
-}
-
-/* Return the size of a series of location descriptors.  */
-
-static unsigned long
-size_of_locs (loc)
-     register dw_loc_descr_ref loc;
-{
-  register unsigned long size = 0;
-
-  for (; loc != NULL; loc = loc->dw_loc_next)
-    size += size_of_loc_descr (loc);
-
-  return size;
-}
-
 /* Return the power-of-two number of bytes necessary to represent VALUE.  */
 
 static int
@@ -4674,7 +5057,7 @@ size_of_die (die)
       switch (AT_class (a))
        {
        case dw_val_class_addr:
-         size += PTR_SIZE;
+         size += DWARF2_ADDR_SIZE;
          break;
        case dw_val_class_loc:
          {
@@ -4686,7 +5069,7 @@ size_of_die (die)
          }
          break;
        case dw_val_class_const:
-         size += 4;
+         size += size_of_sleb128 (AT_int (a));
          break;
        case dw_val_class_unsigned_const:
          size += constant_size (AT_unsigned (a));
@@ -4707,7 +5090,7 @@ size_of_die (die)
          size += DWARF_OFFSET_SIZE;
          break;
        case dw_val_class_lbl_id:
-         size += PTR_SIZE;
+         size += DWARF2_ADDR_SIZE;
          break;
        case dw_val_class_lbl_offset:
          size += DWARF_OFFSET_SIZE;
@@ -4814,11 +5197,11 @@ size_of_aranges ()
   size = DWARF_ARANGES_HEADER_SIZE;
 
   /* Count the address/length pair for this compilation unit.  */
-  size += 2 * PTR_SIZE;
-  size += 2 * PTR_SIZE * arange_table_in_use;
+  size += 2 * DWARF2_ADDR_SIZE;
+  size += 2 * DWARF2_ADDR_SIZE * arange_table_in_use;
 
   /* Count the two zero words used to terminated the address range table.  */
-  size += 2 * PTR_SIZE;
+  size += 2 * DWARF2_ADDR_SIZE;
   return size;
 }
 \f
@@ -4843,7 +5226,7 @@ value_format (a)
          abort ();
        }
     case dw_val_class_const:
-      return DW_FORM_data4;
+      return DW_FORM_sdata;
     case dw_val_class_unsigned_const:
       switch (constant_size (AT_unsigned (a)))
        {
@@ -4928,143 +5311,24 @@ output_abbrev_section ()
                  ? "DW_children_yes" : "DW_children_no"));
 
       fputc ('\n', asm_out_file);
-
-      for (a_attr = abbrev->die_attr; a_attr != NULL;
-          a_attr = a_attr->dw_attr_next)
-       {
-         output_uleb128 (a_attr->dw_attr);
-         if (flag_debug_asm)
-           fprintf (asm_out_file, " (%s)",
-                    dwarf_attr_name (a_attr->dw_attr));
-
-         fputc ('\n', asm_out_file);
-         output_value_format (a_attr);
-       }
-
-      fprintf (asm_out_file, "\t%s\t0,0\n", ASM_BYTE_OP);
-    }
-
-  /* Terminate the table.  */
-  fprintf (asm_out_file, "\t%s\t0\n", ASM_BYTE_OP);
-}
-
-/* Output location description stack opcode's operands (if any).  */
-
-static void
-output_loc_operands (loc)
-     register dw_loc_descr_ref loc;
-{
-  register dw_val_ref val1 = &loc->dw_loc_oprnd1;
-  register dw_val_ref val2 = &loc->dw_loc_oprnd2;
-
-  switch (loc->dw_loc_opc)
-    {
-    case DW_OP_addr:
-      ASM_OUTPUT_DWARF_ADDR_CONST (asm_out_file, val1->v.val_addr);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_const1u:
-    case DW_OP_const1s:
-      ASM_OUTPUT_DWARF_DATA1 (asm_out_file, val1->v.val_flag);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_const2u:
-    case DW_OP_const2s:
-      ASM_OUTPUT_DWARF_DATA2 (asm_out_file, val1->v.val_int);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_const4u:
-    case DW_OP_const4s:
-      ASM_OUTPUT_DWARF_DATA4 (asm_out_file, val1->v.val_int);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_const8u:
-    case DW_OP_const8s:
-      abort ();
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_constu:
-      output_uleb128 (val1->v.val_unsigned);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_consts:
-      output_sleb128 (val1->v.val_int);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_pick:
-      ASM_OUTPUT_DWARF_DATA1 (asm_out_file, val1->v.val_int);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_plus_uconst:
-      output_uleb128 (val1->v.val_unsigned);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_skip:
-    case DW_OP_bra:
-      ASM_OUTPUT_DWARF_DATA2 (asm_out_file, val1->v.val_int);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_breg0:
-    case DW_OP_breg1:
-    case DW_OP_breg2:
-    case DW_OP_breg3:
-    case DW_OP_breg4:
-    case DW_OP_breg5:
-    case DW_OP_breg6:
-    case DW_OP_breg7:
-    case DW_OP_breg8:
-    case DW_OP_breg9:
-    case DW_OP_breg10:
-    case DW_OP_breg11:
-    case DW_OP_breg12:
-    case DW_OP_breg13:
-    case DW_OP_breg14:
-    case DW_OP_breg15:
-    case DW_OP_breg16:
-    case DW_OP_breg17:
-    case DW_OP_breg18:
-    case DW_OP_breg19:
-    case DW_OP_breg20:
-    case DW_OP_breg21:
-    case DW_OP_breg22:
-    case DW_OP_breg23:
-    case DW_OP_breg24:
-    case DW_OP_breg25:
-    case DW_OP_breg26:
-    case DW_OP_breg27:
-    case DW_OP_breg28:
-    case DW_OP_breg29:
-    case DW_OP_breg30:
-    case DW_OP_breg31:
-      output_sleb128 (val1->v.val_int);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_regx:
-      output_uleb128 (val1->v.val_unsigned);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_fbreg:
-      output_sleb128 (val1->v.val_int);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_bregx:
-      output_uleb128 (val1->v.val_unsigned);
-      fputc ('\n', asm_out_file);
-      output_sleb128 (val2->v.val_int);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_piece:
-      output_uleb128 (val1->v.val_unsigned);
-      fputc ('\n', asm_out_file);
-      break;
-    case DW_OP_deref_size:
-    case DW_OP_xderef_size:
-      ASM_OUTPUT_DWARF_DATA1 (asm_out_file, val1->v.val_flag);
-      fputc ('\n', asm_out_file);
-      break;
-    default:
-      break;
+
+      for (a_attr = abbrev->die_attr; a_attr != NULL;
+          a_attr = a_attr->dw_attr_next)
+       {
+         output_uleb128 (a_attr->dw_attr);
+         if (flag_debug_asm)
+           fprintf (asm_out_file, " (%s)",
+                    dwarf_attr_name (a_attr->dw_attr));
+
+         fputc ('\n', asm_out_file);
+         output_value_format (a_attr);
+       }
+
+      fprintf (asm_out_file, "\t%s\t0,0\n", ASM_BYTE_OP);
     }
+
+  /* Terminate the table.  */
+  fprintf (asm_out_file, "\t%s\t0\n", ASM_BYTE_OP);
 }
 
 /* Output the DIE and its attributes.  Called recursively to generate
@@ -5077,7 +5341,6 @@ output_die (die)
   register dw_attr_ref a;
   register dw_die_ref c;
   register unsigned long size;
-  register dw_loc_descr_ref loc;
 
   output_uleb128 (die->die_abbrev);
   if (flag_debug_asm)
@@ -5115,23 +5378,15 @@ output_die (die)
                     ASM_COMMENT_START, dwarf_attr_name (a->dw_attr));
 
          fputc ('\n', asm_out_file);
-         for (loc = AT_loc (a); loc != NULL; loc = loc->dw_loc_next)
-           {
-             /* Output the opcode.  */
-             ASM_OUTPUT_DWARF_DATA1 (asm_out_file, loc->dw_loc_opc);
-             if (flag_debug_asm)
-               fprintf (asm_out_file, "\t%s %s", ASM_COMMENT_START,
-                        dwarf_stack_op_name (loc->dw_loc_opc));
-
-             fputc ('\n', asm_out_file);
 
-             /* Output the operand(s) (if any).  */
-             output_loc_operands (loc);
-           }
+         output_loc_sequence (AT_loc (a));
          break;
 
        case dw_val_class_const:
-         ASM_OUTPUT_DWARF_DATA4 (asm_out_file, AT_int (a));
+         /* ??? It would be slightly more efficient to use a scheme like is
+            used for unsigned constants below, but gdb 4.x does not sign
+            extend.  Gdb 5.x does sign extend.  */
+         output_sleb128 (AT_int (a));
          break;
 
        case dw_val_class_unsigned_const:
@@ -5147,9 +5402,7 @@ output_die (die)
              ASM_OUTPUT_DWARF_DATA4 (asm_out_file, AT_unsigned (a));
              break;
            case 8:
-             ASM_OUTPUT_DWARF_DATA8 (asm_out_file,
-                                     a->dw_attr_val.v.val_long_long.hi,
-                                     a->dw_attr_val.v.val_long_long.low);
+             ASM_OUTPUT_DWARF_DATA8 (asm_out_file, AT_unsigned (a));
              break;
            default:
              abort ();
@@ -5163,9 +5416,9 @@ output_die (die)
                   ASM_COMMENT_START, dwarf_attr_name (a->dw_attr));
 
          fputc ('\n', asm_out_file);
-         ASM_OUTPUT_DWARF_DATA8 (asm_out_file,
-                                 a->dw_attr_val.v.val_long_long.hi,
-                                 a->dw_attr_val.v.val_long_long.low);
+         ASM_OUTPUT_DWARF_CONST_DOUBLE (asm_out_file,
+                                        a->dw_attr_val.v.val_long_long.hi,
+                                        a->dw_attr_val.v.val_long_long.low);
 
          if (flag_debug_asm)
            fprintf (asm_out_file,
@@ -5285,7 +5538,7 @@ output_compilation_unit_header ()
             ASM_COMMENT_START);
 
   fputc ('\n', asm_out_file);
-  ASM_OUTPUT_DWARF_DATA1 (asm_out_file, PTR_SIZE);
+  ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DWARF2_ADDR_SIZE);
   if (flag_debug_asm)
     fprintf (asm_out_file, "\t%s Pointer Size (in bytes)", ASM_COMMENT_START);
 
@@ -5439,7 +5692,7 @@ output_aranges ()
             ASM_COMMENT_START);
 
   fputc ('\n', asm_out_file);
-  ASM_OUTPUT_DWARF_DATA1 (asm_out_file, PTR_SIZE);
+  ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DWARF2_ADDR_SIZE);
   if (flag_debug_asm)
     fprintf (asm_out_file, "\t%s Size of Address", ASM_COMMENT_START);
 
@@ -5450,19 +5703,19 @@ output_aranges ()
             ASM_COMMENT_START);
 
   fputc ('\n', asm_out_file);
-  /* We need to align to twice the pointer size here.
-     If DWARF_OFFSET_SIZE == 4, then we have emitted 12 bytes, and need 4
-     bytes of padding to align for either 4 or 8 byte pointers.  */
-  ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
-  /* If DWARF_OFFSET_SIZE == 8, then we have emitted 20 bytes, and need 12
-     bytes of padding to align for 8 byte pointers.  We have already emitted
-     4 bytes of padding, so emit 8 more here.  */
-  if (DWARF_OFFSET_SIZE == 8)
-    fprintf (asm_out_file, ",0,0");
 
-  if (flag_debug_asm)
-    fprintf (asm_out_file, "\t%s Pad to %d byte boundary",
-            ASM_COMMENT_START, 2 * PTR_SIZE);
+  /* We need to align to twice the pointer size here.  */
+  if (DWARF_ARANGES_PAD_SIZE)
+    {
+      /* Pad using a 2 bytes word so that padding is correct
+         for any pointer size.  */
+      ASM_OUTPUT_DWARF_DATA2 (asm_out_file, 0);
+      for (i = 2; i < DWARF_ARANGES_PAD_SIZE; i += 2)
+        fprintf (asm_out_file, ",0");
+      if (flag_debug_asm)
+        fprintf (asm_out_file, "\t%s Pad to %d byte boundary",
+                 ASM_COMMENT_START, 2 * DWARF2_ADDR_SIZE);
+    }
 
   fputc ('\n', asm_out_file);
   ASM_OUTPUT_DWARF_ADDR (asm_out_file, text_section_label);
@@ -5497,7 +5750,8 @@ output_aranges ()
          if (loc->dw_loc_opc != DW_OP_addr)
            abort ();
 
-         ASM_OUTPUT_DWARF_ADDR (asm_out_file, loc->dw_loc_oprnd1.v.val_addr);
+         ASM_OUTPUT_DWARF_ADDR_CONST (asm_out_file,
+                                      loc->dw_loc_oprnd1.v.val_addr);
        }
 
       if (flag_debug_asm)
@@ -5666,12 +5920,18 @@ output_line_info ()
     {
       register dw_line_info_ref line_info = &line_info_table[lt_index];
 
+#if 0
+      /* Disable this optimization for now; GDB wants to see two line notes
+        at the beginning of a function so it can find the end of the
+        prologue.  */
+
       /* Don't emit anything for redundant notes.  Just updating the
          address doesn't accomplish anything, because we already assume
          that anything after the last address is this line.  */
       if (line_info->dw_line_num == current_line
          && line_info->dw_file_num == current_file)
        continue;
+#endif
 
       /* Emit debug info for the address of the current line, choosing
         the encoding that uses the least amount of space.  */
@@ -5698,13 +5958,14 @@ output_line_info ()
        }
       else
        {
-         /* This can handle any delta.  This takes 4+PTR_SIZE bytes.  */
+         /* This can handle any delta.  This takes
+             4+DWARF2_ADDR_SIZE bytes.  */
          ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
          if (flag_debug_asm)
            fprintf (asm_out_file, "\t%s DW_LNE_set_address",
                     ASM_COMMENT_START);
          fputc ('\n', asm_out_file);
-         output_uleb128 (1 + PTR_SIZE);
+         output_uleb128 (1 + DWARF2_ADDR_SIZE);
          fputc ('\n', asm_out_file);
          ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
          fputc ('\n', asm_out_file);
@@ -5796,7 +6057,7 @@ output_line_info ()
       if (flag_debug_asm)
        fprintf (asm_out_file, "\t%s DW_LNE_set_address", ASM_COMMENT_START);
       fputc ('\n', asm_out_file);
-      output_uleb128 (1 + PTR_SIZE);
+      output_uleb128 (1 + DWARF2_ADDR_SIZE);
       fputc ('\n', asm_out_file);
       ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
       fputc ('\n', asm_out_file);
@@ -5804,8 +6065,6 @@ output_line_info ()
       fputc ('\n', asm_out_file);
     }
 
-  /* Output the marker for the end of the line number info.  */
-  ASM_OUTPUT_LABEL (asm_out_file, ".LTEND");
   ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
   if (flag_debug_asm)
     fprintf (asm_out_file, "\t%s DW_LNE_end_sequence", ASM_COMMENT_START);
@@ -5824,11 +6083,13 @@ output_line_info ()
       register dw_separate_line_info_ref line_info
        = &separate_line_info_table[lt_index];
 
+#if 0
       /* Don't emit anything for redundant notes.  */
       if (line_info->dw_line_num == current_line
          && line_info->dw_file_num == current_file
          && line_info->function == function)
        goto cont;
+#endif
 
       /* Emit debug info for the address of the current line.  If this is
         a new function, or the first line of a function, then we need
@@ -5846,7 +6107,7 @@ output_line_info ()
                     ASM_COMMENT_START);
 
          fputc ('\n', asm_out_file);
-         output_uleb128 (1 + PTR_SIZE);
+         output_uleb128 (1 + DWARF2_ADDR_SIZE);
          fputc ('\n', asm_out_file);
          ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
          fputc ('\n', asm_out_file);
@@ -5875,7 +6136,7 @@ output_line_info ()
                fprintf (asm_out_file, "\t%s DW_LNE_set_address",
                         ASM_COMMENT_START);
              fputc ('\n', asm_out_file);
-             output_uleb128 (1 + PTR_SIZE);
+             output_uleb128 (1 + DWARF2_ADDR_SIZE);
              fputc ('\n', asm_out_file);
              ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
              fputc ('\n', asm_out_file);
@@ -5944,7 +6205,9 @@ output_line_info ()
          fputc ('\n', asm_out_file);
        }
 
+#if 0
     cont:
+#endif
       ++lt_index;
 
       /* If we're done with a function, end its sequence.  */
@@ -5975,7 +6238,7 @@ output_line_info ()
                fprintf (asm_out_file, "\t%s DW_LNE_set_address",
                         ASM_COMMENT_START);
              fputc ('\n', asm_out_file);
-             output_uleb128 (1 + PTR_SIZE);
+             output_uleb128 (1 + DWARF2_ADDR_SIZE);
              fputc ('\n', asm_out_file);
              ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
              fputc ('\n', asm_out_file);
@@ -5996,38 +6259,11 @@ output_line_info ()
          fputc ('\n', asm_out_file);
        }
     }
-}
-\f
-/* Given a pointer to a BLOCK node return non-zero if (and only if) the node
-   in question represents the outermost pair of curly braces (i.e. the "body
-   block") of a function or method.
-
-   For any BLOCK node representing a "body block" of a function or method, the
-   BLOCK_SUPERCONTEXT of the node will point to another BLOCK node which
-   represents the outermost (function) scope for the function or method (i.e.
-   the one which includes the formal parameters).  The BLOCK_SUPERCONTEXT of
-   *that* node in turn will point to the relevant FUNCTION_DECL node. */
-
-static inline int
-is_body_block (stmt)
-     register tree stmt;
-{
-  if (TREE_CODE (stmt) == BLOCK)
-    {
-      register tree parent = BLOCK_SUPERCONTEXT (stmt);
-
-      if (TREE_CODE (parent) == BLOCK)
-       {
-         register tree grandparent = BLOCK_SUPERCONTEXT (parent);
-
-         if (TREE_CODE (grandparent) == FUNCTION_DECL)
-           return 1;
-       }
-    }
 
-  return 0;
+  /* Output the marker for the end of the line number info.  */
+  ASM_OUTPUT_LABEL (asm_out_file, ".LTEND");
 }
-
+\f
 /* Given a pointer to a tree node for some base type, return a pointer to
    a DIE that describes the given type.
 
@@ -6310,6 +6546,24 @@ type_is_enum (type)
   return TREE_CODE (type) == ENUMERAL_TYPE;
 }
 
+/* Return the register number described by a given RTL node.  */
+
+static unsigned int
+reg_number (rtl)
+     register rtx rtl;
+{
+  register unsigned regno = REGNO (rtl);
+
+  if (regno >= FIRST_PSEUDO_REGISTER)
+    {
+      warning ("internal regno botch: regno = %d\n", regno);
+      regno = 0;
+    }
+
+  regno = DBX_REGISTER_NUMBER (regno);
+  return regno;
+}
+
 /* Return a location descriptor that designates a machine register.  */
 
 static dw_loc_descr_ref
@@ -6387,6 +6641,10 @@ mem_loc_descriptor (rtl, mode)
      actually within the array.  That's *not* necessarily the same as the
      zeroth element of the array.  */
 
+#ifdef ASM_SIMPLIFY_DWARF_ADDR
+  rtl = ASM_SIMPLIFY_DWARF_ADDR (rtl);
+#endif
+
   switch (GET_CODE (rtl))
     {
     case POST_INC:
@@ -6436,7 +6694,7 @@ mem_loc_descriptor (rtl, mode)
     case SYMBOL_REF:
       mem_loc_result = new_loc_descr (DW_OP_addr, 0, 0);
       mem_loc_result->dw_loc_oprnd1.val_class = dw_val_class_addr;
-      mem_loc_result->dw_loc_oprnd1.v.val_addr = addr_to_string (rtl);
+      mem_loc_result->dw_loc_oprnd1.v.val_addr = save_rtx (rtl);
       break;
 
     case PRE_INC:
@@ -6549,13 +6807,13 @@ loc_descriptor (rtl)
   return loc_result;
 }
 
-/* Given an unsigned value, round it up to the lowest multiple of `boundary'
+/* Given a value, round it up to the lowest multiple of `boundary'
    which is not less than the value itself.  */
 
-static inline unsigned
+static inline HOST_WIDE_INT
 ceiling (value, boundary)
-     register unsigned value;
-     register unsigned boundary;
+     HOST_WIDE_INT value;
+     unsigned int boundary;
 {
   return (((value + boundary - 1) / boundary) * boundary);
 }
@@ -6599,7 +6857,7 @@ simple_type_align_in_bits (type)
    else return BITS_PER_WORD if the type actually turns out to be an
    ERROR_MARK node.  */
 
-static inline unsigned
+static inline unsigned HOST_WIDE_INT
 simple_type_size_in_bits (type)
      register tree type;
 {
@@ -6609,10 +6867,10 @@ simple_type_size_in_bits (type)
     {
       register tree type_size_tree = TYPE_SIZE (type);
 
-      if (TREE_CODE (type_size_tree) != INTEGER_CST)
+      if (! host_integerp (type_size_tree, 1))
        return TYPE_ALIGN (type);
 
-      return (unsigned) TREE_INT_CST_LOW (type_size_tree);
+      return tree_low_cst (type_size_tree, 1);
     }
 }
 
@@ -6623,22 +6881,21 @@ simple_type_size_in_bits (type)
    be a pointer to an ERROR_MARK node, or because the offset is actually
    variable.  (We can't handle the latter case just yet).  */
 
-static unsigned
+static HOST_WIDE_INT
 field_byte_offset (decl)
      register tree decl;
 {
-  register unsigned type_align_in_bytes;
-  register unsigned type_align_in_bits;
-  register unsigned type_size_in_bits;
-  register unsigned object_offset_in_align_units;
-  register unsigned object_offset_in_bits;
-  register unsigned object_offset_in_bytes;
-  register tree type;
-  register tree bitpos_tree;
-  register tree field_size_tree;
-  register unsigned bitpos_int;
-  register unsigned deepest_bitpos;
-  register unsigned field_size_in_bits;
+  unsigned int type_align_in_bytes;
+  unsigned int type_align_in_bits;
+  unsigned HOST_WIDE_INT type_size_in_bits;
+  HOST_WIDE_INT object_offset_in_align_units;
+  HOST_WIDE_INT object_offset_in_bits;
+  HOST_WIDE_INT object_offset_in_bytes;
+  tree type;
+  tree field_size_tree;
+  HOST_WIDE_INT bitpos_int;
+  HOST_WIDE_INT deepest_bitpos;
+  unsigned HOST_WIDE_INT field_size_in_bits;
 
   if (TREE_CODE (decl) == ERROR_MARK)
     return 0;
@@ -6647,21 +6904,28 @@ field_byte_offset (decl)
     abort ();
 
   type = field_type (decl);
-
-  bitpos_tree = DECL_FIELD_BITPOS (decl);
   field_size_tree = DECL_SIZE (decl);
 
+  /* If there was an error, the size could be zero.  */
+  if (! field_size_tree)
+    {
+      if (errorcount)
+       return 0;
+
+      abort ();
+    }
+
   /* We cannot yet cope with fields whose positions are variable, so 
      for now, when we see such things, we simply return 0.  Someday, we may
      be able to handle such cases, but it will be damn difficult.  */
-  if (TREE_CODE (bitpos_tree) != INTEGER_CST)
+  if (! host_integerp (bit_position (decl), 0))
     return 0;
 
-  bitpos_int = (unsigned) TREE_INT_CST_LOW (bitpos_tree);
+  bitpos_int = int_bit_position (decl);
 
     /* If we don't know the size of the field, pretend it's a full word.  */
-  if (TREE_CODE (field_size_tree) == INTEGER_CST)
-    field_size_in_bits = (unsigned) TREE_INT_CST_LOW (field_size_tree);
+  if (host_integerp (field_size_tree, 1))
+    field_size_in_bits = tree_low_cst (field_size_tree, 1);
   else
     field_size_in_bits = BITS_PER_WORD;
 
@@ -6797,7 +7061,7 @@ add_data_member_location_attribute (die, decl)
   register enum dwarf_location_atom op;
 
   if (TREE_CODE (decl) == TREE_VEC)
-    offset = TREE_INT_CST_LOW (BINFO_OFFSET (decl));
+    offset = tree_low_cst (BINFO_OFFSET (decl), 0);
   else
     offset = field_byte_offset (decl);
 
@@ -6888,7 +7152,7 @@ add_const_value_attribute (die, rtl)
     case SYMBOL_REF:
     case LABEL_REF:
     case CONST:
-      add_AT_addr (die, DW_AT_const_value, addr_to_string (rtl));
+      add_AT_addr (die, DW_AT_const_value, save_rtx (rtl));
       break;
 
     case PLUS:
@@ -7133,8 +7397,6 @@ add_bound_info (subrange_die, bound_attr, bound)
      register enum dwarf_attribute bound_attr;
      register tree bound;
 {
-  register unsigned bound_value = 0;
-
   /* If this is an Ada unconstrained array type, then don't emit any debug
      info because the array bounds are unknown.  They are parameterized when
      the type is instantiated.  */
@@ -7148,13 +7410,14 @@ add_bound_info (subrange_die, bound_attr, bound)
 
     /* All fixed-bounds are represented by INTEGER_CST nodes.        */
     case INTEGER_CST:
-      bound_value = TREE_INT_CST_LOW (bound);
-      if (bound_attr == DW_AT_lower_bound
-         && ((is_c_family () && bound_value == 0)
-             || (is_fortran () && bound_value == 1)))
-       /* use the default */;
+      if (! host_integerp (bound, 0)
+         || (bound_attr == DW_AT_lower_bound
+             && ((is_c_family () && integer_zerop (bound))
+                 || (is_fortran () && integer_onep (bound)))))
+       /* use the default */
+       ;
       else
-       add_AT_unsigned (subrange_die, bound_attr, bound_value);
+       add_AT_unsigned (subrange_die, bound_attr, tree_low_cst (bound, 0));
       break;
 
     case CONVERT_EXPR:
@@ -7186,7 +7449,8 @@ add_bound_info (subrange_die, bound_attr, bound)
         We assume that a MEM rtx is safe because gcc wouldn't put the
         value there unless it was going to be used repeatedly in the
         function, i.e. for cleanups.  */
-      if (! optimize || GET_CODE (SAVE_EXPR_RTL (bound)) == MEM)
+      if (! optimize || (SAVE_EXPR_RTL (bound)
+                        && GET_CODE (SAVE_EXPR_RTL (bound)) == MEM))
        {
          register dw_die_ref ctx = lookup_decl_die (current_function_decl);
          register dw_die_ref decl_die = new_die (DW_TAG_variable, ctx);
@@ -7367,13 +7631,12 @@ add_bit_offset_attribute (die, decl)
      register dw_die_ref die;
      register tree decl;
 {
-  register unsigned object_offset_in_bytes = field_byte_offset (decl);
-  register tree type = DECL_BIT_FIELD_TYPE (decl);
-  register tree bitpos_tree = DECL_FIELD_BITPOS (decl);
-  register unsigned bitpos_int;
-  register unsigned highest_order_object_bit_offset;
-  register unsigned highest_order_field_bit_offset;
-  register unsigned bit_offset;
+  HOST_WIDE_INT object_offset_in_bytes = field_byte_offset (decl);
+  tree type = DECL_BIT_FIELD_TYPE (decl);
+  HOST_WIDE_INT bitpos_int;
+  HOST_WIDE_INT highest_order_object_bit_offset;
+  HOST_WIDE_INT highest_order_field_bit_offset;
+  HOST_WIDE_INT unsigned bit_offset;
 
   /* Must be a field and a bit field.  */
   if (!type
@@ -7382,11 +7645,12 @@ add_bit_offset_attribute (die, decl)
 
   /* We can't yet handle bit-fields whose offsets are variable, so if we
      encounter such things, just return without generating any attribute
-     whatsoever.  */
-  if (TREE_CODE (bitpos_tree) != INTEGER_CST)
+     whatsoever.  Likewise for variable or too large size.  */
+  if (! host_integerp (bit_position (decl), 0)
+      || ! host_integerp (DECL_SIZE (decl), 1))
     return;
 
-  bitpos_int = (unsigned) TREE_INT_CST_LOW (bitpos_tree);
+  bitpos_int = int_bit_position (decl);
 
   /* Note that the bit offset is always the distance (in bits) from the
      highest-order bit of the "containing object" to the highest-order bit of 
@@ -7398,9 +7662,7 @@ add_bit_offset_attribute (die, decl)
 
   if (! BYTES_BIG_ENDIAN)
     {
-      highest_order_field_bit_offset
-       += (unsigned) TREE_INT_CST_LOW (DECL_SIZE (decl));
-
+      highest_order_field_bit_offset += tree_low_cst (DECL_SIZE (decl), 0);
       highest_order_object_bit_offset += simple_type_size_in_bits (type);
     }
 
@@ -7424,8 +7686,9 @@ add_bit_size_attribute (die, decl)
   if (TREE_CODE (decl) != FIELD_DECL
       || ! DECL_BIT_FIELD_TYPE (decl))
     abort ();
-  add_AT_unsigned (die, DW_AT_bit_size,
-                  (unsigned) TREE_INT_CST_LOW (DECL_SIZE (decl)));
+
+  if (host_integerp (DECL_SIZE (decl), 1))
+    add_AT_unsigned (die, DW_AT_bit_size, tree_low_cst (DECL_SIZE (decl), 1));
 }
 
 /* If the compiled language is ANSI C, then add a 'prototyped'
@@ -7453,9 +7716,25 @@ add_abstract_origin_attribute (die, origin)
 {
   dw_die_ref origin_die = NULL;
 
-  if (TREE_CODE_CLASS (TREE_CODE (origin)) == 'd')
+  if (TREE_CODE (origin) != FUNCTION_DECL)
+    {
+      /* We may have gotten separated from the block for the inlined
+        function, if we're in an exception handler or some such; make
+        sure that the abstract function has been written out.
+
+         Doing this for nested functions is wrong, however; functions are
+        distinct units, and our context might not even be inline.  */
+      tree fn = origin;
+      if (TYPE_P (fn))
+       fn = TYPE_STUB_DECL (fn);
+      fn = decl_function_context (fn);
+      if (fn)
+       gen_abstract_function (fn);
+    }
+
+  if (DECL_P (origin))
     origin_die = lookup_decl_die (origin);
-  else if (TREE_CODE_CLASS (TREE_CODE (origin)) == 't')
+  else if (TYPE_P (origin))
     origin_die = lookup_type_die (origin);
 
   if (origin_die == NULL)
@@ -7474,10 +7753,12 @@ add_pure_or_virtual_attribute (die, func_decl)
   if (DECL_VINDEX (func_decl))
     {
       add_AT_unsigned (die, DW_AT_virtuality, DW_VIRTUALITY_virtual);
-      add_AT_loc (die, DW_AT_vtable_elem_location,
-                 new_loc_descr (DW_OP_constu,
-                                TREE_INT_CST_LOW (DECL_VINDEX (func_decl)),
-                                0));
+
+      if (host_integerp (DECL_VINDEX (func_decl), 0))
+       add_AT_loc (die, DW_AT_vtable_elem_location,
+                   new_loc_descr (DW_OP_constu,
+                                  tree_low_cst (DECL_VINDEX (func_decl), 0),
+                                  0));
 
       /* GNU extension: Record what type this method came from originally.  */
       if (debug_info_level > DINFO_LEVEL_TERSE)
@@ -7517,6 +7798,7 @@ add_name_and_src_coords_attributes (die, decl)
        add_src_coords_attributes (die, decl);
 
       if ((TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL)
+         && TREE_PUBLIC (decl)
          && DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
        add_AT_string (die, DW_AT_MIPS_linkage_name,
                       IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
@@ -7534,34 +7816,28 @@ push_decl_scope (scope)
     {
       decl_scope_table_allocated += DECL_SCOPE_TABLE_INCREMENT;
       decl_scope_table
-       = (decl_scope_node *) xrealloc (decl_scope_table,
-                                       (decl_scope_table_allocated
-                                        * sizeof (decl_scope_node)));
-    }
-
-  decl_scope_table[decl_scope_depth].scope = scope;
-
-  /* If we're starting to emit a global class while we're in the middle
-     of emitting a function, we need to find the proper .previous.  */
-
-  if (AGGREGATE_TYPE_P (scope))
-    {
-      tree containing_scope = TYPE_CONTEXT (scope);
-      int i;
-
-      for (i = decl_scope_depth - 1; i >= 0; --i)
-       if (decl_scope_table[i].scope == containing_scope)
-         break;
-
-      decl_scope_table[decl_scope_depth].previous = i;
+       = (tree *) xrealloc (decl_scope_table,
+                            decl_scope_table_allocated * sizeof (tree));
     }
-  else
-    decl_scope_table[decl_scope_depth].previous = decl_scope_depth - 1;
 
+  decl_scope_table[decl_scope_depth] = scope;
   decl_scope_depth++;
 }
 
-/* Return the DIE for the scope that immediately contains this declaration.  */
+/* Pop a declaration scope.  */
+static inline void
+pop_decl_scope ()
+{
+  if (decl_scope_depth <= 0)
+    abort ();
+  --decl_scope_depth;
+}
+
+/* Return the DIE for the scope that immediately contains this type.
+   Non-named types get global scope.  Named types nested in other
+   types get their containing scope if it's open, or global scope
+   otherwise.  All other types (i.e. function-local named types) get
+   the current active scope.  */
 
 static dw_die_ref
 scope_die_for (t, context_die)
@@ -7572,14 +7848,11 @@ scope_die_for (t, context_die)
   register tree containing_scope;
   register int i;
 
-  /* Walk back up the declaration tree looking for a place to define
-     this type.  */
-  if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
-    containing_scope = TYPE_CONTEXT (t);
-  else if (TREE_CODE (t) == FUNCTION_DECL && DECL_VINDEX (t))
-    containing_scope = decl_class_context (t);
-  else
-    containing_scope = DECL_CONTEXT (t);
+  /* Non-types always go in the current scope.  */
+  if (! TYPE_P (t))
+    abort ();
+
+  containing_scope = TYPE_CONTEXT (t);
 
   /* Ignore namespaces for the moment.  */
   if (containing_scope && TREE_CODE (containing_scope) == NAMESPACE_DECL)
@@ -7591,34 +7864,20 @@ scope_die_for (t, context_die)
   if (containing_scope && TREE_CODE (containing_scope) == FUNCTION_TYPE)
     containing_scope = NULL_TREE;
 
-  /* Function-local tags and functions get stuck in limbo until they are
-     fixed up by decls_for_scope.  */
-  if (context_die == NULL && containing_scope != NULL_TREE
-      && (TREE_CODE (t) == FUNCTION_DECL || is_tagged_type (t)))
-    return NULL;
-
   if (containing_scope == NULL_TREE)
     scope_die = comp_unit_die;
-  else if (TYPE_P (containing_scope) || DECL_P (containing_scope))
+  else if (TYPE_P (containing_scope))
     {
-      /* For types and decls, we can just look up the appropriate DIE.  But
-        first we check to see if we're in the middle of emitting it so we
-        know where the new DIE should go.  */
+      /* For types, we can just look up the appropriate DIE.  But
+        first we check to see if we're in the middle of emitting it
+        so we know where the new DIE should go.  */
 
       for (i = decl_scope_depth - 1; i >= 0; --i)
-       if (decl_scope_table[i].scope == containing_scope)
+       if (decl_scope_table[i] == containing_scope)
          break;
 
       if (i < 0)
        {
-         /* Function-local tags and functions get stuck in limbo
-            until they are fixed up by decls_for_scope.  */
-         if (TREE_CODE (containing_scope) == FUNCTION_DECL
-             && (TREE_CODE (t) == FUNCTION_DECL || is_tagged_type (t)))
-           return NULL;
-           
-         if (! TYPE_P (containing_scope))
-           abort ();
          if (debug_info_level > DINFO_LEVEL_TERSE
              && !TREE_ASM_WRITTEN (containing_scope))
            abort ();
@@ -7627,56 +7886,38 @@ scope_die_for (t, context_die)
          scope_die = comp_unit_die;
        }
       else
-       {
-         if (TYPE_P (containing_scope))
-           scope_die = lookup_type_die (containing_scope);
-         else
-           scope_die = lookup_decl_die (containing_scope);
-       }
+       scope_die = lookup_type_die (containing_scope);
     }
   else
-    {
-      /* Something that we can't just look up the DIE for, such as a
-         BLOCK.  */
-
-      for (i = decl_scope_depth - 1, scope_die = context_die;
-          i >= 0 && decl_scope_table[i].scope != containing_scope;
-          (scope_die = scope_die->die_parent,
-           i = decl_scope_table[i].previous))
-       ;
+    scope_die = context_die;
 
-      /* ??? Integrate_decl_tree does not handle BLOCK_TYPE_TAGS, nor
-        does it try to handle types defined by TYPE_DECLs.  Such types
-        thus have an incorrect TYPE_CONTEXT, which points to the block
-        they were originally defined in, instead of the current block
-        created by function inlining.  We try to detect that here and
-        work around it.  */
-
-      if (i < 0 && scope_die == comp_unit_die
-         && TREE_CODE (containing_scope) == BLOCK
-         && is_tagged_type (t)
-         && (block_ultimate_origin (decl_scope_table[decl_scope_depth - 1].scope)
-             == containing_scope))
-       {
-         scope_die = context_die;
-         /* Since the checks below are no longer applicable.  */
-         i = 0;
-       }
+  return scope_die;
+}
 
-      if (i < 0)
-       abort ();
-    }
+/* Returns nonzero iff CONTEXT_DIE is internal to a function.  */
 
-  return scope_die;
+static inline int local_scope_p PARAMS ((dw_die_ref));
+static inline int
+local_scope_p (context_die)
+     dw_die_ref context_die;
+{
+  for (; context_die; context_die = context_die->die_parent)
+    if (context_die->die_tag == DW_TAG_inlined_subroutine
+       || context_die->die_tag == DW_TAG_subprogram)
+      return 1;
+  return 0;
 }
 
-/* Pop a declaration scope.  */
-static inline void
-pop_decl_scope ()
+/* Returns nonzero iff CONTEXT_DIE is a class.  */
+
+static inline int class_scope_p PARAMS ((dw_die_ref));
+static inline int
+class_scope_p (context_die)
+     dw_die_ref context_die;
 {
-  if (decl_scope_depth <= 0)
-    abort ();
-  --decl_scope_depth;
+  return (context_die
+         && (context_die->die_tag == DW_TAG_structure_type
+             || context_die->die_tag == DW_TAG_union_type));
 }
 
 /* Many forms of DIEs require a "type description" attribute.  This
@@ -7723,11 +7964,11 @@ add_type_attribute (object_die, type, decl_const, decl_volatile, context_die)
    a pointer to the (string) tag name for the given type, or zero if the type
    was declared without a tag.  */
 
-static char *
+static const char *
 type_tag (type)
      register tree type;
 {
-  register char *name = 0;
+  register const char *name = 0;
 
   if (TYPE_NAME (type) != 0)
     {
@@ -7768,12 +8009,12 @@ member_declared_type (member)
    from the DECL_NAME name used in the source file.  */
 
 #if 0
-static char *
+static const char *
 decl_start_label (decl)
      register tree decl;
 {
   rtx x;
-  char *fnname;
+  const char *fnname;
   x = DECL_RTL (decl);
   if (GET_CODE (x) != MEM)
     abort ();
@@ -7885,45 +8126,6 @@ gen_entry_point_die (decl, context_die)
 }
 #endif
 
-/* Remember a type in the pending_types_list.  */
-
-static void
-pend_type (type)
-     register tree type;
-{
-  if (pending_types == pending_types_allocated)
-    {
-      pending_types_allocated += PENDING_TYPES_INCREMENT;
-      pending_types_list
-       = (tree *) xrealloc (pending_types_list,
-                            sizeof (tree) * pending_types_allocated);
-    }
-
-  pending_types_list[pending_types++] = type;
-}
-
-/* Output any pending types (from the pending_types list) which we can output
-   now (taking into account the scope that we are working on now).
-
-   For each type output, remove the given type from the pending_types_list
-   *before* we try to output it.  */
-
-static void
-output_pending_types_for_scope (context_die)
-     register dw_die_ref context_die;
-{
-  register tree type;
-
-  while (pending_types)
-    {
-      --pending_types;
-      type = pending_types_list[pending_types];
-      gen_type_die (type, context_die);
-      if (!TREE_ASM_WRITTEN (type))
-       abort ();
-    }
-}
-
 /* Remember a type in the incomplete_types_list.  */
 
 static void
@@ -7965,7 +8167,7 @@ gen_inlined_enumeration_type_die (type, context_die)
      register dw_die_ref context_die;
 {
   register dw_die_ref type_die = new_die (DW_TAG_enumeration_type,
-                                         scope_die_for (type, context_die));
+                                         context_die);
   /* We do not check for TREE_ASM_WRITTEN (type) being set, as the type may
      be incomplete and such types are not marked.  */
   add_abstract_origin_attribute (type_die, type);
@@ -7978,8 +8180,8 @@ gen_inlined_structure_type_die (type, context_die)
      register tree type;
      register dw_die_ref context_die;
 {
-  register dw_die_ref type_die = new_die (DW_TAG_structure_type,
-                                         scope_die_for (type, context_die));
+  register dw_die_ref type_die = new_die (DW_TAG_structure_type, context_die);
+
   /* We do not check for TREE_ASM_WRITTEN (type) being set, as the type may
      be incomplete and such types are not marked.  */
   add_abstract_origin_attribute (type_die, type);
@@ -7992,8 +8194,8 @@ gen_inlined_union_type_die (type, context_die)
      register tree type;
      register dw_die_ref context_die;
 {
-  register dw_die_ref type_die = new_die (DW_TAG_union_type,
-                                         scope_die_for (type, context_die));
+  register dw_die_ref type_die = new_die (DW_TAG_union_type, context_die);
+
   /* We do not check for TREE_ASM_WRITTEN (type) being set, as the type may
      be incomplete and such types are not marked.  */
   add_abstract_origin_attribute (type_die, type);
@@ -8047,8 +8249,16 @@ gen_enumeration_type_die (type, context_die)
 
          add_name_attribute (enum_die,
                              IDENTIFIER_POINTER (TREE_PURPOSE (link)));
-         add_AT_unsigned (enum_die, DW_AT_const_value,
-                          (unsigned) TREE_INT_CST_LOW (TREE_VALUE (link)));
+
+         if (host_integerp (TREE_VALUE (link), 0))
+           {
+             if (tree_int_cst_sgn (TREE_VALUE (link)) < 0)
+               add_AT_int (enum_die, DW_AT_const_value,
+                           tree_low_cst (TREE_VALUE (link), 0));
+             else
+               add_AT_unsigned (enum_die, DW_AT_const_value,
+                                tree_low_cst (TREE_VALUE (link), 0));
+           }
        }
     }
   else
@@ -8127,12 +8337,7 @@ gen_unspecified_parameters_die (decl_or_type, context_die)
 /* Generate a list of nameless DW_TAG_formal_parameter DIEs (and perhaps a
    DW_TAG_unspecified_parameters DIE) to represent the types of the formal
    parameters as specified in some function type specification (except for
-   those which appear as part of a function *definition*).
-
-   Note we must be careful here to output all of the parameter DIEs before*
-   we output any DIEs needed to represent the types of the formal parameters.
-   This keeps svr4 SDB happy because it (incorrectly) thinks that the first
-   non-parameter DIE it sees ends the formal parameter list.  */
+   those which appear as part of a function *definition*).  */
 
 static void
 gen_formal_types_die (function_or_method_type, context_die)
@@ -8192,6 +8397,61 @@ gen_formal_types_die (function_or_method_type, context_die)
     }
 }
 
+/* We want to generate the DIE for TYPE so that we can generate the
+   die for MEMBER, which has been defined; we will need to refer back
+   to the member declaration nested within TYPE.  If we're trying to
+   generate minimal debug info for TYPE, processing TYPE won't do the
+   trick; we need to attach the member declaration by hand.  */
+
+static void
+gen_type_die_for_member (type, member, context_die)
+     tree type, member;
+     dw_die_ref context_die;
+{
+  gen_type_die (type, context_die);
+
+  /* If we're trying to avoid duplicate debug info, we may not have
+     emitted the member decl for this function.  Emit it now.  */
+  if (TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (type))
+      && ! lookup_decl_die (member))
+    {
+      if (decl_ultimate_origin (member))
+       abort ();
+
+      push_decl_scope (type);
+      if (TREE_CODE (member) == FUNCTION_DECL)
+       gen_subprogram_die (member, lookup_type_die (type));
+      else
+       gen_variable_die (member, lookup_type_die (type));
+      pop_decl_scope ();
+    }
+}
+
+/* Generate the DWARF2 info for the "abstract" instance
+   of a function which we may later generate inlined and/or
+   out-of-line instances of.  */
+
+static void
+gen_abstract_function (decl)
+     tree decl;
+{
+  register dw_die_ref old_die = lookup_decl_die (decl);
+  tree save_fn;
+
+  if (old_die && get_AT_unsigned (old_die, DW_AT_inline))
+    /* We've already generated the abstract instance.  */
+    return;
+
+  save_fn = current_function_decl;
+  current_function_decl = decl;
+
+  set_decl_abstract_flags (decl, 1);
+  dwarf2out_decl (decl);
+  set_decl_abstract_flags (decl, 0);
+
+  current_function_decl = save_fn;
+}
+
 /* Generate a DIE to represent a declared function (either file-scope or
    block-local).  */
 
@@ -8207,14 +8467,34 @@ gen_subprogram_die (decl, context_die)
   register tree fn_arg_types;
   register tree outer_scope;
   register dw_die_ref old_die = lookup_decl_die (decl);
-  register int declaration
-    = (current_function_decl != decl
-       || (context_die
-          && (context_die->die_tag == DW_TAG_structure_type
-              || context_die->die_tag == DW_TAG_union_type)));
+  register int declaration = (current_function_decl != decl
+                             || class_scope_p (context_die));
+
+  /* Note that it is possible to have both DECL_ABSTRACT and `declaration'
+     be true, if we started to generate the abstract instance of an inline,
+     decided to output its containing class, and proceeded to emit the
+     declaration of the inline from the member list for the class.  In that
+     case, `declaration' takes priority; we'll get back to the abstract
+     instance when we're done with the class.  */
+
+  /* The class-scope declaration DIE must be the primary DIE.  */
+  if (origin && declaration && class_scope_p (context_die))
+    {
+      origin = NULL;
+      if (old_die)
+       abort ();
+    }
 
   if (origin != NULL)
     {
+      if (declaration && ! local_scope_p (context_die))
+       abort ();
+
+      /* Fixup die_parent for the abstract instance of a nested
+        inline function.  */
+      if (old_die && old_die->die_parent == NULL)
+       add_child_die (context_die, old_die);
+
       subr_die = new_die (DW_TAG_subprogram, context_die);
       add_abstract_origin_attribute (subr_die, origin);
     }
@@ -8280,15 +8560,7 @@ gen_subprogram_die (decl, context_die)
     }
   else
     {
-      register dw_die_ref scope_die;
-
-      if (DECL_CONTEXT (decl))
-       scope_die = scope_die_for (decl, context_die);
-      else
-       /* Don't put block extern declarations under comp_unit_die.  */
-       scope_die = context_die;
-
-      subr_die = new_die (DW_TAG_subprogram, scope_die);
+      subr_die = new_die (DW_TAG_subprogram, context_die);
                         
       if (TREE_PUBLIC (decl))
        add_AT_flag (subr_die, DW_AT_external, 1);
@@ -8313,33 +8585,32 @@ gen_subprogram_die (decl, context_die)
 
   if (declaration)
     {
-      add_AT_flag (subr_die, DW_AT_declaration, 1);
+      if (! origin)
+       add_AT_flag (subr_die, DW_AT_declaration, 1);
 
       /* The first time we see a member function, it is in the context of
          the class to which it belongs.  We make sure of this by emitting
          the class first.  The next time is the definition, which is
          handled above.  The two may come from the same source text.  */
-      if (DECL_CONTEXT (decl))
+      if (DECL_CONTEXT (decl) || DECL_ABSTRACT (decl))
        equate_decl_number_to_die (decl, subr_die);
     }
   else if (DECL_ABSTRACT (decl))
     {
-      /* ??? Checking DECL_DEFER_OUTPUT is correct for static inline functions,
-        but not for extern inline functions.  We can't get this completely
-        correct because information about whether the function was declared
-        inline is not saved anywhere.  */
-      if (DECL_DEFER_OUTPUT (decl))
+      if (DECL_INLINE (decl) && !flag_no_inline)
        {
-         if (DECL_INLINE (decl) && !flag_no_inline)
+         /* ??? Checking DECL_DEFER_OUTPUT is correct for static
+            inline functions, but not for extern inline functions.
+            We can't get this completely correct because information
+            about whether the function was declared inline is not
+            saved anywhere.  */
+         if (DECL_DEFER_OUTPUT (decl))
            add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_inlined);
          else
-           add_AT_unsigned (subr_die, DW_AT_inline,
-                            DW_INL_declared_not_inlined);
+           add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_inlined);
        }
-      else if (DECL_INLINE (decl) && !flag_no_inline)
-       add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_inlined);
       else
-       abort ();
+       add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_not_inlined);
 
       equate_decl_number_to_die (decl, subr_die);
     }
@@ -8388,7 +8659,6 @@ gen_subprogram_die (decl, context_die)
      FUNCTION_TYPE. If the chain of type nodes hanging off of this
      FUNCTION_TYPE node ends with a void_type_node then there should *not* be 
      an ellipsis at the end.  */
-  push_decl_scope (decl);
 
   /* In the case where we are describing a mere function declaration, all we
      need to do here (and all we *can* do here) is to describe the *types* of 
@@ -8468,8 +8738,6 @@ gen_subprogram_die (decl, context_die)
        }
 #endif
     }
-
-  pop_decl_scope ();
 }
 
 /* Generate a DIE to represent a declared data object.  */
@@ -8483,11 +8751,8 @@ gen_variable_die (decl, context_die)
   register dw_die_ref var_die = new_die (DW_TAG_variable, context_die);
 
   dw_die_ref old_die = lookup_decl_die (decl);
-  int declaration
-    = (DECL_EXTERNAL (decl)
-       || current_function_decl != decl_function_context (decl)
-       || context_die->die_tag == DW_TAG_structure_type
-       || context_die->die_tag == DW_TAG_union_type);
+  int declaration = (DECL_EXTERNAL (decl)
+                    || class_scope_p (context_die));
 
   if (origin != NULL)
     add_abstract_origin_attribute (var_die, origin);
@@ -8539,12 +8804,11 @@ gen_variable_die (decl, context_die)
   if (declaration)
     add_AT_flag (var_die, DW_AT_declaration, 1);
   
-  if ((declaration && decl_class_context (decl)) || DECL_ABSTRACT (decl))
+  if (class_scope_p (context_die) || DECL_ABSTRACT (decl))
     equate_decl_number_to_die (decl, var_die);
 
   if (! declaration && ! DECL_ABSTRACT (decl))
     {
-      equate_decl_number_to_die (decl, var_die);
       add_location_or_const_value_attribute (var_die, decl);
       add_pubname (decl, var_die);
     }
@@ -8611,15 +8875,14 @@ gen_lexical_block_die (stmt, context_die, depth)
   if (! BLOCK_ABSTRACT (stmt))
     {
       ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
-                                  next_block_number);
+                                  BLOCK_NUMBER (stmt));
       add_AT_lbl_id (stmt_die, DW_AT_low_pc, label);
-      ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_END_LABEL, next_block_number);
+      ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_END_LABEL,
+                                  BLOCK_NUMBER (stmt));
       add_AT_lbl_id (stmt_die, DW_AT_high_pc, label);
     }
 
-  push_decl_scope (stmt);
   decls_for_scope (stmt, stmt_die, depth);
-  pop_decl_scope ();
 }
 
 /* Generate a DIE for an inlined subprogram.  */
@@ -8637,15 +8900,17 @@ gen_inlined_subroutine_die (stmt, context_die, depth)
       register tree decl = block_ultimate_origin (stmt);
       char label[MAX_ARTIFICIAL_LABEL_BYTES];
 
+      /* Emit info for the abstract instance first, if we haven't yet.  */
+      gen_abstract_function (decl);
+
       add_abstract_origin_attribute (subr_die, decl);
       ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
-                                  next_block_number);
+                                  BLOCK_NUMBER (stmt));
       add_AT_lbl_id (subr_die, DW_AT_low_pc, label);
-      ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_END_LABEL, next_block_number);
+      ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_END_LABEL,
+                                  BLOCK_NUMBER (stmt));
       add_AT_lbl_id (subr_die, DW_AT_high_pc, label);
-      push_decl_scope (decl);
       decls_for_scope (stmt, subr_die, depth);
-      pop_decl_scope ();
       current_function_has_inlines = 1;
     }
 }
@@ -8744,7 +9009,7 @@ gen_compile_unit_die (filename)
 {
   register dw_die_ref die;
   char producer[250];
-  char *wd = getpwd ();
+  const char *wd = getpwd ();
   int language;
 
   die = new_die (DW_TAG_compile_unit, NULL);
@@ -8833,6 +9098,7 @@ gen_member_die (type, context_die)
      register dw_die_ref context_die;
 {
   register tree member;
+  dw_die_ref child;
 
   /* If this is not an incomplete type, output descriptions of each of its
      members. Note that as we output the DIEs necessary to represent the
@@ -8860,14 +9126,33 @@ gen_member_die (type, context_die)
 
   /* Now output info about the data members and type members.  */
   for (member = TYPE_FIELDS (type); member; member = TREE_CHAIN (member))
-    gen_decl_die (member, context_die);
+    {
+      /* If we thought we were generating minimal debug info for TYPE
+        and then changed our minds, some of the member declarations
+        may have already been defined.  Don't define them again, but
+        do put them in the right order.  */
+
+      child = lookup_decl_die (member);
+      if (child)
+       splice_child_die (context_die, child);
+      else
+       gen_decl_die (member, context_die);
+    }
 
   /* Now output info about the function members (if any).  */
   for (member = TYPE_METHODS (type); member; member = TREE_CHAIN (member))
-    gen_decl_die (member, context_die);
+    {
+      child = lookup_decl_die (member);
+      if (child)
+       splice_child_die (context_die, child);
+      else
+       gen_decl_die (member, context_die);
+    }
 }
 
-/* Generate a DIE for a structure or union type.  */
+/* Generate a DIE for a structure or union type.  If TYPE_DECL_SUPPRESS_DEBUG
+   is set, we pretend that the type was never defined, so we only get the
+   member DIEs needed by later specification DIEs.  */
 
 static void
 gen_struct_or_union_type_die (type, context_die)
@@ -8877,8 +9162,11 @@ gen_struct_or_union_type_die (type, context_die)
   register dw_die_ref type_die = lookup_type_die (type);
   register dw_die_ref scope_die = 0;
   register int nested = 0;
+  int complete = (TYPE_SIZE (type)
+                 && (! TYPE_STUB_DECL (type)
+                     || ! TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (type))));
 
-  if (type_die && ! TYPE_SIZE (type))
+  if (type_die && ! complete)
     return;
 
   if (TYPE_CONTEXT (type) != NULL_TREE
@@ -8903,16 +9191,9 @@ gen_struct_or_union_type_die (type, context_die)
   else
     remove_AT (type_die, DW_AT_declaration);
 
-  /* If we're not in the right context to be defining this type, defer to
-     avoid tricky recursion.  */
-  if (TYPE_SIZE (type) && decl_scope_depth > 0 && scope_die == comp_unit_die)
-    {
-      add_AT_flag (type_die, DW_AT_declaration, 1);
-      pend_type (type);
-    }
   /* If this type has been completed, then give it a byte_size attribute and
      then give a list of members.  */
-  else if (TYPE_SIZE (type))
+  if (complete)
     {
       /* Prevent infinite recursion in cases where the type of some member of 
          this type is expressed in terms of this type itself.  */
@@ -8944,7 +9225,7 @@ gen_struct_or_union_type_die (type, context_die)
     {
       add_AT_flag (type_die, DW_AT_declaration, 1);
 
-      /* We can't do this for function-local types, and we don't need to.  */
+      /* We don't need to do this for function-local types.  */
       if (! decl_function_context (TYPE_STUB_DECL (type)))
        add_incomplete_type (type);
     }
@@ -8981,7 +9262,7 @@ gen_typedef_die (decl, context_die)
     return;
   TREE_ASM_WRITTEN (decl) = 1;
 
-  type_die = new_die (DW_TAG_typedef, scope_die_for (decl, context_die));
+  type_die = new_die (DW_TAG_typedef, context_die);
   origin = decl_ultimate_origin (decl);
   if (origin != NULL)
     add_abstract_origin_attribute (type_die, origin);
@@ -9096,6 +9377,10 @@ gen_type_die (type, context_die)
        gen_array_type_die (type, context_die);
       break;
 
+    case VECTOR_TYPE:
+      gen_type_die (TYPE_DEBUG_REPRESENTATION_TYPE (type), context_die);
+      break;
+
     case ENUMERAL_TYPE:
     case RECORD_TYPE:
     case UNION_TYPE:
@@ -9104,7 +9389,7 @@ gen_type_die (type, context_die)
         written out yet, writing it out will cover this one, too.
          This does not apply to instantiations of member class templates;
         they need to be added to the containing class as they are
-        generated.  FIXME: This breaks the idea of combining type decls
+        generated.  FIXME: This hurts the idea of combining type decls
          from multiple TUs, since we can't predict what set of template
          instantiations we'll get.  */
       if (TYPE_CONTEXT (type)
@@ -9174,7 +9459,7 @@ gen_tagged_type_instantiation_die (type, context_die)
   if (type != type_main_variant (type))
     abort ();
 
-  /* Do not check TREE_ASM_WRITTEN(type) as it may not be set if this is
+  /* Do not check TREE_ASM_WRITTEN (type) as it may not be set if this is
      an instance of an unresolved type.  */
   
   switch (TREE_CODE (type))
@@ -9216,7 +9501,8 @@ gen_block_die (stmt, context_die, depth)
 
   /* Ignore blocks never really used to make RTL.  */
 
-  if (stmt == NULL_TREE || !TREE_USED (stmt))
+  if (stmt == NULL_TREE || !TREE_USED (stmt)
+      || (!TREE_ASM_WRITTEN (stmt) && !BLOCK_ABSTRACT (stmt)))
     return;
 
   /* Determine the "ultimate origin" of this block.  This block may be an
@@ -9299,9 +9585,6 @@ decls_for_scope (stmt, context_die, depth)
   if (stmt == NULL_TREE || ! TREE_USED (stmt))
     return;
 
-  if (!BLOCK_ABSTRACT (stmt) && depth > 0)
-    next_block_number++;
-
   /* Output the DIEs to represent all of the data objects and typedefs
      declared directly within this block but not within any nested
      sub-blocks.  Also, nested function and tag DIEs have been
@@ -9364,12 +9647,8 @@ gen_decl_die (decl, context_die)
   if (TREE_CODE (decl) == ERROR_MARK)
     return;
 
-  /* If this ..._DECL node is marked to be ignored, then ignore it. But don't 
-     ignore a function definition, since that would screw up our count of
-     blocks, and that in turn will completely screw up the labels we will 
-     reference in subsequent DW_AT_low_pc and DW_AT_high_pc attributes (for
-     subsequent blocks).  */
-  if (DECL_IGNORED_P (decl) && TREE_CODE (decl) != FUNCTION_DECL)
+  /* If this ..._DECL node is marked to be ignored, then ignore it.  */
+  if (DECL_IGNORED_P (decl))
     return;
 
   switch (TREE_CODE (decl))
@@ -9383,23 +9662,32 @@ gen_decl_die (decl, context_die)
       /* Don't output any DIEs to represent mere function declarations,
         unless they are class members or explicit block externs.  */
       if (DECL_INITIAL (decl) == NULL_TREE && DECL_CONTEXT (decl) == NULL_TREE
-         && (current_function_decl == NULL_TREE || DECL_ARTIFICIAL (decl)))
+         && (current_function_decl == NULL_TREE || DECL_ARTIFICIAL (decl)))
        break;
 
+      /* If we're emitting an out-of-line copy of an inline function,
+        emit info for the abstract instance and set up to refer to it.  */
+      if (DECL_INLINE (decl) && ! DECL_ABSTRACT (decl)
+         && ! class_scope_p (context_die))
+       {
+         gen_abstract_function (decl);
+         set_decl_origin_self (decl);
+       }
+
       if (debug_info_level > DINFO_LEVEL_TERSE)
        {
          /* Before we describe the FUNCTION_DECL itself, make sure that we
             have described its return type.  */
          gen_type_die (TREE_TYPE (TREE_TYPE (decl)), context_die);
 
-         /* And its containing type.  */
-         origin = decl_class_context (decl);
-         if (origin != NULL_TREE)
-           gen_type_die (origin, context_die);
-
          /* And its virtual context.  */
          if (DECL_VINDEX (decl) != NULL_TREE)
            gen_type_die (DECL_CONTEXT (decl), context_die);
+
+         /* And its containing type.  */
+         origin = decl_class_context (decl);
+         if (origin != NULL_TREE)
+           gen_type_die_for_member (origin, decl, context_die);
        }
 
       /* Now output a DIE to represent the function itself.  */
@@ -9419,7 +9707,7 @@ gen_decl_die (decl, context_die)
          inline function) we have to generate a special (abbreviated)
          DW_TAG_structure_type, DW_TAG_union_type, or DW_TAG_enumeration_type 
          DIE here.  */
-      if (TYPE_DECL_IS_STUB (decl) && DECL_ABSTRACT_ORIGIN (decl) != NULL_TREE)
+      if (TYPE_DECL_IS_STUB (decl) && decl_ultimate_origin (decl) != NULL_TREE)
        {
          gen_tagged_type_instantiation_die (TREE_TYPE (decl), context_die);
          break;
@@ -9450,7 +9738,7 @@ gen_decl_die (decl, context_die)
       /* And its containing type.  */
       origin = decl_class_context (decl);
       if (origin != NULL_TREE)
-       gen_type_die (origin, context_die);
+       gen_type_die_for_member (origin, decl, context_die);
 
       /* Now output the DIE to represent the data object itself.  This gets
          complicated because of the possibility that the VAR_DECL really
@@ -9492,8 +9780,8 @@ gen_decl_die (decl, context_die)
 
 void
 dwarf2out_add_library_unit_info (filename, context_list)
-     char *filename;
-     char *context_list;
+     const char *filename;
+     const char *context_list;
 {
   unsigned int file_index;
 
@@ -9523,21 +9811,9 @@ dwarf2out_decl (decl)
   if (TREE_CODE (decl) == ERROR_MARK)
     return;
 
-  /* If this ..._DECL node is marked to be ignored, then ignore it.  We gotta 
-     hope that the node in question doesn't represent a function definition.
-     If it does, then totally ignoring it is bound to screw up our count of
-     blocks, and that in turn will completely screw up the labels we will 
-     reference in subsequent DW_AT_low_pc and DW_AT_high_pc attributes (for
-     subsequent blocks).  (It's too bad that BLOCK nodes don't carry their
-     own sequence numbers with them!) */
+  /* If this ..._DECL node is marked to be ignored, then ignore it.  */
   if (DECL_IGNORED_P (decl))
-    {
-      if (TREE_CODE (decl) == FUNCTION_DECL
-          && DECL_INITIAL (decl) != NULL)
-       abort ();
-
-      return;
-    }
+    return;
 
   switch (TREE_CODE (decl))
     {
@@ -9545,7 +9821,7 @@ dwarf2out_decl (decl)
       /* Ignore this FUNCTION_DECL if it refers to a builtin declaration of a 
          builtin function.  Explicit programmer-supplied declarations of
          these same functions should NOT be ignored however.  */
-      if (DECL_EXTERNAL (decl) && DECL_FUNCTION_CODE (decl))
+      if (DECL_EXTERNAL (decl) && DECL_BUILT_IN (decl))
        return;
 
       /* What we would really like to do here is to filter out all mere
@@ -9603,6 +9879,10 @@ dwarf2out_decl (decl)
       break;
 
     case TYPE_DECL:
+      /* Don't emit stubs for types unless they are needed by other DIEs.  */
+      if (TYPE_DECL_SUPPRESS_DEBUG (decl))
+       return;
+
       /* Don't bother trying to generate any DIEs to represent any of the
          normal built-in types for the language we are compiling.  */
       if (DECL_SOURCE_LINE (decl) == 0)
@@ -9633,7 +9913,6 @@ dwarf2out_decl (decl)
     }
 
   gen_decl_die (decl, context_die);
-  output_pending_types_for_scope (comp_unit_die);
 }
 
 /* Output a marker (i.e. a label) for the beginning of the generated code for
@@ -9658,6 +9937,25 @@ dwarf2out_end_block (blocknum)
   ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, BLOCK_END_LABEL, blocknum);
 }
 
+/* Returns nonzero if it is appropriate not to emit any debugging
+   information for BLOCK, because it doesn't contain any instructions.
+
+   Don't allow this for blocks with nested functions or local classes
+   as we would end up with orphans, and in the presence of scheduling
+   we may end up calling them anyway.  */
+
+int
+dwarf2out_ignore_block (block)
+     tree block;
+{
+  tree decl;
+  for (decl = BLOCK_VARS (block); decl; decl = TREE_CHAIN (decl))
+    if (TREE_CODE (decl) == FUNCTION_DECL
+       || (TREE_CODE (decl) == TYPE_DECL && TYPE_DECL_IS_STUB (decl)))
+      return 0;
+  return 1;
+}
+
 /* Output a marker (i.e. a label) at a point in the assembly code which
    corresponds to a given source level label.  */
 
@@ -9868,7 +10166,7 @@ dwarf2out_undef (lineno, buffer)
 void
 dwarf2out_init (asm_out_file, main_input_filename)
      register FILE *asm_out_file;
-     register char *main_input_filename;
+     register const char *main_input_filename;
 {
   /* Remember the name of the primary input file.  */
   primary_filename = main_input_filename;
@@ -9888,8 +10186,7 @@ dwarf2out_init (asm_out_file, main_input_filename)
 
   /* Allocate the initial hunk of the decl_scope_table.  */
   decl_scope_table
-    = (decl_scope_node *) xcalloc (DECL_SCOPE_TABLE_INCREMENT,
-                                  sizeof (decl_scope_node));
+    = (tree *) xcalloc (DECL_SCOPE_TABLE_INCREMENT, sizeof (tree));
   decl_scope_table_allocated = DECL_SCOPE_TABLE_INCREMENT;
   decl_scope_depth = 0;
 
@@ -9916,6 +10213,12 @@ dwarf2out_init (asm_out_file, main_input_filename)
      invoked when the given (base) source file was compiled.  */
   comp_unit_die = gen_compile_unit_die (main_input_filename);
 
+  if (ggc_p)
+    {
+      VARRAY_RTX_INIT (used_rtx_varray, 32, "used_rtx_varray");
+      ggc_add_rtx_varray_root (&used_rtx_varray, 1);
+    }
+
   ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
   ASM_GENERATE_INTERNAL_LABEL (abbrev_section_label, ABBREV_SECTION_LABEL, 0);
   if (DWARF2_GENERATE_TEXT_SECTION_LABEL)