From patchwork Mon May 31 16:57:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jose E. Marchesi" X-Patchwork-Id: 1485732 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=ERRDqVZT; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Fv1hJ1lbPz9s5R for ; Tue, 1 Jun 2021 02:58:23 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2A40D3847827; Mon, 31 May 2021 16:58:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A40D3847827 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1622480301; bh=gM7ADS/bdzUeJw6R7USlY1aopsq6RbJqZx8RqJs3WHU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ERRDqVZTGfEIWkcw6IXFBBqtAPGeO/NB9jNkesE4BLkWihqR75IGFdDeDl9SDRAPf HWsE2WbmdX6AzzOWgDiaMwJlJEP27zC56TKCtutL0ltUxEJs5XNJvdHJshOkpln2h6 5kerhaXICN9oKJGbjRJvjutH3MiUBGwyKTf0WBkg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by sourceware.org (Postfix) with ESMTPS id EBFEB385783A for ; Mon, 31 May 2021 16:58:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EBFEB385783A Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 14VGmxXm138487 for ; Mon, 31 May 2021 16:58:17 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 38ub4ckmca-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 May 2021 16:58:16 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 14VGoOe6174121 for ; Mon, 31 May 2021 16:58:16 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2042.outbound.protection.outlook.com [104.47.57.42]) by aserp3030.oracle.com with ESMTP id 38ubncjb0r-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 May 2021 16:58:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V7lT3h5udfQ54QS3sCd/munRyr438RkDCQCyIlKwMQHUxUQS3EmitdB8TlvIZDqsXEPev2Z30KrGyLr9ppbufonhe2m1QDKH2/w9o0WUSs2igXmATgTnlfv9RlXIjkZJuiwHh3s0/GHrUHbxrXC9NRqhpZJPMvrhfLYvLb30h2tnW82VRegboLB5/1AFJdLcYBxxqfQPv94WT1598ROMQXT9hNfHKTmhMBFms4B93S6/aTTRBxJUjaw/h8pRmOJ04OVx6LeBtow0O+w18jLBhvRNkVw+Ukrk/vbmxmWOLfRA2pGAr8NQNTiEQHT4F0V8qtAtoXwnOhDKM4Szu2t0fQ== 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=gM7ADS/bdzUeJw6R7USlY1aopsq6RbJqZx8RqJs3WHU=; b=h5ZCwmPOxB34XMTADOSbl5hw2lEKFZKQfz7DN/7kUAT69w1qUhYi967axM/mCDc4nl66NtVqgzUFNwk8daCAOwXhW4qsqGPPVKCu25a7gVhNK9U5CwKwuFUtvw92GYoA89fckQ1EFysvOevjec+vy1j0wmdyaDywySQLqDmFNKqWNbysJpRTHofHkj0rWt3KGIZpPjVqm6xbN6t6yl1PlS+SDtC2c/FZfVwJd6jVZDmMHnKCeHaDSe7SsBabOGBNf3/wRvTwXOHoeLWGiaJfqp1JpAluEybZlOpyZB5R+dzu+gc4YRyInoL8cSxGimPgQ1vmMycl0kuSYqiUJCzw1g== 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 DM6PR10MB3257.namprd10.prod.outlook.com (2603:10b6:5:1a1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.21; Mon, 31 May 2021 16:58:15 +0000 Received: from DM5PR10MB2041.namprd10.prod.outlook.com ([fe80::14a9:31e9:48af:5e4f]) by DM5PR10MB2041.namprd10.prod.outlook.com ([fe80::14a9:31e9:48af:5e4f%8]) with mapi id 15.20.4173.030; Mon, 31 May 2021 16:58:14 +0000 To: gcc-patches@gcc.gnu.org Subject: [[PATCH V9] 1/7] dwarf: add a dwarf2int.h internal interface Date: Mon, 31 May 2021 18:57:56 +0200 Message-Id: <20210531165802.5686-2-jose.marchesi@oracle.com> X-Mailer: git-send-email 2.25.0.2.g232378479e In-Reply-To: <20210531165802.5686-1-jose.marchesi@oracle.com> References: <20210531165802.5686-1-jose.marchesi@oracle.com> X-Originating-IP: [141.143.193.73] X-ClientProxiedBy: LO2P123CA0070.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1::34) 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.73) by LO2P123CA0070.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.20 via Frontend Transport; Mon, 31 May 2021 16:58:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d1c6d01-a9cb-44d0-e4c0-08d9245547df X-MS-TrafficTypeDiagnostic: DM6PR10MB3257: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZFs6h8CYMT+053c3XPSXApsibUGhyH/H3UTGvPgxnm6nYCM/OagVbERDfaIxeLXgBOkybNiSJII6mCXhQEWH+yfXPctNhi/2m+JOava3L7KSOHCU052RUV84gEqwiGglS58M5eI0cP0IlKDtAvon2wzYBroDY5MIe0g6fXn43O3g3+56trsVWMqshxso1Y6cq350C5beFHZ1Zfni3Z8bnyde66cqnIP76DfhL4w6i2iBEQg+GfIf1dRndz/R4HeDvyIsbdDlCTnh3Eibtgo7cVW+Tv6aAxqwNFarcozCnBx/TmT68qfRcnEDT1ZsCoOh5a3Tgm1L9kcDxoUr2gS/YzrirEHET99UrXW2ntcSnQiJLEbJPnF56DpkRqCB3/DKTVb80K1ICd+8aMhNBun9ksPDAXRGfw+Oen9mf0AU2RDZyiYOP4SINKZOeBLdvAs//82Y2DBrcCRaGDvI4gp4q5TqXrY585BcfodeSCAy37Hyt28uHLE8dIuPsjSc18wRkvSmX/mFyj2/rJ22gg4RIBvcqltt6bVPZepY0WEvv1B7bk+81SQa9dEeD2zgl4qgMmv0Lyv0XAXBp6JlvW11XsdmYxzddoWhLPVAXvky6w98uZYA9lkG1jl6hyv/9KCXZEPuLGWzawh4dK/Arzwol6j11hhe6UmGcBQvv3aLB6HI/BRWp1enZ+hgmezkgt+5L+OeeegLphWzAnI+fjUkL4xAmuxAUtyRoUWgIWVoHOrnsMY2zqBE5ssV+sP/rG/E9K3pDzxgXK21r8AgNfZwLEQAykKaLGu71estXwSYhbk= 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:(376002)(366004)(396003)(346002)(136003)(39860400002)(478600001)(83380400001)(16526019)(8936002)(66476007)(86362001)(186003)(38350700002)(8676002)(2906002)(5660300002)(52116002)(1076003)(30864003)(6486002)(36756003)(6916009)(6666004)(6512007)(316002)(38100700002)(6506007)(26005)(956004)(2616005)(66556008)(66946007)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: UX2fc0pmdMSqCi8CXcpLc5BBQeEOPgOiVulCPiDuMhJZxxpF4137O7iARSXYmogqIAd84Xzatc4MsmM8h2pdsMUtFSeC59HdvCCqut74UdU5Jaeyvc9/k/02ncYURJ7DoNv7ruMIObOLY5TaeNxS6DdiQQOfjT6itS5CWyJu2vnkMyimc7P3RAF60QYZ3tf4HTOZcwL11ZR67SPNH9vIRdvelttdx3Tg+TMpDt2usIvxnC/RGumEOQwtXotbTuoKrCQRGluY1hu/23MX5gGKXRsT+eaVoZvueOBCcDOQU4c3RLZj1s8GY7KFZeFJO0T25yfv9hHotNrb94mLFsonX1mEJloJw26bSSIdJ1nqDIJsEMdYPztxa80zQWwjqKBsOExLHovPF/XgfJ0+oZtn7+dnMqA7VdMUbrvioCXpoayFo/RgLC4M4r3BXghF1Fxb9gnHl/eQmNbQVzJRc1KyZs2dP0GP3gneAJzcSDYNPTwIpGxj4PUyx38hJ2pFRN5+RqTGYo9ZeZfP/JI2AuVE5XC+m3d2k/fek7tmd10ToThiC/AC+sHittRvrYGy4kaqbthP5e1NyoFaOJPTeh083dZ9BZ9+jeaSzMPFjI2TBD2QTwHY1mfidj0lYWsMYGde/DEi5w0LjwQvFUoBaZS5JsTALXS/6iv7loWeJuarM071qalfwCNuUHFDOBjYHNK8v8gtLxtMAR16HufGF7+3tlCLLQEIp5iNYL2UF54lKzN00tafvXqjwTFtl+FG1lGbjDBZq76Z+HljOOGedppAXhHWVG/Zw4FMsfXZSiqZjSMuAe+vRhyCRsIi4J+PvMeQhMM9NoeJJhz62TKlyk/XobBOO7BUyYD08+ofXswdp5kDJ3w/eMPJemGFylVMyBBG7vhhwasbspGXAxcXNvQlfJVv63Pnc0eHQCdNGYfr90+VBVckelvCyWvtOqMJyQxQb1yIAkbjsb7SU+ihdF/71TwuJCHhpU8aZYJn6lIAUkhgHSgD9ex1f9Ph3zXy4b5W1LqCcT2izcf/qjMPAGzDLhm93uIG8bdNg+DfwTMozEM3pDR+Iu6QnEaWrqBoIV+9TqZuFT7EyN/KNIWVLT37i8xc6q4ngqOXimZ9jSGhB8tzvMGrQPZmf8a2eb1bhgFx27Lw07zHWb5aYJe+HjLaHO9fXrrwq3xZa44wAlGRyVVmAnTh7d6TffP8jEZvg9YCftH8cQzRYtPgsD963CkAXXeQpdGxwbx0YqqjwNdRKYd3sOW8aOSuptJZxId5mqY5aBqAFGjoA+Tlekgur3hqzr5DqrHniCdBTL89CONDGEuDJKBu+jzcFg5ZaFk4K5P0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d1c6d01-a9cb-44d0-e4c0-08d9245547df X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB2041.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2021 16:58:14.8870 (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: y8xg4GewNMqbP/0rsOS4bUoFR7GeUdVMLH3jCiMpxrtJ3SjrniwIyasIbF+vkJpXfgALI89WBhpZ94lffCnb/qU8M2RaeRd/LIOrj9ofKm4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3257 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10001 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105310126 X-Proofpoint-GUID: KokeTvYb32K8G7p1fDbCEYYgjHu5V7x- X-Proofpoint-ORIG-GUID: KokeTvYb32K8G7p1fDbCEYYgjHu5V7x- X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10001 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 adultscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105310126 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, MSGID_FROM_MTA_HEADER, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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-Patchwork-Original-From: "Jose E. Marchesi via Gcc-patches" From: "Jose E. Marchesi" Reply-To: "Jose E. Marchesi" Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This patch introduces a dwarf2int.h header, to be used by code that needs access to the internal DIE structures and their attributes. 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 dwarf2int.h: - get_AT - AT_int - 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 n the future we probably want these functions to sport a dw_* prefix. Also, some type definitions have been moved from dwarf2out.c to dwarf2int.h: - dw_attr_node - struct dwarf_file_data Finally, three new accessor functions have been added to dwarf2out.c with prototypes in dwarf2int.h: - dw_get_die_child - dw_get_die_sib - dw_get_die_tag 2021-05-14 Jose E. Marchesi * dwarf2int.h: New file. * dwarf2out.c (get_AT): Function is no longer static. (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. (dw_get_die_tag): New function. (dw_get_die_child): Likewise. (dw_get_die_sib): Likewise. Include dwarf2int.h. * gengtype.c: add dwarf2int.h to open_base_files. * Makefile.in (GTFILES): Add dwarf2int.h. --- gcc/Makefile.in | 1 + gcc/dwarf2int.h | 67 +++++++++++++++++++++++++++++++++++++++++ gcc/dwarf2out.c | 79 ++++++++++++++++++++++++------------------------- gcc/gengtype.c | 6 ++-- 4 files changed, 109 insertions(+), 44 deletions(-) create mode 100644 gcc/dwarf2int.h diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 4cb2966157e..95d5e18ad9d 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2648,6 +2648,7 @@ GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/ipa-modref.h $(srcdir)/ipa-modref.c \ $(srcdir)/ipa-modref-tree.h \ $(srcdir)/signop.h \ + $(srcdir)/dwarf2int.h \ $(srcdir)/dwarf2out.h \ $(srcdir)/dwarf2asm.c \ $(srcdir)/dwarf2cfi.c \ diff --git a/gcc/dwarf2int.h b/gcc/dwarf2int.h new file mode 100644 index 00000000000..f49f51d957b --- /dev/null +++ b/gcc/dwarf2int.h @@ -0,0 +1,67 @@ +/* Prototypes for functions manipulating DWARF2 DIEs. + Copyright (C) 2021 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* This file contains prototypes for functions defined in dwarf2out.c. It is + intended to be included in source files that need some internal knowledge of + the GCC dwarf structures. */ + +#ifndef GCC_DWARF2INT_H +#define GCC_DWARF2INT_H 1 + +/* 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_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_DWARF2INT_H */ diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index b99598eb9f8..ea192cd02ff 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -80,6 +80,7 @@ along with GCC; see the file COPYING3. If not see #include "expr.h" #include "dwarf2out.h" #include "dwarf2asm.h" +#include "dwarf2int.h" #include "toplev.h" #include "md5.h" #include "tree-pretty-print.h" @@ -1332,12 +1333,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 +3118,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 +3695,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, @@ -3750,12 +3731,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 +3745,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 +3817,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 +3864,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 +4470,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 +4526,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 +4549,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 @@ -5201,6 +5174,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 +5395,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 +5450,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 +5461,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 +5472,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 +5480,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 +5488,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 +5773,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 +5918,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 +13147,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; @@ -20898,7 +20895,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/gengtype.c b/gcc/gengtype.c index b94e2f126ec..c347694fa6a 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -1725,9 +1725,9 @@ open_base_files (void) "tree-dfa.h", "tree-ssa.h", "reload.h", "cpplib.h", "tree-chrec.h", "except.h", "output.h", "cfgloop.h", "target.h", "lto-streamer.h", "target-globals.h", "ipa-ref.h", "cgraph.h", "symbol-summary.h", - "ipa-prop.h", "ipa-fnsummary.h", "dwarf2out.h", "omp-general.h", - "omp-offload.h", "ipa-modref-tree.h", "ipa-modref.h", "symtab-thunks.h", - "symtab-clones.h", + "ipa-prop.h", "ipa-fnsummary.h", "dwarf2out.h", "dwarf2int.h", + "omp-general.h", "omp-offload.h", "ipa-modref-tree.h", "ipa-modref.h", + "symtab-thunks.h", "symtab-clones.h", NULL }; const char *const *ifp;