This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH to dwarf2* for VECTOR_TYPE


For stabs, we represent a vector as a struct containing an array.  For
dwarf2, we can do better; with this patch, we represent it as an array with
the GNU_vector attribute.  The gdb work to support this is proceeding now,
if it's not already complete.

Tested i686-pc-linux-gnu, applied trunk and 3.1 (since the VECTOR_TYPE
stuff is all new).

2002-04-24  Jason Merrill  <jason@redhat.com>

	* dwarf2.h (enum dwarf_attribute): Add DW_AT_GNU_vector.
	* dwarf2out.c (dwarf_attr_name): Support it.
	(gen_array_type_die): Emit it.
	(lookup_type_die): No special handling for VECTOR_TYPE.
	(gen_type_die): Hand VECTOR_TYPE off to gen_array_type_die.

*** dwarf2.h.~1~	Wed Apr 24 01:04:56 2002
--- dwarf2.h	Mon Apr 22 19:57:06 2002
*************** enum dwarf_attribute
*** 239,244 ****
--- 239,245 ----
      DW_AT_src_coords = 0x2104,
      DW_AT_body_begin = 0x2105,
      DW_AT_body_end   = 0x2106,
+     DW_AT_GNU_vector = 0x2107,
      /* VMS Extensions.  */
      DW_AT_VMS_rtnbeg_pd_address = 0x2201
    };
*** dwarf2out.c.~1~	Wed Apr 24 01:04:56 2002
--- dwarf2out.c	Mon Apr 22 19:57:00 2002
*************** dwarf_attr_name (attr)
*** 4171,4176 ****
--- 4171,4179 ----
        return "DW_AT_body_begin";
      case DW_AT_body_end:
        return "DW_AT_body_end";
+     case DW_AT_GNU_vector:
+       return "DW_AT_GNU_vector";
+ 
      case DW_AT_VMS_rtnbeg_pd_address:
        return "DW_AT_VMS_rtnbeg_pd_address";
  
*************** static inline dw_die_ref
*** 5111,5119 ****
  lookup_type_die (type)
       tree type;
  {
-   if (TREE_CODE (type) == VECTOR_TYPE)
-     type = TYPE_DEBUG_REPRESENTATION_TYPE (type);
- 
    return (dw_die_ref) TYPE_SYMTAB_POINTER (type);
  }
  
--- 5114,5119 ----
*************** gen_array_type_die (type, context_die)
*** 9767,9772 ****
--- 9767,9782 ----
  #endif
  
    array_die = new_die (DW_TAG_array_type, scope_die, type);
+   add_name_attribute (array_die, type_tag (type));
+   equate_type_number_to_die (type, array_die);
+ 
+   if (TREE_CODE (type) == VECTOR_TYPE)
+     {
+       /* The frontend feeds us a representation for the vector as a struct
+ 	 containing an array.  Pull out the array type.  */
+       type = TREE_TYPE (TYPE_FIELDS (TYPE_DEBUG_REPRESENTATION_TYPE (type)));
+       add_AT_flag (array_die, DW_AT_GNU_vector, 1);
+     }
  
  #if 0
    /* We default the array ordering.  SDB will probably do
*************** gen_array_type_die (type, context_die)
*** 9788,9796 ****
  #endif
      add_subscript_info (array_die, type);
  
-   add_name_attribute (array_die, type_tag (type));
-   equate_type_number_to_die (type, array_die);
- 
    /* Add representation of the type of the elements of this array type.  */
    element_type = TREE_TYPE (type);
  
--- 9798,9803 ----
*************** gen_type_die (type, context_die)
*** 11133,11139 ****
        break;
  
      case VECTOR_TYPE:
!       gen_type_die (TYPE_DEBUG_REPRESENTATION_TYPE (type), context_die);
        break;
  
      case ENUMERAL_TYPE:
--- 11140,11146 ----
        break;
  
      case VECTOR_TYPE:
!       gen_array_type_die (type, context_die);
        break;
  
      case ENUMERAL_TYPE:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]