From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48005 invoked by alias); 23 Nov 2019 10:53:51 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 47995 invoked by uid 89); 23 Nov 2019 10:53:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx1.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Tue, 01 Jan 2019 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [committed] Factor out skip_attrs_1 with cu_version parameter Message-ID: <20191123105338.GA5083@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2019-q4/txt/msg00067.txt.bz2 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 * 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); } }