From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id DF704386FC1F for ; Mon, 28 Jun 2021 17:35:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DF704386FC1F Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15SHKXcr022291 for ; Mon, 28 Jun 2021 17:35:38 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 39f174hv5n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 28 Jun 2021 17:35:38 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 15SHJmXa155964 for ; Mon, 28 Jun 2021 17:35:37 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by aserp3020.oracle.com with ESMTP id 39dv241ant-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 28 Jun 2021 17:35:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UscgDmzg5B+hk48jnsHJei0NZxO/TY95OSs5wyMKEgvp6v5XYYnpOCBF+PXx3vnHPs9z9LpmbwUxV05wGexm8Jayhh42+8yoZqKXEJaLZVaCXKjll0HLOS+u7LpW/D/abxleFlc5th0XZIkrpajIGMthmzz4Qs8J/0wkUXim3yriZGe1IECv8uwjJNzW4Jgo6Hmt0bZUZ/zPLv0DWI41p576jl9DVYXJXExNgx4Hyk81cmwRQguUPwJpqYJDmw2yqcHoMdi2Pu/qrSEt+yl/iLvShN6hs3Kq+YPtEo8wYG0OjjFgQm2QbWZfAHP0/LyoN3Xset/4dN/q9n3ce51scw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GzhMSf4igFzUUg83RsCZ4ddmeuidB1YZmphlJodOSwo=; b=CoiHQIpeX7v79I96r449THu3R3UKzgmkwntBulX0Qnn8WW2I/Q2bH/ID15oUaI72Wdui3TXQtFjjYMGG2y9AvEh1du/pQhDM5cMMboh28lGpjTP8324s8BNnVQwbIVGVfTflL56BfM7iNKGI96FazEI35FnZUDHvEEaPDhc0Y09X1hg2LBTlehViu08t+LZGnGPEnBWn9fBhMqEn2+2HRMIFH0z8GwtjOFlKGw1jXT+Qw+gTY4PeIr8iKcLMUH+dAI06luqR6+7sayQ54QS5sIkQud7HaWFeB5D2xBu4p2ScNho6sWovDOBBZ90L31aaLB2CMAD1KveRKVMwLf46MA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from DM5PR10MB2041.namprd10.prod.outlook.com (2603:10b6:3:111::16) by DS7PR10MB5200.namprd10.prod.outlook.com (2603:10b6:5:3a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18; Mon, 28 Jun 2021 17:35:36 +0000 Received: from DM5PR10MB2041.namprd10.prod.outlook.com ([fe80::3c15:20ad:f67a:eb04]) by DM5PR10MB2041.namprd10.prod.outlook.com ([fe80::3c15:20ad:f67a:eb04%12]) with mapi id 15.20.4264.026; Mon, 28 Jun 2021 17:35:35 +0000 From: "Jose E. Marchesi" To: gcc-patches@gcc.gnu.org Subject: [COMMITTED V10 1/7] dwarf: externalize some DWARF internals for needs of CTF/BTF Date: Mon, 28 Jun 2021 19:35:17 +0200 Message-Id: <20210628173523.29350-2-jose.marchesi@oracle.com> X-Mailer: git-send-email 2.25.0.2.g232378479e In-Reply-To: <20210628173523.29350-1-jose.marchesi@oracle.com> References: <20210628173523.29350-1-jose.marchesi@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [141.143.193.71] X-ClientProxiedBy: LO4P123CA0283.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::18) To DM5PR10MB2041.namprd10.prod.outlook.com (2603:10b6:3:111::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from termi.localdomain (141.143.193.71) by LO4P123CA0283.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Mon, 28 Jun 2021 17:35:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4ae40168-5080-4a18-e39e-08d93a5b2329 X-MS-TrafficTypeDiagnostic: DS7PR10MB5200: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PcxERTfpzzHsDd8R/INEgsYojC7yBn3SzqZzGy0C0EKLxgZpW8pCIKICVnziEVzPE9DTdnRbRoRFOsLM3wgWeOgdw+CODBJzDqnoY1kQw8bYiU17WVd94o6TaNn67PnDFI+2L0nXcNy+I7aIc+yO+pFA0ZWWqm8tcQ4VuCcHyxTlptLCjNVK4kXR/LBlSAFtDVZJL1049wlr5kuqw4J0vaBKq3DUGhzhBSHIeBuRGfwsubHYZ9XZ2G1cNiD53rgINYnMWhptkfVHue2zPn4eBsULstkyXXFuqSU5HeWWuho4rFSg7dgJgjyAPTVp/fJu2EyVzTaSEiV5kUnwYyIOW6tbw4qKdChSd9E2ZDSxto2WIy785CRtkrOdiTo/W/DiNeFBhi2svzxu10a6RIf9oowCSq0gZzIoefQfI4FQW1rE9syBiyrzctDZZo72yJWLb0XFYSINjQ+qU2t6Asv/wDVP34vZn7ywZP2LXAO4hIxbdn1gXXcp5hHARyHNekrvUVOJ5SCNzOZEgl8MsP5PBhtj2JLn23t8yZFOmV48ZHCZg3/+j7ZfIDE8hD0107CbevtCHRZAtR2CVDfAmyvTM2a2amPQJ94up2LwT0nWc4cllgoOQj9DMk/wJPiDWAPBPr8X5m3REOHBISIUKAty5d23KOEYnLx8I/epvyUr59/BBYRNoKDC/ICRPbaAJFeqY60cjaAbGEaMVBlbzrb/yw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB2041.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(396003)(376002)(136003)(346002)(366004)(6916009)(83380400001)(2906002)(6512007)(478600001)(6486002)(16526019)(30864003)(66476007)(1076003)(6666004)(316002)(6506007)(38350700002)(38100700002)(8936002)(5660300002)(2616005)(956004)(36756003)(186003)(8676002)(26005)(66556008)(66946007)(86362001)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?3JPeKgyMDzcXvLGrb9a7PgnHSWSq0CiXFfyrHV2+AYz3UfGdWHgN+exORcny?= =?us-ascii?Q?XosW+nRHPaxl/Keaa/r3/Y5GNOtvwpvMI2oMIc1J7pmQwTfkV+5eIKzT9PLa?= =?us-ascii?Q?PhhpYAy/hc/GY1UCbRfe4KrS7J+zqQU2VkZKGh/D8NL9Mfg539k5ibldyAu9?= =?us-ascii?Q?/nckZ7yT1Oo80vlInFeVlkCyh8WwNKCRagG4nI3S3Z/UDqH+fspHW5v9Htt9?= =?us-ascii?Q?utmkT4GsBZ6TUSx/1Plv3scSEEe56ON4CFhPvqrGy20as6DkNBa7D5BIBLKB?= =?us-ascii?Q?5WBvf4ujDV8tWblX1Q838DjqkY4Nw1jCTGpYbxn3KcDnuusIJ62j9Ys6P42R?= =?us-ascii?Q?u5FU8TMROZvMLiJbjqDladQmX17jJwHBX0xpMknO/o2pkBILwP1amzIxjpvE?= =?us-ascii?Q?7/67pVsSec3Ct2xx0r68s87cvHyO7GWIUYQlbT55jHm3cyVeBhsEP4Z5Vnqd?= =?us-ascii?Q?KDFjBaRbGDd4UoarsU3v7QTNKlyDLQCnlPPWjqw0PSvnlUAr8WJ4+/bUD2j8?= =?us-ascii?Q?NLl+Vmma6mnXUQ+uCATqjnoS9qPWcMScJLxmfQDt894Lix0ZkrIWOHC7Hxm4?= =?us-ascii?Q?pZmp/oc4gs3cnjA88g0PbNWOCQ0VXTScAf7dIyIh5LPvbxMTFi6fJBJAjUe+?= =?us-ascii?Q?wVtmAhdaZRn/K3585pHTZKV0PbDVOyUai/47V4QWW+o++icyOLkZSiZDSUrY?= =?us-ascii?Q?o18kOEq8VRqO762qaTcfTJS/byCuXNrpklwGzBsM1Q1XbpKKYXeW1aVj2bks?= =?us-ascii?Q?9D/LvFizDG6KpTVjLd1mf35hD4GC8pU/7gqhKmddtaGiDAyE1qJhJSgxWki7?= =?us-ascii?Q?wj4uQaWyqP/pcuI5OPEp1OpNKKvTVe9NUZtFcJ7990zPeJG2TiZ5a3vF96O5?= =?us-ascii?Q?PAQzGnEVqjJvF2ouqcCoshW/Zsb1WzP61mpzDK2WfmW+S/nrnMNxhF/zlEsI?= =?us-ascii?Q?hn3KJ2m/QbQDBItQgpB2xuQxGCphidZGmBjZ3pLnKvFLbLfJFp3IBCtH2JAX?= =?us-ascii?Q?DD8zCr3laQDh8mv9upAX6qJvF3VdDkPeNaUJnkGrc1emTEA9GjHYRR5zXdlj?= =?us-ascii?Q?0lZavGxijASGOQtHHSB+arr+ScQmrdRTIPJoaDCbrL8vzX8TwD7KMKl3Q3bJ?= =?us-ascii?Q?j6PRSL5/7I6Dn9mFZnGGzzUxbSxrCpjVKHwdT3xTkiw6zY6HxepuUUDxMV/T?= =?us-ascii?Q?adfhHwTc+ef0gI3apsxjnH9Xs9Q4N26BixQHxL5aeT6xqYiwe3vMu4HqiUow?= =?us-ascii?Q?MhWJnmIRfxijvnUxzb7p/9jNP5aeX25P32Z6jF/WuT4IGjIYbnl/janbV6ml?= =?us-ascii?Q?9ORKQO4WqFw4fHYTd6refPi0?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ae40168-5080-4a18-e39e-08d93a5b2329 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB2041.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2021 17:35:35.8347 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YH9epXsS8vOCbedNQg1BVGJE2Pp8v1sV+QuCflU1aJ3F+8vMbijefMeRp4Yn7kdFfJxoZcsjEFM8R2MN79+jK+1p8bxNhovKvna16QWK0VI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5200 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10029 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106280115 X-Proofpoint-GUID: 2ASWGoI-qCf80soW2FEBpJVNgz1V4XQQ X-Proofpoint-ORIG-GUID: 2ASWGoI-qCf80soW2FEBpJVNgz1V4XQQ X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2021 17:35:41 -0000 This patch externalizes some internal DIE structures and their attributes for the use of DWARF-based debug formats like CTF and BTF. The following functions which were previously defined as static in dwarf2out.c are now non-static, and extern prototypes for them have been added to dwarf2out.h: - get_AT - AT_int - AT_class - AT_loc - get_AT_ref - get_AT_string - get_AT_class - AT_unsigned - get_AT_unsigned - get_AT_flag - add_name_attribute - new_die_raw - base_type_die - lookup_decl_die - get_AT_file Note how this patch doens't change the names of these functions to avoid a massive renaming in dwarf2out.c, but in the future we probably want these functions to sport a dw_* prefix. Also, some type definitions have been moved from dwarf2out.c to dwarf2out.h: - dw_attr_node - struct dwarf_file_data Finally, three new accessor functions have been added to dwarf2out.c with prototypes in dwarf2out.h: - dw_get_die_child - dw_get_die_sib - dw_get_die_tag 2021-06-28 Jose E. Marchesi * dwarf2out.c (AT_class): Function is no longer static. (AT_int): Likewise. (AT_unsigned): Likewise. (AT_loc): Likewise. (get_AT): Likewise. (get_AT_string): Likewise. (get_AT_flag): Likewise. (get_AT_unsigned): Likewise. (get_AT_ref): Likewise. (new_die_raw): Likewise. (lookup_decl_die): Likewise. (base_type_die): Likewise. (add_name_attribute): Likewise. (add_AT_int): Likewise. (add_AT_unsigned): Likewise. (add_AT_loc): Likewise. (dw_get_die_tag): New function. (dw_get_die_child): Likewise. (dw_get_die_sib): Likewise. (struct dwarf_file_data): Move from here to dwarf2out.h (struct dw_attr_struct): Likewise. * dwarf2out.h: Analogous changes. --- gcc/dwarf2out.c | 81 +++++++++++++++++++++++-------------------------- gcc/dwarf2out.h | 44 +++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 43 deletions(-) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 9a91981acb0..e10006c5081 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -1332,12 +1332,6 @@ dwarf2out_switch_text_section (void) /* And now, the subset of the debugging information support code necessary for emitting location expressions. */ -/* Data about a single source file. */ -struct GTY((for_user)) dwarf_file_data { - const char * filename; - int emitted_number; -}; - /* Describe an entry into the .debug_addr section. */ enum ate_kind { @@ -3123,17 +3117,6 @@ maybe_reset_location_view (rtx_insn *insn, dw_line_info_table *table) RESET_NEXT_VIEW (table->view); } -/* Each DIE attribute has a field specifying the attribute kind, - a link to the next attribute in the chain, and an attribute value. - Attributes are typically linked below the DIE they modify. */ - -typedef struct GTY(()) dw_attr_struct { - enum dwarf_attribute dw_attr; - dw_val_node dw_attr_val; -} -dw_attr_node; - - /* The Debugging Information Entry (DIE) structure. DIEs form a tree. The children of each node form a circular list linked by die_sib. die_child points to the node *before* the "first" child node. */ @@ -3711,14 +3694,11 @@ static const char *dwarf_form_name (unsigned); static tree decl_ultimate_origin (const_tree); static tree decl_class_context (tree); static void add_dwarf_attr (dw_die_ref, dw_attr_node *); -static inline enum dw_val_class AT_class (dw_attr_node *); static inline unsigned int AT_index (dw_attr_node *); static void add_AT_flag (dw_die_ref, enum dwarf_attribute, unsigned); static inline unsigned AT_flag (dw_attr_node *); static void add_AT_int (dw_die_ref, enum dwarf_attribute, HOST_WIDE_INT); -static inline HOST_WIDE_INT AT_int (dw_attr_node *); static void add_AT_unsigned (dw_die_ref, enum dwarf_attribute, unsigned HOST_WIDE_INT); -static inline unsigned HOST_WIDE_INT AT_unsigned (dw_attr_node *); static void add_AT_double (dw_die_ref, enum dwarf_attribute, HOST_WIDE_INT, unsigned HOST_WIDE_INT); static inline void add_AT_vec (dw_die_ref, enum dwarf_attribute, unsigned int, @@ -3733,7 +3713,6 @@ static inline dw_die_ref AT_ref (dw_attr_node *); static inline int AT_ref_external (dw_attr_node *); static inline void set_AT_ref_external (dw_attr_node *, int); static void add_AT_loc (dw_die_ref, enum dwarf_attribute, dw_loc_descr_ref); -static inline dw_loc_descr_ref AT_loc (dw_attr_node *); static void add_AT_loc_list (dw_die_ref, enum dwarf_attribute, dw_loc_list_ref); static inline dw_loc_list_ref AT_loc_list (dw_attr_node *); @@ -3750,12 +3729,7 @@ static void add_AT_macptr (dw_die_ref, enum dwarf_attribute, const char *); static void add_AT_range_list (dw_die_ref, enum dwarf_attribute, unsigned long, bool); static inline const char *AT_lbl (dw_attr_node *); -static dw_attr_node *get_AT (dw_die_ref, enum dwarf_attribute); static const char *get_AT_low_pc (dw_die_ref); -static const char *get_AT_string (dw_die_ref, enum dwarf_attribute); -static int get_AT_flag (dw_die_ref, enum dwarf_attribute); -static unsigned get_AT_unsigned (dw_die_ref, enum dwarf_attribute); -static inline dw_die_ref get_AT_ref (dw_die_ref, enum dwarf_attribute); static bool is_c (void); static bool is_cxx (void); static bool is_cxx (const_tree); @@ -3769,7 +3743,6 @@ static dw_die_ref lookup_type_die (tree); static dw_die_ref strip_naming_typedef (tree, dw_die_ref); static dw_die_ref lookup_type_die_strip_naming_typedef (tree); static void equate_type_number_to_die (tree, dw_die_ref); -static dw_die_ref lookup_decl_die (tree); static var_loc_list *lookup_decl_loc (const_tree); static void equate_decl_number_to_die (tree, dw_die_ref); static struct var_loc_node *add_var_loc_to_decl (tree, rtx, const char *, var_loc_view); @@ -3842,7 +3815,6 @@ static void output_ranges (void); static dw_line_info_table *new_line_info_table (void); static void output_line_info (bool); static void output_file_names (void); -static dw_die_ref base_type_die (tree, bool); static int is_base_type (tree); static dw_die_ref subrange_type_die (tree, tree, tree, tree, dw_die_ref); static int decl_quals (const_tree); @@ -3890,7 +3862,6 @@ static rtx rtl_for_decl_location (tree); static bool add_location_or_const_value_attribute (dw_die_ref, tree, bool); static bool tree_add_const_value_attribute (dw_die_ref, tree); static bool tree_add_const_value_attribute_for_decl (dw_die_ref, tree); -static void add_name_attribute (dw_die_ref, const char *); static void add_desc_attribute (dw_die_ref, tree); static void add_gnat_descriptive_type_attribute (dw_die_ref, tree, dw_die_ref); static void add_comp_dir_attribute (dw_die_ref); @@ -4497,7 +4468,7 @@ add_dwarf_attr (dw_die_ref die, dw_attr_node *attr) vec_safe_push (die->die_attr, *attr); } -static inline enum dw_val_class +enum dw_val_class AT_class (dw_attr_node *a) { return a->dw_attr_val.val_class; @@ -4553,7 +4524,7 @@ add_AT_int (dw_die_ref die, enum dwarf_attribute attr_kind, HOST_WIDE_INT int_va add_dwarf_attr (die, &attr); } -static inline HOST_WIDE_INT +HOST_WIDE_INT AT_int (dw_attr_node *a) { gcc_assert (a && (AT_class (a) == dw_val_class_const @@ -4576,7 +4547,7 @@ add_AT_unsigned (dw_die_ref die, enum dwarf_attribute attr_kind, add_dwarf_attr (die, &attr); } -static inline unsigned HOST_WIDE_INT +unsigned HOST_WIDE_INT AT_unsigned (dw_attr_node *a) { gcc_assert (a && (AT_class (a) == dw_val_class_unsigned_const @@ -4960,7 +4931,7 @@ add_AT_loc (dw_die_ref die, enum dwarf_attribute attr_kind, dw_loc_descr_ref loc add_dwarf_attr (die, &attr); } -static inline dw_loc_descr_ref +dw_loc_descr_ref AT_loc (dw_attr_node *a) { gcc_assert (a && AT_class (a) == dw_val_class_loc); @@ -5201,6 +5172,30 @@ index_addr_table_entry (addr_table_entry **h, unsigned int *index) return 1; } +/* Return the tag of a given DIE. */ + +enum dwarf_tag +dw_get_die_tag (dw_die_ref die) +{ + return die->die_tag; +} + +/* Return a reference to the children list of a given DIE. */ + +dw_die_ref +dw_get_die_child (dw_die_ref die) +{ + return die->die_child; +} + +/* Return a reference to the sibling of a given DIE. */ + +dw_die_ref +dw_get_die_sib (dw_die_ref die) +{ + return die->die_sib; +} + /* Add an address constant attribute value to a DIE. When using dwarf_split_debug_info, address attributes in dies destined for the final executable should be direct references--setting the parameter @@ -5398,7 +5393,7 @@ AT_lbl (dw_attr_node *a) /* Get the attribute of type attr_kind. */ -static dw_attr_node * +dw_attr_node * get_AT (dw_die_ref die, enum dwarf_attribute attr_kind) { dw_attr_node *a; @@ -5453,7 +5448,7 @@ get_AT_low_pc (dw_die_ref die) /* Return the value of the string attribute designated by ATTR_KIND, or NULL if it is not present. */ -static inline const char * +const char * get_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind) { dw_attr_node *a = get_AT (die, attr_kind); @@ -5464,7 +5459,7 @@ get_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind) /* Return the value of the flag attribute designated by ATTR_KIND, or -1 if it is not present. */ -static inline int +int get_AT_flag (dw_die_ref die, enum dwarf_attribute attr_kind) { dw_attr_node *a = get_AT (die, attr_kind); @@ -5475,7 +5470,7 @@ get_AT_flag (dw_die_ref die, enum dwarf_attribute attr_kind) /* Return the value of the unsigned attribute designated by ATTR_KIND, or 0 if it is not present. */ -static inline unsigned +unsigned get_AT_unsigned (dw_die_ref die, enum dwarf_attribute attr_kind) { dw_attr_node *a = get_AT (die, attr_kind); @@ -5483,7 +5478,7 @@ get_AT_unsigned (dw_die_ref die, enum dwarf_attribute attr_kind) return a ? AT_unsigned (a) : 0; } -static inline dw_die_ref +dw_die_ref get_AT_ref (dw_die_ref die, enum dwarf_attribute attr_kind) { dw_attr_node *a = get_AT (die, attr_kind); @@ -5491,7 +5486,7 @@ get_AT_ref (dw_die_ref die, enum dwarf_attribute attr_kind) return a ? AT_ref (a) : NULL; } -static inline struct dwarf_file_data * +struct dwarf_file_data * get_AT_file (dw_die_ref die, enum dwarf_attribute attr_kind) { dw_attr_node *a = get_AT (die, attr_kind); @@ -5776,7 +5771,7 @@ splice_child_die (dw_die_ref parent, dw_die_ref child) /* Create and return a new die with TAG_VALUE as tag. */ -static inline dw_die_ref +dw_die_ref new_die_raw (enum dwarf_tag tag_value) { dw_die_ref die = ggc_cleared_alloc (); @@ -5921,7 +5916,7 @@ decl_die_hasher::equal (die_node *x, tree y) /* Return the DIE associated with a given declaration. */ -static inline dw_die_ref +dw_die_ref lookup_decl_die (tree decl) { dw_die_ref *die = decl_die_table->find_slot_with_hash (decl, DECL_UID (decl), @@ -13150,7 +13145,7 @@ need_endianity_attribute_p (bool reverse) This routine must only be called for GCC type nodes that correspond to Dwarf base (fundamental) types. */ -static dw_die_ref +dw_die_ref base_type_die (tree type, bool reverse) { dw_die_ref base_type_result; @@ -20994,7 +20989,7 @@ compute_frame_pointer_to_fb_displacement (poly_int64 offset) /* Generate a DW_AT_name attribute given some string value to be included as the value of the attribute. */ -static void +void add_name_attribute (dw_die_ref die, const char *name_string) { if (name_string != NULL && *name_string != 0) diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h index 54b6343704c..057afdb53a0 100644 --- a/gcc/dwarf2out.h +++ b/gcc/dwarf2out.h @@ -387,4 +387,48 @@ struct fixed_point_type_info void dwarf2out_c_finalize (void); +/* Some DWARF internals are exposed for the needs of DWARF-based debug + formats. */ + +/* Each DIE attribute has a field specifying the attribute kind, + a link to the next attribute in the chain, and an attribute value. + Attributes are typically linked below the DIE they modify. */ + +typedef struct GTY(()) dw_attr_struct { + enum dwarf_attribute dw_attr; + dw_val_node dw_attr_val; +} +dw_attr_node; + +extern dw_attr_node *get_AT (dw_die_ref, enum dwarf_attribute); +extern HOST_WIDE_INT AT_int (dw_attr_node *); +extern unsigned HOST_WIDE_INT AT_unsigned (dw_attr_node *a); +extern dw_loc_descr_ref AT_loc (dw_attr_node *); +extern dw_die_ref get_AT_ref (dw_die_ref, enum dwarf_attribute); +extern const char *get_AT_string (dw_die_ref, enum dwarf_attribute); +extern enum dw_val_class AT_class (dw_attr_node *); +extern unsigned HOST_WIDE_INT AT_unsigned (dw_attr_node *); +extern unsigned get_AT_unsigned (dw_die_ref, enum dwarf_attribute); +extern int get_AT_flag (dw_die_ref, enum dwarf_attribute); + +extern void add_name_attribute (dw_die_ref, const char *); + +extern dw_die_ref new_die_raw (enum dwarf_tag); +extern dw_die_ref base_type_die (tree, bool); + +extern dw_die_ref lookup_decl_die (tree); + +extern dw_die_ref dw_get_die_child (dw_die_ref); +extern dw_die_ref dw_get_die_sib (dw_die_ref); +extern enum dwarf_tag dw_get_die_tag (dw_die_ref); + +/* Data about a single source file. */ +struct GTY((for_user)) dwarf_file_data { + const char * filename; + int emitted_number; +}; + +extern struct dwarf_file_data *get_AT_file (dw_die_ref, + enum dwarf_attribute); + #endif /* GCC_DWARF2OUT_H */ -- 2.25.0.2.g232378479e