public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] Print when types are capabilities in debug dumps
@ 2022-05-05 12:04 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2022-05-05 12:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9fe818be7c3594dc63d1945bd4cefa39b2ea417d

commit 9fe818be7c3594dc63d1945bd4cefa39b2ea417d
Author: Matthew Malcomson <matthew.malcomson@arm.com>
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)
         {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-05 12:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05 12:04 [gcc(refs/vendors/ARM/heads/morello)] Print when types are capabilities in debug dumps Matthew Malcomson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).