From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed] Factor out skip_attrs_1 with cu_version parameter
Date: Tue, 01 Jan 2019 00:00:00 -0000 [thread overview]
Message-ID: <20191123105338.GA5083@delia> (raw)
Hi,
The function skip_attrs has a dw_cu_ref parameter named cu, which is passed
around further, but the only use that it has is cu->cu_version.
GCC at -O2 already refactors the function to replace the cu parameter with
a parameter unsigned int *cu_version_pointer.
Factor out a new function skip_attrs_1 out of skip_attrs that has an unsigned
int parameter named cu_version.
Committed to trunk.
Thanks,
- Tom
Factor out skip_attrs_1 with cu_version parameter
2019-11-23 Tom de Vries <tdevries@suse.de>
* dwz.c (skip_attr_no_dw_form_indirect, skip_attr):
Replace cu with cu_version parameter.
(get_AT, propagate_multifile_refs_backward): Update calls.
(skip_attrs_1): New function, factored out of ...
(skip_attrs): ... here.
---
dwz.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/dwz.c b/dwz.c
index 157b3a8..28728fb 100644
--- a/dwz.c
+++ b/dwz.c
@@ -1330,14 +1330,15 @@ off_htab_lookup (dw_cu_ref cu, unsigned int die_offset)
return the pointer after the attribute, assuming FORM is not
dw_form_indirect. */
static inline unsigned char * FORCE_INLINE
-skip_attr_no_dw_form_indirect (dw_cu_ref cu, uint32_t form, unsigned char *ptr)
+skip_attr_no_dw_form_indirect (unsigned int cu_version, uint32_t form,
+ unsigned char *ptr)
{
size_t len = 0;
switch (form)
{
case DW_FORM_ref_addr:
- ptr += cu->cu_version == 2 ? ptr_size : 4;
+ ptr += cu_version == 2 ? ptr_size : 4;
break;
case DW_FORM_addr:
ptr += ptr_size;
@@ -1403,13 +1404,14 @@ skip_attr_no_dw_form_indirect (dw_cu_ref cu, uint32_t form, unsigned char *ptr)
/* For a die attribute ATTR starting at PTR, with the die in CU, return the
pointer after the attribute. */
static inline unsigned char * FORCE_INLINE
-skip_attr (dw_cu_ref cu, struct abbrev_attr *attr, unsigned char *ptr)
+skip_attr (unsigned int cu_version, struct abbrev_attr *attr,
+ unsigned char *ptr)
{
uint32_t form = attr->form;
while (form == DW_FORM_indirect)
form = read_uleb128 (ptr);
- return skip_attr_no_dw_form_indirect (cu, form, ptr);
+ return skip_attr_no_dw_form_indirect (cu_version, form, ptr);
}
/* Return a pointer at which DIE's attribute AT is encoded, and fill in
@@ -1441,7 +1443,7 @@ get_AT (dw_die_ref die, enum dwarf_attribute at, enum dwarf_form *formp)
return ptr;
}
- ptr = skip_attr_no_dw_form_indirect (cu, form, ptr);
+ ptr = skip_attr_no_dw_form_indirect (cu->cu_version, form, ptr);
}
return NULL;
}
@@ -3171,18 +3173,26 @@ static dw_die_ref die_nontoplevel_freelist;
fields. */
static dw_die_ref die_collapsed_child_freelist;
-/* Return pointer after the attributes of a DIE from CU which uses abbrevs
- T and starts at PTR. */
+/* Return pointer after the attributes of a DIE from a cu with CU_VERSION
+ which uses abbrevs T and starts at PTR. */
static unsigned char *
-skip_attrs (dw_cu_ref cu, struct abbrev_tag *t, unsigned char *ptr)
+skip_attrs_1 (unsigned int cu_version, struct abbrev_tag *t, unsigned char *ptr)
{
unsigned int i;
for (i = 0; i < t->nattr; ++i)
- ptr = skip_attr (cu, &t->attr[i], ptr);
+ ptr = skip_attr (cu_version, &t->attr[i], ptr);
return ptr;
}
+/* Return pointer after the attributes of a DIE from CU which uses abbrevs
+ T and starts at PTR. */
+static unsigned char *
+skip_attrs (dw_cu_ref cu, struct abbrev_tag *t, unsigned char *ptr)
+{
+ return skip_attrs_1 (cu->cu_version, t, ptr);
+}
+
/* Expand children of TOP_DIE that have been collapsed by
collapse_child. CHECKSUM is true if checksum should be
computed - expansion is performed during read_debug_info
@@ -11234,7 +11244,7 @@ propagate_multifile_refs_backward (dw_cu_ref cu, dw_die_ref top_die,
}
break;
default:
- ptr = skip_attr_no_dw_form_indirect (cu, form, ptr);
+ ptr = skip_attr_no_dw_form_indirect (cu->cu_version, form, ptr);
}
}
reply other threads:[~2019-11-23 10:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191123105338.GA5083@delia \
--to=tdevries@suse.de \
--cc=dwz@sourceware.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).