* [debug] Remove unused debug_str_hash_forced code
@ 2011-05-03 10:19 Mark Wielaard
2011-05-03 20:48 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2011-05-03 10:19 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, aoliva, jakub
[-- Attachment #1: Type: text/plain, Size: 779 bytes --]
Hi,
While reading through the dwarf2out debug_str support I got confused by
some of the code dealing with debug_str_hash_forced. But after PR41404
was fixed nothing actually uses this anymore. So this patch just removes
the dead code and simplifies a check.
2011-05-03 Mark Wielaard <mjw@redhat.com>
* dwarf2out.c (debug_str_hash_forced): Removed.
(gen_label_for_indirect_string): Removed.
(get_debug_string_label): Removed.
(AT_string_form): Generate label directly.
(output_indirect_string): Test indirect_string_node for
DW_FORM_strp instead of checking label and refcount.
(prune_indirect_string): Removed.
(prune_unused_types): Don't check debug_str_hash_forced or
call prune_indirect_string.
OK to commit and push?
Thanks,
Mark
[-- Attachment #2: debug_str_hash_forced.patch --]
[-- Type: text/x-patch, Size: 3525 bytes --]
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 83653d2..c42fdb9 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -433,10 +433,6 @@ struct GTY(()) indirect_string_node {
static GTY ((param_is (struct indirect_string_node))) htab_t debug_str_hash;
-/* True if the compilation unit has location entries that reference
- debug strings. */
-static GTY(()) bool debug_str_hash_forced = false;
-
static GTY(()) int dw2_string_counter;
static GTY(()) unsigned long dwarf2out_cfi_label_num;
@@ -7676,37 +7672,6 @@ add_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind, const char *str)
add_dwarf_attr (die, &attr);
}
-/* Create a label for an indirect string node, ensuring it is going to
- be output, unless its reference count goes down to zero. */
-
-static inline void
-gen_label_for_indirect_string (struct indirect_string_node *node)
-{
- char label[32];
-
- if (node->label)
- return;
-
- ASM_GENERATE_INTERNAL_LABEL (label, "LASF", dw2_string_counter);
- ++dw2_string_counter;
- node->label = xstrdup (label);
-}
-
-/* Create a SYMBOL_REF rtx whose value is the initial address of a
- debug string STR. */
-
-static inline rtx
-get_debug_string_label (const char *str)
-{
- struct indirect_string_node *node = find_AT_string (str);
-
- debug_str_hash_forced = true;
-
- gen_label_for_indirect_string (node);
-
- return gen_rtx_SYMBOL_REF (Pmode, node->label);
-}
-
static inline const char *
AT_string (dw_attr_ref a)
{
@@ -7722,6 +7687,7 @@ AT_string_form (dw_attr_ref a)
{
struct indirect_string_node *node;
unsigned int len;
+ char label[32];
gcc_assert (a && AT_class (a) == dw_val_class_str);
@@ -7744,7 +7710,9 @@ AT_string_form (dw_attr_ref a)
&& (len - DWARF_OFFSET_SIZE) * node->refcount <= len))
return node->form = DW_FORM_string;
- gen_label_for_indirect_string (node);
+ ASM_GENERATE_INTERNAL_LABEL (label, "LASF", dw2_string_counter);
+ ++dw2_string_counter;
+ node->label = xstrdup (label);
return node->form = DW_FORM_strp;
}
@@ -23069,7 +23037,7 @@ output_indirect_string (void **h, void *v ATTRIBUTE_UNUSED)
{
struct indirect_string_node *node = (struct indirect_string_node *) *h;
- if (node->label && node->refcount)
+ if (node->form == DW_FORM_strp)
{
switch_to_section (debug_str_section);
ASM_OUTPUT_LABEL (asm_out_file, node->label);
@@ -23386,21 +23354,6 @@ prune_unused_types_prune (dw_die_ref die)
} while (c != die->die_child);
}
-/* A helper function for dwarf2out_finish called through
- htab_traverse. Clear .debug_str strings that we haven't already
- decided to emit. */
-
-static int
-prune_indirect_string (void **h, void *v ATTRIBUTE_UNUSED)
-{
- struct indirect_string_node *node = (struct indirect_string_node *) *h;
-
- if (!node->label || !node->refcount)
- htab_clear_slot (debug_str_hash, h);
-
- return 1;
-}
-
/* Remove dies representing declarations that we never use. */
static void
@@ -23441,10 +23394,7 @@ prune_unused_types (void)
for (i = 0; VEC_iterate (dw_die_ref, base_types, i, base_type); i++)
prune_unused_types_mark (base_type, 1);
- /* Get rid of nodes that aren't marked; and update the string counts. */
- if (debug_str_hash && debug_str_hash_forced)
- htab_traverse (debug_str_hash, prune_indirect_string, NULL);
- else if (debug_str_hash)
+ if (debug_str_hash)
htab_empty (debug_str_hash);
prune_unused_types_prune (comp_unit_die ());
for (node = limbo_die_list; node; node = node->next)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [debug] Remove unused debug_str_hash_forced code
2011-05-03 10:19 [debug] Remove unused debug_str_hash_forced code Mark Wielaard
@ 2011-05-03 20:48 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2011-05-03 20:48 UTC (permalink / raw)
To: Mark Wielaard; +Cc: gcc-patches, aoliva, jakub
OK.
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-05-03 20:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-03 10:19 [debug] Remove unused debug_str_hash_forced code Mark Wielaard
2011-05-03 20:48 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).