From patchwork Thu Mar 26 16:16:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 455119 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5D1AB140146 for ; Fri, 27 Mar 2015 03:16:46 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ROXyfXJQ; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=MBWZphvNJ0+gTxTxd3RlLZPofRZK+yhtNjT/vZ49kLYmR1 AoZ9Dx8NnRX6yDKaUqlkxBrsDy+DLa4PWqp/JlkbNnoDc2AKFqsohkt6eQVi9a7C oKdVoVjZ+76SPSyzfhwO1SFL12HJ/gzODJZcB2sYEMP1kezOKRgsZi2BCuDsc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=AXc+IfRBwSBQtV9YEuSw+G7KRiQ=; b=ROXyfXJQUATIUNQjGjTY RlKM1w3SyOHYVc/yzvdDO7TK7FzVtdUhUktu9Kj4Z6edy32PEKto2L5BY4t1rB+D TgWh3v9htc0Rj8DuUhFx9kwob/QvJIegtDE8DpW8wR+dgdghVEiTLjgHMj8GptVB rOH8cynBJj6v4Hlb1hh2i/I= Received: (qmail 37385 invoked by alias); 26 Mar 2015 16:16:38 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 37359 invoked by uid 89); 26 Mar 2015 16:16:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 26 Mar 2015 16:16:32 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id D8663AC7B8 for ; Thu, 26 Mar 2015 16:16:30 +0000 (UTC) Received: from reynosa.quesejoda.com (vpn-57-200.rdu2.redhat.com [10.10.57.200]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2QGGT7o005533; Thu, 26 Mar 2015 12:16:29 -0400 Message-ID: <551430DC.4010904@redhat.com> Date: Thu, 26 Mar 2015 09:16:28 -0700 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: jason merrill , gcc-patches Subject: [debug-early] Remove redundant argument to add_subscript_info Hi Jason. Is there a reason we pass a collapsible option to add_subscript_info? It seems like it's value is always !is_ada(). Can we just get rid of the argument, and calculate its value within the function, or was it there for some future flexibility? I'd like to queue this patch for GCC 6, if it's ok with you. It can live in the debug-early work if you approve. Aldy commit eb0b7b1e769d3ea17cf4663d9fc1cb90fb406e59 Author: Aldy Hernandez Date: Thu Mar 26 09:03:51 2015 -0700 Remove redundant argument to add_subscript_info. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 1928846..b771fd9 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -3257,7 +3257,7 @@ static void add_scalar_info (dw_die_ref, enum dwarf_attribute, tree, int, const struct loc_descr_context *); static void add_bound_info (dw_die_ref, enum dwarf_attribute, tree, const struct loc_descr_context *); -static void add_subscript_info (dw_die_ref, tree, bool); +static void add_subscript_info (dw_die_ref, tree); static void add_byte_size_attribute (dw_die_ref, tree); static void add_bit_offset_attribute (dw_die_ref, tree); static void add_bit_size_attribute (dw_die_ref, tree); @@ -16920,16 +16920,18 @@ add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr, } /* Add subscript info to TYPE_DIE, describing an array TYPE, collapsing - possibly nested array subscripts in a flat sequence if COLLAPSE_P is true. - Note that the block of subscript information for an array type also - includes information about the element type of the given array type. + possibly nested array subscripts in a flat sequence for non-Ada + languages. Note that the block of subscript information for an + array type also includes information about the element type of the + given array type. This function reuses previously set type and bound information if available. */ static void -add_subscript_info (dw_die_ref type_die, tree type, bool collapse_p) +add_subscript_info (dw_die_ref type_die, tree type) { + bool collapse_p = !is_ada (); unsigned dimension_number; tree lower, upper; dw_die_ref child = type_die->die_child; @@ -17637,7 +17639,7 @@ fill_variable_array_bounds (tree type) dw_die_ref array_die = lookup_type_die (type); if (!array_die) return false; - add_subscript_info (array_die, type, !is_ada ()); + add_subscript_info (array_die, type); return true; } return false; @@ -17652,18 +17654,6 @@ gen_array_type_die (tree type, dw_die_ref context_die) { dw_die_ref array_die; - /* GNU compilers represent multidimensional array types as sequences of one - dimensional array types whose element types are themselves array types. - We sometimes squish that down to a single array_type DIE with multiple - subscripts in the Dwarf debugging info. The draft Dwarf specification - say that we are allowed to do this kind of compression in C, because - there is no difference between an array of arrays and a multidimensional - array. We don't do this for Ada to remain as close as possible to the - actual representation, which is especially important against the language - flexibilty wrt arrays of variable size. */ - - bool collapse_nested_arrays = !is_ada (); - if (fill_variable_array_bounds (type)) return; @@ -17737,7 +17727,18 @@ gen_array_type_die (tree type, dw_die_ref context_die) size_int (TYPE_VECTOR_SUBPARTS (type) - 1), NULL); } else - add_subscript_info (array_die, type, collapse_nested_arrays); + add_subscript_info (array_die, type); + + /* GNU compilers represent multidimensional array types as sequences of one + dimensional array types whose element types are themselves array types. + We sometimes squish that down to a single array_type DIE with multiple + subscripts in the Dwarf debugging info. The draft Dwarf specification + say that we are allowed to do this kind of compression in C, because + there is no difference between an array of arrays and a multidimensional + array. We don't do this for Ada to remain as close as possible to the + actual representation, which is especially important against the language + flexibilty wrt arrays of variable size. */ + bool collapse_nested_arrays = !is_ada (); /* Add representation of the type of the elements of this array type and emit the corresponding DIE if we haven't done it already. */