aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@apple.com>2006-04-21 06:22:42 +0000
committerGeoffrey Keating <geoffk@apple.com>2006-04-21 06:22:42 +0000
commit9534094c4a564eaa154708455ad23fa81081a67a (patch)
treecd239ef9a5c43f3ec3d4286e2344b4da4e4d82e5
parentbb3d0e0e2e3528b1a7fcf059e7969b8189b212b0 (diff)
2006-04-17 Geoffrey Keating <geoffk@apple.com>
Radar 4522168 * dwarf2out.c (free_AT): Delete. (remove_AT): Update string ref counts. (remove_child_TAG): Don't call free_die. (free_die): Delete. (break_out_includes): Don't call free_die on DW_TAG_GNU_BINCL or DW_TAG_GNU_EINCL. (prune_unused_types_walk_attribs): Reset string refcounts. (prune_unused_types_update_strings): New. (prune_unused_types_prune): Don't make unnecessary stores. Don't call free_die. Do call prune_unused_types_update_strings. (prune_unused_types): Empty debug_str_hash. 2006-04-10 Geoffrey Keating <geoffk@apple.com> Radar 4522168 * dwarf2out.c (struct dw_attr_struct): Remove dw_attr_next. Declare VECs of this type. (struct die_struct): Make field die_attr a VEC of dw_attr_struct. (remove_children): Delete. (add_dwarf_attr): Use VEC routines. (add_AT_flag): Update for changes to add_dwarf_attr. (add_AT_int): Likewise. (add_AT_unsigned): Likewise. (add_AT_long_long): Likewise. (add_AT_vec): Likewise. (add_AT_string): Likewise. (add_AT_die_ref): Likewise. (add_AT_fde_ref): Likewise. (add_AT_loc): Likewise. (add_AT_loc_list): Likewise. (add_AT_addr): Likewise. (add_AT_lbl_id): Likewise. (add_AT_lineptr): Likewise. (add_AT_macptr): Likewise. (add_AT_offset): Likewise. (add_AT_range_list): Likewise. (get_AT): Use VEC_iterate. (remove_AT): Use VEC_ordered_remove. (free_die): Fold remove_children into here; have it use VEC_iterate. (print_die): Use VEC_iterate on attrs. (reverse_die_lists): Don't reverse attr lists. (die_checksum): Use VEC_iterate on attrs. (same_die_p): Likewise. (output_location_lists): Likewise. (build_abbrev_table): Likewise. (size_of_die): Likewise. (unmark_all_dies): Likewise. (output_abbrev_section): Likewise. (output_die): Likewise. (prune_unused_types_walk_attribs): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/apple-local-200502-branch@113134 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog54
-rw-r--r--gcc/dwarf2out.c586
2 files changed, 379 insertions, 261 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 081234f2bae..88863993a22 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,57 @@
+2006-04-17 Geoffrey Keating <geoffk@apple.com>
+
+ Radar 4498201
+ * dwarf2out.c (free_AT): Delete.
+ (remove_AT): Update string ref counts.
+ (remove_child_TAG): Don't call free_die.
+ (free_die): Delete.
+ (break_out_includes): Don't call free_die on DW_TAG_GNU_BINCL
+ or DW_TAG_GNU_EINCL.
+ (prune_unused_types_walk_attribs): Reset string refcounts.
+ (prune_unused_types_update_strings): New.
+ (prune_unused_types_prune): Don't make unnecessary stores. Don't
+ call free_die. Do call prune_unused_types_update_strings.
+ (prune_unused_types): Empty debug_str_hash.
+
+2006-04-10 Geoffrey Keating <geoffk@apple.com>
+
+ Radar 4498201
+ * dwarf2out.c (struct dw_attr_struct): Remove dw_attr_next.
+ Declare VECs of this type.
+ (struct die_struct): Make field die_attr a VEC of dw_attr_struct.
+ (remove_children): Delete.
+ (add_dwarf_attr): Use VEC routines.
+ (add_AT_flag): Update for changes to add_dwarf_attr.
+ (add_AT_int): Likewise.
+ (add_AT_unsigned): Likewise.
+ (add_AT_long_long): Likewise.
+ (add_AT_vec): Likewise.
+ (add_AT_string): Likewise.
+ (add_AT_die_ref): Likewise.
+ (add_AT_fde_ref): Likewise.
+ (add_AT_loc): Likewise.
+ (add_AT_loc_list): Likewise.
+ (add_AT_addr): Likewise.
+ (add_AT_lbl_id): Likewise.
+ (add_AT_lineptr): Likewise.
+ (add_AT_macptr): Likewise.
+ (add_AT_offset): Likewise.
+ (add_AT_range_list): Likewise.
+ (get_AT): Use VEC_iterate.
+ (remove_AT): Use VEC_ordered_remove.
+ (free_die): Fold remove_children into here; have it use VEC_iterate.
+ (print_die): Use VEC_iterate on attrs.
+ (reverse_die_lists): Don't reverse attr lists.
+ (die_checksum): Use VEC_iterate on attrs.
+ (same_die_p): Likewise.
+ (output_location_lists): Likewise.
+ (build_abbrev_table): Likewise.
+ (size_of_die): Likewise.
+ (unmark_all_dies): Likewise.
+ (output_abbrev_section): Likewise.
+ (output_die): Likewise.
+ (prune_unused_types_walk_attribs): Likewise.
+
2006-04-04 Geoffrey Keating <geoffk@apple.com>
Radar 4502209
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 40d74ec96d5..38c810b9fa0 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3649,18 +3649,24 @@ dw_separate_line_info_entry;
typedef struct dw_attr_struct GTY(())
{
enum dwarf_attribute dw_attr;
- dw_attr_ref dw_attr_next;
+ /* APPLE LOCAL mainline 2006-04-20 4498201 */
+ /* remove field dw_attr_next */
dw_val_node dw_attr_val;
}
dw_attr_node;
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+DEF_VEC_GC_O(dw_attr_node);
+
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
/* The Debugging Information Entry (DIE) structure */
typedef struct die_struct GTY(())
{
enum dwarf_tag die_tag;
char *die_symbol;
- dw_attr_ref die_attr;
+/* APPLE LOCAL mainline 2006-04-20 4498201 */
+ VEC(dw_attr_node) * die_attr;
dw_die_ref die_parent;
dw_die_ref die_child;
dw_die_ref die_sib;
@@ -3994,8 +4000,8 @@ static bool is_fortran (void);
static bool is_ada (void);
static void remove_AT (dw_die_ref, enum dwarf_attribute);
static void remove_child_TAG (dw_die_ref, enum dwarf_tag);
-static inline void free_die (dw_die_ref);
-static void remove_children (dw_die_ref);
+/* APPLE LOCAL mainline 2006-04-20 4498201 */
+/* free_die, remove_children removed */
static void add_child_die (dw_die_ref, dw_die_ref);
static dw_die_ref new_die (enum dwarf_tag, dw_die_ref, tree);
static dw_die_ref lookup_type_die (tree);
@@ -4832,11 +4838,15 @@ decl_class_context (tree decl)
static inline void
add_dwarf_attr (dw_die_ref die, dw_attr_ref attr)
{
- if (die != NULL && attr != NULL)
- {
- attr->dw_attr_next = die->die_attr;
- die->die_attr = attr;
- }
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ /* Maybe this should be an assert? */
+ if (die == NULL)
+ return;
+
+ if (die->die_attr == NULL)
+ die->die_attr = VEC_alloc (dw_attr_node, 1);
+ VEC_safe_push (dw_attr_node, die->die_attr, attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
static inline enum dw_val_class
@@ -4850,13 +4860,14 @@ AT_class (dw_attr_ref a)
static inline void
add_AT_flag (dw_die_ref die, enum dwarf_attribute attr_kind, unsigned int flag)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_flag;
- attr->dw_attr_val.v.val_flag = flag;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_flag;
+ attr.dw_attr_val.v.val_flag = flag;
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
static inline unsigned
@@ -4871,13 +4882,14 @@ AT_flag (dw_attr_ref a)
static inline void
add_AT_int (dw_die_ref die, enum dwarf_attribute attr_kind, HOST_WIDE_INT int_val)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_const;
- attr->dw_attr_val.v.val_int = int_val;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_const;
+ attr.dw_attr_val.v.val_int = int_val;
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
static inline HOST_WIDE_INT
@@ -4893,13 +4905,14 @@ static inline void
add_AT_unsigned (dw_die_ref die, enum dwarf_attribute attr_kind,
unsigned HOST_WIDE_INT unsigned_val)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_unsigned_const;
- attr->dw_attr_val.v.val_unsigned = unsigned_val;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_unsigned_const;
+ attr.dw_attr_val.v.val_unsigned = unsigned_val;
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
static inline unsigned HOST_WIDE_INT
@@ -4915,14 +4928,15 @@ static inline void
add_AT_long_long (dw_die_ref die, enum dwarf_attribute attr_kind,
long unsigned int val_hi, long unsigned int val_low)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_long_long;
- attr->dw_attr_val.v.val_long_long.hi = val_hi;
- attr->dw_attr_val.v.val_long_long.low = val_low;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_long_long;
+ attr.dw_attr_val.v.val_long_long.hi = val_hi;
+ attr.dw_attr_val.v.val_long_long.low = val_low;
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
/* Add a floating point attribute value to a DIE and return it. */
@@ -4931,15 +4945,16 @@ static inline void
add_AT_vec (dw_die_ref die, enum dwarf_attribute attr_kind,
unsigned int length, unsigned int elt_size, unsigned char *array)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_vec;
- attr->dw_attr_val.v.val_vec.length = length;
- attr->dw_attr_val.v.val_vec.elt_size = elt_size;
- attr->dw_attr_val.v.val_vec.array = array;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_vec;
+ attr.dw_attr_val.v.val_vec.length = length;
+ attr.dw_attr_val.v.val_vec.elt_size = elt_size;
+ attr.dw_attr_val.v.val_vec.array = array;
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
/* Hash and equality functions for debug_str_hash. */
@@ -4962,7 +4977,8 @@ debug_str_eq (const void *x1, const void *x2)
static inline void
add_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind, const char *str)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
struct indirect_string_node *node;
void **slot;
@@ -4978,11 +4994,12 @@ add_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind, const char *str)
node->str = ggc_strdup (str);
node->refcount++;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_str;
- attr->dw_attr_val.v.val_str = node;
- add_dwarf_attr (die, attr);
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_str;
+ attr.dw_attr_val.v.val_str = node;
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
static inline const char *
@@ -5034,14 +5051,15 @@ AT_string_form (dw_attr_ref a)
static inline void
add_AT_die_ref (dw_die_ref die, enum dwarf_attribute attr_kind, dw_die_ref targ_die)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_die_ref;
- attr->dw_attr_val.v.val_die_ref.die = targ_die;
- attr->dw_attr_val.v.val_die_ref.external = 0;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_die_ref;
+ attr.dw_attr_val.v.val_die_ref.die = targ_die;
+ attr.dw_attr_val.v.val_die_ref.external = 0;
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
/* Add an AT_specification attribute to a DIE, and also make the back
@@ -5083,13 +5101,14 @@ set_AT_ref_external (dw_attr_ref a, int i)
static inline void
add_AT_fde_ref (dw_die_ref die, enum dwarf_attribute attr_kind, unsigned int targ_fde)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_fde_ref;
- attr->dw_attr_val.v.val_fde_index = targ_fde;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_fde_ref;
+ attr.dw_attr_val.v.val_fde_index = targ_fde;
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
/* Add a location description attribute value to a DIE. */
@@ -5097,13 +5116,14 @@ add_AT_fde_ref (dw_die_ref die, enum dwarf_attribute attr_kind, unsigned int tar
static inline void
add_AT_loc (dw_die_ref die, enum dwarf_attribute attr_kind, dw_loc_descr_ref loc)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_loc;
- attr->dw_attr_val.v.val_loc = loc;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_loc;
+ attr.dw_attr_val.v.val_loc = loc;
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
static inline dw_loc_descr_ref
@@ -5116,13 +5136,14 @@ AT_loc (dw_attr_ref a)
static inline void
add_AT_loc_list (dw_die_ref die, enum dwarf_attribute attr_kind, dw_loc_list_ref loc_list)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_loc_list;
- attr->dw_attr_val.v.val_loc_list = loc_list;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_loc_list;
+ attr.dw_attr_val.v.val_loc_list = loc_list;
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
/* APPLE LOCAL mainline 4.2 2006-01-02 4386366 */
have_location_lists = true;
}
@@ -5139,13 +5160,14 @@ AT_loc_list (dw_attr_ref a)
static inline void
add_AT_addr (dw_die_ref die, enum dwarf_attribute attr_kind, rtx addr)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_addr;
- attr->dw_attr_val.v.val_addr = addr;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_addr;
+ attr.dw_attr_val.v.val_addr = addr;
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
static inline rtx
@@ -5160,13 +5182,14 @@ AT_addr (dw_attr_ref a)
static inline void
add_AT_lbl_id (dw_die_ref die, enum dwarf_attribute attr_kind, const char *lbl_id)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_lbl_id;
- attr->dw_attr_val.v.val_lbl_id = xstrdup (lbl_id);
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_lbl_id;
+ attr.dw_attr_val.v.val_lbl_id = xstrdup (lbl_id);
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
/* APPLE LOCAL begin dwarf 4383509 */
@@ -5177,13 +5200,14 @@ static inline void
add_AT_lineptr (dw_die_ref die, enum dwarf_attribute attr_kind,
const char *label)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_lineptr;
- attr->dw_attr_val.v.val_lbl_id = xstrdup (label);
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_lineptr;
+ attr.dw_attr_val.v.val_lbl_id = xstrdup (label);
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
/* Add a section offset attribute value to a DIE, an offset into the
@@ -5193,13 +5217,14 @@ static inline void
add_AT_macptr (dw_die_ref die, enum dwarf_attribute attr_kind,
const char *label)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_macptr;
- attr->dw_attr_val.v.val_lbl_id = xstrdup (label);
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_macptr;
+ attr.dw_attr_val.v.val_lbl_id = xstrdup (label);
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
/* APPLE LOCAL end dwarf 4383509 */
@@ -5209,13 +5234,14 @@ static inline void
add_AT_offset (dw_die_ref die, enum dwarf_attribute attr_kind,
unsigned HOST_WIDE_INT offset)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_offset;
- attr->dw_attr_val.v.val_offset = offset;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_offset;
+ attr.dw_attr_val.v.val_offset = offset;
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
/* Add an range_list attribute value to a DIE. */
@@ -5224,13 +5250,14 @@ static void
add_AT_range_list (dw_die_ref die, enum dwarf_attribute attr_kind,
long unsigned int offset)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_range_list;
- attr->dw_attr_val.v.val_offset = offset;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_range_list;
+ attr.dw_attr_val.v.val_offset = offset;
+ add_dwarf_attr (die, &attr);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
static inline const char *
@@ -5249,23 +5276,26 @@ AT_lbl (dw_attr_ref a)
static dw_attr_ref
get_AT (dw_die_ref die, enum dwarf_attribute attr_kind)
{
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
dw_attr_ref a;
+ unsigned ix;
dw_die_ref spec = NULL;
- if (die != NULL)
- {
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
- if (a->dw_attr == attr_kind)
- return a;
- else if (a->dw_attr == DW_AT_specification
- || a->dw_attr == DW_AT_abstract_origin)
- spec = AT_ref (a);
+ if (! die)
+ return NULL;
- if (spec)
- return get_AT (spec, attr_kind);
- }
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ if (a->dw_attr == attr_kind)
+ return a;
+ else if (a->dw_attr == DW_AT_specification
+ || a->dw_attr == DW_AT_abstract_origin)
+ spec = AT_ref (a);
+
+ if (spec)
+ return get_AT (spec, attr_kind);
return NULL;
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
/* Return the "low pc" attribute value, typically associated with a subprogram
@@ -5391,39 +5421,34 @@ is_ada (void)
return lang == DW_LANG_Ada95 || lang == DW_LANG_Ada83;
}
-/* Free up the memory used by A. */
-
-static inline void free_AT (dw_attr_ref);
-static inline void
-free_AT (dw_attr_ref a)
-{
- if (AT_class (a) == dw_val_class_str)
- if (a->dw_attr_val.v.val_str->refcount)
- a->dw_attr_val.v.val_str->refcount--;
-}
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+/* Remove free_AT */
/* Remove the specified attribute if present. */
static void
remove_AT (dw_die_ref die, enum dwarf_attribute attr_kind)
{
- dw_attr_ref *p;
- dw_attr_ref removed = NULL;
+ dw_attr_ref a;
+ unsigned ix;
- if (die != NULL)
- {
- for (p = &(die->die_attr); *p; p = &((*p)->dw_attr_next))
- if ((*p)->dw_attr == attr_kind)
- {
- removed = *p;
- *p = (*p)->dw_attr_next;
- break;
- }
+ if (! die)
+ return;
- if (removed != 0)
- free_AT (removed);
- }
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ if (a->dw_attr == attr_kind)
+ {
+ if (AT_class (a) == dw_val_class_str)
+ if (a->dw_attr_val.v.val_str->refcount)
+ a->dw_attr_val.v.val_str->refcount--;
+
+ /* VEC_ordered_remove should help reduce the number of abbrevs
+ that are needed. */
+ VEC_ordered_remove (dw_attr_node, die->die_attr, ix);
+ return;
+ }
}
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
/* Remove child die whose die_tag is specified tag. */
@@ -5442,7 +5467,8 @@ remove_child_TAG (dw_die_ref die, enum dwarf_tag tag)
die->die_child = next;
else
prev->die_sib = next;
- free_die (current);
+ /* APPLE LOCAL mainline 2006-04-20 4498201 */
+ /* Don't call free_die */
current = next;
}
else
@@ -5453,42 +5479,10 @@ remove_child_TAG (dw_die_ref die, enum dwarf_tag tag)
}
}
-/* Free up the memory used by DIE. */
-
-static inline void
-free_die (dw_die_ref die)
-{
- remove_children (die);
-}
-
-/* Discard the children of this DIE. */
-
-static void
-remove_children (dw_die_ref die)
-{
- dw_die_ref child_die = die->die_child;
-
- die->die_child = NULL;
-
- while (child_die != NULL)
- {
- dw_die_ref tmp_die = child_die;
- dw_attr_ref a;
-
- child_die = child_die->die_sib;
-
- for (a = tmp_die->die_attr; a != NULL;)
- {
- dw_attr_ref tmp_a = a;
-
- a = a->dw_attr_next;
- free_AT (tmp_a);
- }
-
- free_die (tmp_die);
- }
-}
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+/* Remove free_die */
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
/* Add a child DIE below its parent. We build the lists up in reverse
addition order, and correct that in reverse_all_dies. */
@@ -5702,6 +5696,8 @@ print_die (dw_die_ref die, FILE *outfile)
{
dw_attr_ref a;
dw_die_ref c;
+ /* APPLE LOCAL mainline 2006-04-20 4498201 */
+ unsigned ix;
print_spaces (outfile);
fprintf (outfile, "DIE %4lu: %s\n",
@@ -5710,7 +5706,8 @@ print_die (dw_die_ref die, FILE *outfile)
fprintf (outfile, " abbrev id: %lu", die->die_abbrev);
fprintf (outfile, " offset: %lu\n", die->die_offset);
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
+/* APPLE LOCAL mainline 2006-04-20 4498201 */
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
{
print_spaces (outfile);
fprintf (outfile, " %s: ", dwarf_attr_name (a->dw_attr));
@@ -5844,17 +5841,9 @@ static void
reverse_die_lists (dw_die_ref die)
{
dw_die_ref c, cp, cn;
- dw_attr_ref a, ap, an;
-
- for (a = die->die_attr, ap = 0; a; a = an)
- {
- an = a->dw_attr_next;
- a->dw_attr_next = ap;
- ap = a;
- }
-
- die->die_attr = ap;
+ /* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ /* APPLE LOCAL end mainline 2006-04-20 4498201 */
for (c = die->die_child, cp = 0; c; c = cn)
{
cn = c->die_sib;
@@ -5997,6 +5986,8 @@ die_checksum (dw_die_ref die, struct md5_ctx *ctx, int *mark)
{
dw_die_ref c;
dw_attr_ref a;
+ /* APPLE LOCAL mainline 2006-04-20 4498201 */
+ unsigned ix;
/* To avoid infinite recursion. */
if (die->die_mark)
@@ -6008,7 +5999,8 @@ die_checksum (dw_die_ref die, struct md5_ctx *ctx, int *mark)
CHECKSUM (die->die_tag);
- for (a = die->die_attr; a; a = a->dw_attr_next)
+ /* APPLE LOCAL mainline 2006-04-20 4498201 */
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
attr_checksum (a, ctx, mark);
for (c = die->die_child; c; c = c->die_sib)
@@ -6118,7 +6110,10 @@ static int
same_die_p (dw_die_ref die1, dw_die_ref die2, int *mark)
{
dw_die_ref c1, c2;
- dw_attr_ref a1, a2;
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_ref a1;
+ unsigned ix;
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
/* To avoid infinite recursion. */
if (die1->die_mark)
@@ -6128,14 +6123,16 @@ same_die_p (dw_die_ref die1, dw_die_ref die2, int *mark)
if (die1->die_tag != die2->die_tag)
return 0;
- for (a1 = die1->die_attr, a2 = die2->die_attr;
- a1 && a2;
- a1 = a1->dw_attr_next, a2 = a2->dw_attr_next)
- if (!same_attr_p (a1, a2, mark))
- return 0;
- if (a1 || a2)
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ if (VEC_length (dw_attr_node, die1->die_attr)
+ != VEC_length (dw_attr_node, die2->die_attr))
return 0;
+
+ for (ix = 0; VEC_iterate (dw_attr_node, die1->die_attr, ix, a1); ix++)
+ if (!same_attr_p (a1, VEC_index (dw_attr_node, die2->die_attr, ix), mark))
+ return 0;
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
for (c1 = die1->die_child, c2 = die2->die_child;
c1 && c2;
c1 = c1->die_sib, c2 = c2->die_sib)
@@ -6420,16 +6417,12 @@ break_out_includes (dw_die_ref die)
/* This DIE is for a secondary CU; remove it from the main one. */
*ptr = c->die_sib;
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
if (c->die_tag == DW_TAG_GNU_BINCL)
- {
- unit = push_new_compile_unit (unit, c);
- free_die (c);
- }
+ unit = push_new_compile_unit (unit, c);
else if (c->die_tag == DW_TAG_GNU_EINCL)
- {
- unit = pop_compile_unit (unit);
- free_die (c);
- }
+ unit = pop_compile_unit (unit);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
else
add_child_die (unit, c);
}
@@ -6495,12 +6488,15 @@ static void
output_location_lists (dw_die_ref die)
{
dw_die_ref c;
- dw_attr_ref d_attr;
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_ref a;
+ unsigned ix;
- for (d_attr = die->die_attr; d_attr; d_attr = d_attr->dw_attr_next)
- if (AT_class (d_attr) == dw_val_class_loc_list)
- output_loc_list (AT_loc_list (d_attr));
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ if (AT_class (a) == dw_val_class_loc_list)
+ output_loc_list (AT_loc_list (a));
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
for (c = die->die_child; c != NULL; c = c->die_sib)
output_location_lists (c);
@@ -6517,44 +6513,50 @@ build_abbrev_table (dw_die_ref die)
unsigned long abbrev_id;
unsigned int n_alloc;
dw_die_ref c;
- dw_attr_ref d_attr, a_attr;
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_attr_ref a;
+ unsigned ix;
/* Scan the DIE references, and mark as external any that refer to
DIEs from other CUs (i.e. those which are not marked). */
- for (d_attr = die->die_attr; d_attr; d_attr = d_attr->dw_attr_next)
- if (AT_class (d_attr) == dw_val_class_die_ref
- && AT_ref (d_attr)->die_mark == 0)
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ if (AT_class (a) == dw_val_class_die_ref
+ && AT_ref (a)->die_mark == 0)
{
- gcc_assert (AT_ref (d_attr)->die_symbol);
+ gcc_assert (AT_ref (a)->die_symbol);
- set_AT_ref_external (d_attr, 1);
+ set_AT_ref_external (a, 1);
}
for (abbrev_id = 1; abbrev_id < abbrev_die_table_in_use; ++abbrev_id)
{
dw_die_ref abbrev = abbrev_die_table[abbrev_id];
-
- if (abbrev->die_tag == die->die_tag)
+ dw_attr_ref die_a, abbrev_a;
+ unsigned ix;
+ bool ok = true;
+
+ if (abbrev->die_tag != die->die_tag)
+ continue;
+ if ((abbrev->die_child != NULL) != (die->die_child != NULL))
+ continue;
+
+ if (VEC_length (dw_attr_node, abbrev->die_attr)
+ != VEC_length (dw_attr_node, die->die_attr))
+ continue;
+
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, die_a); ix++)
{
- if ((abbrev->die_child != NULL) == (die->die_child != NULL))
+ abbrev_a = VEC_index (dw_attr_node, abbrev->die_attr, ix);
+ if ((abbrev_a->dw_attr != die_a->dw_attr)
+ || (value_format (abbrev_a) != value_format (die_a)))
{
- a_attr = abbrev->die_attr;
- d_attr = die->die_attr;
-
- while (a_attr != NULL && d_attr != NULL)
- {
- if ((a_attr->dw_attr != d_attr->dw_attr)
- || (value_format (a_attr) != value_format (d_attr)))
- break;
-
- a_attr = a_attr->dw_attr_next;
- d_attr = d_attr->dw_attr_next;
- }
-
- if (a_attr == NULL && d_attr == NULL)
- break;
+ ok = false;
+ break;
}
}
+ if (ok)
+ break;
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
if (abbrev_id >= abbrev_die_table_in_use)
@@ -6605,9 +6607,12 @@ size_of_die (dw_die_ref die)
{
unsigned long size = 0;
dw_attr_ref a;
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ unsigned ix;
size += size_of_uleb128 (die->die_abbrev);
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
{
switch (AT_class (a))
{
@@ -6739,6 +6744,8 @@ unmark_all_dies (dw_die_ref die)
{
dw_die_ref c;
dw_attr_ref a;
+/* APPLE LOCAL mainline 2006-04-20 4498201 */
+ unsigned ix;
if (!die->die_mark)
return;
@@ -6747,7 +6754,8 @@ unmark_all_dies (dw_die_ref die)
for (c = die->die_child; c; c = c->die_sib)
unmark_all_dies (c);
- for (a = die->die_attr; a; a = a->dw_attr_next)
+/* APPLE LOCAL mainline 2006-04-20 4498201 */
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
if (AT_class (a) == dw_val_class_die_ref)
unmark_all_dies (AT_ref (a));
}
@@ -6886,12 +6894,14 @@ output_abbrev_section (void)
{
unsigned long abbrev_id;
- dw_attr_ref a_attr;
-
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
for (abbrev_id = 1; abbrev_id < abbrev_die_table_in_use; ++abbrev_id)
{
dw_die_ref abbrev = abbrev_die_table[abbrev_id];
+ unsigned ix;
+ dw_attr_ref a_attr;
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
dw2_asm_output_data_uleb128 (abbrev_id, "(abbrev code)");
dw2_asm_output_data_uleb128 (abbrev->die_tag, "(TAG: %s)",
dwarf_tag_name (abbrev->die_tag));
@@ -6901,8 +6911,10 @@ output_abbrev_section (void)
else
dw2_asm_output_data (1, DW_children_no, "DW_children_no");
- for (a_attr = abbrev->die_attr; a_attr != NULL;
- a_attr = a_attr->dw_attr_next)
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ for (ix = 0; VEC_iterate (dw_attr_node, abbrev->die_attr, ix, a_attr);
+ ix++)
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
{
dw2_asm_output_data_uleb128 (a_attr->dw_attr, "(%s)",
dwarf_attr_name (a_attr->dw_attr));
@@ -7031,6 +7043,8 @@ output_die (dw_die_ref die)
dw_attr_ref a;
dw_die_ref c;
unsigned long size;
+/* APPLE LOCAL mainline 2006-04-20 4498201 */
+ unsigned ix;
/* If someone in another CU might refer to us, set up a symbol for
them to point to. */
@@ -7040,7 +7054,8 @@ output_die (dw_die_ref die)
dw2_asm_output_data_uleb128 (die->die_abbrev, "(DIE (0x%lx) %s)",
die->die_offset, dwarf_tag_name (die->die_tag));
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
+/* APPLE LOCAL mainline 2006-04-20 4498201 */
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
{
const char *name = dwarf_attr_name (a->dw_attr);
@@ -10205,7 +10220,8 @@ containing_function_has_frame_base (tree decl)
{
tree declcontext = decl_function_context (decl);
dw_die_ref context;
- dw_attr_ref attr;
+ /* APPLE LOCAL mainline 2006-04-20 4498201 */
+ /* Delete 'attr' */
if (!declcontext)
return false;
@@ -10214,9 +10230,10 @@ containing_function_has_frame_base (tree decl)
if (!context)
return false;
- for (attr = context->die_attr; attr; attr = attr->dw_attr_next)
- if (attr->dw_attr == DW_AT_frame_base)
- return true;
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ if (get_AT (context, DW_AT_frame_base))
+ return true;
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
return false;
}
@@ -13716,8 +13733,11 @@ static void
prune_unused_types_walk_attribs (dw_die_ref die)
{
dw_attr_ref a;
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ unsigned ix;
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
{
if (a->dw_attr_val.val_class == dw_val_class_die_ref)
{
@@ -13731,6 +13751,12 @@ prune_unused_types_walk_attribs (dw_die_ref die)
a->dw_attr_val.v.val_unsigned =
maybe_emit_file (a->dw_attr_val.v.val_unsigned);
}
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ /* Set the string's refcount to 0 so that prune_unused_types_mark
+ accounts properly for it. */
+ if (AT_class (a) == dw_val_class_str)
+ a->dw_attr_val.v.val_str->refcount = 0;
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
}
@@ -13831,34 +13857,68 @@ prune_unused_types_walk (dw_die_ref die)
prune_unused_types_walk (c);
}
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+/* Increment the string counts on strings referred to from DIE's
+ attributes. */
+
+static void
+prune_unused_types_update_strings (dw_die_ref die)
+{
+ dw_attr_ref a;
+ unsigned ix;
+
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ if (AT_class (a) == dw_val_class_str)
+ {
+ struct indirect_string_node *s = a->dw_attr_val.v.val_str;
+ s->refcount++;
+ /* Avoid unnecessarily putting strings that are used less than
+ twice in the hash table. */
+ if (s->refcount == 2
+ || (s->refcount == 1
+ && (DEBUG_STR_SECTION_FLAGS & SECTION_MERGE) != 0))
+ {
+ void ** slot;
+ slot = htab_find_slot_with_hash (debug_str_hash, s->str,
+ htab_hash_string (s->str),
+ INSERT);
+ gcc_assert (*slot == NULL);
+ *slot = s;
+ }
+ }
+}
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
/* Remove from the tree DIE any dies that aren't marked. */
static void
prune_unused_types_prune (dw_die_ref die)
{
- dw_die_ref c, p, n;
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ dw_die_ref *p;
gcc_assert (die->die_mark);
- p = NULL;
- for (c = die->die_child; c; c = n)
+ p = &die->die_child;
+ while (*p)
{
- n = c->die_sib;
- if (c->die_mark)
+ dw_die_ref c = *p;
+ if (c && ! c->die_mark)
{
- prune_unused_types_prune (c);
- p = c;
+ do {
+ c = c->die_sib;
+ } while (c && ! c->die_mark);
+ *p = c;
}
- else
+
+ if (c)
{
- if (p)
- p->die_sib = n;
- else
- die->die_child = n;
- free_die (c);
+ prune_unused_types_update_strings (c);
+ prune_unused_types_prune (c);
+ p = &c->die_sib;
}
}
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
}
@@ -13887,7 +13947,11 @@ prune_unused_types (void)
for (i = 0; i < arange_table_in_use; i++)
prune_unused_types_mark (arange_table[i], 1);
- /* Get rid of nodes that aren't marked. */
+/* APPLE LOCAL begin mainline 2006-04-20 4498201 */
+ /* Get rid of nodes that aren't marked; and update the string counts. */
+ if (debug_str_hash)
+ htab_empty (debug_str_hash);
+/* APPLE LOCAL end mainline 2006-04-20 4498201 */
prune_unused_types_prune (comp_unit_die);
for (node = limbo_die_list; node; node = node->next)
prune_unused_types_prune (node->die);