From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2049) id 710D93856270; Thu, 5 May 2022 12:04:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 710D93856270 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Matthew Malcomson To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] Print when types are capabilities in debug dumps X-Act-Checkin: gcc X-Git-Author: Matthew Malcomson X-Git-Refname: refs/vendors/ARM/heads/morello X-Git-Oldrev: 30e16bf212a0692e9b3b34e19102c4f13af88740 X-Git-Newrev: 9fe818be7c3594dc63d1945bd4cefa39b2ea417d Message-Id: <20220505120424.710D93856270@sourceware.org> Date: Thu, 5 May 2022 12:04:24 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2022 12:04:24 -0000 https://gcc.gnu.org/g:9fe818be7c3594dc63d1945bd4cefa39b2ea417d commit 9fe818be7c3594dc63d1945bd4cefa39b2ea417d Author: Matthew Malcomson Date: Thu Mar 17 15:49:46 2022 +0000 Print when types are capabilities in debug dumps This makes reading hybrid dumps much easier. Turns declarations in dumps from things like struct va_list * * ap_ptr; struct va_list * ap_array[3]; void * _1; struct va_list * _2; void * _3; struct va_list * _4; struct va_list * _5; const char * _6; const char * _7; to struct va_list * __capability * ap_ptr; struct va_list * ap_array[3]; void * __capability _1; struct va_list * _2; void * __capability _3; struct va_list * _4; struct va_list * _5; Especially handy when using `-ffake-hybrid` since we don't really know which declarations were made into capabilities. Diff: --- gcc/tree-pretty-print.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 6bfaaee6fc1..8de10a4608e 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see #include "gomp-constants.h" #include "gimple.h" #include "fold-const.h" +#include "target.h" /* Disable warnings about quoting issues in the pp_xxx calls below that (intentionally) don't follow GCC diagnostic conventions. */ @@ -1798,7 +1799,13 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags, case POINTER_TYPE: case REFERENCE_TYPE: - str = (TREE_CODE (node) == POINTER_TYPE ? "*" : "&"); + if (targetm.capability_mode ().exists () + && targetm.capability_mode ().require () != Pmode + && capability_type_p (node)) + str = (TREE_CODE (node) == POINTER_TYPE + ? "* __capability" : "& __capability"); + else + str = (TREE_CODE (node) == POINTER_TYPE ? "*" : "&"); if (TREE_TYPE (node) == NULL) {